Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
veewee committed Dec 5, 2017
1 parent 9eb9cc8 commit 74fe243
Show file tree
Hide file tree
Showing 17 changed files with 381 additions and 174 deletions.
8 changes: 4 additions & 4 deletions src/Fixer/Import/NoUnusedImportsFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected function applyFix(\SplFileInfo $file, Tokens $tokens)
}

/**
* @param string $content
* @param string $content
* @param NamespaceUseAnalysis[] $useDeclarations
*
* @return array
Expand All @@ -113,7 +113,7 @@ private function detectUseUsages($content, array $useDeclarations)
}

/**
* @param Tokens $tokens
* @param Tokens $tokens
* @param StartEndTokenAwareAnalysis[] $partials
*
* @return string
Expand Down Expand Up @@ -217,9 +217,9 @@ private function removeUseDeclaration(Tokens $tokens, NamespaceUseAnalysis $useD
}

/**
* @param Tokens $tokens
* @param Tokens $tokens
* @param NamespaceUseAnalysis[] $useDeclarations
* @param NamespaceAnalysis[] $namespaceDeclarations
* @param NamespaceAnalysis[] $namespaceDeclarations
*/
private function removeUsesInSameNamespace(Tokens $tokens, array $useDeclarations, array $namespaceDeclarations)
{
Expand Down
26 changes: 13 additions & 13 deletions src/Tokenizer/Analyzer/Analysis/ArgumentAnalysis.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
*/
final class ArgumentAnalysis
{

/**
* The default value of the argument.
*
* @var string|null
* @var null|string
*/
private $default;

Expand All @@ -42,28 +41,29 @@ final class ArgumentAnalysis
/**
* The type of the argument.
*
* @var string|null
* @var null|string
*/
private $type;

/**
* @var int|null
* @var null|int
*/
private $typeIndexStart;

/**
* @var int|null
* @var null|int
*/
private $typeIndexEnd;

/**
* ArgumentAnalysis constructor.
* @param string $name
* @param int $nameIndex
* @param string|null $default
* @param string|null $type
* @param int|null $typeIndexStart
* @param int|null $typeIndexEnd
*
* @param string $name
* @param int $nameIndex
* @param null|string $default
* @param null|string $type
* @param null|int $typeIndexStart
* @param null|int $typeIndexEnd
*/
public function __construct($name, $nameIndex, $default, $type, $typeIndexStart, $typeIndexEnd)
{
Expand Down Expand Up @@ -124,15 +124,15 @@ public function hasType()
}

/**
* @return int|null
* @return null|int
*/
public function getTypeIndexStart()
{
return $this->typeIndexStart;
}

/**
* @return int|null
* @return null|int
*/
public function getTypeIndexEnd()
{
Expand Down
5 changes: 3 additions & 2 deletions src/Tokenizer/Analyzer/Analysis/NamespaceAnalysis.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ final class NamespaceAnalysis implements StartEndTokenAwareAnalysis

/**
* NamespaceAnalysis constructor.
*
* @param string $fullName
* @param string $shortName
* @param int $startIndex
* @param int $endIndex
* @param int $startIndex
* @param int $endIndex
*/
public function __construct($fullName, $shortName, $startIndex, $endIndex)
{
Expand Down
7 changes: 4 additions & 3 deletions src/Tokenizer/Analyzer/Analysis/NamespaceUseAnalysis.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,12 @@ final class NamespaceUseAnalysis implements StartEndTokenAwareAnalysis

/**
* NamespaceAnalysis constructor.
*
* @param string $fullName
* @param string $shortName
* @param bool $aliased
* @param int $startIndex
* @param int $endIndex
* @param bool $aliased
* @param int $startIndex
* @param int $endIndex
*/
public function __construct($fullName, $shortName, $aliased, $startIndex, $endIndex)
{
Expand Down
10 changes: 9 additions & 1 deletion src/Tokenizer/Analyzer/Analysis/StartEndTokenAwareAnalysis.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<?php

declare(strict_types=1);
/*
* This file is part of PHP CS Fixer.
*
* (c) Fabien Potencier <fabien@symfony.com>
* Dariusz Rumiński <dariusz.ruminski@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

namespace PhpCsFixer\Tokenizer\Analyzer\Analysis;

Expand Down
2 changes: 1 addition & 1 deletion src/Tokenizer/Analyzer/FunctionsAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function getFunctionArguments(Tokens $tokens, $methodIndex)
* @param Tokens $tokens
* @param int $methodIndex
*
* @return FunctionReturnTypeAnalysis|null
* @return null|FunctionReturnTypeAnalysis
*/
public function getFunctionReturnType(Tokens $tokens, $methodIndex)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Tokenizer/Analyzer/NamespaceUsesAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/**
* @internal
*/
class NamespaceUsesAnalyzer
final class NamespaceUsesAnalyzer
{
/**
* @param Tokens $tokens
Expand Down
1 change: 1 addition & 0 deletions src/Tokenizer/Analyzer/NamespacesAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ final class NamespacesAnalyzer
{
/**
* @param Tokens $tokens
*
* @return NamespaceAnalysis[]
*/
public function getDeclarations(Tokens $tokens)
Expand Down
Loading

0 comments on commit 74fe243

Please sign in to comment.