Skip to content

Commit dcd1c28

Browse files
authored
Merge pull request #64 from codeigniter4/develop
Prep for Release
2 parents c0f4c53 + c4726ff commit dcd1c28

20 files changed

+117
-63
lines changed

.github/workflows/phpcsfixer.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,12 @@ jobs:
3434
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3535

3636
- name: Get composer cache directory
37-
id: composer-cache
38-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
37+
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
3938

4039
- name: Cache composer dependencies
4140
uses: actions/cache@v3
4241
with:
43-
path: ${{ steps.composer-cache.outputs.dir }}
42+
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
4443
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
4544
restore-keys: ${{ runner.os }}-composer-
4645

.github/workflows/phpstan.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,12 @@ jobs:
4343
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4444

4545
- name: Get composer cache directory
46-
id: composer-cache
47-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
46+
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
4847

4948
- name: Cache composer dependencies
5049
uses: actions/cache@v3
5150
with:
52-
path: ${{ steps.composer-cache.outputs.dir }}
51+
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
5352
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
5453
restore-keys: ${{ runner.os }}-composer-
5554

.github/workflows/psalm.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,12 @@ jobs:
3939
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4040

4141
- name: Get composer cache directory
42-
id: composer-cache
43-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
42+
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
4443

4544
- name: Cache composer dependencies
4645
uses: actions/cache@v3
4746
with:
48-
path: ${{ steps.composer-cache.outputs.dir }}
47+
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
4948
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
5049
restore-keys: ${{ runner.os }}-composer-
5150

.github/workflows/rector.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,12 @@ jobs:
4343
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4444

4545
- name: Get composer cache directory
46-
id: composer-cache
47-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
46+
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
4847

4948
- name: Cache composer dependencies
5049
uses: actions/cache@v3
5150
with:
52-
path: ${{ steps.composer-cache.outputs.dir }}
51+
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
5352
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
5453
restore-keys: ${{ runner.os }}-composer-
5554

@@ -63,5 +62,5 @@ jobs:
6362
6463
- name: Analyze for refactoring
6564
run: |
66-
composer global require --dev rector/rector:^0.13.8
65+
composer global require --dev rector/rector:^0.15.1
6766
rector process --dry-run --no-progress-bar

.php-cs-fixer.dist.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
__DIR__ . '/src/',
1111
])
1212
->exclude('build')
13-
->append([__FILE__]);
13+
->append([
14+
__FILE__,
15+
__DIR__ . '/rector.php',
16+
]);
1417

1518
$overrides = [];
1619

CONTRIBUTING.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Contributing to CodeIgniter4
2+
3+
CodeIgniter is a community driven project and accepts contributions of
4+
code and documentation from the community.
5+
6+
If you'd like to contribute, please read [Contributing to CodeIgniter](https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/README.md)
7+
in the [main repository](https://github.com/codeigniter4/CodeIgniter4).
8+
9+
If you are going to contribute to this repository, please report bugs or send PRs
10+
to this repository instead of the main repository.

composer.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"devkit",
1010
"toolkit",
1111
"development",
12-
"tools"
12+
"tools",
13+
"static analysis"
1314
],
1415
"authors": [
1516
{
@@ -22,23 +23,23 @@
2223
"homepage": "https://github.com/codeigniter4/devkit",
2324
"require": {
2425
"php": "^7.4 || ^8.0",
25-
"codeigniter/coding-standard": "^1.1",
26+
"codeigniter/coding-standard": "^1.5",
2627
"fakerphp/faker": "^1.9",
2728
"mikey179/vfsstream": "^1.6",
28-
"nexusphp/cs-config": "^3.1",
29+
"nexusphp/cs-config": "^3.6",
2930
"nexusphp/tachycardia": "^1.0",
3031
"phpstan/extension-installer": "^1.1",
3132
"phpstan/phpstan": "^1.0",
3233
"phpstan/phpstan-deprecation-rules": "^1.0",
3334
"phpstan/phpstan-phpunit": "^1.0",
3435
"phpunit/phpunit": "^9.3",
3536
"roave/security-advisories": "dev-latest",
36-
"vimeo/psalm": "^4.22"
37+
"vimeo/psalm": "^5.0"
3738
},
3839
"require-dev": {
3940
"codeigniter4/framework": "^4.1",
4041
"icanhazstring/composer-unused": "^0.8.2",
41-
"rector/rector": "0.14.0"
42+
"rector/rector": "0.15.1"
4243
},
4344
"minimum-stability": "dev",
4445
"prefer-stable": true,
@@ -63,10 +64,11 @@
6364
"@test"
6465
],
6566
"cs": "php-cs-fixer fix --ansi --verbose --dry-run --diff",
66-
"cs-fix": "php-cs-fixer fix --ansi --verbose --diff --using-cache=yes",
67+
"cs-fix": "php-cs-fixer fix --ansi --verbose --diff",
6768
"style": "@cs-fix",
6869
"deduplicate": "phpcpd app/ src/",
6970
"inspect": "deptrac analyze --cache-file=build/deptrac.cache",
70-
"mutate": "infection --threads=2 --skip-initial-tests --coverage=build/phpunit"
71+
"mutate": "infection --threads=2 --skip-initial-tests --coverage=build/phpunit",
72+
"test": "phpunit"
7173
}
7274
}

psalm_autoload.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@
1818
require_once $filePath;
1919
}
2020
}
21+
22+
chdir(__DIR__);

rector.php

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

3-
use Rector\Config\RectorConfig;
43
use Rector\CodeQuality\Rector\BooleanAnd\SimplifyEmptyArrayCheckRector;
4+
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
55
use Rector\CodeQuality\Rector\Expression\InlineIfToExplicitIfRector;
66
use Rector\CodeQuality\Rector\For_\ForToForeachRector;
77
use Rector\CodeQuality\Rector\Foreach_\UnusedForeachValueToArrayKeysRector;
@@ -18,6 +18,7 @@
1818
use Rector\CodingStyle\Rector\ClassMethod\FuncGetArgsToVariadicParamRector;
1919
use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector;
2020
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
21+
use Rector\Config\RectorConfig;
2122
use Rector\Core\ValueObject\PhpVersion;
2223
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPromotedPropertyRector;
2324
use Rector\DeadCode\Rector\MethodCall\RemoveEmptyMethodCallRector;
@@ -29,15 +30,23 @@
2930
use Rector\Php56\Rector\FunctionLike\AddDefaultValueForUndefinedVariableRector;
3031
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
3132
use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector;
32-
use Rector\Php74\Rector\Property\TypedPropertyRector;
3333
use Rector\PHPUnit\Set\PHPUnitSetList;
34+
use Rector\Privatization\Rector\Property\PrivatizeFinalClassPropertyRector;
3435
use Rector\PSR4\Rector\FileWithoutNamespace\NormalizeNamespaceByPSR4ComposerAutoloadRector;
3536
use Rector\Set\ValueObject\LevelSetList;
3637
use Rector\Set\ValueObject\SetList;
38+
use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromAssignsRector;
3739

3840
return static function (RectorConfig $rectorConfig): void {
39-
$rectorConfig->sets([SetList::DEAD_CODE, LevelSetList::UP_TO_PHP_74, PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD, PHPUnitSetList::PHPUNIT_80]);
41+
$rectorConfig->sets([
42+
SetList::DEAD_CODE,
43+
LevelSetList::UP_TO_PHP_74,
44+
PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD,
45+
PHPUnitSetList::PHPUNIT_100,
46+
]);
47+
4048
$rectorConfig->parallel();
49+
4150
// The paths to refactor (can also be supplied with CLI arguments)
4251
$rectorConfig->paths([
4352
__DIR__ . '/src/',
@@ -78,7 +87,7 @@
7887
__DIR__ . '/tests',
7988
],
8089

81-
// Ignore files that should not be namespaced
90+
// Ignore files that should not be namespaced to their folder
8291
NormalizeNamespaceByPSR4ComposerAutoloadRector::class => [
8392
__DIR__ . '/src/Helpers',
8493
],
@@ -89,6 +98,10 @@
8998
// May be uninitialized on purpose
9099
AddDefaultValueForUndefinedVariableRector::class,
91100
]);
101+
102+
// auto import fully qualified class names
103+
$rectorConfig->importNames();
104+
92105
$rectorConfig->rule(SimplifyUselessVariableRector::class);
93106
$rectorConfig->rule(RemoveAlwaysElseRector::class);
94107
$rectorConfig->rule(CountArrayToEmptyArrayComparisonRector::class);
@@ -112,8 +125,14 @@
112125
$rectorConfig->rule(SimplifyEmptyArrayCheckRector::class);
113126
$rectorConfig->rule(NormalizeNamespaceByPSR4ComposerAutoloadRector::class);
114127
$rectorConfig
115-
->ruleWithConfiguration(TypedPropertyRector::class, [
116-
// Set to false if you use in libraries, or it does create breaking changes.
117-
TypedPropertyRector::INLINE_PUBLIC => true,
128+
->ruleWithConfiguration(TypedPropertyFromAssignsRector::class, [
129+
/**
130+
* The INLINE_PUBLIC value is default to false to avoid BC break, if you use for libraries and want to preserve BC break, you don't need to configure it, as it included in LevelSetList::UP_TO_PHP_74
131+
* Set to true for projects that allow BC break
132+
*/
133+
TypedPropertyFromAssignsRector::INLINE_PUBLIC => true,
118134
]);
135+
$rectorConfig->rule(StringClassNameToClassConstantRector::class);
136+
$rectorConfig->rule(PrivatizeFinalClassPropertyRector::class);
137+
$rectorConfig->rule(CompleteDynamicPropertiesRector::class);
119138
};

src/Template/.github/workflows/deptrac.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,12 @@ jobs:
3939
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4040

4141
- name: Get composer cache directory
42-
id: composer-cache
43-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
42+
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV
4443

4544
- name: Cache composer dependencies
4645
uses: actions/cache@v3
4746
with:
48-
path: ${{ steps.composer-cache.outputs.dir }}
47+
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
4948
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
5049
restore-keys: ${{ runner.os }}-composer-
5150

0 commit comments

Comments
 (0)