Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Zend\Config - plugin loading, ZF2-354, CS fixes #1479

Closed
wants to merge 40 commits into from

11 participants

Denis Portnov Maks3w Matthew Weier O'Phinney Ben Scholzen Yanick Rochon kevin mulama Walter Dal Mut jmarien Evan Coury Enrico Zimuel Nicholas Calugar
Denis Portnov
  • bit of refactoring to utilize plugin loading
  • ability to register reader for file extension (functionality was there but no public method existed)
  • ZF2-354
  • CS and docblock fixes
Denis Portnov denixport commented on the diff
library/Zend/Config/Writer/AbstractWriter.php
@@ -62,7 +63,7 @@ function($error, $message = '', $file = '', $line = 0) use ($filename) {
), $error);
}, E_WARNING
);
- file_put_contents($filename, $this->toString($config), $exclusiveLock);
+ file_put_contents($filename, $this->toString($config), $flags);

fixes ZF2-354

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
library/Zend/Config/Processor/Filter.php
@@ -69,7 +69,8 @@ public function setFilter(ZendFilter $filter)
* Process
*
* @param Config $config
- * @return Config
+ * @return Config
+ * @throws \Zend\Config\Exception\InvalidArgumentException
Ben Scholzen Collaborator
DASPRiD added a note

Why do you use the FQDN of the exception here, instead of just Exception\InvalidArgumentException? Same for all other occurences.

Looks like my IDE doesn't recognize parent namespace. Will fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
library/Zend/Config/Reader/Ini.php
((5 lines not shown))
*/
public function fromFile($filename)
{
- if (!file_exists($filename)) {
- throw new Exception\RuntimeException("The file $filename doesn't exists.");
+ if (!is_readable($filename)) {
+ throw new Exception\RuntimeException("File '{$filename}' doesn't exist or not readable");
Ben Scholzen Collaborator
DASPRiD added a note

Better go with sprintf() directly here. Same for all other occurences.

Agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
library/Zend/Config/Reader/Yaml.php
((24 lines not shown))
*/
- public function __construct($yamlDecoder=null) {
+ public function __construct($yamlDecoder = null)
+ {
if (!empty($yamlDecoder)) {
Ben Scholzen Collaborator
DASPRiD added a note

Can you updated this do a null comparision? $yamlDecoder !== null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
library/Zend/Config/Reader/Yaml.php
@@ -113,8 +122,9 @@ public function fromFile($filename)
* fromString(): defined by Reader interface.
*
* @see ReaderInterface::fromString()
- * @param string $string
+ * @param string $string
Ben Scholzen Collaborator
DASPRiD added a note

Why did you remove the correct alignment here?

sorry, will fix that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
library/Zend/Config/Reader/Yaml.php
((5 lines not shown))
/**
* Process the array for @include
- *
- * @param array $data
- * @return array
+ *
+ * @param array $data
Ben Scholzen Collaborator
DASPRiD added a note

Same here… and probably other places?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
library/Zend/Config/ReaderLoader.php
((18 lines not shown))
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+
+namespace Zend\Config;
+
+use Zend\Loader\PluginClassLoader;
+
+/**
+ * Plugin Class Loader implementation for config readers.
+ *
+ * @category Zend
+ * @package Zend_Serializer
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ */
+class ReaderLoader extends PluginClassLoader
Ben Scholzen Collaborator
DASPRiD added a note

Do we actually need our own Loader here? Why not just let the Broker register those plugins by default?

I was basically following the practice established around the framework. But I can change that back, not sure if it adds any performance hit though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
library/Zend/Config/Writer/Yaml.php
((9 lines not shown))
/**
* Constructor
*
- * @param callable $yamlDecoder
+ * @param callback|string $yamlDecoder
Ben Scholzen Collaborator
DASPRiD added a note

callable is actually the correct term, as it is the valid typehint as of PHP 5.4.

right, but minimal version is 5.3.3, also phpDocumentor has it as callback (http://www.phpdoc.org/docs/latest/for-users/types.html)

Matthew Weier O'Phinney Owner

We should go with callable for forward compat purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
library/Zend/Config/Writer/Yaml.php
((5 lines not shown))
/**
* Get callback for decoding YAML
*
- * @return callable
+ * @return callback
Ben Scholzen Collaborator
DASPRiD added a note

Same here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
tests/Zend/Config/Reader/AbstractReaderTestCase.php
@@ -50,7 +50,7 @@
public function testMissingFile()
{
$filename = $this->getTestAssetPath('no-file');
- $this->setExpectedException('Zend\Config\Exception\RuntimeException', "The file $filename doesn't exists.");
+ $this->setExpectedException('Zend\Config\Exception\RuntimeException', "doesn't exist");
Ben Scholzen Collaborator
DASPRiD added a note

Why limiting the check for two words here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Denis Portnov

fixed all the above, except ReaderLoader class, needs more discussion

Ben Scholzen

I've seen no other place where we include the Exceptions directly, always the Exception namespace.

Actually similar code is already there in master https://github.com/zendframework/zf2/blob/master/library/Zend/Config/Processor/Constant.php#L24
But if you find it not ok, I can change it back

library/Zend/Config/ReaderBroker.php
((6 lines not shown))
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @package Zend_Config
+ */
+
+namespace Zend\Config;
+
+use Zend\Loader\PluginBroker;
+use Zend\Config\Reader\ReaderInterface;
+
+/**
+ * Broker for serializer adapter instances
+ *
+ * @category Zend
+ * @package Zend_Serializer
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
Maks3w Collaborator
Maks3w added a note

@copyright and @license are not needed in class docblocks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
library/Zend/Config/ReaderLoader.php
((5 lines not shown))
+ * @link http://github.com/zendframework/zf2 for the canonical source repository
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @package Zend_Config
+ */
+
+namespace Zend\Config;
+
+use Zend\Loader\PluginClassLoader;
+
+/**
+ * Plugin Class Loader implementation for config readers.
+ *
+ * @category Zend
+ * @package Zend_Config
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
Maks3w Collaborator
Maks3w added a note

the same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Maks3w
Collaborator

Thank you @denixport the reason for that is I will open a PR soon for update all file headers to the new format and then doing your change we can avoid merge conflicts

Maks3w
Collaborator

Also I recommend you add a comment when you add a commit because there aren't notifications for that to the reviewer.

@DASPRiD ping

kevin mulama

I was just wondering, can this tutorial work in a linux shared hosting account? if not can be done to make it function in a linux shared hosting account.

I think you're in the wrong place. Go on IRC, freenode.net and join #zftalk.2. There are plenty of Google hits if you need more information.

ezimuel and others added some commits
Enrico Zimuel ezimuel Merge pull request #1444 from wdalmut/master
Zend\Mvc Quick Start Italian Translation
ea3f18f
Matthew Weier O'Phinney weierophinney Merge branch 'feature/validator-cleanup' of https://github.com/Maks3w… 161e608
Matthew Weier O'Phinney weierophinney Merge branch 'feature/ipvfuture-validator' of https://github.com/Maks…
…3w/zf2 into feature/1590
60e08be
Matthew Weier O'Phinney weierophinney [#1590] Removed var_dump d12342a
Matthew Weier O'Phinney weierophinney Merge branch 'feature/mail-add-headers-containter-to-parts' of https:…
…//github.com/Maks3w/zf2 into feature/mail-headers
73ece1a
Matthew Weier O'Phinney weierophinney [#1555] minor CS cleanup
- space after foreach
fbd39d0
Nicholas Calugar SocalNick Fixing FilterChain for plugins via ServiceManager.
Also, the word filters need to accept arrays or else they can't be attached with attachByName.
0df5ff9
Matthew Weier O'Phinney weierophinney Merge branch 'hotfix/uri-validation' of https://github.com/Maks3w/zf2
…into hotfix/uri-ipv6
1ce6f77
Evan Coury EvanDotPro Merge pull request #1620 from jmarien/fixes/captcha
small typos fixed in Exception namespaces for form element view helpers
79edf2b
Denis Portnov denixport extended Factory, plugin loading and CS fixes b060c30
Denis Portnov denixport registerExtension(), tests, more CS fixes c3c8dbc
Denis Portnov denixport dockblock fixes, fix yaml_emit in YAML writer d0720dc
Denis Portnov denixport revert back to previous exceptions e8765b8
Denis Portnov denixport fixed dockblocks and headers c85fd1e
Denis Portnov denixport implement PluginManager d8fcf1b
Denis Portnov denixport Merge remote-tracking branch 'origin/hotfix/config' into hotfix/config
Conflicts:
	library/Zend/Config/Factory.php
	tests/Zend/Config/FactoryTest.php
4fc171b
Denis Portnov denixport remove Broker/Loader 30689b7
Denis Portnov denixport closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 2, 2012
  1. Walter Dal Mut

    minor fix. remove en

    wdalmut authored
  2. Walter Dal Mut
Commits on Jun 4, 2012
  1. Walter Dal Mut

    Fix a lot of translations

    wdalmut authored
Commits on Jun 5, 2012
  1. Walter Dal Mut

    Zend_Captcha resource ita

    wdalmut authored
  2. Walter Dal Mut
  3. Walter Dal Mut

    Added missing translation

    wdalmut authored
Commits on Jun 11, 2012
  1. Denis Portnov
  2. Denis Portnov
Commits on Jun 12, 2012
  1. Denis Portnov
  2. Denis Portnov
Commits on Jun 13, 2012
  1. Denis Portnov

    fixed dockblocks and headers

    denixport authored
Commits on Jun 14, 2012
  1. Walter Dal Mut
  2. Walter Dal Mut

    @ezimuel suggestions

    wdalmut authored
Commits on Jun 21, 2012
  1. Maks3w

    [Uri] Add IPv6 to the list of valid types by default

    Maks3w authored
    Replaces the changes made in #1524 (4367cfa)
    
    [Uri] Explain better the concept of the bitmask for part types
Commits on Jun 22, 2012
  1. Maks3w
  2. Maks3w
Commits on Jun 26, 2012
  1. Maks3w

    [Validator] Code clean-up

    Maks3w authored
    * Fix PHPDoc
    * Fix CS (remove underscore)
  2. Maks3w
  3. Maks3w
  4. Maks3w

    [Validator] Add support for IPvFuture and literal format

    Maks3w authored
    Add support to IPvFuture as described in RFC 3986
    Add support for IPs in literal format
  5. Maks3w
  6. jmarien
Commits on Jun 27, 2012
  1. Evan Coury

    Merge pull request #1638 from macnibblet/macnibblet/hotfix/formselect…

    EvanDotPro authored
    …-selected-values
    
    FormSelect cannot use strict comparison of values
  2. Enrico Zimuel

    Merge pull request #1444 from wdalmut/master

    ezimuel authored
    Zend\Mvc Quick Start Italian Translation
  3. Matthew Weier O'Phinney
  4. Matthew Weier O'Phinney
  5. Matthew Weier O'Phinney

    [#1590] Removed var_dump

    weierophinney authored
  6. Matthew Weier O'Phinney
  7. Matthew Weier O'Phinney

    [#1555] minor CS cleanup

    weierophinney authored
    - space after foreach
  8. Nicholas Calugar

    Fixing FilterChain for plugins via ServiceManager.

    SocalNick authored
    Also, the word filters need to accept arrays or else they can't be attached with attachByName.
  9. Matthew Weier O'Phinney
  10. Evan Coury

    Merge pull request #1620 from jmarien/fixes/captcha

    EvanDotPro authored
    small typos fixed in Exception namespaces for form element view helpers
  11. Denis Portnov
  12. Denis Portnov
  13. Denis Portnov
  14. Denis Portnov
  15. Denis Portnov

    fixed dockblocks and headers

    denixport authored
  16. Denis Portnov

    implement PluginManager

    denixport authored
  17. Denis Portnov

    Merge remote-tracking branch 'origin/hotfix/config' into hotfix/config

    denixport authored
    Conflicts:
    	library/Zend/Config/Factory.php
    	tests/Zend/Config/FactoryTest.php
  18. Denis Portnov

    remove Broker/Loader

    denixport authored
Something went wrong with that request. Please try again.