Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinDev committed Nov 9, 2021
1 parent 1877835 commit da00c85
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 37 deletions.
2 changes: 1 addition & 1 deletion packages/admin-block-editor/src/Block/DefaultBlock.php
Expand Up @@ -25,7 +25,7 @@ class DefaultBlock extends AbstractBlock

public function __construct(string $name)
{
if (! \in_array($name, self::AVAILABLE_BLOCKS)) {
if (! \in_array($name, self::AVAILABLE_BLOCKS, true)) {
throw new Exception('Not a default block `'.$name.'`');
}

Expand Down
4 changes: 2 additions & 2 deletions packages/admin/src/FormField/MediaPreviewField.php
Expand Up @@ -35,14 +35,14 @@ private function issetRelatedPages(): bool
{
$relatedPages = $this->getRelatedPages();

if (! empty($relatedPages['content']) || $relatedPages['mainImage']->count() > 0) {
if ([] !== $relatedPages['content'] || $relatedPages['mainImage']->count() > 0) {
return true;
} else {
return false;
}
}

private function getRelatedPages(): ?array
private function getRelatedPages(): array
{
if (null !== $this->relatedPages) {
return $this->relatedPages;
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/FormField/PageSlugField.php
Expand Up @@ -10,7 +10,7 @@ class PageSlugField extends AbstractField
{
protected function getSlugHelp()
{
if (! $this->admin->hasSubject() || ! $this->admin->getSubject()->getSlug()) {
if ('' === $this->admin->getSubject()->getSlug()) {
return 'admin.page.slug.help';
}

Expand Down
4 changes: 2 additions & 2 deletions packages/admin/src/PageAdmin.php
Expand Up @@ -65,7 +65,7 @@ protected function configureFormFields(FormMapper $form): void
$form->end();

foreach ($fields[1] as $k => $block) {
if (! ($this->getSubject() && $this->getSubject()->getSlug()) && 'admin.page.revisions' == $k) {
if (null === $this->getSubject()->getId() && 'admin.page.revisions' == $k) {
continue;
}

Expand All @@ -82,7 +82,7 @@ protected function configureFormFields(FormMapper $form): void

protected function alterNewInstance(object $object): void
{
if (! $object instanceof PageInterface) {
if (false === $object instanceof PageInterface) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/PageCRUDController.php
Expand Up @@ -19,7 +19,7 @@ public function loadContainer(ContainerInterface $container): void
{
$this->container = $container;

if (! $this->container->has('parameter_bag')) {
if (false === $this->container->has('parameter_bag')) {
throw new Exception('patch no longer worked');
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/conversation/src/Form/FormTrait.php
Expand Up @@ -229,7 +229,7 @@ protected function showSuccess(): string
protected function getNextStepFunctionName()
{
$getFormMethod = 'getStep'.self::$step[$this->getNextStep()];
if (! method_exists($this, $getFormMethod)) {
if (false === method_exists($this, $getFormMethod)) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/conversation/src/Form/MessageForm.php
Expand Up @@ -38,7 +38,7 @@ protected function getUser()
return null;
}

if (! \is_object($user = $token->getUser())) {
if (false === \is_object($user = $token->getUser())) {
// e.g. anonymous authentication
return null;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/Component/App/AppPool.php
Expand Up @@ -56,7 +56,7 @@ public function switchCurrentApp($host): self

public function get(?string $host = ''): AppConfig
{
$host = ! $host ? $this->currentApp : $host;
$host = \in_array($host, [null, ''], true) ? $this->currentApp : $host;
if (isset($this->apps[$host])) {
return $this->apps[$host];
}
Expand Down Expand Up @@ -133,7 +133,7 @@ public function sameHost($host): bool

public function getApp(string $host = ''): AppConfig
{
if (! $host) {
if ('' === $host) {
$host = $this->currentApp;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/Component/EntityFilter/ManagerPool.php
Expand Up @@ -34,7 +34,7 @@ public function getProperty(object $entity, string $property = '')
{
$manager = $this->getManager($entity);

if (! $property) {
if ('' === $property) {
return $manager;
}

Expand Down
Binary file modified packages/skeleton/var/app.db
Binary file not shown.
49 changes: 24 additions & 25 deletions rector.php
Expand Up @@ -26,35 +26,34 @@ function ($path) { return __DIR__.'/'.$path; },

$parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_74);

/**/
$containerConfigurator->import(SetList::DEAD_CODE);
//$containerConfigurator->import(SetList::DEAD_CODE);


/**
$containerConfigurator->import(SetList::TYPE_DECLARATION);

$services = $containerConfigurator->services();

$services->set(BooleanInBooleanNotRuleFixerRector::class)
->call('configure', [[
BooleanInBooleanNotRuleFixerRector::TREAT_AS_NON_EMPTY => true,
]]);
$services->set(BooleanInIfConditionRuleFixerRector::class)
->call('configure', [[
BooleanInIfConditionRuleFixerRector::TREAT_AS_NON_EMPTY => false,
]]);
$services->set(BooleanInTernaryOperatorRuleFixerRector::class)
->call('configure', [[
BooleanInTernaryOperatorRuleFixerRector::TREAT_AS_NON_EMPTY => false,
]]);
$services->set(DisallowedEmptyRuleFixerRector::class)
->call('configure', [[
DisallowedEmptyRuleFixerRector::TREAT_AS_NON_EMPTY => false,
]]);
$services->set(DisallowedShortTernaryRuleFixerRector::class)
->call('configure', [[
DisallowedShortTernaryRuleFixerRector::TREAT_AS_NON_EMPTY => false,
]]);
/**/
// $services->set(BooleanInBooleanNotRuleFixerRector::class)
// ->call('configure', [[
// BooleanInBooleanNotRuleFixerRector::TREAT_AS_NON_EMPTY => true,
// ]]); // ...

// $services->set(BooleanInIfConditionRuleFixerRector::class)
// ->call('configure', [[
// BooleanInIfConditionRuleFixerRector::TREAT_AS_NON_EMPTY => false,
// ]]);
// $services->set(BooleanInTernaryOperatorRuleFixerRector::class)
// ->call('configure', [[
// BooleanInTernaryOperatorRuleFixerRector::TREAT_AS_NON_EMPTY => false,
// ]]);
// $services->set(DisallowedEmptyRuleFixerRector::class)
// ->call('configure', [[
// DisallowedEmptyRuleFixerRector::TREAT_AS_NON_EMPTY => false,
// ]]);
// $services->set(DisallowedShortTernaryRuleFixerRector::class)
// ->call('configure', [[
// DisallowedShortTernaryRuleFixerRector::TREAT_AS_NON_EMPTY => false,
// ]]);


};

0 comments on commit da00c85

Please sign in to comment.