Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Add ConfigProvider #30

Merged
merged 6 commits into from
Feb 6, 2018
Merged

Add ConfigProvider #30

merged 6 commits into from
Feb 6, 2018

Conversation

geerteltink
Copy link
Member

Adds ConfigProvider with basic configuration.

composer.json Outdated
@@ -50,6 +50,9 @@
"dev-master": "2.1.x-dev",
"dev-develop": "2.2.x-dev",
"dev-release-3.0.0": "3.0.x-dev"
},
"zf": {
"config-provider": "Zend\\Expressive\\Router\\ConfigProvider"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in the previous review, I would consider changing namespace for the repository.

<?php
/**
* @see https://github.com/zendframework/zend-expressive-aurarouter for the canonical source repository
* @copyright Copyright (c) 2015-2018 Zend Technologies USA Inc. (https://www.zend.com)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only 2018 please for new files.

<?php
/**
* @see https://github.com/zendframework/zend-expressive-aurarouter for the canonical source repository
* @copyright Copyright (c) 2015-2018 Zend Technologies USA Inc. (https://www.zend.com)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2018 only please

* @copyright Copyright (c) 2015-2018 Zend Technologies USA Inc. (https://www.zend.com)
* @license https://github.com/zendframework/zend-expressive-aurarouter/blob/master/LICENSE.md New BSD License
*/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no new line before strict_type declaration

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we actually decided on this? The Stratigility repo has no space between the file-level docblock and the declaration, but the zend-expressive repo does (a fact I was going to point out in your review of my latest patch there). We need to decide on a style and stick with one; right now, we have two in as many repos.

Personally, I prefer a line between them, as that makes it clear that the docblock is separate from the declaration.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we decide it here, but I prefer a new line in between as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@weierophinney @xtreamwayz I've jest checked, and I was sure that we shouldn't have the empty line there, but I'm really sorry. I was wrong! I prefer the line as well, and here is a previous comment by @weierophinney:
zendframework/zend-expressive-router#41 (comment)

So lets keep the empty line, update other repositories to add this line, and ignore my all comments about it. Thanks.

public function getDependencies() : array
{
return [
'factories' => [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

invokables probably...
https://github.com/zendframework/zend-expressive-skeleton/blob/release-3.0.0/src/ExpressiveInstaller/Resources/config/router-aura-router.php#L10

I would consider to have invokables for AuraRouter and aliases for RouterInterface

public function testInvocationReturnsArray() : array
{
$config = ($this->provider)();
self::assertInternalType('array', $config);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$this->... ?

self::assertInternalType('array', $config['dependencies']);
self::assertArrayHasKey('factories', $config['dependencies']);
self::assertInternalType('array', $config['dependencies']['factories']);
self::assertArrayHasKey(RouterInterface::class, $config['dependencies']['factories']);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$this-> ... 5x ?

@weierophinney
Copy link
Member

@xtreamwayz Same comments from the fastroute package apply here:

  • Use a subnamespace for the ConfigProvider.
  • Use $this-> instead of self:: for now.

@geerteltink
Copy link
Member Author

Use a subnamespace for the ConfigProvider.

@MWOP Not sure what you mean by that. Change the namespace of the entire package to Zend\Expressive\Aurarouter? That would be a BC break for all router components.
Change the name or move the ConfigProvider you create an inconsistency with other packages.

@weierophinney
Copy link
Member

@MWOP Not sure what you mean by that. Change the namespace of the entire package to Zend\Expressive\Aurarouter? That would be a BC break for all router components.
Change the name or move the ConfigProvider you create an inconsistency with other packages.

I think you meant @weierophinney here. 😄

No, I meant that you should add a subnamespace in this package: Zend\Expressive\Router\AuraRouter (as the root namespace is Zend\Expressive\Router, and push the ConfigProvider under that: Zend\Expressive\Router\AuraRouter\ConfigProvider.

Otherwise, we'll have potential conflicts when trying to resolve the Zend\Expressive\Router\ConfigProvider class.

geerteltink and others added 6 commits February 6, 2018 12:16
Moves it to the `Zend\Expressive\Router\AuraRouter` subnamespace, to
prevent potential conflicts with other config providers under the
`Zend\Expressive\Router` namespace.
We use `$this->` everywhere else, essentially, so `self::` is
inconsistent. If we decided to go with the latter in the future, we can
do mass updates across all components.
@weierophinney weierophinney added this to the 3.0.0alpha1 milestone Feb 6, 2018
@weierophinney weierophinney merged commit 78ca530 into zendframework:release-3.0.0 Feb 6, 2018
@weierophinney
Copy link
Member

Thanks, @xtreamwayz!

@geerteltink geerteltink deleted the feature/config-provider branch February 6, 2018 19:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants