Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Update zend-coding standard #47

Closed

Conversation

tux-rampage
Copy link
Contributor

@tux-rampage tux-rampage commented Dec 6, 2018

This PR aims to update the zend-coding standard to version 2

This is work in progress

Zend cs is currently in alpha. This PR should also help the contributors of zend-coding-standard to finalize it for the release.

Currently this just updates the dependencies and applies autofix to see the outcome.

TODO

  • Remove @alpha from dependency's version constraint
  • Remove direct webimpress/conting-standard dependency
  • Fix remaining CS violations that are not auto-fixable

@tux-rampage tux-rampage added this to the 3.2.0 milestone Dec 6, 2018
@tux-rampage tux-rampage self-assigned this Dec 6, 2018
@tux-rampage tux-rampage added this to In progress in QA via automation Dec 6, 2018
Copy link
Contributor Author

@tux-rampage tux-rampage left a comment

Choose a reason for hiding this comment

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

On the first review there seems to be some issues with the php-doc alignment rule

* @param ConfigInterface $config The configuration to compile from
* @param DependencyResolverInterface $resolver The resolver to utilize
* @param string|null $namespace Namespace to use for generated class; defaults
* to Zend\Di\Generated.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@webimpress The autofixer for the alignment rule does some odd things here? What is this indentation based upon?

src/Injector.php Outdated
* The runtime definition is used when null is passed or the parameter is omitted.
* @param Resolver\DependencyResolverInterface|null $resolver A custom resolver instance to resolve dependencies.
* The default resolver is used when null is passed or the parameter is omitted
* @param ConfigInterface|null $config A custom configuration to utilize. An empty configuration is used
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@webimpress another nitpick of the alignment rule's cs fixer. Now the max line length is exceeded.

Copy link
Member

@michalbundyra michalbundyra left a comment

Choose a reason for hiding this comment

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

In general looks good, but weird indents on second line of the comment in PHPDocs. We need to check it for sure.

* @param string|null $namespace Namespace to use for generated class; defaults
* to Zend\Di\Generated.
* @param LoggerInterface|null $logger An optional logger instance to log failures
* and processed classes.
Copy link
Member

Choose a reason for hiding this comment

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

Hm... these indent of second line of the comment are weird. Is it automatically fixed?

@xtreamwayz I think we need to check it.

@@ -23,7 +23,7 @@ public function typelessRequired($bar)
{
}

public function typehintOptional(A $fooOpt = null)
public function typehintOptional(?A $fooOpt = null)
Copy link
Member

Choose a reason for hiding this comment

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

Is it not affecting tests? Usually we don't want to run cs checks on TestAssets

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No it shouldn't since this just explicitly states the already implied nullabillity of this param. Should tests in general be excluded or just the test assets?

Copy link
Member

Choose a reason for hiding this comment

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

TestAssets please

<exclude-pattern>*/TestAsset/*</exclude-pattern>

@geerteltink geerteltink added this to In progress in Zend Coding Standard 2 Dec 8, 2018
@tux-rampage
Copy link
Contributor Author

@webimpress I switched to dev-develop. Now the sniff fails. I guess due to active development:

> phpcbf -sp
ERROR: Referenced sniff "WebimpressCodingStandard.PHP.InstantiatingParenthesis" does not exist

Run "phpcbf --help" for usage information

Script phpcbf -sp handling the cs-fix event returned with error code 3

@michalbundyra
Copy link
Member

@tux-rampage Yes, I removed that sniff from my library, because there is one in PHP_CodeSniffer. The change is in my PR zendframework/zend-coding-standard#10

You can try to use that branch, as it contains the latest changes with more sniffs and then let us know if it is better for you. It contains fix for the comments in PHPDocs :)

@michalbundyra
Copy link
Member

@tux-rampage would you like to try the latest alpha of Zend Coding Standard?
https://github.com/zendframework/zend-coding-standard/releases/tag/2.0.0-alpha.3

@tux-rampage
Copy link
Contributor Author

@tux-rampage would you like to try the latest alpha of Zend Coding Standard?
https://github.com/zendframework/zend-coding-standard/releases/tag/2.0.0-alpha.3

Sure, but most likely not before next week. I'm quite busy at the moment.

@waahhhh waahhhh mentioned this pull request Dec 10, 2019
17 tasks
@michalbundyra michalbundyra removed this from the 3.2.0 milestone Dec 10, 2019
@michalbundyra
Copy link
Member

Closing now as we do not have yet ready zend-coding-standard and not sure if it will be ready before moving to Laminas.

QA automation moved this from In progress to Done Dec 10, 2019
Zend Coding Standard 2 automation moved this from In progress to Done Dec 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
QA
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants