Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

Commit

Permalink
Fixed CS
Browse files Browse the repository at this point in the history
  • Loading branch information
stof committed Nov 25, 2013
1 parent 818b599 commit 97a07a8
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 57 deletions.
2 changes: 1 addition & 1 deletion Command/DumpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected function execute(InputInterface $input, OutputInterface $stdout)
);

$self = $this;
$batch->execute(function($name) use($self, $stdout) {
$batch->execute(function ($name) use ($self, $stdout) {
$self->dumpAsset($name, $stdout);
});
} else {
Expand Down
1 change: 0 additions & 1 deletion DependencyInjection/Compiler/FilterManagerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

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

/**
* Adds services tagged as filters to the filter manager.
Expand Down
21 changes: 10 additions & 11 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ public function getConfigTreeBuilder()
->end()
->scalarNode('read_from')->defaultValue('%kernel.root_dir%/../web')->end()
->scalarNode('write_to')->defaultValue('%assetic.read_from%')->end()
->scalarNode('java')->defaultValue(function() use($finder) { return $finder->find('java', '/usr/bin/java'); })->end()
->scalarNode('node')->defaultValue(function() use($finder) { return $finder->find('node', '/usr/bin/node'); })->end()
->scalarNode('java')->defaultValue(function () use ($finder) { return $finder->find('java', '/usr/bin/java'); })->end()
->scalarNode('node')->defaultValue(function () use ($finder) { return $finder->find('node', '/usr/bin/node'); })->end()
->arrayNode('node_paths')
->prototype('scalar')->end()
->end()
->scalarNode('ruby')->defaultValue(function() use($finder) { return $finder->find('ruby', '/usr/bin/ruby'); })->end()
->scalarNode('sass')->defaultValue(function() use($finder) { return $finder->find('sass', '/usr/bin/sass'); })->end()
->scalarNode('ruby')->defaultValue(function () use ($finder) { return $finder->find('ruby', '/usr/bin/ruby'); })->end()
->scalarNode('sass')->defaultValue(function () use ($finder) { return $finder->find('sass', '/usr/bin/sass'); })->end()
->end()
;

Expand Down Expand Up @@ -128,13 +128,12 @@ private function addAssetsSection(ArrayNodeDefinition $rootNode)
->prototype('array')
->beforeNormalization()
// a scalar is a simple formula of one input file
->ifTrue(function($v) { return !is_array($v); })
->then(function($v) { return array('inputs' => array($v)); })
->ifTrue(function ($v) { return !is_array($v); })
->then(function ($v) { return array('inputs' => array($v)); })
->end()
->beforeNormalization()
->always()
->then(function($v)
{
->then(function ($v) {
// cast scalars as array
foreach (array('input', 'inputs', 'filter', 'filters') as $key) {
if (isset($v[$key]) && !is_array($v[$key])) {
Expand Down Expand Up @@ -186,12 +185,12 @@ private function addFiltersSection(ArrayNodeDefinition $rootNode, ExecutableFind
->prototype('variable')
->treatNullLike(array())
->validate()
->ifTrue(function($v) { return !is_array($v); })
->ifTrue(function ($v) { return !is_array($v); })
->thenInvalid('The assetic.filters config %s must be either null or an array.')
->end()
->end()
->validate()
->always(function($v) use ($finder) {
->always(function ($v) use ($finder) {
if (isset($v['compass']) && !isset($v['compass']['bin'])) {
$v['compass']['bin'] = $finder->find('compass', '/usr/bin/compass');
}
Expand Down Expand Up @@ -240,7 +239,7 @@ private function addTwigSection(ArrayNodeDefinition $rootNode)
->prototype('variable')
->treatNullLike(array())
->validate()
->ifTrue(function($v) { return !is_array($v); })
->ifTrue(function ($v) { return !is_array($v); })
->thenInvalid('The assetic.twig.functions config %s must be either null or an array.')
->end()
->end()
Expand Down
3 changes: 2 additions & 1 deletion DependencyInjection/DirectoryResourceDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function __construct($bundle, $engine, array $dirs)
if (1 == count($dirs)) {
// no need to coalesce
self::configureDefinition($this, $bundle, $engine, reset($dirs));

return;
}

Expand All @@ -61,7 +62,7 @@ public function __construct($bundle, $engine, array $dirs)
;
}

static private function configureDefinition(Definition $definition, $bundle, $engine, $dir)
private static function configureDefinition(Definition $definition, $bundle, $engine, $dir)
{
$definition
->setClass('%assetic.directory_resource.class%')
Expand Down
2 changes: 1 addition & 1 deletion Factory/Resource/FileResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected function getTemplate()
return $this->template;
}

static private function createTemplateReference($bundle, $file)
private static function createTemplateReference($bundle, $file)
{
$parts = explode('/', strtr($file, '\\', '/'));
$elements = explode('.', array_pop($parts));
Expand Down
2 changes: 1 addition & 1 deletion Resources/config/controller.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<argument type="service" id="assetic.cache" />
<argument>%assetic.enable_profiler%</argument>
<argument type="service" id="profiler" on-invalid="null" />

<call method="setValueSupplier">
<argument type="service" id="assetic.value_supplier" on-invalid="ignore" />
</call>
Expand Down
60 changes: 30 additions & 30 deletions Resources/config/filters/uglifycss.xml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<parameters>
<parameter key="assetic.filter.uglifycss.class">Assetic\Filter\UglifyCssFilter</parameter>
<parameter key="assetic.filter.uglifycss.bin">/usr/bin/uglifycss</parameter>
<parameter key="assetic.filter.uglifycss.node">%assetic.node.bin%</parameter>
<parameter key="assetic.filter.uglifycss.timeout">null</parameter>
<parameter key="assetic.filter.uglifycss.node_paths">%assetic.node.paths%</parameter>
<parameter key="assetic.filter.uglifycss.expand_vars">false</parameter>
<parameter key="assetic.filter.uglifycss.ugly_comments">false</parameter>
<parameter key="assetic.filter.uglifycss.cute_comments">false</parameter>
</parameters>

<services>
<service id="assetic.filter.uglifycss" class="%assetic.filter.uglifycss.class%">
<tag name="assetic.filter" alias="uglifycss" />
<argument>%assetic.filter.uglifycss.bin%</argument>
<argument>%assetic.filter.uglifycss.node%</argument>
<call method="setTimeout"><argument>%assetic.filter.uglifycss.timeout%</argument></call>
<call method="setNodePaths"><argument>%assetic.filter.uglifycss.node_paths%</argument></call>
<call method="setExpandVars"><argument>%assetic.filter.uglifycss.expand_vars%</argument></call>
<call method="setUglyComments"><argument>%assetic.filter.uglifycss.ugly_comments%</argument></call>
<call method="setCuteComments"><argument>%assetic.filter.uglifycss.cute_comments%</argument></call>
</service>
</services>
</container>
<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<parameters>
<parameter key="assetic.filter.uglifycss.class">Assetic\Filter\UglifyCssFilter</parameter>
<parameter key="assetic.filter.uglifycss.bin">/usr/bin/uglifycss</parameter>
<parameter key="assetic.filter.uglifycss.node">%assetic.node.bin%</parameter>
<parameter key="assetic.filter.uglifycss.timeout">null</parameter>
<parameter key="assetic.filter.uglifycss.node_paths">%assetic.node.paths%</parameter>
<parameter key="assetic.filter.uglifycss.expand_vars">false</parameter>
<parameter key="assetic.filter.uglifycss.ugly_comments">false</parameter>
<parameter key="assetic.filter.uglifycss.cute_comments">false</parameter>
</parameters>

<services>
<service id="assetic.filter.uglifycss" class="%assetic.filter.uglifycss.class%">
<tag name="assetic.filter" alias="uglifycss" />
<argument>%assetic.filter.uglifycss.bin%</argument>
<argument>%assetic.filter.uglifycss.node%</argument>
<call method="setTimeout"><argument>%assetic.filter.uglifycss.timeout%</argument></call>
<call method="setNodePaths"><argument>%assetic.filter.uglifycss.node_paths%</argument></call>
<call method="setExpandVars"><argument>%assetic.filter.uglifycss.expand_vars%</argument></call>
<call method="setUglyComments"><argument>%assetic.filter.uglifycss.ugly_comments%</argument></call>
<call method="setCuteComments"><argument>%assetic.filter.uglifycss.cute_comments%</argument></call>
</service>
</services>
</container>
1 change: 0 additions & 1 deletion Routing/AsseticLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Assetic\Factory\LazyAssetManager;
use Symfony\Bundle\AsseticBundle\Config\AsseticResource;
use Symfony\Component\Config\Loader\Loader;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;

Expand Down
3 changes: 1 addition & 2 deletions Templating/AsseticHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ public function image($inputs = array(), $filters = array(), array $options = ar
*/
private function getAssetUrls($inputs = array(), $filters = array(), array $options = array())
{
$explode = function($value)
{
$explode = function ($value) {
return array_map('trim', explode(',', $value));
};

Expand Down
4 changes: 2 additions & 2 deletions Tests/Command/DumpCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ protected function setUp()
$writeTo = $this->writeTo;
$this->container->expects($this->any())
->method('getParameter')
->will($this->returnCallback(function($p) use($writeTo) {
->will($this->returnCallback(function ($p) use ($writeTo) {
if ('assetic.write_to' === $p) {
return $writeTo;
} else if ('assetic.variables' === $p) {
} elseif ('assetic.variables' === $p) {
return array();
}

Expand Down
2 changes: 1 addition & 1 deletion Tests/DependencyInjection/AsseticExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class AsseticExtensionTest extends \PHPUnit_Framework_TestCase
private $kernel;
private $container;

static public function assertSaneContainer(Container $container, $message = '')
public static function assertSaneContainer(Container $container, $message = '')
{
$errors = array();
foreach ($container->getServiceIds() as $id) {
Expand Down
4 changes: 2 additions & 2 deletions Tests/Factory/AssetFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function testBundleNotation()

$this->parameterBag->expects($this->once())
->method('resolveValue')
->will($this->returnCallback(function($v) { return $v; }));
->will($this->returnCallback(function ($v) { return $v; }));
$this->kernel->expects($this->once())
->method('getBundle')
->with('MyBundle')
Expand Down Expand Up @@ -67,7 +67,7 @@ public function testBundleGlobNotation($input)

$this->parameterBag->expects($this->once())
->method('resolveValue')
->will($this->returnCallback(function($v) { return $v; }));
->will($this->returnCallback(function ($v) { return $v; }));
$this->kernel->expects($this->once())
->method('getBundle')
->with('MyBundle')
Expand Down
2 changes: 0 additions & 2 deletions Tests/Templating/AsseticHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

namespace Symfony\Bundle\AsseticBundle\Tests\Templating;

use Assetic\Asset\AssetCollection;
use Assetic\Asset\AssetInterface;
use Assetic\Asset\StringAsset;
use Assetic\Factory\AssetFactory;
use Symfony\Bundle\AsseticBundle\Templating\AsseticHelper;

Expand Down
2 changes: 1 addition & 1 deletion Twig/AsseticNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected function compileAssetUrl(\Twig_Compiler $compiler, AssetInterface $ass
$vars = array();
foreach ($asset->getVars() as $var) {
$vars[] = new \Twig_Node_Expression_Constant($var, $this->getLine());

// Retrieves values of assetic vars from the context, $context['assetic']['vars'][$var].
$vars[] = new \Twig_Node_Expression_GetAttr(
new \Twig_Node_Expression_GetAttr(
Expand Down

0 comments on commit 97a07a8

Please sign in to comment.