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

type-hints #142

Merged
merged 7 commits into from
Feb 23, 2018
Merged

type-hints #142

merged 7 commits into from
Feb 23, 2018

Conversation

smoench
Copy link
Contributor

@smoench smoench commented Jan 15, 2018

No description provided.

/**
* @param string $className
*
* @return array<string>
Copy link
Member

Choose a reason for hiding this comment

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

string[]?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@@ -28,5 +28,7 @@ protected function execute(

$configurationLoader->dumpConfiguration();
$output->writeln('depfile <info>dumped.</info>');

return 0;
Copy link
Member

Choose a reason for hiding this comment

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

you can now add the return type hint

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@@ -49,5 +49,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}

$output->writeln('<info>Deprac is already the latest version.</info>');

return 0;
Copy link
Member

Choose a reason for hiding this comment

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

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

* @param ConfigurationLayer[] $layers
* @param ConfigurationRuleset $ruleset
* @param array $paths
* @param array $excludeFiles
Copy link
Member

Choose a reason for hiding this comment

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

I would now drop the docblock. It doesn't add any value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed; replaced array with string[]

* @param $color
* @param $collectors
* @param ConfigurationCollector[] $collectors
* @param string $name
Copy link
Member

Choose a reason for hiding this comment

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

code style

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

{
# must
yield [
[
'must' => [
['type' => true],
['type' => 'true'],
Copy link
Collaborator

Choose a reason for hiding this comment

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

why strings?

Copy link
Contributor Author

@smoench smoench Jan 15, 2018

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

well, it's ok even if i think it's a bit overkill. getCollectorMock('true', true) and 'true' is brainfuck.
i'd prefer casting the bool to a string. there will never be other values than true / false.

Copy link
Contributor

Choose a reason for hiding this comment

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

truly, mixing strings and booleans (true / false) is not a nice style. we're talking about the type here, and the type has a name. "true" or "false" as a string. Or "boolean", "object", "null" etc. And not if the state is true or false.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@timglabisch I added some more improvements and fixed the "brainfuck" as you mentioned. Even I could apply the validity with phpstan level 7.

* @param $arguments
*/
public function __construct($arguments)
public function __construct(array $arguments)

Choose a reason for hiding this comment

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

rename to $options

@smoench smoench merged commit bb8b99a into master Feb 23, 2018
@smoench smoench deleted the type-hints branch February 23, 2018 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants