-
-
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.
Add the TemplateExtends, TemplateImplements and TemplateUse attributes
- Loading branch information
1 parent
73299b3
commit 02eaae6
Showing
7 changed files
with
260 additions
and
11 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
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,69 @@ | ||
<?php | ||
|
||
namespace test\PhpStaticAnalysis\RectorRule\Fixture; | ||
|
||
use PhpStaticAnalysis\Attributes\Property; | ||
use PhpStaticAnalysis\Attributes\Template; | ||
|
||
#[Template('T')] | ||
class TemplateClass | ||
{ | ||
} | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
* @extends TemplateClass<int> this is the extended class | ||
*/ | ||
#[Property(name:'string')] | ||
class TemplateExtendsAttributeTest extends TemplateClass | ||
{ | ||
} | ||
|
||
/** | ||
* @template-extends TemplateClass<int> | ||
*/ | ||
class TemplateExtendsAttributeTest2 extends TemplateClass | ||
{ | ||
} | ||
|
||
/** | ||
* @phpstan-extends TemplateClass<int> | ||
*/ | ||
class TemplateExtendsAttributeTest3 extends TemplateClass | ||
{ | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace test\PhpStaticAnalysis\RectorRule\Fixture; | ||
|
||
use PhpStaticAnalysis\Attributes\Property; | ||
use PhpStaticAnalysis\Attributes\Template; | ||
|
||
#[Template('T')] | ||
class TemplateClass | ||
{ | ||
} | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
#[Property(name:'string')] | ||
#[\PhpStaticAnalysis\Attributes\TemplateExtends('TemplateClass<int>')] // this is the extended class | ||
class TemplateExtendsAttributeTest extends TemplateClass | ||
{ | ||
} | ||
|
||
#[\PhpStaticAnalysis\Attributes\TemplateExtends('TemplateClass<int>')] | ||
class TemplateExtendsAttributeTest2 extends TemplateClass | ||
{ | ||
} | ||
|
||
#[\PhpStaticAnalysis\Attributes\TemplateExtends('TemplateClass<int>')] | ||
class TemplateExtendsAttributeTest3 extends TemplateClass | ||
{ | ||
} | ||
|
||
?> |
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,69 @@ | ||
<?php | ||
|
||
namespace test\PhpStaticAnalysis\RectorRule\Fixture; | ||
|
||
use PhpStaticAnalysis\Attributes\Property; | ||
use PhpStaticAnalysis\Attributes\Template; | ||
|
||
#[Template('T')] | ||
interface TemplateInterface | ||
{ | ||
} | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
* @implements TemplateInterface<int> this is the implemented interface | ||
*/ | ||
#[Property(name:'string')] | ||
class TemplateImplementsAttributeTest implements TemplateInterface | ||
{ | ||
} | ||
|
||
/** | ||
* @template-implements TemplateInterface<int> | ||
*/ | ||
class TemplateImplementsAttributeTest2 implements TemplateInterface | ||
{ | ||
} | ||
|
||
/** | ||
* @phpstan-implements TemplateInterface<int> | ||
*/ | ||
class TemplateImplementsAttributeTest3 implements TemplateInterface | ||
{ | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace test\PhpStaticAnalysis\RectorRule\Fixture; | ||
|
||
use PhpStaticAnalysis\Attributes\Property; | ||
use PhpStaticAnalysis\Attributes\Template; | ||
|
||
#[Template('T')] | ||
interface TemplateInterface | ||
{ | ||
} | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
#[Property(name:'string')] | ||
#[\PhpStaticAnalysis\Attributes\TemplateImplements('TemplateInterface<int>')] // this is the implemented interface | ||
class TemplateImplementsAttributeTest implements TemplateInterface | ||
{ | ||
} | ||
|
||
#[\PhpStaticAnalysis\Attributes\TemplateImplements('TemplateInterface<int>')] | ||
class TemplateImplementsAttributeTest2 implements TemplateInterface | ||
{ | ||
} | ||
|
||
#[\PhpStaticAnalysis\Attributes\TemplateImplements('TemplateInterface<int>')] | ||
class TemplateImplementsAttributeTest3 implements TemplateInterface | ||
{ | ||
} | ||
|
||
?> |
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,75 @@ | ||
<?php | ||
|
||
namespace test\PhpStaticAnalysis\RectorRule\Fixture; | ||
|
||
use PhpStaticAnalysis\Attributes\Property; | ||
use PhpStaticAnalysis\Attributes\Template; | ||
|
||
#[Template('T')] | ||
trait TemplateTrait | ||
{ | ||
} | ||
|
||
#[Property(name:'string')] | ||
class TemplateUseAttributeTest | ||
{ | ||
/** | ||
* @codeCoverageIgnore | ||
* @use TemplateTrait<int> this is the used trait | ||
*/ | ||
use TemplateTrait; | ||
} | ||
|
||
class TemplateUseAttributeTest2 | ||
{ | ||
/** | ||
* @template-use TemplateTrait<int> | ||
*/ | ||
use TemplateTrait; | ||
} | ||
|
||
class TemplateUseAttributeTest3 | ||
{ | ||
/** | ||
* @phpstan-use TemplateTrait<int> | ||
*/ | ||
use TemplateTrait; | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace test\PhpStaticAnalysis\RectorRule\Fixture; | ||
|
||
use PhpStaticAnalysis\Attributes\Property; | ||
use PhpStaticAnalysis\Attributes\Template; | ||
|
||
#[Template('T')] | ||
trait TemplateTrait | ||
{ | ||
} | ||
|
||
#[Property(name:'string')] | ||
#[\PhpStaticAnalysis\Attributes\TemplateUse('TemplateTrait<int>')] // this is the used trait | ||
class TemplateUseAttributeTest | ||
{ | ||
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
use TemplateTrait; | ||
} | ||
|
||
#[\PhpStaticAnalysis\Attributes\TemplateUse('TemplateTrait<int>')] | ||
class TemplateUseAttributeTest2 | ||
{ | ||
use TemplateTrait; | ||
} | ||
|
||
#[\PhpStaticAnalysis\Attributes\TemplateUse('TemplateTrait<int>')] | ||
class TemplateUseAttributeTest3 | ||
{ | ||
use TemplateTrait; | ||
} | ||
|
||
?> |