Skip to content

Commit

Permalink
Update to php-cs-fixer v2.
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
  • Loading branch information
crynobone committed Oct 14, 2017
1 parent 6c0d1df commit 5cd4731
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 67 deletions.
76 changes: 20 additions & 56 deletions .php_cs
@@ -1,59 +1,23 @@
<?php

$finder = Symfony\Component\Finder\Finder::create()
->files()
->in(__DIR__.'/src')
->in(__DIR__.'/resources/config')
->ignoreDotFiles(true)
->ignoreVCS(true);
$finder = PhpCsFixer\Finder::create()
->in(__DIR__.'/resources')
->in(__DIR__.'/src')
->in(__DIR__.'/tests');

return Symfony\CS\Config\Config::create()
->setUsingCache(true)
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
->fixers([
'-psr0',
'align_double_arrow',
'align_equals',
'blankline_after_open_tag',
'concat_without_spaces',
'double_arrow_multiline_whitespaces',
'duplicate_semicolon',
'empty_return',
'extra_empty_lines',
'include',
'join_function',
'multiline_array_trailing_comma',
'multiline_spaces_before_semicolon',
'new_with_braces',
'no_blank_lines_after_class_opening',
'no_empty_lines_after_phpdocs',
'object_operator',
'operators_spaces',
'phpdoc_indent',
'phpdoc_inline_tag',
'phpdoc_no_access',
'-phpdoc_no_empty_return',
'phpdoc_no_package',
'-phpdoc_params',
'phpdoc_scalar',
'phpdoc_separation',
'phpdoc_short_description',
'phpdoc_to_comment',
'phpdoc_trim',
'phpdoc_type_to_var',
'phpdoc_var_without_name',
'remove_leading_slash_use',
'remove_lines_between_uses',
'short_array_syntax',
'single_array_no_trailing_comma',
'single_blank_line_before_namespace',
'single_quote',
'spaces_cast',
'standardize_not_equal',
'ternary_spaces',
'trim_array_spaces',
'unused_use',
'whitespacy_lines',
'visibility',
])
->finder($finder);
return PhpCsFixer\Config::create()
->setRiskyAllowed(false)
->setRules([
'@Symfony' => true,
'binary_operator_spaces' => ['align_double_arrow' => false, 'align_equals' => false],
'no_empty_comment' => false,
'no_extra_consecutive_blank_lines' => false,
'not_operator_with_successor_space' => true,
'ordered_imports' => ['sortAlgorithm' => 'length'],
'phpdoc_align' => false,
'phpdoc_no_empty_return' => false,
'phpdoc_order' => true,
'pre_increment' => false,
'yoda_style' => false,
])
->setFinder($finder);
6 changes: 3 additions & 3 deletions src/Jobs/CreateThumbnail.php
Expand Up @@ -31,9 +31,9 @@ protected function getDefaultOptions()
{
return [
'dimension' => 200,
'filter' => ImageInterface::FILTER_UNDEFINED,
'format' => '{filename}.thumb.{extension}',
'mode' => ImageInterface::THUMBNAIL_OUTBOUND,
'filter' => ImageInterface::FILTER_UNDEFINED,
'format' => '{filename}.thumb.{extension}',
'mode' => ImageInterface::THUMBNAIL_OUTBOUND,
];
}
}
2 changes: 1 addition & 1 deletion src/Jobs/Generator.php
Expand Up @@ -38,7 +38,7 @@ public function handle(ImagineInterface $imagine)
$data = $this->getFilteredOptions($this->options);
$path = rtrim($data['path'], '/');

$source = Str::replace('{filename}.{extension}', $data);
$source = Str::replace('{filename}.{extension}', $data);
$destination = Str::replace($data['format'], $data);

$this->handleImageManipulation($imagine->open("{$path}/{$source}"), $data)
Expand Down
12 changes: 6 additions & 6 deletions src/Jobs/ResizeImage.php
Expand Up @@ -17,7 +17,7 @@ class ResizeImage extends Generator
*/
protected function handleImageManipulation(ImageInterface $image, array $data)
{
$width = $data['width'];
$width = $data['width'];
$height = $data['height'];

if (isset($data['dimension'])) {
Expand All @@ -36,11 +36,11 @@ protected function getDefaultOptions()
{
return [
'dimension' => null,
'filter' => ImageInterface::FILTER_UNDEFINED,
'format' => '{filename}.{width}x{height}.{extension}',
'name' => null,
'width' => 320,
'height' => 320,
'filter' => ImageInterface::FILTER_UNDEFINED,
'format' => '{filename}.{width}x{height}.{extension}',
'name' => null,
'width' => 320,
'height' => 320,
];
}
}
4 changes: 3 additions & 1 deletion tests/ImagineServiceProviderTest.php
@@ -1,4 +1,6 @@
<?php namespace Orchestra\Imagine\TestCase;
<?php

namespace Orchestra\Imagine\TestCase;

use Mockery as m;
use PHPUnit\Framework\TestCase;
Expand Down

0 comments on commit 5cd4731

Please sign in to comment.