Skip to content

Commit

Permalink
Add unit test for ReturnTypeHintSniff
Browse files Browse the repository at this point in the history
  • Loading branch information
othercorey committed Jul 11, 2021
1 parent c0078d3 commit 3ae15c2
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
26 changes: 26 additions & 0 deletions CakePHP/Tests/Classes/ReturnTypeHintUnitTest.inc
@@ -0,0 +1,26 @@
<?php
namespace Beakman;

class Foo
{
/**
* @return $this
*/
public function correct()
{
}

/**
* @return $this
*/
public function incorrect(): Foo
{
}

/**
* @return $this
*/
public function incorrectSelf(): self
{
}
}
28 changes: 28 additions & 0 deletions CakePHP/Tests/Classes/ReturnTypeHintUnitTest.php
@@ -0,0 +1,28 @@
<?php

namespace CakePHP\Tests\Classes;

use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;

class ReturnTypeHintUnitTest extends AbstractSniffUnitTest
{
/**
* @inheritDoc
*/
public function getErrorList()
{
return [
16 => 1,
23 => 1,
];
}

/**
* @inheritDoc
*/
public function getWarningList()
{
return [
];
}
}
29 changes: 29 additions & 0 deletions CakePHP/Tests/Classes/ReturnTypeHintUnitTestinc.fixed
@@ -0,0 +1,29 @@
<?php
namespace Beakman;

use Other\Crap;
use Other\Error as OtherError;

class Foo
{
/**
* @return $this
*/
public function correct()
{
}

/**
* @return $this
*/
public function incorrect(): Foo
{
}

/**
* @return $this
*/
public function incorrectSelf()
{
}
}

0 comments on commit 3ae15c2

Please sign in to comment.