-
Notifications
You must be signed in to change notification settings - Fork 52
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
Adopt PSR-12 as base coding standard #148
Conversation
c422886
to
83aa348
Compare
As per item 5.1 of the PSR:
I've found some occurrences in diff --git a/lib/Doctrine/Migrations/Generator/SqlGenerator.php b/lib/Doctrine/Migrations/Generator/SqlGenerator.php
index 8c92c12..9868a28 100644
--- a/lib/Doctrine/Migrations/Generator/SqlGenerator.php
+++ b/lib/Doctrine/Migrations/Generator/SqlGenerator.php
@@ -47,8 +47,10 @@ class SqlGenerator
$storageConfiguration = $this->configuration->getMetadataStorageConfiguration();
foreach ($sql as $query) {
- if ($storageConfiguration instanceof TableMetadataStorageConfiguration
- && stripos($query, $storageConfiguration->getTableName()) !== false) {
+ if (
+ $storageConfiguration instanceof TableMetadataStorageConfiguration
+ && stripos($query, $storageConfiguration->getTableName()) !== false
+ ) {
continue;
} and diff --git a/lib/Doctrine/Migrations/Provider/LazySchemaDiffProvider.php b/lib/Doctrine/Migrations/Provider/LazySchemaDiffProvider.php
index 0d0df44..3606bd2 100644
--- a/lib/Doctrine/Migrations/Provider/LazySchemaDiffProvider.php
+++ b/lib/Doctrine/Migrations/Provider/LazySchemaDiffProvider.php
@@ -81,8 +81,10 @@ class LazySchemaDiffProvider implements SchemaDiffProvider
/** @return string[] */
public function getSqlDiffToMigrate(Schema $fromSchema, Schema $toSchema) : array
{
- if ($toSchema instanceof LazyLoadingInterface
- && ! $toSchema->isProxyInitialized()) {
+ if (
+ $toSchema instanceof LazyLoadingInterface
+ && ! $toSchema->isProxyInitialized()
+ ) {
return [];
} Is it something that we want? 👍or 👎 |
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.
@carusogabriel would you please add a test for the multiline thing (and to any other sniff we're implicitly adding here)?
@lcobucci Yes sir :) I'll add for the following ones that I've found:
Also, as already reported in squizlabs/PHP_CodeSniffer#460, looks like we need to exclude |
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.
Only a minor suggestion, rest LGTM once tests have been added 🎉
81ba736
83aa348
to
81ba736
Compare
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.
Great work, Gabriel!
81ba736
to
ffa59fd
Compare
@carusogabriel might want to revisit those build failures though ;) |
@alcaeus Yeah, I'm trying to figure the |
ffa59fd
to
6abaf58
Compare
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.
awesome, thanks
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.
🎉
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 PR proposes that the Doctrine's CS adopts PSR-12 as the base for our standards, with a few changes, as voted in the past.
Important changes:
SlevomatCodingStandard.ControlStructures.NewWithParentheses
was dropped in favor ofPSR12.Classes.ClassInstantiation
, in specificPSR12.Classes.ClassInstantiation.MissingParentheses
tests/fixed/binary_operators.php
was added to ensure the behaviour of a new rule:PSR12.Operators.OperatorSpacing
(will close implement new sniff to force spaces after=
#123, Add sniff to ensure spaces around binary operators #126 as well Add custom sniffs to address spacing of operators #134 if approved)