Skip to content
Permalink
Browse files

Ran php-cs-fixer

  • Loading branch information...
Kévin Gomez
Kévin Gomez committed Feb 6, 2018
1 parent 7ce9754 commit a8331be1c01eb92c89e5261e1798c5c0ec36bdd1
53 .php_cs
@@ -1,20 +1,41 @@
<?php
return Symfony\CS\Config\Config::create()
->setUsingCache(true)
->level(Symfony\CS\FixerInterface::CONTRIB_LEVEL)
->fixers([
'-pre_increment',
'-empty_return',
'-align_double_arrow',
'-align_equals',
'-logical_not_operators_with_spaces',
'-logical_not_operators_with_successor_space',
'-ordered_use',
'-phpdoc_var_to_type',
declare(strict_types=1);
$finder = PhpCsFixer\Finder::create()
->in(__DIR__.'/src')
;
return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
'@PHP71Migration' => true,
'@PHP71Migration:risky' => true,
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_annotation_without_dot' => false,
'php_unit_strict' => true,
'no_useless_else' => true,
'no_short_echo_tag' => true,
'no_null_property_initialization' => true,
'no_php4_constructor' => true,
'no_unreachable_default_argument_value' => true,
'combine_consecutive_issets' => true,
'strict_comparison' => true,
'declare_strict_types' => true,
'dir_constant' => true,
'array_syntax' => ['syntax' => 'short'],
'strict_param' => true,
'phpdoc_align' => false,
'concat_space' => false,
'phpdoc_summary' => false,
'linebreak_after_opening_tag' => true,
'phpdoc_separation' => false,
'self_accessor' => false,
'yoda_style' => false,
'increment_style' => ['style' => 'post'],
])
->finder(
Symfony\CS\Finder\DefaultFinder::create()
->in(__DIR__)
)
->setRiskyAllowed(true)
->setFinder($finder)
;
@@ -18,7 +18,8 @@
},
"require-dev": {
"phpunit/phpunit": "^6.5",
"symfony/routing": "^3.0|^4.0"
"symfony/routing": "^3.0|^4.0",
"friendsofphp/php-cs-fixer": "^2.10"
},
"autoload": {
"psr-4": { "SitemapGenerator\\": "src/" }
@@ -40,7 +40,7 @@ public function getFilename(): string
/**
* {@inheritdoc}
*/
public function dump(string $string)
public function dump(string $string): void
{
if ($this->handle === null) {
$this->openFile();
@@ -8,11 +8,11 @@ final class ChangeFrequency
{
public const ALWAYS = 'always';
public const HOURLY = 'hourly';
public const DAILY = 'daily';
public const DAILY = 'daily';
public const WEEKLY = 'weekly';
public const MONTHLY = 'monthly';
public const YEARLY = 'yearly';
public const NEVER = 'never';
public const NEVER = 'never';
public const KNOWN_FREQUENCIES = [
self::ALWAYS, self::HOURLY, self::DAILY,
@@ -47,7 +47,7 @@ public function getLoc(): string
return $this->loc;
}
public function setCaption(?string $caption)
public function setCaption(?string $caption): void
{
$this->caption = $caption;
}
@@ -57,7 +57,7 @@ public function getCaption(): ?string
return $this->caption;
}
public function setGeoLocation(?string $geoLocation)
public function setGeoLocation(?string $geoLocation): void
{
$this->geoLocation = $geoLocation;
}
@@ -67,7 +67,7 @@ public function getGeoLocation(): ?string
return $this->geoLocation;
}
public function setTitle(?string $title)
public function setTitle(?string $title): void
{
$this->title = $title;
}
@@ -77,7 +77,7 @@ public function getTitle(): ?string
return $this->title;
}
public function setLicense(?string $license)
public function setLicense(?string $license): void
{
$this->license = $license;
}
@@ -67,7 +67,7 @@ public function getLoc(): string
return $this->loc;
}
public function setLastmod(\DateTimeInterface $lastmod)
public function setLastmod(\DateTimeInterface $lastmod): void
{
$this->lastmod = $lastmod;
}
@@ -85,7 +85,7 @@ public function getLastmod(): ?string
return $this->lastmod->format('Y-m-d');
}
public function setChangeFreq(string $changeFreq)
public function setChangeFreq(string $changeFreq): void
{
if ($changeFreq !== null && !ChangeFrequency::isValid($changeFreq)) {
throw new \DomainException(sprintf('Invalid changefreq given ("%s"). Valid values are: %s', $changeFreq, implode(', ', ChangeFrequency::KNOWN_FREQUENCIES)));
@@ -99,7 +99,7 @@ public function getChangeFreq(): ?string
return $this->changeFreq;
}
public function setPriority(float $priority)
public function setPriority(float $priority): void
{
if ($priority < 0 || $priority > 1) {
throw new \DomainException('The priority must be between 0 and 1');
@@ -121,7 +121,7 @@ public function addVideo(Video $video): void
/**
* @param Video[] $videos
*/
public function setVideos(iterable $videos)
public function setVideos(iterable $videos): void
{
$this->videos = $videos;
}
@@ -185,7 +185,7 @@ public function getDescription(): string
return $this->description;
}
public function setContentLoc(string $loc)
public function setContentLoc(string $loc): void
{
$this->contentLoc = $loc;
}
@@ -10,7 +10,7 @@
final class Spaceless implements SitemapIndexFormatter
{
protected $formatter;
private $formatter;
public function __construct(SitemapFormatter $formatter)
{
@@ -59,7 +59,7 @@ public function formatSitemapIndex(Entity\SitemapIndexEntry $entry): string
return $this->stripSpaces($this->formatter->formatSitemapIndex($entry));
}
protected function stripSpaces($string): string
private function stripSpaces($string): string
{
return str_replace(["\t", "\r", "\n"], '', $string);
}
@@ -5,7 +5,6 @@
namespace SitemapGenerator\Provider;
use Symfony\Component\PropertyAccess\PropertyAccess;
use SitemapGenerator\Entity\Url;
use SitemapGenerator\UrlGenerator;
@@ -15,7 +15,7 @@ final class DefaultValues
/** @var \DateTimeInterface|null */
private $lastmod;
final private function __construct()
private function __construct()
{
}
@@ -4,11 +4,11 @@
namespace SitemapGenerator;
use SitemapGenerator\Entity;
interface SitemapFormatter
{
public function getSitemapStart(): string;
public function getSitemapEnd(): string;
public function formatUrl(Entity\Url $url): string;
}
@@ -56,7 +56,7 @@ public function build(): void
$chunkedProviders = $this->chunk(iter\chain(...$this->providers), $this->limit);
foreach ($chunkedProviders as $i => $provider) {
// Modify the filename of the dumper, add the filename to the sitemap indexes
$entryFilename = $this->getSitemapIndexFilename($this->dumper->getFilename(), $i+1);
$entryFilename = $this->getSitemapIndexFilename($this->dumper->getFilename(), $i + 1);
// dump the entry in the sitemap index
$entry = $this->createIndexEntry($entryFilename);
@@ -93,7 +93,7 @@ private function getSitemapIndexFilename(string $filename, int $index): string
private function chunk(\Iterator $iterable, $size): \Iterator
{
while ($iterable->valid()) {
$closure = function() use ($iterable, $size) {
$closure = function () use ($iterable, $size) {
$count = $size;
while ($count-- && $iterable->valid()) {
@@ -4,11 +4,11 @@
namespace SitemapGenerator;
use SitemapGenerator\Entity;
interface SitemapIndexFormatter extends SitemapFormatter
{
public function getSitemapIndexStart(): string;
public function getSitemapIndexEnd(): string;
public function formatSitemapIndex(Entity\SitemapIndexEntry $entry): string;
}

0 comments on commit a8331be

Please sign in to comment.
You can’t perform that action at this time.