# \EonX\EasyStandard\Rector\AddCoversAnnotationRector (opens new window)

Adds @covers annotation for test classes.

// before
class SomeServiceTest extends \PHPUnit\Framework\TestCase
{
}
// after
/**
 * @covers \SomeService
 */
class SomeServiceTest extends \PHPUnit\Framework\TestCase
{
}

Parameters

  • replaceArray - An array of strings that will be cut from the FQCN (Fully Qualified Class Name) when searching for the class covered by this test. Default value: [].
# \EonX\EasyStandard\Rector\AddSeeAnnotationRector (opens new window)

Adds @see annotation for data providers.

// before
/**
 * Provides some data.
 *
 * @return mixed[]
 */
public function provideSomeData(): array
{
}
// after
/**
 * Provides some data.
 *
 * @return mixed[]
 *
 * @see testMethod
 */
public function provideSomeData(): array
{
}
# \EonX\EasyStandard\Rector\AnnotationsCommentsRector (opens new window)

Comments should have punctuation marks at the end of the sentence.

// before
/**
 * Some class
 */
class SomeClass
{
}
// after
/**
 * Some class.
 */
class SomeClass
{
}
# \EonX\EasyStandard\Rector\ExplicitBoolCompareRector (opens new window)

Makes bool conditions prettier.

// before
final class SomeController
{
    public function run($items)
    {
        if (\is_array([]) === true) {
            return 'is array';
        }
    }
}
// after
final class SomeController
{
    public function run($items)
    {
        if (\is_array([])) {
            return 'is array';
        }
    }
}
# \EonX\EasyStandard\Rector\InheritDocRector (opens new window)

Replaces {@inheritdoc} annotation with {@inheritDoc}.

// before
/**
 * {@inheritdoc}
 */
public function someMethod(): array
{
}
//after
/**
 * {@inheritDoc}
 */
public function someMethod(): array
{
}
# \EonX\EasyStandard\Rector\RestoreDefaultNullToNullableTypeParameterRector (opens new window)

Adds default null value to function arguments with PHP 7.1 nullable type.

// before
class SomeClass
{
    public function __construct(?string $value)
    {
         $this->value = $value;
    }
}
// after
class SomeClass
{
    public function __construct(?string $value = null)
    {
         $this->value = $value;
    }
}
# \EonX\EasyStandard\Rector\StrictInArrayRector (opens new window)

Makes in_array calls strict.

// before
\in_array($value, $items);
// after
\in_array($value, $items, true);
# \EonX\EasyStandard\Rector\UselessSingleAnnotationRector (opens new window)

Removes PHPDoc completely if it contains only useless single annotation.

// before
/**
 * {@inheritDoc}
 */
public function someMethod(): array
{
}
// after
public function someMethod(): array
{
}