-
Notifications
You must be signed in to change notification settings - Fork 137
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
IniParser refactoring, filename prefixes, test fixes #104
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR! Sorry for the late answer. Can you please address the requested changes? Maybe @hassankhan could add some tips for this PR.
* | ||
* @throws EmptyDirectoryException If `$path` is an empty directory | ||
*/ | ||
public function __construct($path) | ||
public function __construct($path, $prefix = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please use an associative array with the configuration instead of having $prefix
directly as second parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify, the constructor method should look like __construct($path, $options = [])
where prefix
would be a key under $options
.
* | ||
* @throws EmptyDirectoryException If `$path` is an empty directory | ||
*/ | ||
public function __construct($path) | ||
public function __construct($path, $prefix = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify, the constructor method should look like __construct($path, $options = [])
where prefix
would be a key under $options
.
Hi @kekenec, thanks for the PR! Just curious as to whether there was a specific reason for changing the QCNs in the test files? |
This PR has the conflicted files and it should be fixed. |
*/ | ||
protected $data = null; | ||
protected $data = array(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about setting the short array syntax []
?
* @covers \Noodlehaus\Config::__construct() | ||
* @covers \Noodlehaus\Config::get() | ||
*/ | ||
public function testConstructWithPrefix() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method code block should be:
public function testConstructWithPrefix()
{
......
}
$data
equals tonull
andparse_ini_file
didn't throw any error/warning. So when we callerror_get_last
we assume that there wasn't errors in the past that are suppressed via@
/custom error handler. But even PHPUnit uses@
operator, e.g. for creating log directories and files specified in configuration file, and it may cause warning/error while testing.$prefix
forConfig::__construct
method. If$prefix
is true, then every configuration file provided in the first argument will be parsed as an array containing the config array itself by the filename as a key.I'm sorry for this huge pull request. If needed, i can break it up to several small requests.