Skip to content
Merged
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
43 changes: 19 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
permissions:
contents: read
name: build

on:
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'psalm.xml'

paths: &paths
- 'src/**'
- 'config/**'
- 'tests/**'
- 'phpunit.xml.dist'
- 'composer.json'
- '.github/workflows/build.yml'
push:
branches:
- master
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'psalm.xml'
branches: ['master']
paths: *paths

name: build
permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
phpunit:
Expand All @@ -33,5 +27,6 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.0']
composer-command: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi --no-security-blocking
['8.1', '8.2', '8.3', '8.4', '8.5']
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
27 changes: 27 additions & 0 deletions .github/workflows/rector-cs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Rector + PHP CS Fixer

on:
pull_request:
paths:
- 'src/**'
- 'config/**'
- 'tests/**'
- 'rector.php'
- '.php-cs-fixer.dist.php'
- 'composer.json'
- '.github/workflows/rector-cs.yml'

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
rector-cs:
permissions:
contents: write # Required to commit formatting fixes back to the PR
uses: yiisoft/actions/.github/workflows/rector-cs.yml@master
with:
php: '8.1'
24 changes: 0 additions & 24 deletions .github/workflows/rector.yml

This file was deleted.

20 changes: 10 additions & 10 deletions .github/workflows/zizmor.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
name: GitHub Actions Security Analysis with zizmor 🌈

on:
push:
branches:
- master
- main
paths:
- '.github/**.yml'
- '.github/**.yaml'
pull_request:
paths:
paths: &paths
- '.github/**.yml'
- '.github/**.yaml'
push:
branches: ['master']
paths: *paths

permissions:
actions: read # Required by zizmor when reading workflow metadata through the API.
contents: read # Required to read workflow files.
actions: read # Required by zizmor when reading workflow metadata through the API
contents: read # Required to read workflow files

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
zizmor:
Expand Down
25 changes: 25 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

declare(strict_types=1);

use PhpCsFixer\Finder;
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
use Yiisoft\CodeStyle\ConfigBuilder;

$finder = (new Finder())
->in([
__DIR__ . '/src',
__DIR__ . '/tests',
__DIR__ . '/config',
])
->exclude('Infrastructure/CodeUsage/Fixture');

return ConfigBuilder::build()
->setCacheFile(__DIR__ . '/runtime/.php-cs-fixer.cache')
->setRiskyAllowed(true)
->setParallelConfig(ParallelConfigFactory::detect())
->setRules([
'@Yiisoft/Core' => true,
'@Yiisoft/Core:risky' => true,
])
->setFinder($finder);
85 changes: 0 additions & 85 deletions .styleci.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Requirements

If you prefer manual install, you need:
- GNU/Linux or Windows **with bash**
- PHP 8.0 or higher
- PHP 8.1 - 8.5
- [Composer](https://getcomposer.org/) installed and
available [as `composer` on the command line](https://getcomposer.org/doc/00-intro.md#globally)

Expand Down
11 changes: 9 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
}
],
"require": {
"php": "^8.0",
"php": "8.1 - 8.5",
"ext-curl": "*",
"ext-openssl": "*",
"knplabs/github-api": "^3.2",
Expand All @@ -46,7 +46,9 @@
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.2",
"phpunit/phpunit": "^9.6.29"
"friendsofphp/php-cs-fixer": "^3.95.18",
"phpunit/phpunit": "^9.6.29",
"yiisoft/code-style": "^1.1"
},
"autoload": {
"psr-4": {
Expand All @@ -58,6 +60,11 @@
"Yiisoft\\YiiDevTool\\Test\\": "tests"
}
},
"scripts": {
"cs-fix": "php-cs-fixer fix",
"rector": "rector",
"test": "phpunit"
},
"extra": {
"bamarni-bin": {
"bin-links": true,
Expand Down
12 changes: 6 additions & 6 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

declare(strict_types=1);

use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\Config\RectorConfig;
use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector;
use Yiisoft\CodeStyle\Rector\SetList;

return RectorConfig::configure()
->withPaths([
__DIR__ . '/src',
__DIR__ . '/tests',
__DIR__ . '/config',
])
->withPhpSets(php80: true)
->withRules([
InlineConstructorDefaultToPropertyRector::class,
->withPhpSets(php81: true)
->withSets([
SetList::YII_CORE,
])
->withSkip([
ClosureToArrowFunctionRector::class,
__DIR__ . '/tests/Infrastructure/CodeUsage/Fixture',
]);
2 changes: 2 additions & 0 deletions runtime/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
14 changes: 10 additions & 4 deletions src/App/Command/AddChangelogCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
use Yiisoft\YiiDevTool\App\Component\Package\Package;
use Yiisoft\YiiDevTool\Infrastructure\Changelog;
use Yiisoft\YiiDevTool\Infrastructure\Version;
use InvalidArgumentException;

use function in_array;
use function sprintf;

use const SORT_NATURAL;

final class AddChangelogCommand extends PackageCommand
{
Expand Down Expand Up @@ -47,14 +53,14 @@ protected function processPackage(Package $package): void
{
$io = $this->getIO();

$loweredTypes = array_map(fn (string $type) => strtolower($type), Changelog::TYPES);
$loweredTypes = array_map(strtolower(...), Changelog::TYPES);
if (!in_array(strtolower($this->type), $loweredTypes, true)) {
$io->error(
sprintf(
'The type argument value must be one of the following: %s. "%s" given',
implode(', ', Changelog::TYPES),
$this->type
)
$this->type,
),
);
return;
}
Expand Down Expand Up @@ -89,7 +95,7 @@ protected function processPackage(Package $package): void
));
try {
$changelog->addEntry($text);
} catch (\InvalidArgumentException $e) {
} catch (InvalidArgumentException $e) {
$io->error($e);

$this->registerPackageError($package, $e->getMessage(), 'adding an changelog entry');
Expand Down
10 changes: 6 additions & 4 deletions src/App/Command/Composer/ComposerFixDependenciesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
use Yiisoft\YiiDevTool\Infrastructure\Composer\Config\ComposerConfig;
use Yiisoft\YiiDevTool\Infrastructure\Composer\Config\ComposerConfigDependenciesModifier;

use function count;
use function sprintf;

final class ComposerFixDependenciesCommand extends PackageCommand
{
private array $skippedPackageIds = [];

private const DEV_PATHS = [
'tests',
'config/params-test.php',
Expand All @@ -30,6 +31,7 @@ final class ComposerFixDependenciesCommand extends PackageCommand
'src',
'public/index.php',
];
private array $skippedPackageIds = [];

protected function configure(): void
{
Expand Down Expand Up @@ -98,8 +100,8 @@ protected function processPackage(Package $package): void

$dependencyPackages = $composerInstallation->getInstalledDependencyPackages();

$namespaceUsages =
(new NamespaceUsageFinder())
$namespaceUsages
= (new NamespaceUsageFinder())
->addTargetPaths(CodeUsageEnvironment::DEV, self::DEV_PATHS, $composerPackage->getPath())
->addTargetPaths(CodeUsageEnvironment::PRODUCTION, self::PRODUCTION_PATHS, $composerPackage->getPath())
->getUsages();
Expand Down
Loading