Skip to content

Commit f9df178

Browse files
committed
Update
1 parent 1add75b commit f9df178

File tree

2 files changed

+52
-15
lines changed

2 files changed

+52
-15
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Latest stable version](https://img.shields.io/packagist/v/kubawerlos/php-cs-fixer-custom-fixers.svg?label=current%20version)](https://packagist.org/packages/kubawerlos/php-cs-fixer-custom-fixers)
66
[![PHP version](https://img.shields.io/packagist/php-v/kubawerlos/php-cs-fixer-custom-fixers.svg)](https://php.net)
77
[![License](https://img.shields.io/github/license/kubawerlos/php-cs-fixer-custom-fixers.svg)](LICENSE)
8-
![Tests](https://img.shields.io/badge/tests-3804-brightgreen.svg)
8+
![Tests](https://img.shields.io/badge/tests-3805-brightgreen.svg)
99
[![Downloads](https://img.shields.io/packagist/dt/kubawerlos/php-cs-fixer-custom-fixers.svg)](https://packagist.org/packages/kubawerlos/php-cs-fixer-custom-fixers)
1010

1111
[![CI status](https://github.com/kubawerlos/php-cs-fixer-custom-fixers/actions/workflows/ci.yaml/badge.svg)](https://github.com/kubawerlos/php-cs-fixer-custom-fixers/actions/workflows/ci.yaml)

tests/Fixer/PhpdocTagNoNamedArgumentsFixerTest.php

Lines changed: 51 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -224,53 +224,90 @@ class Foo {}
224224
[],
225225
new WhitespacesFixerConfig("\t", "\r\n"),
226226
];
227+
}
228+
229+
/**
230+
* @dataProvider provideFix80Cases
231+
*
232+
* @requires PHP >= 8.0
233+
*/
234+
public function testFix80(string $expected, ?string $input = null): void
235+
{
236+
$this->doTest($expected, $input);
237+
}
227238

239+
/**
240+
* @return iterable<array{0: string, 1?: string}>
241+
*/
242+
public static function provideFix80Cases(): iterable
243+
{
228244
yield 'do not add for attribute class' => [
229245
<<<'PHP'
230246
<?php
231-
#[Attribute(flags: Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
232-
final readonly class MyAttributeClass {}
247+
#[Attribute(flags: Attribute::TARGET_METHOD)]
248+
final class MyAttributeClass {}
233249
PHP,
234250
];
235251

236-
yield 'do not add for attribute class (used with alias)' => [
252+
yield 'do not add for attribute class (with alias)' => [
237253
<<<'PHP'
238254
<?php
239255
namespace Foo;
240256
use Attribute as TheAttributeClass;
257+
#[TheAttributeClass(flags: TheAttributeClass::TARGET_METHOD)]
258+
abstract class MyAttributeClass {}
259+
PHP,
260+
];
261+
}
262+
263+
/**
264+
* @dataProvider provideFix82Cases
265+
*
266+
* @requires PHP >= 8.2
267+
*/
268+
public function testFix82(string $expected, ?string $input = null): void
269+
{
270+
$this->doTest($expected, $input);
271+
}
272+
273+
/**
274+
* @return iterable<array{0: string, 1?: string}>
275+
*/
276+
public static function provideFix82Cases(): iterable
277+
{
278+
yield 'do not add for attribute (readonly) class' => [
279+
<<<'PHP'
280+
<?php
241281
242282
/**
243283
* @no-named-arguments
244284
*/
245285
#[FooAttribute]
246-
final class NotAttributeClass1 {}
286+
final readonly class NotAttributeClass1 {}
247287
248-
#[TheAttributeClass(flags: Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
249-
abstract class MyAttributeClass {}
288+
#[Attribute(flags: Attribute::TARGET_METHOD)]
289+
abstract readonly class MyAttributeClass {}
250290
251291
/**
252292
* @no-named-arguments
253293
*/
254294
#[FooAttribute]
255295
#[BarAttribute]
256296
#[BazAttribute]
257-
final class NotAttributeClass1 {}
297+
final readonly class NotAttributeClass2 {}
258298
PHP,
259299
<<<'PHP'
260300
<?php
261-
namespace Foo;
262-
use Attribute as TheAttributeClass;
263-
264301
#[FooAttribute]
265-
final class NotAttributeClass1 {}
302+
final readonly class NotAttributeClass1 {}
266303
267-
#[TheAttributeClass(flags: Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
268-
abstract class MyAttributeClass {}
304+
#[Attribute(flags: Attribute::TARGET_METHOD)]
305+
abstract readonly class MyAttributeClass {}
269306
270307
#[FooAttribute]
271308
#[BarAttribute]
272309
#[BazAttribute]
273-
final class NotAttributeClass1 {}
310+
final readonly class NotAttributeClass2 {}
274311
PHP,
275312
];
276313
}

0 commit comments

Comments
 (0)