Skip to content

Commit

Permalink
Improve code documentation from "php-cs-fixer"
Browse files Browse the repository at this point in the history
  • Loading branch information
rougin committed Mar 27, 2024
1 parent 6ca29a9 commit b0aad56
Show file tree
Hide file tree
Showing 218 changed files with 1,059 additions and 601 deletions.
43 changes: 39 additions & 4 deletions phpstyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
$rules = array('@PSR12' => true);

$cscp = 'control_structure_continuation_position';
$rules[$cscp] = array('position' => 'next_line');
$rules[$cscp] = ['position' => 'next_line'];

$braces = array();
$braces['control_structures_opening_brace'] = 'next_line_unless_newline_at_signature_end';
Expand All @@ -18,14 +18,49 @@
$braces['anonymous_classes_opening_brace'] = 'next_line_unless_newline_at_signature_end';
$braces['allow_single_line_empty_anonymous_classes'] = false;
$braces['allow_single_line_anonymous_functions'] = false;

$rules['braces_position'] = $braces;

$rules['new_with_parentheses'] = array('named_class' => false);

$visibility = array('elements' => array());
$visibility['elements'] = array('method', 'property');
$rules['visibility_required'] = $visibility;

$rules['phpdoc_var_annotation_correct_order'] = true;

$rules['single_quote'] = ['strings_containing_single_quote_chars' => true];

$rules['no_unused_imports'] = true;

$rules['align_multiline_comment'] = true;

$rules['trim_array_spaces'] = true;

$order = ['case_sensitive' => true];
$order['null_adjustment'] = 'always_last';
$rules['phpdoc_types_order'] = $order;

$rules['new_with_parentheses'] = ['named_class' => false];

$rules['concat_space'] = ['spacing' => 'one'];

$rules['no_empty_phpdoc'] = true;

$groups = [];
$groups[] = ['deprecated', 'link', 'see', 'since'];
$groups[] = ['property', 'property-read', 'property-write'];
$groups[] = ['method'];
$groups[] = ['author', 'copyright', 'license'];
$groups[] = ['category', 'package', 'subpackage'];
$groups[] = ['param'];
$groups[] = ['return'];
$rules['phpdoc_separation'] = ['groups' => $groups];

$align = ['align' => 'vertical'];
$align['tags'] = ['method', 'param', 'property', 'throws', 'type', 'var'];
$rules['phpdoc_align'] = $align;

$rules['statement_indentation'] = false;

$rules['align_multiline_comment'] = true;
// -----------------------------------------------

$finder = new \PhpCsFixer\Finder;
Expand Down
3 changes: 2 additions & 1 deletion src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
* Application
*
* @package Slytherin
* @author Rougin Gutib <rougingutib@gmail.com>
*
* @author Rougin Gutib <rougingutib@gmail.com>
*/
class Application extends Routing
{
Expand Down
3 changes: 2 additions & 1 deletion src/Application/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
* Application
*
* @package Slytherin
* @author Rougin Gutib <rougingutib@gmail.com>
*
* @author Rougin Gutib <rougingutib@gmail.com>
*/
class Application extends Slytherin
{
Expand Down
3 changes: 2 additions & 1 deletion src/Component/AbstractComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
* Methods used for integrating a component to Slytherin.
*
* @package Slytherin
* @author Rougin Gutib <rougingutib@gmail.com>
*
* @author Rougin Gutib <rougingutib@gmail.com>
*/
abstract class AbstractComponent implements ComponentInterface
{
Expand Down
51 changes: 33 additions & 18 deletions src/Component/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
* Contains all the required components for Slytherin.
*
* @package Slytherin
* @author Rougin Gutib <rougingutib@gmail.com>
*
* @author Rougin Gutib <rougingutib@gmail.com>
*/
class Collection implements ContainerInterface
{
Expand All @@ -37,8 +38,9 @@ public function __construct()
*
* Adds an instance to the container.
*
* @param string $id
* @param object $concrete
* @param string $id
* @param object $concrete
*
* @return self
*/
public function add($id, $concrete)
Expand All @@ -49,7 +51,8 @@ public function add($id, $concrete)
/**
* Returns the specified component.
*
* @param string $id
* @param string $id
*
* @return object
*/
public function get($id)
Expand Down Expand Up @@ -171,7 +174,8 @@ public function getTemplate()
/**
* Checks if a specified component exists.
*
* @param string $id
* @param string $id
*
* @return boolean
*/
public function has($id)
Expand All @@ -182,8 +186,9 @@ public function has($id)
/**
* Sets an instance to the collection.
*
* @param string $id
* @param mixed $concrete
* @param string $id
* @param mixed $concrete
*
* @return self
*/
public function set($id, $concrete = null)
Expand All @@ -196,7 +201,8 @@ public function set($id, $concrete = null)
/**
* Sets the container.
*
* @param \Rougin\Slytherin\Container\ContainerInterface $container
* @param \Rougin\Slytherin\Container\ContainerInterface $container
*
* @return self
*/
public function setContainer(ContainerInterface $container)
Expand All @@ -209,7 +215,8 @@ public function setContainer(ContainerInterface $container)
/**
* Sets the debugger.
*
* @param \Rougin\Slytherin\Debug\ErrorHandlerInterface $debugger
* @param \Rougin\Slytherin\Debug\ErrorHandlerInterface $debugger
*
* @return self
*/
public function setDebugger(ErrorHandlerInterface $debugger)
Expand All @@ -222,7 +229,8 @@ public function setDebugger(ErrorHandlerInterface $debugger)
*
* Sets the dependency injector.
*
* @param \Rougin\Slytherin\Container\ContainerInterface $injector
* @param \Rougin\Slytherin\Container\ContainerInterface $injector
*
* @return self
*/
public function setDependencyInjector(ContainerInterface $injector)
Expand All @@ -233,7 +241,8 @@ public function setDependencyInjector(ContainerInterface $injector)
/**
* Sets the dispatcher.
*
* @param \Rougin\Slytherin\Routing\DispatcherInterface $dispatcher
* @param \Rougin\Slytherin\Routing\DispatcherInterface $dispatcher
*
* @return self
*/
public function setDispatcher(Routing $dispatcher)
Expand All @@ -246,7 +255,8 @@ public function setDispatcher(Routing $dispatcher)
*
* Sets the error handler.
*
* @param \Rougin\Slytherin\Debug\ErrorHandlerInterface $debugger
* @param \Rougin\Slytherin\Debug\ErrorHandlerInterface $debugger
*
* @return self
*/
public function setErrorHandler(ErrorHandlerInterface $debugger)
Expand All @@ -257,8 +267,9 @@ public function setErrorHandler(ErrorHandlerInterface $debugger)
/**
* Sets the HTTP components.
*
* @param \Psr\Http\Message\ServerRequestInterface $request
* @param \Psr\Http\Message\ResponseInterface $response
* @param \Psr\Http\Message\ServerRequestInterface $request
* @param \Psr\Http\Message\ResponseInterface $response
*
* @return self
*/
public function setHttp(ServerRequestInterface $request, ResponseInterface $response)
Expand All @@ -271,7 +282,8 @@ public function setHttp(ServerRequestInterface $request, ResponseInterface $resp
/**
* Sets the HTTP request.
*
* @param \Psr\Http\Message\ServerRequestInterface $request
* @param \Psr\Http\Message\ServerRequestInterface $request
*
* @return self
*/
public function setHttpRequest(ServerRequestInterface $request)
Expand All @@ -284,7 +296,8 @@ public function setHttpRequest(ServerRequestInterface $request)
/**
* Sets the HTTP response.
*
* @param \Psr\Http\Message\ResponseInterface $response
* @param \Psr\Http\Message\ResponseInterface $response
*
* @return self
*/
public function setHttpResponse(ResponseInterface $response)
Expand All @@ -297,7 +310,8 @@ public function setHttpResponse(ResponseInterface $response)
/**
* Sets the middleware.
*
* @param \Rougin\Slytherin\Middleware\DispatcherInterface $middleware
* @param \Rougin\Slytherin\Middleware\DispatcherInterface $middleware
*
* @return self
*/
public function setMiddleware(Middleware $middleware)
Expand All @@ -308,7 +322,8 @@ public function setMiddleware(Middleware $middleware)
/**
* Sets the template.
*
* @param \Rougin\Slytherin\Template\RendererInterface $template
* @param \Rougin\Slytherin\Template\RendererInterface $template
*
* @return self
*/
public function setTemplate(RendererInterface $template)
Expand Down
11 changes: 7 additions & 4 deletions src/Component/Collector.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
* Collects all defined components into a Collection.
*
* @package Slytherin
* @author Rougin Gutib <rougingutib@gmail.com>
*
* @author Rougin Gutib <rougingutib@gmail.com>
*/
class Collector
{
Expand Down Expand Up @@ -40,7 +41,8 @@ public function __construct(array $items = array())
/**
* Creates a new collection.
*
* @param \Rougin\Slytherin\Container\ContainerInterface $container
* @param \Rougin\Slytherin\Container\ContainerInterface $container
*
* @return \Rougin\Slytherin\Component\Collection
*/
public function make(ContainerInterface $container)
Expand Down Expand Up @@ -117,8 +119,9 @@ public function make(ContainerInterface $container)
/**
* Initializes the specified components.
*
* @param \Rougin\Slytherin\Component\ComponentInterface[]|string[] $components
* @param \Rougin\Slytherin\IoC\ContainerInterface $container
* @param \Rougin\Slytherin\Component\ComponentInterface[]|string[] $components
* @param \Rougin\Slytherin\IoC\ContainerInterface $container
*
* @return \Rougin\Slytherin\Component\Collection
*/
public static function get(array $components, ContainerInterface $container = null)
Expand Down
3 changes: 2 additions & 1 deletion src/Component/ComponentInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
* An interface for handling components.
*
* @package Slytherin
* @author Rougin Gutib <rougingutib@gmail.com>
*
* @author Rougin Gutib <rougingutib@gmail.com>
*/
interface ComponentInterface
{
Expand Down
3 changes: 2 additions & 1 deletion src/ComponentCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
* Component Collection
*
* @package Slytherin
* @author Rougin Gutib <rougingutib@gmail.com>
*
* @author Rougin Gutib <rougingutib@gmail.com>
*/
class ComponentCollection extends Components
{
Expand Down
3 changes: 2 additions & 1 deletion src/Components.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
* Component Collection
*
* @package Slytherin
* @author Rougin Gutib <rougingutib@gmail.com>
*
* @author Rougin Gutib <rougingutib@gmail.com>
*/
class Components extends Collection
{
Expand Down
3 changes: 2 additions & 1 deletion src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
* Configuration
*
* @package Slytherin
* @author Rougin Gutib <rougingutib@gmail.com>
*
* @author Rougin Gutib <rougingutib@gmail.com>
*/
class Configuration extends Integration\Configuration
{
Expand Down
26 changes: 16 additions & 10 deletions src/Container/AurynContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
* Daniel Lowrey's Auryn Inversion Of Control (IoC) Dependency Injector.
*
* @package Slytherin
* @author Matthew Turland <me@matthewturland.com>
* @author Rougin Gutib <rougingutib@gmail.com>
*
* @author Matthew Turland <me@matthewturland.com>
* @author Rougin Gutib <rougingutib@gmail.com>
*
* @link https://github.com/rdlowrey/auryn
* @link https://github.com/elazar/auryn-container-interop
Expand Down Expand Up @@ -50,8 +51,9 @@ public function __construct(Injector $injector)
*
* Adds a new instance to the container.
*
* @param string $id
* @param mixed|null $concrete
* @param string $id
* @param mixed|null $concrete
*
* @return self
*/
public function add($id, $concrete = null)
Expand All @@ -62,7 +64,8 @@ public function add($id, $concrete = null)
/**
* Finds an entry of the container by its identifier and returns it.
*
* @param string $id
* @param string $id
*
* @return mixed
*
* @throws \Psr\Container\NotFoundExceptionInterface
Expand All @@ -88,7 +91,8 @@ public function get($id)
/**
* Returns true if the container can return an entry for the given identifier.
*
* @param string $id
* @param string $id
*
* @return boolean
*/
public function has($id)
Expand All @@ -114,8 +118,9 @@ public function has($id)
/**
* Sets a new instance to the container.
*
* @param string $id
* @param mixed $concrete
* @param string $id
* @param mixed $concrete
*
* @return self
*/
public function set($id, $concrete)
Expand All @@ -135,8 +140,9 @@ public function set($id, $concrete)
/**
* Calls methods from the \Auryn\Injector instance.
*
* @param string $method
* @param mixed[] $params
* @param string $method
* @param mixed[] $params
*
* @return mixed
*/
public function __call($method, $params)
Expand Down
Loading

0 comments on commit b0aad56

Please sign in to comment.