From 362148efa74c1662ae3675e791231c6b61c182cd Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Sat, 13 Jan 2018 10:05:08 -0600 Subject: [PATCH 01/55] 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 02/55] 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 03/55] 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 04/55] 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 05/55] 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 06/55] 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 07/55] 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 08/55] 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 09/55] 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 10/55] 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 11/55] 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 12/55] 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 13/55] 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 14/55] 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 15/55] 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 16/55] 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 17/55] 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 18/55] 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 19/55] 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 20/55] 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 21/55] 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 22/55] 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 23/55] 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 24/55] 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 25/55] 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 26/55] 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 27/55] 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 28/55] 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 29/55] 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 30/55] 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 31/55] 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 32/55] 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 33/55] 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 34/55] 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 35/55] 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 36/55] 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 37/55] 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 38/55] 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 39/55] 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 40/55] 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 41/55] 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 42/55] 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 43/55] 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 44/55] 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 45/55] 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 46/55] 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 47/55] 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 48/55] 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 49/55] 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 50/55] 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 51/55] 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 52/55] 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 53/55] 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 54/55] 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 55/55] 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 @@