Problem/Motivation

In #2248463: Require a blank line after <?php, the community has agreed to adopt the standard that a blank line should be required after <?php opening tags.

Proposed resolution

Patch core to be compliant with the new rule during the 8.2.x RC phase.

Command to fix core will be something like:

phpcbf -s -p --standard=Drupal --extensions='php,module,inc,install,test,profile' --sniffs='Drupal.WhiteSpace.OpenTagNewline' ./core

The diff will enable the rule in phpcs.xml.dist and then following that be something like:

diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index ec12097..42f8fab 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @file
  * Functions that need to be loaded on every Drupal request.
diff --git a/core/lib/Drupal/Component/Assertion/Handle.php b/core/lib/Drupal/Component/Assertion/Handle.php
index dd9911e..043d41e 100644
--- a/core/lib/Drupal/Component/Assertion/Handle.php
+++ b/core/lib/Drupal/Component/Assertion/Handle.php
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @file
  * Contains \Drupal\Component\Assertion\Handle.
diff --git a/core/modules/color/color.module b/core/modules/color/color.module
index ca0dc3a..1dbc1da 100644
--- a/core/modules/color/color.module
+++ b/core/modules/color/color.module
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @file
  * Allows users to change the color scheme of themes.
diff --git a/core/modules/field/field.module b/core/modules/field/field.module
index 053ab4a..8133007 100644
--- a/core/modules/field/field.module
+++ b/core/modules/field/field.module
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @file
  * Attach custom data fields to Drupal entities.
diff --git a/core/modules/migrate/tests/src/Unit/process/GetTest.php b/core/modules/migrate/tests/src/Unit/process/GetTest.php
index 316cbfc..ae24d98 100644
--- a/core/modules/migrate/tests/src/Unit/process/GetTest.php
+++ b/core/modules/migrate/tests/src/Unit/process/GetTest.php
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @file
  * Contains \Drupal\Tests\migrate\Unit\process\GetTest.
diff --git a/core/modules/search/tests/modules/search_langcode_test/search_langcode_test.module b/core/modules/search/tests/modules/search_langcode_test/search_langcode_test.module
index cb2a27d..c7d9624 100644
--- a/core/modules/search/tests/modules/search_langcode_test/search_langcode_test.module
+++ b/core/modules/search/tests/modules/search_langcode_test/search_langcode_test.module
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @file
  * Test module setting up two tests, one for checking if the entity $langcode is
diff --git a/core/profiles/minimal/minimal.install b/core/profiles/minimal/minimal.install
index d30cb3b..b9aab3c 100644
--- a/core/profiles/minimal/minimal.install
+++ b/core/profiles/minimal/minimal.install
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @file
  * Install, update and uninstall functions for the minimal installation profile.
diff --git a/core/profiles/standard/standard.install b/core/profiles/standard/standard.install
index 841c10b..0a40ce6 100644
--- a/core/profiles/standard/standard.install
+++ b/core/profiles/standard/standard.install
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @file
  * Install, update and uninstall functions for the standard installation profile.
diff --git a/core/profiles/standard/standard.profile b/core/profiles/standard/standard.profile
index 4ea7656..e3fb930 100644
--- a/core/profiles/standard/standard.profile
+++ b/core/profiles/standard/standard.profile
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @file
  * Enables modules and site configuration for a standard site installation.
diff --git a/core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php b/core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php
index 6042b6f..1299cd6 100644
--- a/core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php
+++ b/core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @file
  * Contains \Drupal\Tests\Component\Assertion\InspectorTest.
diff --git a/core/tests/Drupal/Tests/Core/Mail/MailManagerTest.php b/core/tests/Drupal/Tests/Core/Mail/MailManagerTest.php
index cff3415..d802374 100644
--- a/core/tests/Drupal/Tests/Core/Mail/MailManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Mail/MailManagerTest.php
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @file
  * Contains \Drupal\Tests\Core\Mail\MailManagerTest.

Remaining tasks

CommentFileSizeAuthor
#6 2755677_6.patch3.86 KBMile23
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

xjm created an issue. See original summary.

xjm’s picture

Issue summary: View changes
David_Rothstein’s picture

Issue tags: +Needs backport to D7

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

xjm’s picture

Version: 8.3.x-dev » 8.2.x-dev
Status: Postponed » Active

We can start making this patch now; it's soon!

Mile23’s picture

Title: Adopt standard to require a blank line after <?php during 8.2.x RC » Fix 'Drupal.WhiteSpace.OpenTagNewline' coding standard during 8.2.x RC
Status: Active » Needs review
Parent issue: #2248463: Require a blank line after <?php » #2571965: [meta] Fix PHP coding standards in core
Related issues: +#2248463: Require a blank line after <?php
FileSize
3.86 KB

Easy peasy.

klausi’s picture

Status: Needs review » Reviewed & tested by the community

Looks good, I executed phpcs after the patch and did not get any remaining errors for this sniff.

alexpott’s picture

Title: Fix 'Drupal.WhiteSpace.OpenTagNewline' coding standard during 8.2.x RC » Fix 'Drupal.WhiteSpace.OpenTagNewline' coding standard
Status: Reviewed & tested by the community » Fixed

Committed and pushed 7125a80 to 8.3.x and 4811877 to 8.2.x. Thanks!

  • alexpott committed 7125a80 on 8.3.x
    Issue #2755677 by Mile23: Fix 'Drupal.WhiteSpace.OpenTagNewline' coding...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.