-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b7cff46
Showing
32 changed files
with
1,178 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
indent_style = space | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.editorconfig export-ignore | ||
.gitattributes export-ignore | ||
.gitignore export-ignore | ||
phpstan.neon export-ignore | ||
phpunit.xml export-ignore | ||
tests export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#example-of-a-codeowners-file | ||
* @ddevsr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
|
||
updates: | ||
- package-ecosystem: 'composer' | ||
directory: '/' | ||
schedule: | ||
interval: 'daily' | ||
|
||
- package-ecosystem: 'github-actions' | ||
directory: '/' | ||
schedule: | ||
interval: 'daily' | ||
ignore: | ||
- dependency-name: '*' | ||
update-types: | ||
- 'version-update:semver-minor' | ||
- 'version-update:semver-patch' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Code Analysis | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
# see https://github.com/composer/composer/issues/9368#issuecomment-718112361 | ||
COMPOSER_ROOT_VERSION: "dev-main" | ||
|
||
jobs: | ||
code_analysis: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
actions: | ||
- | ||
name: 'Composer Validate' | ||
run: composer validate | ||
|
||
- | ||
name: 'PHP-CS-Fixer' | ||
run: composer lint | ||
|
||
- | ||
name: 'Rector Dry Run' | ||
run: composer rector | ||
|
||
- | ||
name: 'PHPStan' | ||
run: composer phpstan | ||
|
||
name: ${{ matrix.actions.name }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.3 | ||
coverage: none | ||
|
||
- uses: ramsey/composer-install@v2 | ||
|
||
- run: ${{ matrix.actions.run }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Downgraded Release | ||
|
||
# https://tomasvotruba.com/blog/how-to-release-php-81-and-72-package-in-the-same-repository/ | ||
# https://github.com/TomasVotruba/cognitive-complexity/blob/main/.github/workflows/downgraded_release.yaml | ||
# https://github.com/symplify/config-transformer/blob/main/.github/workflows/downgraded_release.yaml | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
downgrade_release: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- | ||
uses: "actions/checkout@v4" | ||
|
||
- | ||
uses: "shivammathur/setup-php@v2" | ||
with: | ||
php-version: 8.2 | ||
coverage: none | ||
|
||
- uses: "ramsey/composer-install@v2" | ||
|
||
# downgrade /src to PHP 7.2 | ||
- run: vendor/bin/rector process src config --config build/rector-downgrade-php-72.php --ansi | ||
|
||
# copy PHP 7.2 composer | ||
- run: cp build/composer-php-72.json composer.json | ||
|
||
# clear the dev files | ||
- run: rm -rf build .github tests phpstan.neon phpunit.xml | ||
|
||
# setup git user | ||
- | ||
run: | | ||
git config user.email "[email protected]" | ||
git config user.name "GitHub Action" | ||
# publish to the same repository with a new tag | ||
- | ||
name: "Tag Downgraded Code" | ||
run: | | ||
git commit -a -m "release PHP 7.2 downgraded ${GITHUB_REF#refs/tags/}" | ||
# force push tag, so there is only 1 version | ||
git tag "${GITHUB_REF#refs/tags/}" --force | ||
git push origin "${GITHUB_REF#refs/tags/}" --force |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Check conflict branch in PR | ||
on: | ||
schedule: | ||
- cron: '*/780 * * * *' # Run at every 240 minutes / 4 hour | ||
|
||
jobs: | ||
build: | ||
name: Check conflict branch in PR | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Check conflict branch in PR | ||
uses: PHPDevsr/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
label: stale | ||
comment: | | ||
:wave: Hi, @authorTarget! | ||
We detected conflicts in your PR against the base branch :speak_no_evil: | ||
You may want to sync :arrows_counterclockwise: your branch with upstream! | ||
Ref: [Syncing Your Branch](https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/workflow.md#pushing-your-branch) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Check Signed PR | ||
on: | ||
pull_request: | ||
branches: | ||
- 'main' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: write | ||
|
||
jobs: | ||
build: | ||
name: Check Signed Commit | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Check signed commits in PR | ||
uses: 1Password/[email protected] | ||
with: | ||
comment: | | ||
You must GPG-sign your work, certifying that you either wrote the work or otherwise have the right to pass it on to an open-source project. See Developer's Certificate of Origin. See [signing][1]. | ||
**Note that all your commits must be signed.** If you have an unsigned commit, you can sign the previous commits by referring to [gpg-signing-old-commits][2]. | ||
[1]: https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/pull_request.md#signing | ||
[2]: https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/workflow.md#gpg-signing-old-commits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Tests | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
# see https://github.com/composer/composer/issues/9368#issuecomment-718112361 | ||
COMPOSER_ROOT_VERSION: "dev-main" | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
|
||
name: Tests | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.2 | ||
coverage: none | ||
|
||
- uses: "ramsey/composer-install@v1" | ||
|
||
- run: vendor/bin/phpunit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/vendor | ||
composer.lock | ||
|
||
# PHPStorm meta files | ||
.idea/ | ||
|
||
.phpunit.result.cache | ||
.phpunit.cache | ||
.php-cs-fixer.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of CodeIgniter Rector. | ||
* | ||
* (c) CodeIgniter Foundation <[email protected]> | ||
* | ||
* For the full copyright and license information, please view | ||
* the LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
use CodeIgniter\CodingStandard\CodeIgniter4; | ||
use Nexus\CsConfig\Factory; | ||
use PhpCsFixer\Finder; | ||
|
||
$finder = Finder::create() | ||
->files() | ||
->in([ | ||
__DIR__ . '/src/', | ||
__DIR__ . '/tests/', | ||
__DIR__ . '/config/', | ||
]) | ||
->append([ | ||
__FILE__, | ||
__DIR__ . '/rector.php', | ||
]); | ||
|
||
$overrides = [ | ||
'declare_strict_types' => true, | ||
'void_return' => true, | ||
]; | ||
|
||
$options = [ | ||
'finder' => $finder, | ||
'cacheFile' => '.php-cs-fixer.cache', | ||
]; | ||
|
||
return Factory::create(new CodeIgniter4(), $overrides, $options)->forLibrary( | ||
'CodeIgniter Rector', | ||
'PHPDevsr', | ||
'[email protected]' | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
The MIT License | ||
--------------- | ||
|
||
Copyright (c) 2017-present Tomáš Votruba (https://tomasvotruba.cz) | ||
|
||
Permission is hereby granted, free of charge, to any person | ||
obtaining a copy of this software and associated documentation | ||
files (the "Software"), to deal in the Software without | ||
restriction, including without limitation the rights to use, | ||
copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the | ||
Software is furnished to do so, subject to the following | ||
conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Rector Rules for Laravel | ||
[](https://github.com/driftingly/rector-laravel/actions/workflows/tests.yaml) | ||
[](https://github.com/driftingly/rector-laravel/actions/workflows/code_analysis.yaml) | ||
[](https://packagist.org/packages/driftingly/rector-laravel/stats) | ||
[](https://packagist.org/packages/driftingly/rector-laravel) | ||
|
||
See available [Laravel rules](/docs/rector_rules_overview.md) | ||
|
||
## Install | ||
|
||
This package is a [Rector](https://github.com/rectorphp/rector) extension developed by the Laravel community. | ||
|
||
Install the `RectorLaravel` package as dependency: | ||
|
||
```bash | ||
composer require driftingly/rector-laravel --dev | ||
``` | ||
|
||
## Use Sets | ||
|
||
To add a set to your config, use `RectorLaravel\Set\LaravelSetList` class and pick one of the constants: | ||
|
||
```php | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Rector\Config\RectorConfig; | ||
use RectorLaravel\Set\LaravelSetList; | ||
|
||
return RectorConfig::configure() | ||
->withSets([ | ||
LaravelSetList::LARAVEL_110 | ||
]); | ||
``` | ||
|
||
## Learn Rector Faster | ||
|
||
Rector is a tool that [we develop](https://getrector.org/) and share for free, so anyone can save hundreds of hours on refactoring. | ||
But not everyone has time to understand Rector and AST complexity. You have 2 ways to speed this process up: | ||
|
||
* Read the book - <a href="https://leanpub.com/rector-the-power-of-automated-refactoring">The Power of Automated Refactoring</a> | ||
* Hire our experienced team to <a href="https://getrector.org/contact">improve your codebase</a> | ||
|
||
Both ways support us to and improve Rector in sustainable way by learning from practical projects. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "phpdevsr/rector-codeigniter4", | ||
"type": "rector-extension", | ||
"license": "MIT", | ||
"description": "Rector upgrades rules for Codeigniter4", | ||
"require": { | ||
"php": "^7.2 || ^8.0", | ||
"rector/rector": "^1.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"PHPDevsr\\Rector\\Codeigniter4\\": "src" | ||
} | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
"config": { | ||
"optimize-autoloader": true, | ||
"sort-packages": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Rector\Config\RectorConfig; | ||
use Rector\Set\ValueObject\DowngradeLevelSetList; | ||
|
||
return static function (RectorConfig $rectorConfig): void { | ||
$rectorConfig->sets([DowngradeLevelSetList::DOWN_TO_PHP_72]); | ||
}; |
Oops, something went wrong.