Skip to content

Commit db01b9b

Browse files
committed
Replace composer require checker with composer dependency analyser
1 parent dd05197 commit db01b9b

5 files changed

Lines changed: 98 additions & 37 deletions

File tree

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
on:
2+
pull_request:
3+
paths-ignore:
4+
- 'docs/**'
5+
- 'README.md'
6+
- 'CHANGELOG.md'
7+
- '.gitignore'
8+
- '.gitattributes'
9+
- 'infection.json.dist'
10+
- 'phpunit.xml.dist'
11+
- 'psalm.xml'
12+
13+
push:
14+
paths-ignore:
15+
- 'docs/**'
16+
- 'README.md'
17+
- 'CHANGELOG.md'
18+
- '.gitignore'
19+
- '.gitattributes'
20+
- 'infection.json.dist'
21+
- 'phpunit.xml.dist'
22+
- 'psalm.xml'
23+
24+
name: Composer require checker
25+
26+
jobs:
27+
composer-dependency-analyser:
28+
name: PHP ${{ matrix.php }}-${{ matrix.os }}
29+
30+
env:
31+
key: cache-v1
32+
33+
runs-on: ${{ matrix.os }}
34+
35+
strategy:
36+
matrix:
37+
os:
38+
- ubuntu-latest
39+
40+
php:
41+
- 8.2
42+
- 8.3
43+
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v2
47+
48+
- name: Install PHP
49+
uses: shivammathur/setup-php@v2
50+
env:
51+
update: true
52+
with:
53+
php-version: ${{ matrix.php }}
54+
ini-values: date.timezone='UTC'
55+
coverage: none
56+
tools: composer:v2
57+
58+
- name: Determine composer cache directory on Linux
59+
if: matrix.os == 'ubuntu-latest'
60+
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
61+
62+
- name: Cache dependencies installed with composer
63+
uses: actions/cache@v4
64+
with:
65+
path: ${{ env.COMPOSER_CACHE_DIR }}
66+
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
67+
restore-keys: |
68+
php${{ matrix.php }}-composer-
69+
70+
- name: Update composer
71+
run: composer self-update
72+
73+
- name: Install dependencies with composer
74+
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
75+
76+
- name: Analyse project dependencies
77+
run: vendor/bin/composer-dependency-analyser --colors=always

.github/workflows/composer-require-checker.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

composer-dependency-analyser.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
use ShipMonk\ComposerDependencyAnalyser\Config\Configuration;
5+
use ShipMonk\ComposerDependencyAnalyser\Config\ErrorType;
6+
7+
$config = new Configuration();
8+
9+
return $config
10+
->addPathsToScan([__DIR__ . '/config', __DIR__ . '/src'], false)
11+
->addPathToScan(__DIR__ . '/tests', true)
12+
->ignoreErrorsOnPath(__DIR__ . '/config', [ErrorType::DEV_DEPENDENCY_IN_PROD]) // We really can configure non-existent classes
13+
->ignoreErrorsOnPath(__DIR__ . '/src/Console', [ErrorType::DEV_DEPENDENCY_IN_PROD]) // symfony/console is an optional dependency, CLI commands won't be used without it
14+
->disableComposerAutoloadPathScan();

composer.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,22 @@
2121
"yiisoft/injector": "^1.0"
2222
},
2323
"require-dev": {
24-
"maglnet/composer-require-checker": "^4.5",
24+
"php-http/multipart-stream-builder": "^1.4",
2525
"phpunit/phpunit": "^10.1",
26+
"psr/http-client": "^1.0",
27+
"psr/http-factory": "^1.1",
28+
"psr/http-message": "^2.0",
2629
"roave/infection-static-analysis-plugin": "^1.16",
30+
"shipmonk/composer-dependency-analyser": "^1.8",
2731
"symfony/console": "^6.2",
2832
"symfony/http-client": "^7.0",
2933
"vimeo/psalm": "^6.8",
3034
"yiisoft/definitions": "^3.3",
3135
"yiisoft/test-support": "^3.0"
3236
},
3337
"suggest": {
34-
"symfony/http-client": "^6.0",
35-
"yiisoft/yii-console": "^1.0",
38+
"symfony/http-client": "^7.0",
39+
"yiisoft/yii-console": "^2.0",
3640
"yiisoft/yii-event": "^2.0"
3741
},
3842
"autoload": {

tests/Middleware/MiddlewareFactoryTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use Botasis\Runtime\Middleware\MiddlewareFactory;
1313
use Botasis\Runtime\Middleware\MiddlewareFactoryInterface;
1414
use Botasis\Runtime\Middleware\MiddlewareInterface;
15-
use Botasis\Runtime\Request\TelegramRequestEnriched;
1615
use Botasis\Runtime\Response\Response;
1716
use Botasis\Runtime\Response\ResponseInterface;
1817
use Botasis\Runtime\Tests\Middleware\Support\InvalidController;

0 commit comments

Comments
 (0)