Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
/psalm.xml export-ignore
/psalm-baseline.xml export-ignore
/renovate.json export-ignore
/structarmed.php export-ignore
/tools/ export-ignore
/test/ export-ignore
35 changes: 35 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,41 @@ jobs:
- name: "psalm"
run: "tools/vendor/bin/psalm --shepherd --stats"

static-analysis-structarmed:
name: "Static Analysis by StructArmed"

runs-on: ${{ matrix.operating-system }}

strategy:
matrix:
dependencies:
- "locked"
php-version:
- "8.4"
- "8.5"
operating-system:
- "ubuntu-latest"

steps:
- name: "Checkout"
uses: "actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1" # v7

- name: "Install PHP"
uses: "shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240" # 2.37.2
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
extensions: intl, sodium
ini-values: memory_limit=-1

- name: "Install dependencies"
uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # 4.0.0
with:
dependency-versions: "${{ matrix.dependencies }}"

- name: "StructArmed"
run: "vendor/bin/structarmed analyze"

mutation-tests:
name: "Mutation tests"

Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
],
"require-dev": {
"phpbench/phpbench": "^1.7.0",
"phpunit/phpunit": "^13.4.3"
"phpunit/phpunit": "^13.4.3",
"boundwize/structarmed": "^0.19.4"
},
"autoload": {
"psr-4": {
Expand Down
211 changes: 210 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 39 additions & 0 deletions structarmed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

declare(strict_types=1);

use Boundwize\StructArmed\Architecture;
use Boundwize\StructArmed\Preset\Preset;

return Architecture::define()
->skip([
__DIR__ . '/test/unit/Fixture',
])
->withPreset(Preset::PSR4())
->layer('Root', 'src/BetterReflection.php')
->layer('Identifier', 'src/Identifier/')
->layer('NodeCompiler', 'src/NodeCompiler/')
->layer('Reflection', 'src/Reflection/')
->layer('Reflector', 'src/Reflector/')
->layer('SourceLocator', [
'src/SourceLocator/FileChecker.php',
'src/SourceLocator/Exception/',
])
->layer('SourceLocatorAst', 'src/SourceLocator/Ast/')
->layer('Located', 'src/SourceLocator/Located/')
->layer('SourceStubber', 'src/SourceLocator/SourceStubber/')
->layer('SourceLocatorType', 'src/SourceLocator/Type/')
->layer('Util', 'src/Util/')
->ruleset([
'Root' => ['+SourceLocatorType'],
'Identifier' => ['Reflection'],
'NodeCompiler' => ['Reflection', 'Reflector', 'Util'],
'Reflection' => ['+NodeCompiler', 'Located', 'Root', 'SourceLocatorType'],
'Reflector' => ['+Identifier', 'SourceLocatorType'],
'SourceLocator' => [],
'SourceLocatorAst' => ['+Reflector', 'Located', 'Util'],
'Located' => ['SourceLocator', 'Util'],
'SourceStubber' => ['Reflection', 'SourceLocator', 'Util'],
'SourceLocatorType' => ['+SourceLocatorAst', '+SourceStubber', 'Root'],
'Util' => ['+SourceLocatorAst', 'SourceLocator'],
]);
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Roave\BetterReflectionTest\Reflection\Adapter;
namespace Roave\BetterReflectionTest\Reflection\Adapter\Exception;

use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Roave\BetterReflectionTest\Reflection;
namespace Roave\BetterReflectionTest\Reflection\Attribute;

use PhpParser\Node;
use PHPUnit\Framework\Attributes\CoversClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

declare(strict_types=1);

namespace Roave\BetterReflection\SourceLocator\Ast\Exception;
namespace Roave\BetterReflectionTest\SourceLocator\Ast\Exception;

use Exception;
use PhpParser\Error;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use ReflectionProperty;
use Roave\BetterReflection\SourceLocator\Ast\Exception\ParseToAstFailure;
use Roave\BetterReflection\SourceLocator\Located\LocatedSource;

#[CoversClass(ParseToAstFailure::class)]
Expand Down
2 changes: 1 addition & 1 deletion test/unit/SourceLocator/Ast/FindReflectionsInTreeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Roave\BetterReflectionTest\Reflector;
namespace Roave\BetterReflectionTest\SourceLocator\Ast;

use PhpParser\Node;
use PHPUnit\Framework\Attributes\CoversClass;
Expand Down
2 changes: 1 addition & 1 deletion test/unit/SourceLocator/Ast/LocatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Roave\BetterReflectionTest\Reflector;
namespace Roave\BetterReflectionTest\SourceLocator\Ast;

use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
Expand Down
2 changes: 1 addition & 1 deletion test/unit/SourceLocator/Ast/Parser/MemoizingParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Roave\BetterReflectionTest\Reflector;
namespace Roave\BetterReflectionTest\SourceLocator\Ast\Parser;

use PhpParser\Node;
use PhpParser\Node\Name;
Expand Down
Loading