Skip to content

Commit

Permalink
Merge pull request #1 from rectorphp/master
Browse files Browse the repository at this point in the history
Merge upstream
  • Loading branch information
atompulse authored Apr 28, 2020
2 parents 8a36e3b + 390a28c commit 0c33b2b
Show file tree
Hide file tree
Showing 242 changed files with 4,152 additions and 2,634 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/annotated_checkstyle.yaml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/docs.yaml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/validate_doctrine_annotation.yaml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/validate_fixtures.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Validate Services
name: Validate Project

on:
pull_request: null
Expand All @@ -7,7 +7,7 @@ on:
- master

jobs:
validate_services:
validate_project:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -17,4 +17,13 @@ jobs:
coverage: none

- run: composer install --no-progress

- run: bin/rector validate-fixtures --ansi

- run: bin/rector validate-fixture-suffix --ansi

- run: bin/rector sync-annotation-parser --dry-run --ansi

- run: bin/rector validate-services-in-sets --ansi

- run: composer check-docs
2 changes: 2 additions & 0 deletions .github/workflows/validate_sets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ jobs:
coverage: none

- run: composer install --no-progress

# this is very slow, so it has to be in own workflow
- run: bin/rector validate-sets --ansi
1 change: 1 addition & 0 deletions .kodiak.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# .kodiak.toml
version = 1
delete_branch_on_merge = true
2 changes: 2 additions & 0 deletions .phpstorm.meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
\Rector\NodeTypeResolver\Node\AttributeKey::PHP_DOC_INFO,
\Rector\NodeTypeResolver\Node\AttributeKey::KIND,
\Rector\NodeTypeResolver\Node\AttributeKey::CLASS_SHORT_NAME,
\Rector\NodeTypeResolver\Node\AttributeKey::IS_REGULAR_PATTERN,
);

expectedArguments(
Expand All @@ -67,6 +68,7 @@
\Rector\NodeTypeResolver\Node\AttributeKey::PHP_DOC_INFO,
\Rector\NodeTypeResolver\Node\AttributeKey::KIND,
\Rector\NodeTypeResolver\Node\AttributeKey::CLASS_SHORT_NAME,
\Rector\NodeTypeResolver\Node\AttributeKey::IS_REGULAR_PATTERN,
);

expectedArguments(
Expand Down
145 changes: 109 additions & 36 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,68 @@ PRs and issues are linked, so you can find more about it. Thanks to [ChangelogLi

<!-- changelog-linker -->

## v0.7.17 - 2020-04-23
## Unreleased

### Changed

- [#3266] publish dump-rectors command with 3rd party install

## [v0.7.20] - 2020-04-26

- [#3253] make Doctrine property inferer skip non doc
- [#3262] [cs] sort private methods by call order and property by complexity
- [#3265] [docs] make dump-rectors command open to public

### Fixed

- [#3252] [CodeQuality] Fix CompactToVariablesRector for unknown names
- [#3260] [Nette] Fix preg_match_all() to Nette\Utils migrations
- [#3261] Fix autoloading for phpstan configs
- [#3248] Fix [@Route] name can be empty, Thanks to [@stephanvierkant]

### Removed

- [#3264] remove RectorStandaloneRunner, too hacky

## [v0.7.19] - 2020-04-24

### Added

- [#3251] [CodeQuality] Add UnusedForeachValueToArrayKeysRector
- [#3235] [DX] Add validate fixture suffix
- [#3237] [PHP 8.0] Add str_ends_with()
- [#3245] [PHP 8.0] Add Stringable
- [#3228] [PHP 8.0] Add str_starts_with - rule [#500] 🎉🎉🎉

### Changed

- [#3242] Update rector counter, Thanks to [@vladyslavstartsev]
- [#3238] StrStartWith refactoring
- [#3239] simplify throws class resolving
- [#3240] Symfony route with prefix, Thanks to [@stephanvierkant]
- [#3244] docs refactoring

### Fixed

- [#3236] various suffix fixes
- [#3233] Fix single-line doc end

## [v0.7.18] - 2020-04-23

### Changed

- [#3224] /~https://github.com/rectorphp/rector/issues/3223, Thanks to [@atompulse]

### Fixed

- [#3232] Compiler: Fix invalid changes in config/set neon files, Thanks to [@RiKap]

## [v0.7.17] - 2020-04-23

### Added

- [#3219] [Restoration] Add RemoveFinalFromEntityRector
- [#3218] Add more tag value node tests
- [#3196] [CodeQuality] Add SplitListScalarAssignToSeparateLineRector
- [#3195] [PHPUnit] Add strict param to ReplaceAssertArraySubsetRector
- [#3118] Add cache for un-changed files
Expand Down Expand Up @@ -112,8 +170,18 @@ PRs and issues are linked, so you can find more about it. Thanks to [ChangelogLi
- [#3134] Add DoctrineAnnotationParserSyncer to prevent doctrine/annotation constant by-value override
- [#3114] move property adding to PostRector
- [#3141] [PHPUnit 9.1] Add assertFileNotExists() method rename

### Changed
- [#3080] [CodeQuality] Add ArrayKeysAndInArrayToIssetRector
- [#3070] [DeadCode] Add empty() + count($values) > 0 checks to RemoveUnusedNonEmptyArrayBeforeForeachRector
- [#3068] [DeadCode] Add RemoveAssignOfVoidReturnFunctionRector
- [#3062] [DeadCode] Add RemoveUnusedFunctionRector
- [#3066] [DeadCode] Add RemoveUnusedNonEmptyArrayBeforeForeachRector
- [#3047] [PHPUnit] Add CreateMockToCreateStubRector
- [#3081] [TypeDeclaration] Add class method param type resolving by property
- [#3058] [PHP 7.4] Add default null type on properties
- [#3059] [PHP 7.4] Add restoration null default only
- [#3057] [PHP 7.4] Add id tag support + remove array on collection property
- [#3078] Add Safe 0.7 set
- [#3072] [PHP 8.0] Add StrContainsRector

- [#3111] [API] NodeRemovingCommander to PostRector
- [#3084] [Privatization] Privatize methods that are used only locally
Expand All @@ -129,39 +197,6 @@ PRs and issues are linked, so you can find more about it. Thanks to [ChangelogLi
- [#3128] Allow PHPStan generics
- [#3115] move node-replacing to PostRector
- [#3146] Make sure doctrine alias rector works in symfony controllers, Thanks to [@acrobat]

### Fixed

- [#3132] Fix Gedmo annotation printing
- [#3130] Fix missing array key in ArrayMergeOfNonArraysToSimpleArrayRector
- [#3096] Fix [@Route] localized paths
- [#3129] fix missing host at [@Route] annotation

### Removed

- [#3122] remove json rector dump formatter, not needed

<!-- dumped content end -->

## v0.7.17 - 2020-04-23

### Added

- [#3080] [CodeQuality] Add ArrayKeysAndInArrayToIssetRector
- [#3070] [DeadCode] Add empty() + count($values) > 0 checks to RemoveUnusedNonEmptyArrayBeforeForeachRector
- [#3068] [DeadCode] Add RemoveAssignOfVoidReturnFunctionRector
- [#3062] [DeadCode] Add RemoveUnusedFunctionRector
- [#3066] [DeadCode] Add RemoveUnusedNonEmptyArrayBeforeForeachRector
- [#3047] [PHPUnit] Add CreateMockToCreateStubRector
- [#3081] [TypeDeclaration] Add class method param type resolving by property
- [#3058] [PHP 7.4] Add default null type on properties
- [#3059] [PHP 7.4] Add restoration null default only
- [#3057] [PHP 7.4] Add id tag support + remove array on collection property
- [#3078] Add Safe 0.7 set
- [#3072] [PHP 8.0] Add StrContainsRector

### Changed

- [#3082] [CodeQuality] use array_key_exists instead of isset
- [#3056] [PHP 7.4] Improve TypedPropertyRector for Doctrine collection
- [#3051] improve GeneratedValueTagValueNode
Expand All @@ -181,9 +216,14 @@ PRs and issues are linked, so you can find more about it. Thanks to [ChangelogLi
- [#3077] Fix auto import
- [#3079] Fix annotation in requirements of [@Route]
- [#3064] [PHP 7.4] Fix ChangeReflectionTypeToStringToGetNameRector
- [#3132] Fix Gedmo annotation printing
- [#3130] Fix missing array key in ArrayMergeOfNonArraysToSimpleArrayRector
- [#3096] Fix [@Route] localized paths
- [#3129] fix missing host at [@Route] annotation

### Removed

- [#3122] remove json rector dump formatter, not needed
- [#3071] remove ctor dependency on property/assign removal
- [#3076] [PHP 8.0] drop preg_match support from StrContains, too vague

Expand Down Expand Up @@ -2992,3 +3032,36 @@ PRs and issues are linked, so you can find more about it. Thanks to [ChangelogLi
[@callmebob2016]: /~https://github.com/callmebob2016
[@acrobat]: /~https://github.com/acrobat
[@UFTimmy]: /~https://github.com/UFTimmy
[#3266]: /~https://github.com/rectorphp/rector/pull/3266
[#3265]: /~https://github.com/rectorphp/rector/pull/3265
[#3264]: /~https://github.com/rectorphp/rector/pull/3264
[#3262]: /~https://github.com/rectorphp/rector/pull/3262
[#3261]: /~https://github.com/rectorphp/rector/pull/3261
[#3260]: /~https://github.com/rectorphp/rector/pull/3260
[#3253]: /~https://github.com/rectorphp/rector/pull/3253
[#3252]: /~https://github.com/rectorphp/rector/pull/3252
[#3251]: /~https://github.com/rectorphp/rector/pull/3251
[#3248]: /~https://github.com/rectorphp/rector/pull/3248
[#3245]: /~https://github.com/rectorphp/rector/pull/3245
[#3244]: /~https://github.com/rectorphp/rector/pull/3244
[#3242]: /~https://github.com/rectorphp/rector/pull/3242
[#3240]: /~https://github.com/rectorphp/rector/pull/3240
[#3239]: /~https://github.com/rectorphp/rector/pull/3239
[#3238]: /~https://github.com/rectorphp/rector/pull/3238
[#3237]: /~https://github.com/rectorphp/rector/pull/3237
[#3236]: /~https://github.com/rectorphp/rector/pull/3236
[#3235]: /~https://github.com/rectorphp/rector/pull/3235
[#3233]: /~https://github.com/rectorphp/rector/pull/3233
[#3232]: /~https://github.com/rectorphp/rector/pull/3232
[#3228]: /~https://github.com/rectorphp/rector/pull/3228
[#3224]: /~https://github.com/rectorphp/rector/pull/3224
[#3219]: /~https://github.com/rectorphp/rector/pull/3219
[#3218]: /~https://github.com/rectorphp/rector/pull/3218
[#500]: /~https://github.com/rectorphp/rector/pull/500
[v0.7.20]: /~https://github.com/rectorphp/rector/compare/v0.7.19...v0.7.20
[v0.7.19]: /~https://github.com/rectorphp/rector/compare/v0.7.18...v0.7.19
[v0.7.18]: /~https://github.com/rectorphp/rector/compare/v0.7.17...v0.7.18
[v0.7.17]: /~https://github.com/rectorphp/rector/compare/v0.7.16...v0.7.17
[@stephanvierkant]: /~https://github.com/stephanvierkant
[@atompulse]: /~https://github.com/atompulse
[@RiKap]: /~https://github.com/RiKap
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Why refactor manually if Rector can handle 80% of the task for you?

<br>

- **[Overview of all 450+ Rectors](/docs/AllRectorsOverview.md)**
- **[Overview of all 500+ Rectors](/docs/AllRectorsOverview.md)**
- **[Online DEMO](https://getrector.org/demo)**

<br>
Expand Down Expand Up @@ -440,6 +440,7 @@ Use [the `create` command](/docs/RectorRecipe.md).
- [How Does Rector Work?](/docs/HowItWorks.md)
- [PHP Parser Nodes Overview](/docs/NodesOverview.md)
- [Generate Rector from Recipe](/docs/RectorRecipe.md)
- [Add Checkstyle with your CI](/docs/Checkstyle.md)

## How to Contribute

Expand Down
19 changes: 19 additions & 0 deletions bin/rector
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ $autoloadIncluder = new AutoloadIncluder();
$autoloadIncluder->includeCwdVendorAutoloadIfExists();
$autoloadIncluder->autoloadProjectAutoloaderFile('/../../autoload.php');
$autoloadIncluder->includeDependencyOrRepositoryVendorAutoloadIfExists();
$autoloadIncluder->autoloadFromCommandLine();

try {
$rectorConfigsResolver = new RectorConfigsResolver();
Expand Down Expand Up @@ -133,6 +134,24 @@ final class AutoloadIncluder
{
return in_array('--debug', $_SERVER['argv'], true);
}

public function autoloadFromCommandLine(): void
{
$cliArgs = $_SERVER['argv'];

$autoloadOptionPosition = array_search('-a', $cliArgs) ?: array_search('--autoload-file', $cliArgs);
if (! $autoloadOptionPosition) {
return;
}

$autoloadFileValuePosition = $autoloadOptionPosition + 1;
$fileToAutoload = $cliArgs[$autoloadFileValuePosition] ?? null;
if ($fileToAutoload=== null) {
return;
}

$this->loadIfNotLoadedYet($fileToAutoload, __METHOD__);
}
}

final class RectorConfigsResolver
Expand Down
4 changes: 2 additions & 2 deletions compiler/build/box.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"config",
"src",
"rules",
"packages",
"vendor"
"packages"
],
"force-autodiscovery": true,
"output": "tmp/rector.phar",
"php-scoper": "compiler/build/scoper.inc.php"
}
5 changes: 4 additions & 1 deletion compiler/build/scoper.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ function (string $filePath, string $prefix, string $content): string {
if (strpos($filePath, '.neon') === false) {
return $content;
}

// @see /~https://github.com/rectorphp/rector/issues/3227
if (strpos($filePath, 'config/set/') !== 0) {
return $content;
}
if ($content === '') {
return $content;
}
Expand Down
Loading

0 comments on commit 0c33b2b

Please sign in to comment.