-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3680 from samsonasik/apply-rector-1
apply rector: set variable name to camel case
- Loading branch information
Showing
61 changed files
with
958 additions
and
739 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,59 @@ | ||
# When a PR is opened or a push is made, perform | ||
# a static analysis check on the code using Rector. | ||
name: Rector | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- 'develop' | ||
- '4.*' | ||
paths: | ||
- 'app/**' | ||
- 'system/**' | ||
push: | ||
branches: | ||
- 'develop' | ||
- '4.*' | ||
paths: | ||
- 'app/**' | ||
- 'system/**' | ||
|
||
jobs: | ||
build: | ||
name: Analyze code (Rector) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '7.4' | ||
extensions: intl | ||
|
||
- name: Use latest Composer | ||
run: composer self-update | ||
|
||
- name: Validate composer.json | ||
run: composer validate --strict | ||
|
||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- name: Create composer cache directory | ||
run: mkdir -p ${{ steps.composer-cache.outputs.dir }} | ||
|
||
- name: Cache composer dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | ||
restore-keys: ${{ runner.os }}-composer- | ||
|
||
- name: Install dependencies | ||
run: composer install --ansi --no-progress --no-suggest --no-interaction | ||
|
||
- name: Run static analysis | ||
run: vendor/bin/rector process --dry-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
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
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,29 @@ | ||
<?php | ||
|
||
use Rector\Core\Configuration\Option; | ||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; | ||
use Utils\Rector\UnderscoreToCamelCaseVariableNameRector; | ||
|
||
return static function (ContainerConfigurator $containerConfigurator): void { | ||
$parameters = $containerConfigurator->parameters(); | ||
|
||
// paths to refactor; solid alternative to CLI arguments | ||
$parameters->set(Option::PATHS, [__DIR__ . '/app', __DIR__ . '/system']); | ||
|
||
// is there a file you need to skip? | ||
$parameters->set(Option::EXCLUDE_PATHS, [ | ||
__DIR__ . '/app/Views', | ||
__DIR__ . '/system/Autoloader/Autoloader.php', | ||
__DIR__ . '/system/Debug/Toolbar/Views/toolbar.tpl.php', | ||
__DIR__ . '/system/ThirdParty', | ||
]); | ||
|
||
// Rector relies on autoload setup of your project; Composer autoload is included by default; to add more: | ||
$parameters->set(Option::AUTOLOAD_PATHS, [ | ||
// autoload specific file | ||
__DIR__ . '/system/Test/bootstrap.php', | ||
]); | ||
|
||
$services = $containerConfigurator->services(); | ||
$services->set(UnderscoreToCamelCaseVariableNameRector::class); | ||
}; |
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
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
Oops, something went wrong.