This repository was archived by the owner on Nov 21, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Shorthand types must be used #52
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| ---DESCRIPTION--- | ||
| Shorthand types must be used | ||
| ---FILENAME--- | ||
| Foo.php | ||
| ---CONTENTS--- | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Vendor; | ||
|
|
||
| class Foo | ||
| { | ||
| /** @var integer */ | ||
| public $foo; | ||
|
|
||
| /** @var boolean */ | ||
| public $bar; | ||
|
|
||
| /** @var array<integer, boolean> */ | ||
| public $baz; | ||
|
|
||
| /** | ||
| * @param integer $quux | ||
| * | ||
| * @return integer | ||
| */ | ||
| public function qux($quux) | ||
| { | ||
| } | ||
|
|
||
| /** | ||
| * @param boolean $corge | ||
| * | ||
| * @return boolean | ||
| */ | ||
| public function quuz($corge) | ||
| { | ||
| } | ||
|
|
||
| /** | ||
| * @param array<integer, boolean> $garply | ||
| * | ||
| * @return array<integer, boolean> | ||
| */ | ||
| public function grault($garply) | ||
| { | ||
| } | ||
| } | ||
|
|
||
| ---FIXED--- | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Vendor; | ||
|
|
||
| class Foo | ||
| { | ||
| /** @var int */ | ||
| public $foo; | ||
|
|
||
| /** @var bool */ | ||
| public $bar; | ||
|
|
||
| /** @var array<int, bool> */ | ||
| public $baz; | ||
|
|
||
| /** | ||
| * @param int $quux | ||
| * | ||
| * @return int | ||
| */ | ||
| public function qux($quux) | ||
| { | ||
| } | ||
|
|
||
| /** | ||
| * @param bool $corge | ||
| * | ||
| * @return bool | ||
| */ | ||
| public function quuz($corge) | ||
| { | ||
| } | ||
|
|
||
| /** | ||
| * @param array<int, bool> $garply | ||
| * | ||
| * @return array<int, bool> | ||
| */ | ||
| public function grault($garply) | ||
| { | ||
| } | ||
| } | ||
|
|
||
| --- | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| ---DESCRIPTION--- | ||
| Shorthand types must be used | ||
| ---CONTENTS--- | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| /** | ||
| * @param integer $bar | ||
| * | ||
| * @return integer | ||
| */ | ||
| function foo($bar) | ||
| { | ||
| } | ||
|
|
||
| /** | ||
| * @param boolean $qux | ||
| * | ||
| * @return boolean | ||
| */ | ||
| function baz($qux) | ||
| { | ||
| } | ||
|
|
||
| /** | ||
| * @param array<integer, boolean> $quuz | ||
| * | ||
| * @return array<integer, boolean> | ||
| */ | ||
| function quux($quuz) | ||
| { | ||
| } | ||
|
|
||
| ---FIXED--- | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| /** | ||
| * @param int $bar | ||
| * | ||
| * @return int | ||
| */ | ||
| function foo($bar) | ||
| { | ||
| } | ||
|
|
||
| /** | ||
| * @param bool $qux | ||
| * | ||
| * @return bool | ||
| */ | ||
| function baz($qux) | ||
| { | ||
| } | ||
|
|
||
| /** | ||
| * @param array<int, bool> $quuz | ||
| * | ||
| * @return array<int, bool> | ||
| */ | ||
| function quux($quuz) | ||
| { | ||
| } | ||
|
|
||
| --- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| ---DESCRIPTION--- | ||
| Shorthand types must be used | ||
| ---FILENAME--- | ||
| Foo.php | ||
| ---CONTENTS--- | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Vendor; | ||
|
|
||
| interface Foo | ||
| { | ||
| /** | ||
| * @param integer $baz | ||
| * | ||
| * @return integer | ||
| */ | ||
| public function bar($baz); | ||
|
|
||
| /** | ||
| * @param boolean $quux | ||
| * | ||
| * @return boolean | ||
| */ | ||
| public function qux($quux); | ||
|
|
||
| /** | ||
| * @param array<integer, boolean> $corge | ||
| * | ||
| * @return array<integer, boolean> | ||
| */ | ||
| public function quuz($corge); | ||
| } | ||
|
|
||
| ---FIXED--- | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Vendor; | ||
|
|
||
| interface Foo | ||
| { | ||
| /** | ||
| * @param int $baz | ||
| * | ||
| * @return int | ||
| */ | ||
| public function bar($baz); | ||
|
|
||
| /** | ||
| * @param bool $quux | ||
| * | ||
| * @return bool | ||
| */ | ||
| public function qux($quux); | ||
|
|
||
| /** | ||
| * @param array<int, bool> $corge | ||
| * | ||
| * @return array<int, bool> | ||
| */ | ||
| public function quuz($corge); | ||
| } | ||
|
|
||
| --- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| ---DESCRIPTION--- | ||
| Shorthand types must be used | ||
| ---FILENAME--- | ||
| Foo.php | ||
| ---CONTENTS--- | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Vendor; | ||
|
|
||
| trait Foo | ||
| { | ||
| /** @var integer */ | ||
| public $foo; | ||
|
|
||
| /** @var boolean */ | ||
| public $bar; | ||
|
|
||
| /** @var array<integer, boolean> */ | ||
| public $baz; | ||
|
|
||
| /** | ||
| * @param integer $quux | ||
| * | ||
| * @return integer | ||
| */ | ||
| public function qux($quux) | ||
| { | ||
| } | ||
|
|
||
| /** | ||
| * @param boolean $corge | ||
| * | ||
| * @return boolean | ||
| */ | ||
| public function quuz($corge) | ||
| { | ||
| } | ||
|
|
||
| /** | ||
| * @param array<integer, boolean> $garply | ||
| * | ||
| * @return array<integer, boolean> | ||
| */ | ||
| public function grault($garply) | ||
| { | ||
| } | ||
| } | ||
|
|
||
| ---FIXED--- | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Vendor; | ||
|
|
||
| trait Foo | ||
| { | ||
| /** @var int */ | ||
| public $foo; | ||
|
|
||
| /** @var bool */ | ||
| public $bar; | ||
|
|
||
| /** @var array<int, bool> */ | ||
| public $baz; | ||
|
|
||
| /** | ||
| * @param int $quux | ||
| * | ||
| * @return int | ||
| */ | ||
| public function qux($quux) | ||
| { | ||
| } | ||
|
|
||
| /** | ||
| * @param bool $corge | ||
| * | ||
| * @return bool | ||
| */ | ||
| public function quuz($corge) | ||
| { | ||
| } | ||
|
|
||
| /** | ||
| * @param array<int, bool> $garply | ||
| * | ||
| * @return array<int, bool> | ||
| */ | ||
| public function grault($garply) | ||
| { | ||
| } | ||
| } | ||
|
|
||
| --- |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Didn't use
TypeHintDeclarationto force these to be native types, but in this case it doesn'textend/implementanything. Wonder if we can get it to work in that case? Would mean it could create breaking changes though...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.
slevomat/coding-standard#628 got closed pretty quickly. Might become an option in the future.