Skip to content

Commit 196ce22

Browse files
committed
Add Composer Dependency Analyser
1 parent bafe252 commit 196ce22

4 files changed

Lines changed: 21 additions & 10 deletions

File tree

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
name: Composer require checker
1+
name: composer dependency analyser
22

33
on:
44
pull_request:
55
paths: &paths
66
- 'src/**'
77
- 'tests/**'
8+
- '.github/workflows/composer-dependency-analyser.yml'
89
- 'composer.json'
9-
- '.github/workflows/composer-require-checker.yml'
10+
- 'composer-dependency-analyser.php'
1011
push:
1112
branches: ['master']
1213
paths: *paths
@@ -19,10 +20,8 @@ concurrency:
1920
cancel-in-progress: true
2021

2122
jobs:
22-
composer-require-checker:
23-
uses: yiisoft/actions/.github/workflows/composer-require-checker.yml@master
23+
composer-dependency-analyser:
24+
uses: yiisoft/actions/.github/workflows/composer-dependency-analyser.yml@master
2425
with:
25-
os: >-
26-
['ubuntu-latest']
2726
php: >-
2827
['8.0', '8.1', '8.2', '8.3', '8.4']

composer-dependency-analyser.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use ShipMonk\ComposerDependencyAnalyser\Config\Configuration;
6+
7+
return (new Configuration())
8+
->disableComposerAutoloadPathScan()
9+
->setFileExtensions(['php'])
10+
->addPathToScan(__DIR__ . '/src', isDev: false)
11+
->addPathToScan(__DIR__ . '/tests', isDev: true);

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333
},
3434
"require-dev": {
3535
"friendsofphp/php-cs-fixer": "^3.66",
36-
"maglnet/composer-require-checker": "^4.4",
3736
"phpunit/phpunit": "^9.6.22",
3837
"rector/rector": "^2.0.10",
3938
"roave/infection-static-analysis-plugin": "^1.25",
39+
"shipmonk/composer-dependency-analyser": "^1.8",
4040
"spatie/phpunit-watcher": "^1.23.6",
4141
"vimeo/psalm": "^4.30 || ^5.26.1 || ^6.8.8"
4242
},
@@ -63,6 +63,7 @@
6363
}
6464
},
6565
"scripts": {
66+
"dependency-analyser": "composer-dependency-analyser",
6667
"test": "phpunit --testdox --no-interaction",
6768
"test-watch": "phpunit-watcher watch"
6869
}

docs/internals.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ use either newest or any specific version of PHP:
3636

3737
## Dependencies
3838

39-
This package uses [composer-require-checker](https://github.com/maglnet/ComposerRequireChecker) to check if
40-
all dependencies are correctly defined in `composer.json`. To run the checker, execute the following command:
39+
Use [Composer Dependency Analyser](https://github.com/shipmonk-rnd/composer-dependency-analyser) to detect unknown,
40+
shadow, and unused [Composer](https://getcomposer.org) dependencies:
4141

4242
```shell
43-
./vendor/bin/composer-require-checker
43+
./vendor/bin/composer-dependency-analyser
4444
```

0 commit comments

Comments
 (0)