Skip to content

Commit

Permalink
enforce coding standard via php-cs-fixer (#335)
Browse files Browse the repository at this point in the history
enforce coding standard via php-cs-fixer
  • Loading branch information
garak committed Aug 15, 2020
1 parent fe1b2f5 commit 9996764
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 16 deletions.
16 changes: 9 additions & 7 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
.gitattributes export-ignore
.gitignore export-ignore
.travis.yml export-ignore
phpunit.xml.dist export-ignore
README.markdown export-ignore
tests export-ignore
doc export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.php_cs export-ignore
.travis.yml export-ignore
CODE_OF_CONDUCT.md export-ignore
phpunit.xml.dist export-ignore
README.markdown export-ignore
tests export-ignore
doc export-ignore
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.*.cache
/phpunit.xml
/vendor/
/composer.lock
Expand Down
23 changes: 23 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
// see https://github.com/FriendsOfPHP/PHP-CS-Fixer

$finder = PhpCsFixer\Finder::create()
->in([__DIR__.'/src', __DIR__.'/tests'])
;

return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
'@PHP71Migration:risky' => true,
'@PHPUnit75Migration:risky' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => true,
'declare_strict_types' => false,
'native_function_invocation' => false,
'no_superfluous_phpdoc_tags' => false,
'phpdoc_summary' => false,
])
->setFinder($finder)
;
2 changes: 1 addition & 1 deletion src/Knp/Menu/ItemInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public function getChild(string $name): ?self;
*
* Provides a fluent interface
*
* @param array $order New order of children.
* @param array $order new order of children
*
* @return ItemInterface
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Knp/Menu/MenuItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ public function reorderChildren(array $order): ItemInterface

foreach ($order as $name) {
if (!isset($this->children[$name])) {
throw new \InvalidArgumentException('Cannot find children named ' . $name);
throw new \InvalidArgumentException('Cannot find children named '.$name);
}

$child = $this->children[$name];
Expand Down
4 changes: 2 additions & 2 deletions src/Knp/Menu/Renderer/ListRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function render(ItemInterface $item, array $options = []): string

protected function renderList(ItemInterface $item, array $attributes, array $options): string
{
/**
/*
* Return an empty string if any of the following are true:
* a) The menu has no children eligible to be displayed
* b) The depth is 0
Expand All @@ -80,7 +80,7 @@ protected function renderList(ItemInterface $item, array $attributes, array $opt
* This method updates the depth for the children.
*
* @param ItemInterface $item
* @param array $options The options to render the item.
* @param array $options the options to render the item
*
* @return string
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Knp/Menu/Renderer/Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected function renderHtmlAttributes(array $attributes): string
* @param string $name The attribute name
* @param string|bool|null $value The attribute value
*
* @return string The HTML representation of the HTML key attribute pair.
* @return string the HTML representation of the HTML key attribute pair
*/
private function htmlAttributesCallback(string $name, $value): string
{
Expand Down
8 changes: 4 additions & 4 deletions src/Knp/Menu/Util/MenuManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class MenuManipulator
* Moves item to specified position. Rearrange siblings accordingly.
*
* @param ItemInterface $item
* @param int $position Position to move child to.
* @param int $position position to move child to
*/
public function moveToPosition(ItemInterface $item, $position): void
{
Expand Down Expand Up @@ -77,8 +77,8 @@ public function moveToLastPosition(ItemInterface $item): void
* the slice is done before this menu.
*
* @param ItemInterface $item
* @param mixed $offset Name of child, child object, or numeric offset.
* @param mixed $length Name of child, child object, or numeric length.
* @param mixed $offset name of child, child object, or numeric offset
* @param mixed $length name of child, child object, or numeric length
*
* @return ItemInterface
*/
Expand Down Expand Up @@ -113,7 +113,7 @@ public function slice(ItemInterface $item, $offset, $length = null)
* Split menu into two distinct menus.
*
* @param ItemInterface $item
* @param mixed $length Name of child, child object, or numeric length.
* @param mixed $length name of child, child object, or numeric length
*
* @return array Array with two menus, with "primary" and "secondary" key
*/
Expand Down

0 comments on commit 9996764

Please sign in to comment.