From e15be682464c92a8e9f7a46ee144e2a901b6fea5 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sun, 24 May 2026 20:17:54 +0700 Subject: [PATCH 1/2] [QA] Add StructArmed to QA --- .github/workflows/code_analysis.yaml | 4 ++++ composer.json | 1 + .../ReplaceTestFunctionPrefixWithAttributeRectorTest.php | 2 +- .../Fixture/assert_make_empty.php.inc | 6 +++--- .../Source/SomeTypeObject.php | 2 +- .../Fixture/respect_parent_abstract_class.php.inc | 4 ++-- .../Fixture/respect_parent_data_provider.php.inc | 4 ++-- .../Source/AbstractClassWithDataProvider.php | 2 +- .../Source/AnotherAbstractClass.php | 2 +- .../Source/SomeClassToMock.php | 5 ----- .../Source/{CacheAdapter.php => CachedAdapter.php} | 0 structarmed.php | 9 +++++++++ tests/Issues/AnnotationParsing/AnnotationParsingTest.php | 2 +- 13 files changed, 26 insertions(+), 17 deletions(-) delete mode 100644 rules-tests/PHPUnit100/Rector/Class_/PublicDataProviderClassMethodRector/Source/SomeClassToMock.php rename rules-tests/PHPUnit60/Rector/ClassMethod/AddDoesNotPerformAssertionToNonAssertingTestRector/Source/{CacheAdapter.php => CachedAdapter.php} (100%) create mode 100644 structarmed.php diff --git a/.github/workflows/code_analysis.yaml b/.github/workflows/code_analysis.yaml index 6f6f9f0d..b5d58010 100644 --- a/.github/workflows/code_analysis.yaml +++ b/.github/workflows/code_analysis.yaml @@ -36,6 +36,10 @@ jobs: name: 'Tests' run: vendor/bin/phpunit + - + name: 'Run StructArmed' + run: vendor/bin/structarmed analyze + name: ${{ matrix.actions.name }} runs-on: ubuntu-latest timeout-minutes: 10 diff --git a/composer.json b/composer.json index d19863c9..dfbd41a1 100644 --- a/composer.json +++ b/composer.json @@ -7,6 +7,7 @@ "php": ">=8.3" }, "require-dev": { + "boundwize/structarmed": "^0.7.7", "phpstan/extension-installer": "^1.4", "phpstan/phpstan": "^2.1.38", "phpstan/phpstan-deprecation-rules": "^2.0", diff --git a/rules-tests/CodeQuality/Rector/ClassMethod/ReplaceTestFunctionPrefixWithAttributeRector/ReplaceTestFunctionPrefixWithAttributeRectorTest.php b/rules-tests/CodeQuality/Rector/ClassMethod/ReplaceTestFunctionPrefixWithAttributeRector/ReplaceTestFunctionPrefixWithAttributeRectorTest.php index f3030c08..487abf75 100644 --- a/rules-tests/CodeQuality/Rector/ClassMethod/ReplaceTestFunctionPrefixWithAttributeRector/ReplaceTestFunctionPrefixWithAttributeRectorTest.php +++ b/rules-tests/CodeQuality/Rector/ClassMethod/ReplaceTestFunctionPrefixWithAttributeRector/ReplaceTestFunctionPrefixWithAttributeRectorTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace CodeQuality\Rector\ClassMethod\ReplaceTestFunctionPrefixWithAttributeRector; +namespace Rector\PHPUnit\Tests\CodeQuality\Rector\ClassMethod\ReplaceTestFunctionPrefixWithAttributeRector; use Iterator; use PHPUnit\Framework\Attributes\DataProvider; diff --git a/rules-tests/CodeQuality/Rector/MethodCall/AssertEmptyNullableObjectToAssertInstanceofRector/Fixture/assert_make_empty.php.inc b/rules-tests/CodeQuality/Rector/MethodCall/AssertEmptyNullableObjectToAssertInstanceofRector/Fixture/assert_make_empty.php.inc index c0649330..06b0ca19 100644 --- a/rules-tests/CodeQuality/Rector/MethodCall/AssertEmptyNullableObjectToAssertInstanceofRector/Fixture/assert_make_empty.php.inc +++ b/rules-tests/CodeQuality/Rector/MethodCall/AssertEmptyNullableObjectToAssertInstanceofRector/Fixture/assert_make_empty.php.inc @@ -2,7 +2,7 @@ namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\AssertEmptyNullableObjectToAssertInstanceofRector\Fixture; -use CodeQuality\Rector\MethodCall\AssertEmptyNullableObjectToAssertInstanceofRector\Source\SomeTypeObject; +use Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\AssertEmptyNullableObjectToAssertInstanceofRector\Source\SomeTypeObject; use PHPUnit\Framework\TestCase; final class AssertMakeEmpty extends TestCase @@ -25,7 +25,7 @@ final class AssertMakeEmpty extends TestCase namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\AssertEmptyNullableObjectToAssertInstanceofRector\Fixture; -use CodeQuality\Rector\MethodCall\AssertEmptyNullableObjectToAssertInstanceofRector\Source\SomeTypeObject; +use Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\AssertEmptyNullableObjectToAssertInstanceofRector\Source\SomeTypeObject; use PHPUnit\Framework\TestCase; final class AssertMakeEmpty extends TestCase @@ -38,7 +38,7 @@ final class AssertMakeEmpty extends TestCase $someObject = new SomeTypeObject(); } - $this->assertNotInstanceOf(\CodeQuality\Rector\MethodCall\AssertEmptyNullableObjectToAssertInstanceofRector\Source\SomeTypeObject::class, $someObject); + $this->assertNotInstanceOf(\Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\AssertEmptyNullableObjectToAssertInstanceofRector\Source\SomeTypeObject::class, $someObject); } } diff --git a/rules-tests/CodeQuality/Rector/MethodCall/AssertEmptyNullableObjectToAssertInstanceofRector/Source/SomeTypeObject.php b/rules-tests/CodeQuality/Rector/MethodCall/AssertEmptyNullableObjectToAssertInstanceofRector/Source/SomeTypeObject.php index 19dcb9e0..5305ec62 100644 --- a/rules-tests/CodeQuality/Rector/MethodCall/AssertEmptyNullableObjectToAssertInstanceofRector/Source/SomeTypeObject.php +++ b/rules-tests/CodeQuality/Rector/MethodCall/AssertEmptyNullableObjectToAssertInstanceofRector/Source/SomeTypeObject.php @@ -1,6 +1,6 @@ withPreset(Preset::PSR4()); diff --git a/tests/Issues/AnnotationParsing/AnnotationParsingTest.php b/tests/Issues/AnnotationParsing/AnnotationParsingTest.php index b915b2ad..dc247249 100644 --- a/tests/Issues/AnnotationParsing/AnnotationParsingTest.php +++ b/tests/Issues/AnnotationParsing/AnnotationParsingTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Rector\PHPUnit\Tests\Issues\WrongAnnotation; +namespace Rector\PHPUnit\Tests\Issues\AnnotationParsing; use Iterator; use PHPUnit\Framework\Attributes\DataProvider; From d9280f2d99736778f6ea1bf8dbf6feb8bceff45c Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sun, 24 May 2026 22:05:40 +0700 Subject: [PATCH 2/2] final touch: add structarmed.php to .gitattributes --- .gitattributes | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitattributes b/.gitattributes index 9e7b1a00..bd650c54 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9,3 +9,4 @@ stubs export-ignore tests export-ignore rules-tests export-ignore rector.php export-ignore +structarmed.php export-ignore