{"action":"created","issue":{"url":"https://api.github.com/repos/zendframework/zend-coding-standard/issues/1","repository_url":"https://api.github.com/repos/zendframework/zend-coding-standard","labels_url":"https://api.github.com/repos/zendframework/zend-coding-standard/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/zendframework/zend-coding-standard/issues/1/comments","events_url":"https://api.github.com/repos/zendframework/zend-coding-standard/issues/1/events","html_url":"https://github.com/zendframework/zend-coding-standard/pull/1","id":189005782,"number":1,"title":"[WIP] Extended Zend Framework Coding Standard","user":{"login":"webimpress","id":7423207,"avatar_url":"https://avatars2.githubusercontent.com/u/7423207?v=4","gravatar_id":"","url":"https://api.github.com/users/webimpress","html_url":"https://github.com/webimpress","followers_url":"https://api.github.com/users/webimpress/followers","following_url":"https://api.github.com/users/webimpress/following{/other_user}","gists_url":"https://api.github.com/users/webimpress/gists{/gist_id}","starred_url":"https://api.github.com/users/webimpress/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webimpress/subscriptions","organizations_url":"https://api.github.com/users/webimpress/orgs","repos_url":"https://api.github.com/users/webimpress/repos","events_url":"https://api.github.com/users/webimpress/events{/privacy}","received_events_url":"https://api.github.com/users/webimpress/received_events","type":"User","site_admin":false},"labels":[{"id":497683438,"url":"https://api.github.com/repos/zendframework/zend-coding-standard/labels/WIP","name":"WIP","color":"5319e7","default":false},{"id":478367081,"url":"https://api.github.com/repos/zendframework/zend-coding-standard/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/zendframework/zend-coding-standard/milestones/1","html_url":"https://github.com/zendframework/zend-coding-standard/milestone/1","labels_url":"https://api.github.com/repos/zendframework/zend-coding-standard/milestones/1/labels","id":2599966,"number":1,"title":"2.0.0","description":"","creator":{"login":"froschdesign","id":103362,"avatar_url":"https://avatars2.githubusercontent.com/u/103362?v=4","gravatar_id":"","url":"https://api.github.com/users/froschdesign","html_url":"https://github.com/froschdesign","followers_url":"https://api.github.com/users/froschdesign/followers","following_url":"https://api.github.com/users/froschdesign/following{/other_user}","gists_url":"https://api.github.com/users/froschdesign/gists{/gist_id}","starred_url":"https://api.github.com/users/froschdesign/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/froschdesign/subscriptions","organizations_url":"https://api.github.com/users/froschdesign/orgs","repos_url":"https://api.github.com/users/froschdesign/repos","events_url":"https://api.github.com/users/froschdesign/events{/privacy}","received_events_url":"https://api.github.com/users/froschdesign/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":0,"state":"open","created_at":"2017-06-23T05:05:39Z","updated_at":"2017-06-23T05:07:59Z","due_on":null,"closed_at":null},"comments":36,"created_at":"2016-11-14T00:09:49Z","updated_at":"2018-03-04T03:56:59Z","closed_at":null,"author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/zendframework/zend-coding-standard/pulls/1","html_url":"https://github.com/zendframework/zend-coding-standard/pull/1","diff_url":"https://github.com/zendframework/zend-coding-standard/pull/1.diff","patch_url":"https://github.com/zendframework/zend-coding-standard/pull/1.patch"},"body":"**Work in progress**\r\n\r\nJust want to know what you guys thinks about it.\r\n\r\nBasically @weierophinney asked me to add just detection for unused imports.\r\nI went \"a bit\" more far with it and I've added much more rules.\r\nI found easy way how we can write custom rules and we don't need to copy them to Standards directory.\r\n\r\nList what we have there now:\r\n- `Generic.Arrays.DisallowLongArraySyntax`,\r\n- `Generic.Formatting.SpaceAfterCast` (must be one space after cast: `(bool) $var`),\r\n- `Generic.Formatting.SpaceAfterNot`,\r\n- `Generic.CodeAnalysis.EmptyStatement`,\r\n- `Generic.CodeAnalysis.ForLoopShouldBeWhileLoop`,\r\n- `Generic.CodeAnalysis.UnconditionalIfStatement`,\r\n- `Generic.CodeAnalysis.UnnecessaryFinalModifier`,\r\n- `Generic.NamingConventions.ConstructorName`,\r\n- `Generic.PHP.ForbiddenFunctions`,\r\n- `Generic.Files.OneTraitPerFile`,\r\n- `Generic.Strings.UnnecessaryStringConcat`,\r\n- `Squiz.Operators.ValidLogicalOperators`,\r\n- `Squiz.PHP.LowercasePHPFunctions`,\r\n- `Squiz.PHP.NonExecutableCode`,\r\n- `Squiz.Scope.StaticThisUsage`,\r\n- `Squiz.Strings.ConcatenationSpacing`,\r\n- `Squiz.Strings.DoubleQuoteUsage`,\r\n- `Squiz.WhiteSpace.LanguageConstructSpacing`,\r\n- `Squiz.WhiteSpace.OperatorSpacing`,\r\n- `Squiz.WhiteSpace.SemicolonSpacing`,\r\n- `Squiz.WhiteSpace.SuperfluousWhitespace`,\r\n- `ZendCodingStandard.Arrays.Format` (no space after `[` and before `]`, each element in new line for multi-line arrays, no empty lines, correct indents...),\r\n- `ZendCodingStandard.Arrays.TrailingArrayComma` (requires comma after last element in multiline arrays),\r\n- `ZendCodingStandard.Classes.AlphabeticallySortedTraits`,\r\n- `ZendCodingStandard.Classes.NoNullValues` - remove `null` values for class properties,\r\n- `ZendCodingStandard.Classes.TraitUsage`,\r\n- `ZendCodingStandard.Commenting.DocComment`,\r\n- `ZendCodingStandard.Commenting.FunctionComment` - order of tags and empty lines between tags,\r\n- `ZendCodingStandard.Commenting.FunctionDataProviderTag`,\r\n- `ZendCodingStandard.Commenting.FunctionDisallowedTag` - using some tags is disallowed, for example `@expectedException*` from PHPUnit annotations should be replaced with according function calls just before place, where the exception should be thrown,\r\n- `ZendCodingStandard.Commenting.NoInlineCommentAfterCurlyClose`,\r\n- `ZendCodingStandard.Commenting.TagCase`,\r\n- `ZendCodingStandard.Commenting.VariableComment`,\r\n- `ZendCodingStandard.Formatting.DoubleColon` - no spaces before and after,\r\n- `ZendCodingStandard.Formatting.NewKeyword` - one space after,\r\n- `ZendCodingStandard.Formatting.NoSpaceAfterSplat` - no space after `...`,\r\n- `ZendCodingStandard.Formatting.Reference` - no space after reference operator `&$var`,\r\n- `ZendCodingStandard.Formatting.ReturnType` (formating of return type on PHP 7 and 7.1 with nullable types),\r\n- `ZendCodingStandard.Formatting.UnnecessaryParentheses` (remove unnecessary parentheses where it does not misaligned the readability),\r\n- `ZendCodingStandard.Functions.Param` - checks method params and tags - required PHPDocs tags only when type hint is not provided or type hint needs specification (`array`, `iterable`, `\\Traversable`),\r\n- `ZendCodingStandard.Functions.ReturnType` - checks method return statement and return type, tag is required only when return type is not declared or needs specification (`array`, `iterable`, `\\Traversable`), if function returns void, return tag must be omitted,\r\n- `ZendCodingStandard.Functions.Throws` - checks throws tags and throw statement in the function - throw tag must be declared for each exception thrown explicitly in the function,\r\n- `ZendCodingStandard.Methods.LineAfter` (must be exactly one line after method in class, zero after last method in the class),\r\n- `ZendCodingStandard.Namespaces.AlphabeticallySortedUses`,\r\n- `ZendCodingStandard.Namespaces.ConstAndFunctionKeywords` - lower case keywords and single space after,\r\n- `ZendCodingStandard.Namespaces.UnusedUseStatement` (detects unused use statements),\r\n- `ZendCodingStandard.Namespaces.UseDoesNotStartWithBackslash`,\r\n- `ZendCodingStandard.NamingConventions.ValidVariableName` (all variables should be camelCase style),\r\n- `ZendCodingStandard.Operators.BooleanOperator` (boolean operators are not allowed at the end of the line),\r\n- `ZendCodingStandard.Operators.TernaryOperator` (if multi-line, each part should be in new line starting from operator `?` or `:`),\r\n- `ZendCodingStandard.PHP.CorrectClassNameCase` (checks case for defined classes),\r\n- `ZendCodingStandard.PHP.ImportInternalConstant` (import php built-in constants),\r\n- `ZendCodingStandard.PHP.ImportInternalFunction` (import php built-in functions),\r\n- `ZendCodingStandard.PHP.InstantiatingParenthesis` (PSR-12 - always parenthesis when instantiating a new class),\r\n- `ZendCodingStandard.PHP.LowerCaseKeyword` (extends `Generic.PHP.LowerCaseKeyword`),\r\n- `ZendCodingStandard.PHP.RedundantSemicolon` (unnecessary semicolons - for example after closing curly bracket of \"if\" statement),\r\n- `ZendCodingStandard.PHP.TypeCasting` (disallow `!!` casting, require `(bool)` and `(int)` instead of `(boolean)` and `(integer)` accordingly, disallow `(unset)` cast, always lowercase),\r\n- `ZendCodingStandard.Strings.NoConcatenationAtTheEnd`,\r\n- `ZendCodingStandard.WhiteSpace.BlankLine` (only one blank line allowed between parts of the code),\r\n- `ZendCodingStandard.WhiteSpace.CommaSpacing` (no space before comma, one after, allowed more than one in multidimensional arrays),\r\n- `ZendCodingStandard.WhiteSpace.NoBlankLineAtStart` (disallow blank line(s) at start of `class`, `closure`, `function`, `interface` and `trait`),\r\n- `ZendCodingStandard.WhiteSpace.ScopeIndent` (**experimental**, stricter rules of indents).\r\n\r\nI would like to add also some more rules/sniffs:\r\n- [x] trait sniff\r\n  - [x] must be one `use` keyword per declaration - `ZendCodingStandard.Classes.TraitUsage`,\r\n  - [x] exactly one blank line after traits and before methods in class - `ZendCodingStandard.Classes.TraitUsage`,\r\n  - [x] alphabetical order - `ZendCodingStandard.Classes.AlphabeticallySortedTraits`,\r\n  - [x] checking everything inside curly brackets,\r\n- [x] global use statements sniffs\r\n  - [x] alphabetical order - `ZendCodingStandard.Namespaces.AlphabeticallySortedUses`,\r\n  - [x] unused uses - `ZendCodingStandard.Namespaces.UnusedUseStatement `,\r\n  - [x] lower case `const` and `function` keywords - `ZendCodingStandard.Namespaces.ConstAndFunctionKeywords`,\r\n  - [x] one space after `const` and `function` keywords - `ZendCodingStandard.Namespaces.ConstAndFunctionKeywords`,\r\n  - [x] use does not start with backslash - `ZendCodingStandard.Namespaces.UseDoesNotStartWithBackslash`,\r\n- [x] no empty line on top of the body class/method - `ZendCodingStandard.WhiteSpace.NoBlankLineAtStart`,\r\n- [x] more than one blank line is not allowed - `ZendCodingStandard.WhiteSpace.BlankLine`,\r\n- [x] correct camelCase names of internal PHP class (for example `DateTime` instead of `Datetime`) - `ZendCodingStandard.PHP.CorrectClassNameCase`,\r\n- [x] concatenation character shouldn't be at the end of the line `ZendCodingStandard.Strings.NoConcatenationAtTheEndSniff`,\r\n- [x] logical operator shouldn't be at the end of the line - `ZendCodingStandard.Operators.BooleanOperator`,\r\n- [x] PHPDocs with `@dataProvider`:\r\n  - [x] only allowed for `test...` methods,\r\n  - [x] data provider name doesn't have \"Provider\" suffix,\r\n  - [x] should be always above `@param` tags,\r\n  - [x] should be one empty line after and before `@dataProvider ...`,\r\n- [x] disallow `or` and `and` for logical operators (use `||` and `&&` accordingly) - `Squiz.Operators.ValidLogicalOperators`,\r\n- [x] disallow method names the same as their class (deprecated error in PHP 7.0: `Methods with the same name as their class will not be constructors in a future version`) - `Generic.NamingConventions.ConstructorName`,\r\n- [x] arrays formatting - `ZendCodingStandard.Arrays.Format`:\r\n  - [x] no white space after array opening bracket and before closing (disallow `[ 1, 2, 3 ]`),\r\n  - [x] each element in new line for multi-line arrays\r\n  - [x] correct indents,\r\n  - [x] disallow empty lines in arrays,\r\n- [x] no space after splat operator (`...$var`) - `ZendCodingStandard.Formatting.NoSpaceAfterSplat`,\r\n- [x] no space before and after double colon operator (`ClassName::class`) - `ZendCodingStandard.Formatting.DoubleColon`,\r\n- [x] only one space after `new` - `ZendCodingStandard.Formatting.NewKeyword`,\r\n- [x] \"When instantiating a new class, parenthesis MUST always be present even when there are no arguments passed to the constructor.\" (PSR-12),\r\n- [x] unnecessary semicolons (for example after `if` curly closing bracket) - `ZendCodingStandard.PHP.RedundantSemicolon`,\r\n- [x] no space after reference operator `&` - `ZendCodingStandard.Formatting.Reference`.\r\n\r\nOf course would be nice to have also tests for all of our custom sniffs...\r\n\r\nSo as you can see it's quite long list. Can you think about anything else what will be worth to add?\r\n\r\nLet me know what do you think. Thanks!\r\n\r\n/cc @weierophinney @Koopzington @xtreamwayz "},"comment":{"url":"https://api.github.com/repos/zendframework/zend-coding-standard/issues/comments/370200127","html_url":"https://github.com/zendframework/zend-coding-standard/pull/1#issuecomment-370200127","issue_url":"https://api.github.com/repos/zendframework/zend-coding-standard/issues/1","id":370200127,"user":{"login":"Xerkus","id":725842,"avatar_url":"https://avatars1.githubusercontent.com/u/725842?v=4","gravatar_id":"","url":"https://api.github.com/users/Xerkus","html_url":"https://github.com/Xerkus","followers_url":"https://api.github.com/users/Xerkus/followers","following_url":"https://api.github.com/users/Xerkus/following{/other_user}","gists_url":"https://api.github.com/users/Xerkus/gists{/gist_id}","starred_url":"https://api.github.com/users/Xerkus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Xerkus/subscriptions","organizations_url":"https://api.github.com/users/Xerkus/orgs","repos_url":"https://api.github.com/users/Xerkus/repos","events_url":"https://api.github.com/users/Xerkus/events{/privacy}","received_events_url":"https://api.github.com/users/Xerkus/received_events","type":"User","site_admin":false},"created_at":"2018-03-04T03:56:59Z","updated_at":"2018-03-04T03:56:59Z","author_association":"MEMBER","body":"This fix is dangerous. It must not be applied. Order of elements could matter, despite it being associative array. Furthermore, this actually breaks original sorting by hex value.\r\n```diff\r\n     protected static $urlencodeCorrectionMap = [\r\n-        '%21' => \"!\", // sub-delims\r\n-        '%24' => \"$\", // sub-delims\r\n-        '%26' => \"&\", // sub-delims\r\n+        '%21' => '!', // sub-delims\r\n+        '%24' => '$', // sub-delims\r\n+        '%26' => '&', // sub-delims\r\n         '%27' => \"'\", // sub-delims\r\n-        '%28' => \"(\", // sub-delims\r\n-        '%29' => \")\", // sub-delims\r\n-        '%2A' => \"*\", // sub-delims\r\n-        '%2B' => \"+\", // sub-delims\r\n-        '%2C' => \",\", // sub-delims\r\n-//      '%2D' => \"-\", // unreserved - not touched by rawurlencode\r\n-//      '%2E' => \".\", // unreserved - not touched by rawurlencode\r\n-        '%3A' => \":\", // pchar\r\n-        '%3B' => \";\", // sub-delims\r\n-        '%3D' => \"=\", // sub-delims\r\n-        '%40' => \"@\", // pchar\r\n-//      '%5F' => \"_\", // unreserved - not touched by rawurlencode\r\n-//      '%7E' => \"~\", // unreserved - not touched by rawurlencode\r\n+        '%28' => '(', // sub-delims\r\n+        '%29' => ')', // sub-delims\r\n+        '%2A' => '*', // sub-delims\r\n+        '%2B' => '+', // sub-delims\r\n+        '%2C' => ',', // sub-delims\r\n+        //      '%2D' => \"-\", // unreserved - not touched by rawurlencode\r\n+        //      '%2E' => \".\", // unreserved - not touched by rawurlencode\r\n+        '%3A' => ':', // pchar\r\n+        '%3B' => ';', // sub-delims\r\n+        '%3D' => '=', // sub-delims\r\n+        '%40' => '@', // pchar\r\n+        //      '%5F' => \"_\", // unreserved - not touched by rawurlencode\r\n+        //      '%7E' => \"~\", // unreserved - not touched by rawurlencode\r\n     ];\r\n```"}}
{"actor":{"display_login":"Xerkus"}}