-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Config] Add type-hints to public interfaces and classes #32201
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,40 +102,32 @@ public function getXmlRemappings() | |
/** | ||
* Sets whether to add default values for this array if it has not been | ||
* defined in any of the configuration files. | ||
* | ||
* @param bool $boolean | ||
*/ | ||
public function setAddIfNotSet($boolean) | ||
public function setAddIfNotSet(bool $boolean) | ||
{ | ||
$this->addIfNotSet = (bool) $boolean; | ||
$this->addIfNotSet = $boolean; | ||
} | ||
|
||
/** | ||
* Sets whether false is allowed as value indicating that the array should be unset. | ||
* | ||
* @param bool $allow | ||
*/ | ||
public function setAllowFalse($allow) | ||
public function setAllowFalse(bool $allow) | ||
{ | ||
$this->allowFalse = (bool) $allow; | ||
$this->allowFalse = $allow; | ||
} | ||
|
||
/** | ||
* Sets whether new keys can be defined in subsequent configurations. | ||
* | ||
* @param bool $allow | ||
*/ | ||
public function setAllowNewKeys($allow) | ||
public function setAllowNewKeys(bool $allow) | ||
{ | ||
$this->allowNewKeys = (bool) $allow; | ||
$this->allowNewKeys = $allow; | ||
} | ||
|
||
/** | ||
* Sets if deep merging should occur. | ||
* | ||
* @param bool $boolean | ||
*/ | ||
public function setPerformDeepMerging($boolean) | ||
public function setPerformDeepMerging(bool $boolean) | ||
{ | ||
$this->performDeepMerging = (bool) $boolean; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. forgotten cast |
||
} | ||
|
@@ -146,16 +138,16 @@ public function setPerformDeepMerging($boolean) | |
* @param bool $boolean To allow extra keys | ||
* @param bool $remove To remove extra keys | ||
*/ | ||
public function setIgnoreExtraKeys($boolean, $remove = true) | ||
public function setIgnoreExtraKeys(bool $boolean, $remove = true) | ||
{ | ||
$this->ignoreExtraKeys = (bool) $boolean; | ||
$this->ignoreExtraKeys = $boolean; | ||
$this->removeExtraKeys = $this->ignoreExtraKeys && $remove; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function setName($name) | ||
public function setName(string $name) | ||
{ | ||
$this->name = $name; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,5 +23,5 @@ interface PrototypeNodeInterface extends NodeInterface | |
* | ||
* @param string $name The name of the node | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. useless doc |
||
*/ | ||
public function setName($name); | ||
public function setName(string $name); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,7 @@ public function __construct($paths = []) | |
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function locate($name, $currentPath = null, $first = true) | ||
public function locate(string $name, string $currentPath = null, $first = true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. forgotten bool |
||
{ | ||
if ('' == $name) { | ||
throw new \InvalidArgumentException('An empty file name is not valid to be located.'); | ||
|
@@ -81,7 +81,7 @@ public function locate($name, $currentPath = null, $first = true) | |
* | ||
* @return bool | ||
*/ | ||
private function isAbsolutePath($file) | ||
private function isAbsolutePath(string $file) | ||
{ | ||
if ('/' === $file[0] || '\\' === $file[0] | ||
|| (\strlen($file) > 3 && ctype_alpha($file[0]) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,6 +115,6 @@ public function testLocateEmpty() | |
{ | ||
$loader = new FileLocator([__DIR__.'/Fixtures']); | ||
|
||
$loader->locate(null, __DIR__); | ||
$loader->locate('', __DIR__); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test expected an |
||
} | ||
} |
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.
missing callable type