Skip to content

Commit

Permalink
Added php-cs-fixer settings (closes #22)
Browse files Browse the repository at this point in the history
  • Loading branch information
chregu committed Apr 9, 2018
1 parent f44cee8 commit 873107e
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 95 deletions.
1 change: 1 addition & 0 deletions .gitattributes
@@ -1,4 +1,5 @@
/tests export-ignore
/.styleci.yml export-ignore
/.travis.yml export-ignore
/.php_cs.dist export-ignore
/phpunit.xml.dist export-ignore
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -10,3 +10,4 @@
# PHP Storm
/.idea
/sami-output
/.php_cs.cache
26 changes: 26 additions & 0 deletions .php_cs.dist
@@ -0,0 +1,26 @@
<?php

return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'array_syntax' => array('syntax' => 'short'),
'combine_consecutive_unsets' => true,
'heredoc_to_nowdoc' => true,
'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'],
'no_unreachable_default_argument_value' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => true,
'ordered_imports' => true,
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_order' => true,
'psr4' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('vendor')
->in(__DIR__)
)
;
9 changes: 9 additions & 0 deletions README.md
Expand Up @@ -61,3 +61,12 @@ See als the [API Docs](https://rokka.io/client-php-api/master/) for further info
## Running tests

Run `vendor/bin/phpunit` in the project root.

## Running PHP-CS-Fixer

```
curl http://cs.sensiolabs.org/download/php-cs-fixer-v2.phar > /tmp/php-cs-fixer.phar
php /tmp/php-cs-fixer.phar fix -v --diff --using-cache=yes src/
```

```
14 changes: 7 additions & 7 deletions src/Base.php
Expand Up @@ -19,18 +19,18 @@ abstract class Base

const API_VERSION_HEADER = 'Api-Version';

/**
* @var int
*/
private $apiVersion = self::DEFAULT_API_VERSION;

/**
* Client to access Rokka.
*
* @var ClientInterface
*/
protected $client;

/**
* @var int
*/
private $apiVersion = self::DEFAULT_API_VERSION;

/**
* Rokka credentials.
*
Expand Down Expand Up @@ -68,9 +68,9 @@ public function setCredentials($key)
* @param array $options Request options
* @param bool $needsCredentials True if credentials are needed
*
* @return ResponseInterface
*
* @throws GuzzleException
*
* @return ResponseInterface
*/
protected function call($method, $path, array $options = [], $needsCredentials = true)
{
Expand Down
8 changes: 4 additions & 4 deletions src/Core/Stack.php
Expand Up @@ -13,14 +13,14 @@ class Stack extends StackAbstract
public $organization;

/**
* @var \DateTime|null When this stack was first created
* @var StackExpression[]
*/
private $created;
protected $stackExpressions = [];

/**
* @var StackExpression[]
* @var \DateTime|null When this stack was first created
*/
protected $stackExpressions = [];
private $created;

/**
* Constructor.
Expand Down
2 changes: 2 additions & 0 deletions src/Core/UriComponents.php
Expand Up @@ -53,6 +53,8 @@ public function __construct($stack, $hash = null, $format = null, $filename = nu
* Creates a UriComponent object from an array with 'stack', 'hash', 'format', 'filename' and 'stack' as keys.
*
* @since 1.2.0
*
* @param mixed $config
*/
public static function createFromArray($config)
{
Expand Down

0 comments on commit 873107e

Please sign in to comment.