From 1a546acf09dd808df0d30d23dbcdd6db065210ad Mon Sep 17 00:00:00 2001 From: Carlos Granados Date: Wed, 21 Feb 2024 14:36:11 +0100 Subject: [PATCH] Preserve comments from annotations --- composer.json | 4 ++-- tests/data/IsReadOnly/PropertyIsReadOnlyAttribute.php | 2 +- tests/data/Method/ClassMethodAttribute.php | 2 +- tests/data/Param/MethodParamAttribute.php | 2 +- tests/data/Property/ClassPropertyAttribute.php | 2 +- tests/data/PropertyRead/ClassPropertyReadAttribute.php | 2 +- tests/data/PropertyWrite/ClassPropertyWriteAttribute.php | 2 +- tests/data/Returns/MethodReturnsAttribute.php | 2 +- tests/data/Template/ClassTemplateAttribute.php | 2 +- .../TemplateCovariant/ClassTemplateCovariantAttribute.php | 2 +- tests/data/Type/PropertyTypeAttribute.php | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.json b/composer.json index 0b3ce42..365e7d9 100644 --- a/composer.json +++ b/composer.json @@ -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": { diff --git a/tests/data/IsReadOnly/PropertyIsReadOnlyAttribute.php b/tests/data/IsReadOnly/PropertyIsReadOnlyAttribute.php index 4dc5582..3de519e 100644 --- a/tests/data/IsReadOnly/PropertyIsReadOnlyAttribute.php +++ b/tests/data/IsReadOnly/PropertyIsReadOnlyAttribute.php @@ -6,7 +6,7 @@ class PropertyIsReadOnlyAttribute { - #[IsReadOnly] + #[IsReadOnly] // cannot be written to public string $name; public function __construct() diff --git a/tests/data/Method/ClassMethodAttribute.php b/tests/data/Method/ClassMethodAttribute.php index f90a29f..3817508 100644 --- a/tests/data/Method/ClassMethodAttribute.php +++ b/tests/data/Method/ClassMethodAttribute.php @@ -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()', diff --git a/tests/data/Param/MethodParamAttribute.php b/tests/data/Param/MethodParamAttribute.php index 57827d0..ed6b311 100644 --- a/tests/data/Param/MethodParamAttribute.php +++ b/tests/data/Param/MethodParamAttribute.php @@ -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); diff --git a/tests/data/Property/ClassPropertyAttribute.php b/tests/data/Property/ClassPropertyAttribute.php index dec1de3..b0a2798 100644 --- a/tests/data/Property/ClassPropertyAttribute.php +++ b/tests/data/Property/ClassPropertyAttribute.php @@ -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[]', diff --git a/tests/data/PropertyRead/ClassPropertyReadAttribute.php b/tests/data/PropertyRead/ClassPropertyReadAttribute.php index bf1c6a4..01abae2 100644 --- a/tests/data/PropertyRead/ClassPropertyReadAttribute.php +++ b/tests/data/PropertyRead/ClassPropertyReadAttribute.php @@ -4,7 +4,7 @@ use PhpStaticAnalysis\Attributes\PropertyRead; -#[PropertyRead(name: 'string')] +#[PropertyRead(name: 'string')] // cannot be written to #[PropertyRead('int $age')] #[PropertyRead( index1: 'string[]', diff --git a/tests/data/PropertyWrite/ClassPropertyWriteAttribute.php b/tests/data/PropertyWrite/ClassPropertyWriteAttribute.php index a5aab7f..a58f5e2 100644 --- a/tests/data/PropertyWrite/ClassPropertyWriteAttribute.php +++ b/tests/data/PropertyWrite/ClassPropertyWriteAttribute.php @@ -4,7 +4,7 @@ use PhpStaticAnalysis\Attributes\PropertyWrite; -#[PropertyWrite(name: 'string')] +#[PropertyWrite(name: 'string')] // cannot be read #[PropertyWrite('int $age')] #[PropertyWrite( index1: 'string[]', diff --git a/tests/data/Returns/MethodReturnsAttribute.php b/tests/data/Returns/MethodReturnsAttribute.php index 187f3ca..2f9c79e 100644 --- a/tests/data/Returns/MethodReturnsAttribute.php +++ b/tests/data/Returns/MethodReturnsAttribute.php @@ -6,7 +6,7 @@ class MethodReturnsAttribute { - #[Returns('string[]')] + #[Returns('string[]')] // the names of the users public function getNames(): array { return ['hello', 'world']; diff --git a/tests/data/Template/ClassTemplateAttribute.php b/tests/data/Template/ClassTemplateAttribute.php index 3b4c96e..3573694 100644 --- a/tests/data/Template/ClassTemplateAttribute.php +++ b/tests/data/Template/ClassTemplateAttribute.php @@ -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')] diff --git a/tests/data/TemplateCovariant/ClassTemplateCovariantAttribute.php b/tests/data/TemplateCovariant/ClassTemplateCovariantAttribute.php index b759d16..7cf9047 100644 --- a/tests/data/TemplateCovariant/ClassTemplateCovariantAttribute.php +++ b/tests/data/TemplateCovariant/ClassTemplateCovariantAttribute.php @@ -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')] public array $list = []; diff --git a/tests/data/Type/PropertyTypeAttribute.php b/tests/data/Type/PropertyTypeAttribute.php index 7a52ac5..a3145ab 100644 --- a/tests/data/Type/PropertyTypeAttribute.php +++ b/tests/data/Type/PropertyTypeAttribute.php @@ -9,7 +9,7 @@ class PropertyTypeAttribute #[Type('string')] public const ATTRIBUTE_NAME = 'Type'; - #[Type('int[]')] + #[Type('int[]')] // number of items public array $nums = []; /**