Skip to content

Commit

Permalink
PHP CS Fixer 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
emodric committed Mar 25, 2017
1 parent af27936 commit c9c7d70
Show file tree
Hide file tree
Showing 15 changed files with 55 additions and 50 deletions.
41 changes: 23 additions & 18 deletions .php_cs
@@ -1,24 +1,29 @@
<?php

return Symfony\CS\Config\Config::create()
->setUsingLinter(false)
->setUsingCache(true)
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
->fixers([
'concat_with_spaces',
'-concat_without_spaces',
'-empty_return',
'-phpdoc_params',
'-phpdoc_separation',
'-phpdoc_to_comment',
'-spaces_cast',
'-blankline_after_open_tag',
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
'array_syntax' => array('syntax' => 'long'),
'combine_consecutive_unsets' => true,
'concat_space' => ['spacing' => 'one'],
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => true,
'ordered_imports' => true,
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_align' => false,
'phpdoc_order' => true,
'phpdoc_no_alias_tag' => false,
'psr4' => true,
'semicolon_after_instruction' => true,
'strict_comparison' => true,
'strict_param' => true,
])
->finder(
Symfony\CS\Finder\DefaultFinder::create()
->setFinder(
PhpCsFixer\Finder::create()
->exclude(['vendor'])
->in(__DIR__)
->exclude([
'vendor',
])
)
;
Expand Up @@ -2,10 +2,10 @@

namespace Netgen\Bundle\OpenGraphBundle\DependencyInjection\Compiler;

use LogicException;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use LogicException;

class MetaTagHandlersCompilerPass implements CompilerPassInterface
{
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/Configuration.php
Expand Up @@ -2,8 +2,8 @@

namespace Netgen\Bundle\OpenGraphBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\Configuration as SiteAccessConfiguration;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;

/**
* This is the class that validates and merges configuration from your app/config files.
Expand Down
8 changes: 4 additions & 4 deletions DependencyInjection/NetgenOpenGraphExtension.php
Expand Up @@ -2,12 +2,12 @@

namespace Netgen\Bundle\OpenGraphBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ConfigurationProcessor;
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
* This is the class that loads and manages your bundle configuration.
Expand Down
12 changes: 6 additions & 6 deletions Handler/FieldType/Handler.php
Expand Up @@ -2,13 +2,13 @@

namespace Netgen\Bundle\OpenGraphBundle\Handler\FieldType;

use eZ\Publish\Core\Helper\FieldHelper;
use eZ\Publish\Core\Helper\TranslationHelper;
use eZ\Publish\API\Repository\Values\Content\Field;
use Netgen\Bundle\OpenGraphBundle\MetaTag\Item;
use Netgen\Bundle\OpenGraphBundle\Handler\Handler as BaseHandler;
use eZ\Publish\Core\Base\Exceptions\InvalidArgumentException;
use eZ\Publish\Core\Helper\FieldHelper;
use eZ\Publish\Core\Helper\TranslationHelper;
use Netgen\Bundle\OpenGraphBundle\Exception\FieldEmptyException;
use Netgen\Bundle\OpenGraphBundle\Handler\Handler as BaseHandler;
use Netgen\Bundle\OpenGraphBundle\MetaTag\Item;

abstract class Handler extends BaseHandler
{
Expand Down Expand Up @@ -89,7 +89,7 @@ public function getMetaTags($tagName, array $params = array())
protected function getFieldValue(Field $field, $tagName, array $params = array())
{
if (!$this->fieldHelper->isFieldEmpty($this->content, $field->fieldDefIdentifier)) {
return (string)$field->value;
return (string) $field->value;
}

throw new FieldEmptyException($field->fieldDefIdentifier);
Expand All @@ -106,7 +106,7 @@ protected function getFieldValue(Field $field, $tagName, array $params = array()
protected function getFallbackValue($tagName, array $params = array())
{
if (!empty($params[1])) {
return (string)$params[1];
return (string) $params[1];
}

return '';
Expand Down
8 changes: 4 additions & 4 deletions Handler/FieldType/Image.php
Expand Up @@ -2,17 +2,17 @@

namespace Netgen\Bundle\OpenGraphBundle\Handler\FieldType;

use Exception;
use eZ\Publish\API\Repository\Exceptions\InvalidVariationException;
use eZ\Publish\API\Repository\Values\Content\Field;
use eZ\Publish\Core\FieldType\Image\Value;
use eZ\Publish\Core\Helper\FieldHelper;
use eZ\Publish\Core\Helper\TranslationHelper;
use eZ\Publish\SPI\Variation\VariationHandler;
use Symfony\Component\HttpFoundation\RequestStack;
use eZ\Publish\API\Repository\Exceptions\InvalidVariationException;
use eZ\Publish\Core\MVC\Exception\SourceImageNotFoundException;
use eZ\Publish\SPI\Variation\VariationHandler;
use Netgen\Bundle\OpenGraphBundle\Exception\FieldEmptyException;
use Psr\Log\LoggerInterface;
use Exception;
use Symfony\Component\HttpFoundation\RequestStack;

class Image extends Handler
{
Expand Down
2 changes: 1 addition & 1 deletion Handler/Literal/Text.php
Expand Up @@ -2,9 +2,9 @@

namespace Netgen\Bundle\OpenGraphBundle\Handler\Literal;

use eZ\Publish\Core\Base\Exceptions\InvalidArgumentException;
use Netgen\Bundle\OpenGraphBundle\Handler\HandlerInterface;
use Netgen\Bundle\OpenGraphBundle\MetaTag\Item;
use eZ\Publish\Core\Base\Exceptions\InvalidArgumentException;

class Text implements HandlerInterface
{
Expand Down
6 changes: 3 additions & 3 deletions MetaTag/Collector.php
Expand Up @@ -2,12 +2,12 @@

namespace Netgen\Bundle\OpenGraphBundle\MetaTag;

use eZ\Publish\API\Repository\Values\Content\Content;
use eZ\Publish\API\Repository\ContentTypeService;
use eZ\Publish\API\Repository\Values\Content\Content;
use eZ\Publish\Core\MVC\ConfigResolverInterface;
use Netgen\Bundle\OpenGraphBundle\Handler\Registry;
use Netgen\Bundle\OpenGraphBundle\Handler\ContentAware;
use LogicException;
use Netgen\Bundle\OpenGraphBundle\Handler\ContentAware;
use Netgen\Bundle\OpenGraphBundle\Handler\Registry;

class Collector implements CollectorInterface
{
Expand Down
2 changes: 1 addition & 1 deletion NetgenOpenGraphBundle.php
Expand Up @@ -2,9 +2,9 @@

namespace Netgen\Bundle\OpenGraphBundle;

use Netgen\Bundle\OpenGraphBundle\DependencyInjection\Compiler\MetaTagHandlersCompilerPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Netgen\Bundle\OpenGraphBundle\DependencyInjection\Compiler\MetaTagHandlersCompilerPass;

class NetgenOpenGraphBundle extends Bundle
{
Expand Down
4 changes: 2 additions & 2 deletions Templating/Twig/Extension/NetgenOpenGraphExtension.php
Expand Up @@ -2,13 +2,13 @@

namespace Netgen\Bundle\OpenGraphBundle\Templating\Twig\Extension;

use Exception;
use eZ\Publish\API\Repository\Values\Content\Content;
use Netgen\Bundle\OpenGraphBundle\MetaTag\CollectorInterface;
use Netgen\Bundle\OpenGraphBundle\MetaTag\RendererInterface;
use Psr\Log\LoggerInterface;
use Twig_SimpleFunction;
use Twig_Extension;
use Exception;
use Twig_SimpleFunction;

class NetgenOpenGraphExtension extends Twig_Extension
{
Expand Down
4 changes: 2 additions & 2 deletions Tests/Handler/FieldType/ImageTest.php
Expand Up @@ -4,12 +4,12 @@

use eZ\Bundle\EzPublishCoreBundle\Imagine\AliasGenerator;
use eZ\Publish\API\Repository\Exceptions\InvalidVariationException;
use eZ\Publish\API\Repository\Values\Content\Field;
use eZ\Publish\Core\FieldType\Image\Value;
use eZ\Publish\Core\Helper\FieldHelper;
use eZ\Publish\Core\Helper\TranslationHelper;
use eZ\Publish\Core\MVC\Exception\SourceImageNotFoundException;
use eZ\Publish\Core\Repository\Values\Content\Content;
use eZ\Publish\API\Repository\Values\Content\Field;
use eZ\Publish\Core\FieldType\Image\Value;
use eZ\Publish\Core\Repository\Values\Content\VersionInfo;
use eZ\Publish\SPI\Variation\Values\Variation;
use Netgen\Bundle\OpenGraphBundle\Handler\FieldType\Image;
Expand Down
4 changes: 2 additions & 2 deletions Tests/Handler/FieldType/TextBlockTest.php
Expand Up @@ -2,11 +2,11 @@

namespace Netgen\Bundle\OpenGraphBundle\Tests\Handler\FieldType;

use eZ\Publish\API\Repository\Values\Content\Field;
use eZ\Publish\Core\FieldType\TextBlock\Value;
use eZ\Publish\Core\Helper\FieldHelper;
use eZ\Publish\Core\Helper\TranslationHelper;
use eZ\Publish\Core\Repository\Values\Content\Content;
use eZ\Publish\API\Repository\Values\Content\Field;
use eZ\Publish\Core\FieldType\TextBlock\Value;
use Netgen\Bundle\OpenGraphBundle\Handler\FieldType\TextBlock;
use Netgen\Bundle\OpenGraphBundle\Handler\HandlerInterface;

Expand Down
4 changes: 2 additions & 2 deletions Tests/Handler/FieldType/TextLineTest.php
Expand Up @@ -2,11 +2,11 @@

namespace Netgen\Bundle\OpenGraphBundle\Tests\Handler\FieldType;

use eZ\Publish\API\Repository\Values\Content\Field;
use eZ\Publish\Core\FieldType\TextLine\Value;
use eZ\Publish\Core\Helper\FieldHelper;
use eZ\Publish\Core\Helper\TranslationHelper;
use eZ\Publish\Core\Repository\Values\Content\Content;
use eZ\Publish\API\Repository\Values\Content\Field;
use eZ\Publish\Core\FieldType\TextLine\Value;
use Netgen\Bundle\OpenGraphBundle\Handler\FieldType\TextLine;
use Netgen\Bundle\OpenGraphBundle\Handler\HandlerInterface;

Expand Down
4 changes: 2 additions & 2 deletions Tests/Handler/FieldType/XmlTextTest.php
Expand Up @@ -2,11 +2,11 @@

namespace Netgen\Bundle\OpenGraphBundle\Tests\Handler\FieldType;

use eZ\Publish\API\Repository\Values\Content\Field;
use eZ\Publish\Core\FieldType\XmlText\Value;
use eZ\Publish\Core\Helper\FieldHelper;
use eZ\Publish\Core\Helper\TranslationHelper;
use eZ\Publish\Core\Repository\Values\Content\Content;
use eZ\Publish\API\Repository\Values\Content\Field;
use eZ\Publish\Core\FieldType\XmlText\Value;
use Netgen\Bundle\OpenGraphBundle\Handler\FieldType\XmlText;
use Netgen\Bundle\OpenGraphBundle\Handler\HandlerInterface;

Expand Down
2 changes: 1 addition & 1 deletion Tests/Handler/Literal/TextTest.php
Expand Up @@ -36,7 +36,7 @@ public function testGettingTagsWithValidResult()
{
$result = $this->text->getMetaTags('some_tag', array('some_param'));

$this->assertTrue(is_array($result));
$this->assertInternalType('array', $result);
$this->assertInstanceOf(Item::class, $result[0]);
$this->assertEquals('some_tag', $result[0]->getTagName());
$this->assertEquals('some_param', $result[0]->getTagValue());
Expand Down

0 comments on commit c9c7d70

Please sign in to comment.