-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
Adding PSR12 coding standard #56
Changes from all commits
3e8a011
3cd87dc
e9f838e
15702e6
3764204
999b7f9
bf3ae92
9cac0c2
2830ca0
3d363dc
c76ec87
f92e435
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace FriendsOfTYPO3\Headless\ContentObject; | ||
|
||
/*** | ||
* | ||
|
@@ -14,6 +11,10 @@ | |
* | ||
***/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace FriendsOfTYPO3\Headless\ContentObject; | ||
|
||
use RecursiveArrayIterator; | ||
use RecursiveIteratorIterator; | ||
use TYPO3\CMS\Core\Utility\GeneralUtility; | ||
|
@@ -166,7 +167,7 @@ protected function recursiveFind(array $haystack, $needle) | |
* @param array $data | ||
* @return array | ||
*/ | ||
protected function decodeFieldsIfRequired(array $data) : array | ||
protected function decodeFieldsIfRequired(array $data): array | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI, I've added a rule to check this one in #58 |
||
{ | ||
$json = []; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace FriendsOfTYPO3\Headless\DataProcessing; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace FriendsOfTYPO3\Headless\DataProcessing; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
declare(strict_types=1); | ||
|
||
namespace FriendsOfTYPO3\Headless\Hooks; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
declare(strict_types=1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. which rule from PSR-12 applies here? in TYPO3 Core it's formatted with spaces around "=" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My checks went entirely after PSR12, no additional special configuration
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you're right! |
||
|
||
namespace FriendsOfTYPO3\Headless\Utility; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -259,4 +259,4 @@ lib.page { | |
} | ||
} | ||
} | ||
} | ||
} |
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.
is this change intended (moving declare and namespace after comments?
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.
yes it's intended:
https://www.php-fig.org/psr/psr-12/#3-declare-statements-namespace-and-import-statements
The order now is first open tag, then file-comment, then declare, then import, then rest
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.
ok, looks good then
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.
D'no how that rule got accepted to the standard. Can only assume the reviewers missed it. I've never seen any code before that followed that rule of having the doc above the declares. The 2 authors of the PSR must have wanted it, only...