-
Notifications
You must be signed in to change notification settings - Fork 254
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
Updates coding standard to something PSR-12-ish #7886
Updates coding standard to something PSR-12-ish #7886
Conversation
PSR-12 with tab indentation and closing PHP tags (for now, anyway), plus a selection of other nice cleanup options. Signed-off-by: Jon Stovell <jonstovell@gmail.com>
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
f1de869
to
a86ccb8
Compare
Sources/Actions/Activate.php
Outdated
$request = Db::$db->query('', ' | ||
$request = Db::$db->query( | ||
'', | ||
' |
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.
This one's funny. Even though it looks strange, it's consistent with other params on their own lines.
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.
Well its a bc breakage. But we could introduce a identifierQuery() and drop the first param off this one. Considering like 95% of our queries don't need this.
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.
Well its a bc breakage. But we could introduce a identifierQuery() and drop the first param off this one. Considering like 95% of our queries don't need this.
That's a good idea. We'd just need to switch which method the backward compatibility entry in Utils::$smcFunc pointed to, and we'd be good to go.
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.
Hm. Here's another option that would introduce fewer complications for backward compatibility.
$request = Db::$db->query(
'',
'SELECT id_member, validation_code, member_name, real_name, email_address, is_activated, passwd, lngfile
FROM {db_prefix}members' . (empty($_REQUEST['u']) ? '
WHERE member_name = {string:email_address} OR email_address = {string:email_address}' : '
WHERE id_member = {int:id_member}') . '
LIMIT 1',
[
'id_member' => isset($_REQUEST['u']) ? (int) $_REQUEST['u'] : 0,
'email_address' => $_POST['user'] ?? '',
],
);
Taking out the extra line break at the start of the query string makes it look a lot less weird in my opinion.
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.
Does help but still looks odd. If this is easier then go this way. Maybe we introduce that in 3.1 or another future release.
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.
Well its a bc breakage
Not is not. Bots never do bc breaks unless specifically told to.
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.
I believe @jdarwood007 meant that his idea to make an identifierQuery() method would break backward compatibility.
Signed-off-by: Jon Stovell <jonstovell@gmail.com> # Conflicts: # Sources/Security.php
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
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.
I give it my approval as this is just code standards and we just want to align on something that is easier enough for all of us to ensure our code meets prior to sending up PRs
FYI, there are only 42 (nice) uses of the identifier
|
.php-cs-fixer.dist.php
Outdated
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.
To me, blank line before "break" looks weird. But if that is in PSR-12 let's go with it.
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.
It's not required by PSR-12. I've tweaked the rules now to change that bit.
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
Signed-off-by: Jon Stovell <jonstovell@gmail.com>
9a22931
to
a01f66c
Compare
PSR-12 with tab indentation and closing PHP tags (for now, anyway), plus a selection of other nice cleanup options.