Skip to content

Commit

Permalink
Preserve comments from annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
carlos-granados committed Feb 21, 2024
1 parent a9e5db4 commit 1a546ac
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"require": {
"php": ">=8.0",
"ext-simplexml": "*",
"php-static-analysis/attributes": "^0.1.6 || dev-main",
"php-static-analysis/node-visitor": "^0.1.6 || dev-main",
"php-static-analysis/attributes": "^0.1.7 || dev-main",
"php-static-analysis/node-visitor": "^0.1.7 || dev-main",
"vimeo/psalm": "^5"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion tests/data/IsReadOnly/PropertyIsReadOnlyAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class PropertyIsReadOnlyAttribute
{
#[IsReadOnly]
#[IsReadOnly] // cannot be written to
public string $name;

public function __construct()
Expand Down
2 changes: 1 addition & 1 deletion tests/data/Method/ClassMethodAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use PhpStaticAnalysis\Attributes\Method;
use PhpStaticAnalysis\Attributes\Param;

#[Method('string getString()')]
#[Method('string getString()')] // get the main string
#[Method(
'void setString(string $text)',
'static string staticGetter()',
Expand Down
2 changes: 1 addition & 1 deletion tests/data/Param/MethodParamAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class MethodParamAttribute
{
#[Param(names: 'string[]')]
#[Param(names: 'string[]')] // returns the number of names
public function countNames($names): int
{
return count($names);
Expand Down
2 changes: 1 addition & 1 deletion tests/data/Property/ClassPropertyAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use PhpStaticAnalysis\Attributes\Property;

#[Property(name: 'string')]
#[Property(name: 'string')] // the name of the user
#[Property('int $age')]
#[Property(
index1: 'string[]',
Expand Down
2 changes: 1 addition & 1 deletion tests/data/PropertyRead/ClassPropertyReadAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use PhpStaticAnalysis\Attributes\PropertyRead;

#[PropertyRead(name: 'string')]
#[PropertyRead(name: 'string')] // cannot be written to
#[PropertyRead('int $age')]
#[PropertyRead(
index1: 'string[]',
Expand Down
2 changes: 1 addition & 1 deletion tests/data/PropertyWrite/ClassPropertyWriteAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use PhpStaticAnalysis\Attributes\PropertyWrite;

#[PropertyWrite(name: 'string')]
#[PropertyWrite(name: 'string')] // cannot be read
#[PropertyWrite('int $age')]
#[PropertyWrite(
index1: 'string[]',
Expand Down
2 changes: 1 addition & 1 deletion tests/data/Returns/MethodReturnsAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class MethodReturnsAttribute
{
#[Returns('string[]')]
#[Returns('string[]')] // the names of the users
public function getNames(): array
{
return ['hello', 'world'];
Expand Down
2 changes: 1 addition & 1 deletion tests/data/Template/ClassTemplateAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use PhpStaticAnalysis\Attributes\Returns;
use PhpStaticAnalysis\Attributes\Template;

#[Template('T')]
#[Template('T')] // the type used in the class
class ClassTemplateAttribute
{
#[Param(param: 'T')]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ClassTemplateCovariantAttributeChild extends ClassTemplateCovariantAttribu
public function getName() : string { return "child"; }
}

#[TemplateCovariant('T')]
#[TemplateCovariant('T')] // can only be used in covariant position
class Collection {
#[Type('array<int, T>')]
public array $list = [];
Expand Down
2 changes: 1 addition & 1 deletion tests/data/Type/PropertyTypeAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class PropertyTypeAttribute
#[Type('string')]
public const ATTRIBUTE_NAME = 'Type';

#[Type('int[]')]
#[Type('int[]')] // number of items
public array $nums = [];

/**
Expand Down

0 comments on commit 1a546ac

Please sign in to comment.