Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ntr/master/bugfix deletion #14

Merged
merged 7 commits into from
May 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 49 additions & 59 deletions .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,63 +6,53 @@ $finder = PhpCsFixer\Finder::create()
;

return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'single_blank_line_before_namespace' => true,
'function_typehint_space' => true,
'declare_strict_types' => true,
'function_declaration' => true,
'no_spaces_after_function_name' => true,
'no_empty_phpdoc' => true,
'no_empty_comment' => true,
'no_useless_return' => true,
'no_trailing_whitespace' => true,
'no_trailing_whitespace_in_comment' => true,
'no_blank_lines_after_phpdoc' => true,
'ordered_imports' => true,
'phpdoc_add_missing_param_annotation' => [
'only_untyped' => false
],
'phpdoc_no_empty_return' => true,
'phpdoc_order' => true,
'phpdoc_types' => true,
'phpdoc_scalar' => true,
'phpdoc_no_package' => true,
'phpdoc_single_line_var_spacing' => true,
'trailing_comma_in_multiline_array' => true,
'single_quote' => true,
'return_type_declaration' => [
'space_before' => 'none'
],
'method_separation' => true,
'no_blank_lines_after_class_opening' => true,
'phpdoc_return_self_reference' => true,
'phpdoc_trim' => true,
'phpdoc_var_without_name' => true,
'strict_comparison' => true,
'strict_param' => true,
'visibility_required' => true,
'blank_line_before_return' => true,
'cast_spaces' => true,
'class_definition' => array('singleLine' => true),
'no_unused_imports' => true,
'self_accessor' => true,
'whitespace_after_comma_in_array' => true,
'is_null' => true,
'space_after_semicolon' => true,
'semicolon_after_instruction' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_multiline_whitespace_before_semicolons' => true,
'concat_space' => [
'spacing' => 'one'
],
'standardize_not_equals' => true,
'ternary_operator_spaces' => true,
'no_leading_namespace_whitespace' => true,
'dir_constant' => true,
'no_useless_else' => true,
'native_function_casing' => true,
'no_multiline_whitespace_around_double_arrow' => true,
])
->setRules([
'@PSR2' => true,
'@Symfony' => true,

// Fix declare style
'blank_line_after_opening_tag' => false,

// override @Symonfy
'phpdoc_align' => false,
'phpdoc_separation' => false,
'yoda_style' => false,
'phpdoc_summary' => false,
'increment_style' => false,
'php_unit_fqcn_annotation' => false,

'array_syntax' => [
'syntax' => 'short'
],
'class_definition' => [
'single_line' => true
],
'comment_to_phpdoc' => true,
'concat_space' => [
'spacing' => 'one'
],
'declare_strict_types' => true,
'dir_constant' => true,
'is_null' => true,
'no_null_property_initialization' => true,
'no_superfluous_phpdoc_tags' => true,
'no_useless_return' => true,
'no_useless_else' => true,
'multiline_whitespace_before_semicolons' => true,
'mb_str_functions' => true,
'ordered_class_elements' => false,
'ordered_imports' => true,
'php_unit_ordered_covers' => true,
'php_unit_namespaced' => true,
'php_unit_construct' => true,
'phpdoc_add_missing_param_annotation' => [
'only_untyped' => true
],
'phpdoc_order' => true,
'phpdoc_var_annotation_correct_order' => true,
'strict_comparison' => true,
'strict_param' => true,
])
->setRiskyAllowed(true)
->setFinder($finder);
->setUsingCache(false)
->setFinder($finder);
Binary file modified php-cs-fixer
Binary file not shown.
18 changes: 0 additions & 18 deletions src/NestedSetConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ class NestedSetConfig
*/
private $primaryKeyColumnName;

/**
* @param string $primaryKeyColumnName
* @param string $leftColumnName
* @param string $rightColumnName
* @param string $levelColumnName
*/
public function __construct(
string $primaryKeyColumnName,
string $leftColumnName,
Expand All @@ -42,33 +36,21 @@ public function __construct(
$this->levelColumnName = $levelColumnName;
}

/**
* @return string
*/
public function getPrimaryKeyColumnName(): string
{
return $this->primaryKeyColumnName;
}

/**
* @return string
*/
public function getLeftColumnName(): string
{
return $this->leftColumnName;
}

/**
* @return string
*/
public function getRightColumnName(): string
{
return $this->rightColumnName;
}

/**
* @return string
*/
public function getLevelColumnName(): string
{
return $this->levelColumnName;
Expand Down
31 changes: 0 additions & 31 deletions src/NestedSetFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,67 +9,36 @@

class NestedSetFactory
{
/**
* @param Connection $connection
* @param NestedSetConfig $config
* @return NestedSetTableFactory
*/
public static function createTableFactory(Connection $connection, NestedSetConfig $config): NestedSetTableFactory
{
return new NestedSetTableFactory($connection, $config);
}

/**
* @param Connection $connection
* @param NestedSetConfig $config
* @return NestedSetWriter
*/
public static function createWriter(Connection $connection, NestedSetConfig $config): NestedSetWriter
{
return new NestedSetWriter($connection, self::createReader($connection, $config), self::createArrayNodeInspector(), $config);
}

/**
* @param Connection $connection
* @param NestedSetConfig $config
* @return NestedSetQueryFactory
*/
public static function createQueryFactory(Connection $connection, NestedSetConfig $config): NestedSetQueryFactory
{
return new NestedSetQueryFactory($connection, self::createReader($connection, $config), $config);
}

/**
* @param Connection $connection
* @param NestedSetConfig $config
* @return NestedSetTableNodeInspector
*/
public static function createTableNodeInspector(Connection $connection, NestedSetConfig $config): NestedSetTableNodeInspector
{
return new NestedSetTableNodeInspector(self::createArrayNodeInspector(), self::createReader($connection, $config));
}

/**
* @param Connection $connection
* @param NestedSetConfig $config
* @return NestedSetReader
*/
private static function createReader(Connection $connection, NestedSetConfig $config): NestedSetReader
{
return new NestedSetReader($connection, $config);
}

/**
* @return NestedSetNodeInspector
*/
private static function createNodeInspector(): NestedSetNodeInspector
{
return new NestedSetNodeInspector();
}

/**
* @return NestedSetArrayNodeInspector
*/
private static function createArrayNodeInspector(): NestedSetArrayNodeInspector
{
return new NestedSetArrayNodeInspector(self::createNodeInspector());
Expand Down
69 changes: 0 additions & 69 deletions src/NestedSetQueryFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ class NestedSetQueryFactory
*/
private $reader;

/**
* @param Connection $connection
* @param NestedSetConfig $conventionsConfig
* @param NestedSetReader $reader
*/
public function __construct(Connection $connection, NestedSetReader $reader, NestedSetConfig $conventionsConfig)
{
$this->connection = $connection;
Expand All @@ -35,10 +30,6 @@ public function __construct(Connection $connection, NestedSetReader $reader, Nes

/**
* Get all roots from a multi root nested set table
*
* @param string $tableExpression
* @param string $queryAlias
* @return QueryBuilder
*/
public function createFetchRootsQueryBuilder(string $tableExpression, string $queryAlias): QueryBuilder
{
Expand All @@ -51,12 +42,6 @@ public function createFetchRootsQueryBuilder(string $tableExpression, string $qu

/**
* Get all direct children of a particular node
*
* @param string $tableExpression
* @param string $queryAlias
* @param string $rootColumnName
* @param int $parentId
* @return QueryBuilder
*/
public function createChildrenQueryBuilder(
string $tableExpression,
Expand All @@ -82,12 +67,6 @@ public function createChildrenQueryBuilder(

/**
* Select a parent and all it's children
*
* @param string $tableExpression
* @param string $queryAlias
* @param string $rootColumnName
* @param int $parentId
* @return QueryBuilder
*/
public function createParentAndChildrenQueryBuilder(
string $tableExpression,
Expand All @@ -113,12 +92,6 @@ public function createParentAndChildrenQueryBuilder(

/**
* Get the subtree relative to a single node
*
* @param string $tableExpression
* @param string $queryAlias
* @param string $rootColumnName
* @param int $parentId
* @return QueryBuilder
*/
public function createSubtreeQueryBuilder(
string $tableExpression,
Expand All @@ -142,12 +115,6 @@ public function createSubtreeQueryBuilder(

/**
* Get the parents of a particular node
*
* @param string $tableExpression
* @param string $queryAlias
* @param string $rootColumnName
* @param int $nodeId
* @return QueryBuilder
*/
public function createParentsQueryBuilder(
string $tableExpression,
Expand All @@ -172,13 +139,7 @@ public function createParentsQueryBuilder(
/**
* Get the whole subtree relative to a collection of nodes ids
*
* @param string $tableExpression
* @param string $queryAlias
* @param string $rootColumnName
* @param int[] $nodeIds
* @param int $minChildLevel
* @param int $pkType
* @return QueryBuilder
*/
public function createSubtreeThroughMultipleNodesQueryBuilder(
string $tableExpression,
Expand Down Expand Up @@ -216,11 +177,6 @@ public function createSubtreeThroughMultipleNodesQueryBuilder(
->setParameter("{$queryAlias}maxChildLevel", $minChildLevel);
}

/**
* @param string $tableExpression
* @param string $queryAlias
* @return QueryBuilder
*/
private function createDirectNodeSubselectQuery(string $tableExpression, string $queryAlias): QueryBuilder
{
return $this->connection->createQueryBuilder()
Expand All @@ -235,12 +191,6 @@ private function createDirectNodeSubselectQuery(string $tableExpression, string
->andWhere("{$queryAlias}directNode.{$this->pkCol} IN (:{$queryAlias}nodeIds)");
}

/**
* @param string $tableExpression
* @param string $queryAlias
* @param QueryBuilder $directNodeSubSelect
* @return QueryBuilder
*/
private function createParentAndSiblingChainSubselectQuery(
string $tableExpression,
string $queryAlias,
Expand Down Expand Up @@ -278,12 +228,6 @@ private function createParentAndSiblingChainSubselectQuery(
);
}

/**
* @param string $tableExpression
* @param string $queryAlias
* @param QueryBuilder $directNodeSubSelect
* @return QueryBuilder
*/
private function createChildrenSubselectQuery(
string $tableExpression,
string $queryAlias,
Expand Down Expand Up @@ -311,12 +255,6 @@ private function createChildrenSubselectQuery(
);
}

/**
* @param string $tableExpression
* @param string $queryAlias
* @param QueryBuilder $directNodeSubSelect
* @return QueryBuilder
*/
private function createRootSubselectQuery(
string $tableExpression,
string $queryAlias,
Expand All @@ -342,13 +280,6 @@ private function createRootSubselectQuery(
);
}

/**
* @param string $queryAlias
* @param QueryBuilder $childrenQuery
* @param QueryBuilder $parentQuery
* @param QueryBuilder $rootQuery
* @return QueryBuilder
*/
private function createPrimaryKeySubselectQuery(
string $queryAlias,
QueryBuilder $childrenQuery,
Expand Down
Loading