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
28 changes: 21 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ dist: bionic
language: php

php:
- '7.2'
- '7.3'
- '7.4'

Expand All @@ -17,6 +16,11 @@ install:
script:
- vendor/bin/phpunit --testsuite main

stages:
- test
- name: phar
if: (branch = master OR tag IS present) && type = push

jobs:
include:
-
Expand All @@ -35,7 +39,6 @@ jobs:
stage: phar
name: "Deploy PHAR to https://github.com/rectorphp/rector-prefixed"
php: 7.2
if: branch = master AND type = push
script:
# reuse tmp/rector.phar from previous job
- git clone https://${GITHUB_TOKEN}@github.com/rectorphp/rector-prefixed.git rector-prefixed > /dev/null 2>&1
Expand All @@ -45,14 +48,26 @@ jobs:
- git config user.email "travis@travis-ci.org"
- git config user.name "Travis CI"
- git add rector rector.phar
- git commit -m "Updated Rector to commit ${TRAVIS_COMMIT}"

- if [ "${TRAVIS_TAG}" != "" ]; then
COMMIT_MSG="Rector ${TRAVIS_TAG}"
else
COMMIT_MSG="Updated Rector to commit ${TRAVIS_COMMIT}"
fi

- git commit -S -m "${COMMIT_MSG}" -m "${GIT_LOG}"
- git push --quiet origin master

- if [ "${TRAVIS_TAG}" != "" ]; then
git tag -s ${TRAVIS_TAG} -m "${TRAVIS_TAG}"
git push --quiet origin ${TRAVIS_TAG}
fi

# Stage 1
-
stage: test
php: 7.2
name: Lowest dependencies
name: "7.2 with Lowest dependencies"
install:
# install lowest dependencies
- composer update --prefer-lowest --no-progress
Expand Down Expand Up @@ -93,10 +108,9 @@ jobs:
- php ci/check_services_in_yaml_configs.php
- php ci/run_all_sets.php

# Stage 2
-
# Run standalone install in non-root package, ref https://github.com/rectorphp/rector/issues/732
stage: standalone
stage: test
php: 7.3
name: Standalone Run
script:
Expand All @@ -122,7 +136,7 @@ jobs:
# --hide-autoload-errors due to skipped dev deps and mixes tests in /src
- ../rector-dir/vendor/bin/rector process src --set code-quality --hide-autoload-errors --dry-run

# Stage 3
# Stage 2
-
stage: coverage
php: 7.3
Expand Down
124 changes: 123 additions & 1 deletion docs/AllRectorsOverview.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# All 408 Rectors Overview
# All 411 Rectors Overview

- [Projects](#projects)
- [General](#general)
Expand Down Expand Up @@ -598,6 +598,25 @@ Simplify `in_array` and `array_keys` functions combination into `array_key_exist

<br>

### `IntvalToTypeCastRector`

- class: `Rector\CodeQuality\Rector\FuncCall\IntvalToTypeCastRector`

Change intval() to faster and readable (int) $value

```diff
class SomeClass
{
public function run($value)
{
- return intval($value);
+ return (int) $value;
}
}
```

<br>

### `IsAWithStringWithThirdArgumentRector`

- class: `Rector\CodeQuality\Rector\FuncCall\IsAWithStringWithThirdArgumentRector`
Expand Down Expand Up @@ -2313,6 +2332,30 @@ Removes unneeded $a = $a assigns

<br>

### `TernaryToBooleanOrFalseToBooleanAndRector`

- class: `Rector\DeadCode\Rector\Ternary\TernaryToBooleanOrFalseToBooleanAndRector`

Change ternary of bool : false to && bool

```diff
class SomeClass
{
public function go()
{
- return $value ? $this->getBool() : false;
+ return $value && $this->getBool();
}

private function getBool(): bool
{
return (bool) 5;
}
}
```

<br>

## Doctrine

### `AddEntityIdByConditionRector`
Expand Down Expand Up @@ -2683,6 +2726,85 @@ Change Timestampable from gedmo/doctrine-extensions to knplabs/doctrine-behavior

<br>

### `TranslationBehaviorRector`

- class: `Rector\DoctrineGedmoToKnplabs\Rector\Class_\TranslationBehaviorRector`

Change Translation from gedmo/doctrine-extensions to knplabs/doctrine-behaviors

```diff
-use Gedmo\Mapping\Annotation as Gedmo;
-use Doctrine\ORM\Mapping as ORM;
-use Gedmo\Translatable\Translatable;
+use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait;
+use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;

-/**
- * @ORM\Table
- */
-class Article implements Translatable
+class SomeClass implements TranslatableInterface
{
+ use TranslatableTrait;
+}
+
+
+use Knp\DoctrineBehaviors\Contract\Entity\TranslationInterface;
+use Knp\DoctrineBehaviors\Model\Translatable\TranslationTrait;
+
+class SomeClassTranslation implements TranslationInterface
+{
+ use TranslationTrait;
+
/**
- * @Gedmo\Translatable
* @ORM\Column(length=128)
*/
private $title;

/**
- * @Gedmo\Translatable
* @ORM\Column(type="text")
*/
private $content;
-
- /**
- * @Gedmo\Locale
- * Used locale to override Translation listener`s locale
- * this is not a mapped field of entity metadata, just a simple property
- * and it is not necessary because globally locale can be set in listener
- */
- private $locale;
-
- public function setTitle($title)
- {
- $this->title = $title;
- }
-
- public function getTitle()
- {
- return $this->title;
- }
-
- public function setContent($content)
- {
- $this->content = $content;
- }
-
- public function getContent()
- {
- return $this->content;
- }
-
- public function setTranslatableLocale($locale)
- {
- $this->locale = $locale;
- }
}
```

<br>

### `TreeBehaviorRector`

- class: `Rector\DoctrineGedmoToKnplabs\Rector\Class_\TreeBehaviorRector`
Expand Down