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

[Config] Add type-hints to public interfaces and classes #32201

Merged
merged 1 commit into from
Jun 29, 2019

Conversation

jschaedl
Copy link
Contributor

@jschaedl jschaedl commented Jun 26, 2019

Q A
Branch? master
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #32179
License MIT
Doc PR N/A

This PR adds type hints to all public interfaces of the Config component.

@jschaedl jschaedl force-pushed the improvement/config-type-hints branch 2 times, most recently from 00875f5 to 0254139 Compare June 26, 2019 19:05
@jschaedl jschaedl marked this pull request as ready for review June 26, 2019 19:17
@derrabus derrabus mentioned this pull request Jun 27, 2019
57 tasks
@derrabus
Copy link
Member

Please also update those implementations of the updated interfaces that are also part of the Config component.

@nicolas-grekas nicolas-grekas added this to the 5.0 milestone Jun 28, 2019
@@ -26,7 +26,7 @@ interface LoaderInterface
*
* @throws \Exception If something went wrong
*/
public function load($resource, $type = null);
public function load($resource, ?string $type = null);
Copy link
Member

Choose a reason for hiding this comment

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

? should be removed (same below when null is the default), per our CS

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -115,6 +115,6 @@ public function testLocateEmpty()
{
$loader = new FileLocator([__DIR__.'/Fixtures']);

$loader->locate(null, __DIR__);
$loader->locate('', __DIR__);
Copy link
Contributor Author

@jschaedl jschaedl Jun 28, 2019

Choose a reason for hiding this comment

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

This test expected an InvalidArgumentException but gets a TypeError now.

@jschaedl jschaedl force-pushed the improvement/config-type-hints branch from ee3536a to ae54f82 Compare June 28, 2019 16:51
@jschaedl jschaedl changed the title [Config] Add type-hints to public interfaces [Config] Add type-hints to public interfaces and classes Jun 29, 2019
@fabpot fabpot force-pushed the improvement/config-type-hints branch from ae54f82 to e069dc4 Compare June 29, 2019 06:48
@fabpot
Copy link
Member

fabpot commented Jun 29, 2019

Thank you @jschaedl.

@fabpot fabpot merged commit e069dc4 into symfony:master Jun 29, 2019
fabpot added a commit that referenced this pull request Jun 29, 2019
… (jschaedl)

This PR was squashed before being merged into the 5.0-dev branch (closes #32201).

Discussion
----------

[Config] Add type-hints to public interfaces and classes

| Q             | A
| ------------- | ---
| Branch?       | master <!-- see below -->
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #32179  <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | N/A <!-- required for new features -->

This PR adds type hints to all public interfaces of the Config component.

Commits
-------

e069dc4 [Config] Add type-hints to public interfaces and classes
*/
public function setPerformDeepMerging($boolean)
public function setPerformDeepMerging(bool $boolean)
{
$this->performDeepMerging = (bool) $boolean;
Copy link
Member

Choose a reason for hiding this comment

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

forgotten cast

@@ -23,5 +23,5 @@ interface PrototypeNodeInterface extends NodeInterface
*
* @param string $name The name of the node
Copy link
Member

Choose a reason for hiding this comment

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

useless doc

@@ -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)
Copy link
Member

Choose a reason for hiding this comment

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

forgotten bool

@@ -28,5 +28,5 @@ interface ConfigCacheFactoryInterface
*
* @return ConfigCacheInterface The cache instance
*/
public function cache($file, $callable);
public function cache(string $file, $callable);
Copy link
Member

Choose a reason for hiding this comment

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

missing callable type

@jschaedl
Copy link
Contributor Author

@Tobion Thanks. I will create a follow-up PR to address your comments.

@Tobion
Copy link
Member

Tobion commented Jun 29, 2019

@jschaedl I already opened #32286

jschaedl added a commit to jschaedl/symfony that referenced this pull request Jun 29, 2019
jschaedl added a commit to jschaedl/symfony that referenced this pull request Jun 29, 2019
fabpot added a commit that referenced this pull request Jul 5, 2019
This PR was merged into the 5.0-dev branch.

Discussion
----------

[Config] finish adding parameter types

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yno
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #32179
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

Completes some missing things in #32201

Commits
-------

2ca8354 [Config] finish adding parameter types
@jschaedl jschaedl deleted the improvement/config-type-hints branch February 23, 2020 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants