-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
189e5ad
commit 8032ba7
Showing
5 changed files
with
218 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?php | ||
|
||
namespace test\PhpStaticAnalysis\RectorRule\Fixture; | ||
|
||
use PhpStaticAnalysis\Attributes\Param; | ||
|
||
class ImpureAttributeTest | ||
{ | ||
/** | ||
* @impure | ||
*/ | ||
public function getName(): void | ||
{ | ||
} | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
* @impure | ||
*/ | ||
public function getMoreNames(): void | ||
{ | ||
} | ||
|
||
/** | ||
* @impure | ||
*/ | ||
#[Param(name:'string')] | ||
public function getAnotherName($name) | ||
{ | ||
return "Hello " . $name; | ||
} | ||
|
||
/** | ||
* @impure this function is impure | ||
*/ | ||
public function getUserName(): void | ||
{ | ||
} | ||
|
||
/** | ||
* @phpstan-impure | ||
*/ | ||
public function getPHPStanName(): void | ||
{ | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace test\PhpStaticAnalysis\RectorRule\Fixture; | ||
|
||
use PhpStaticAnalysis\Attributes\Param; | ||
|
||
class ImpureAttributeTest | ||
{ | ||
#[\PhpStaticAnalysis\Attributes\Impure] | ||
public function getName(): void | ||
{ | ||
} | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
#[\PhpStaticAnalysis\Attributes\Impure] | ||
public function getMoreNames(): void | ||
{ | ||
} | ||
|
||
#[Param(name:'string')] | ||
#[\PhpStaticAnalysis\Attributes\Impure] | ||
public function getAnotherName($name) | ||
{ | ||
return "Hello " . $name; | ||
} | ||
|
||
#[\PhpStaticAnalysis\Attributes\Impure] // this function is impure | ||
public function getUserName(): void | ||
{ | ||
} | ||
|
||
#[\PhpStaticAnalysis\Attributes\Impure] | ||
public function getPHPStanName(): void | ||
{ | ||
} | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<?php | ||
|
||
namespace test\PhpStaticAnalysis\RectorRule\Fixture; | ||
|
||
use PhpStaticAnalysis\Attributes\Param; | ||
|
||
class PureAttributeTest | ||
{ | ||
/** | ||
* @pure | ||
*/ | ||
public function getName(): void | ||
{ | ||
} | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
* @pure | ||
*/ | ||
public function getMoreNames(): void | ||
{ | ||
} | ||
|
||
/** | ||
* @pure | ||
*/ | ||
#[Param(name:'string')] | ||
public function getAnotherName($name) | ||
{ | ||
return "Hello " . $name; | ||
} | ||
|
||
/** | ||
* @pure this function is pure | ||
*/ | ||
public function getUserName(): void | ||
{ | ||
} | ||
|
||
/** | ||
* @psalm-pure | ||
*/ | ||
public function getPsalmName(): void | ||
{ | ||
} | ||
|
||
/** | ||
* @phpstan-pure | ||
*/ | ||
public function getPHPStanName(): void | ||
{ | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace test\PhpStaticAnalysis\RectorRule\Fixture; | ||
|
||
use PhpStaticAnalysis\Attributes\Param; | ||
|
||
class PureAttributeTest | ||
{ | ||
#[\PhpStaticAnalysis\Attributes\Pure] | ||
public function getName(): void | ||
{ | ||
} | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
#[\PhpStaticAnalysis\Attributes\Pure] | ||
public function getMoreNames(): void | ||
{ | ||
} | ||
|
||
#[Param(name:'string')] | ||
#[\PhpStaticAnalysis\Attributes\Pure] | ||
public function getAnotherName($name) | ||
{ | ||
return "Hello " . $name; | ||
} | ||
|
||
#[\PhpStaticAnalysis\Attributes\Pure] // this function is pure | ||
public function getUserName(): void | ||
{ | ||
} | ||
|
||
#[\PhpStaticAnalysis\Attributes\Pure] | ||
public function getPsalmName(): void | ||
{ | ||
} | ||
|
||
#[\PhpStaticAnalysis\Attributes\Pure] | ||
public function getPHPStanName(): void | ||
{ | ||
} | ||
} | ||
|
||
?> |