Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Commit

Permalink
[CodingStandard] fixer temp
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed May 11, 2017
1 parent 232dd62 commit 13eefcd
Show file tree
Hide file tree
Showing 17 changed files with 381 additions and 345 deletions.
628 changes: 315 additions & 313 deletions easy-coding-standard.neon

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class ClassWrapper
/**
* @var mixed[]
*/
private $tokens;
private $tokens = [];

/**
* @var MethodWrapper[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ final class DocBlockWrapper
private $indentationType = 'spaces';

/**
* @var string[]
* @var mixed[]
*/
private $tokens;
private $tokens = [];

/**
* @var Fixer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ final class MethodWrapper
/**
* @var ParameterWrapper[]
*/
private $parameters;
private $parameters = [];

/**
* @var mixed[]
*/
private $methodToken;
private $methodToken = [];

/**
* @var int
Expand All @@ -47,7 +47,7 @@ final class MethodWrapper
/**
* @var mixed[]
*/
private $tokens;
private $tokens = [];

private function __construct(File $file, int $position)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class ParameterWrapper
/**
* @var mixed[]
*/
private $tokens;
private $tokens = [];

private function __construct(File $file, int $position)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ final class PropertyWrapper
/**
* @var mixed[]
*/
private $propertyToken;
private $propertyToken = [];

/**
* @var mixed[]
*/
private $tokens;
private $tokens = [];

/**
* @var ?int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ private function isArrayPropertyDocComment(Token $token): bool

private function addDefaultValueForArrayProperty(Tokens $tokens, int $semicolonPosition): void
{
// todo: prepare nicer api
$tokens->insertAt($semicolonPosition, new Token([CT::T_ARRAY_SQUARE_BRACE_CLOSE, ']']));
$tokens->insertAt($semicolonPosition, new Token([CT::T_ARRAY_SQUARE_BRACE_OPEN, '[']));
$tokens->insertAt($semicolonPosition, new Token([T_WHITESPACE, ' ']));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class ClassMetrics
/**
* @var mixed[]
*/
private $tokens;
private $tokens = [];

public function __construct(File $file, int $classPosition)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class NewClassSniff implements Sniff
/**
* @var mixed[]
*/
private $tokens;
private $tokens = [];

/**
* @return int[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final class ArrayPropertyDefaultValueFixerTest extends AbstractFixerTestCase
/**
* @dataProvider provideFixCases()
*/
public function testFix(string $expected, string $input)
public function testFix(string $expected, string $input): void
{
$this->doTest($expected, $input);
}
Expand All @@ -28,24 +28,12 @@ public function provideFixCases(): array
{
return [
[
'<?php
class SomeClass
{
/**
* @var int[]
*/
public $property = [];
}',
'<?php
class SomeClass
{
/**
* @var int[]
*/
public $property;
}',
file_get_contents(__DIR__ . '/fixed/fixed.php.inc'),
file_get_contents(__DIR__ . '/wrong/wrong.php.inc')
],
[
file_get_contents(__DIR__ . '/fixed/fixed2.php.inc'),
file_get_contents(__DIR__ . '/wrong/wrong2.php.inc')
]
];
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

class SomeClass
{
/**
* @var int[]
*/
public $property = [];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

class SomeClass
{
/**
* @var int[]
*/
public static $property = [];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

class SomeClass
{
/**
* @var int[]
*/
public $property;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

class SomeClass
{
/**
* @var int[]
*/
public static $property;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final class TokenDispatcher
/**
* @var Sniff[][]
*/
private $tokenListeners;
private $tokenListeners = [];

public function __construct(SkipperInterface $skipper)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ final class EventStateStorage
/**
* @var Event[]
*/
private $storage;
private $storage = [];

public function addEventState(string $event, Event $state): void
{
Expand Down
9 changes: 9 additions & 0 deletions src/UndefinedArray.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

class UndefinedArray
{
/**
* @var int[]
*/
public $array = [];
}

0 comments on commit 13eefcd

Please sign in to comment.