Skip to content

Commit 911b2f7

Browse files
Add Throws attribute
1 parent c6014ec commit 911b2f7

23 files changed

+177
-23
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,6 @@ These are the available attributes and their corresponding PHPDoc annotations:
116116
| [TemplateExtends](doc/TemplateExtends.md) | `@extends` `@template-extends` |
117117
| [TemplateImplements](doc/TemplateImplements.md) | `@implements` `@template-implements` |
118118
| [TemplateUse](doc/TemplateUse.md) | `@use` `@template-use` |
119+
| [Throws](doc/Throws.md) | `@throws` |
119120
| [Type](doc/Type.md) | `@var` `@return` |
120121

doc/Impure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class ImpureExample
1717
{
1818
public static int $i = 0;
1919

20-
#[Impure]
20+
#[Impure] // this function is impure
2121
public static function addCumulative(int $left) : int
2222
{
2323
self::$i += $left;

doc/IsReadOnly.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use PhpStaticAnalysis\Attributes\IsReadOnly;
1717

1818
class IsReadOnlyExample
1919
{
20-
#[IsReadOnly]
20+
#[IsReadOnly] // this property cannot be written to
2121
public string $name;
2222

2323
...

doc/Method.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ If the class has more than one method that we want to specify, the signatures fo
1919

2020
use PhpStaticAnalysis\Attributes\Method;
2121

22-
#[Method('string getString()')]
22+
#[Method('string getString()')] // these methods are available
2323
#[Method(
2424
'void setString(string $text)',
2525
'static string staticGetter()',

doc/Mixin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class A
2424
}
2525
}
2626

27-
#[Mixin('A')]
27+
#[Mixin(A::class)] // this class proxies A
2828
class B
2929
{
3030
public function doB(): void

doc/Property.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ If the attribute is used as a replacement for the `Type` attribute for a propert
2525

2626
use PhpStaticAnalysis\Attributes\Property;
2727

28-
#[Property(name: 'string')]
28+
#[Property(name: 'string')] // these properties are available
2929
#[Property('int $age')]
3030
#[Property(
3131
index1: 'string[]',

doc/PropertyRead.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ If the class has more than one property that we want to specify, the types for t
2121

2222
use PhpStaticAnalysis\Attributes\PropertyRead;
2323

24-
#[PropertyRead(name: 'string')]
24+
#[PropertyRead(name: 'string')] // these properties cannot be written to
2525
#[PropertyRead('int $age')]
2626
#[PropertyRead(
2727
index1: 'string[]',

doc/PropertyWrite.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ If the class has more than one property that we want to specify, the types for t
2121

2222
use PhpStaticAnalysis\Attributes\PropertyWrite;
2323

24-
#[PropertyWrite(name: 'string')]
24+
#[PropertyWrite(name: 'string')] // these properties cannot be read
2525
#[PropertyWrite('int $age')]
2626
#[PropertyWrite(
2727
index1: 'string[]',

doc/Pure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use PhpStaticAnalysis\Attributes\Pure;
1515

1616
class PureExample
1717
{
18-
#[Pure]
18+
#[Pure] // this function is pure
1919
public static function add(int $left, int $right) : int
2020
{
2121
return $left + $right;

doc/RequireExtends.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use PhpStaticAnalysis\Attributes\RequireExtends;
1818
abstract class Parent {
1919
}
2020

21-
#[RequireExtends('ParentClass')]
21+
#[RequireExtends(Parent::class)] // needs to extend this class
2222
trait myTrait {
2323
}
2424

0 commit comments

Comments
 (0)