Unverified Commit f48180be authored by Alex Pott's avatar Alex Pott Committed by GitHub
Browse files

feat(VariableAnalysis): Use sirbrillig/phpcs-variable-analysis (#3119378 by alexpott)

parent 7385c9df
Loading
Loading
Loading
Loading
+11 −2340

File changed.

Preview size limit exceeded, changes collapsed.

+7 −1
Original line number Diff line number Diff line
@@ -12,9 +12,15 @@
    <exclude-pattern>*</exclude-pattern>
  </rule>

  <rule ref="DrupalPractice.CodeAnalysis.VariableAnalysis.UndefinedVariable">
  <rule ref="DrupalPractice.CodeAnalysis.VariableAnalysis">
    <!-- Do not run this sniff on template files. -->
    <exclude-pattern>*.tpl.php</exclude-pattern>
    <properties>
      <property name="allowUnusedFunctionParameters" value="true"/>
    </properties>
  </rule>
  <rule ref="DrupalPractice.CodeAnalysis.VariableAnalysis.UndefinedVariable">
    <severity>0</severity>
  </rule>

  <!-- Ignore various version control directories. -->
+2 −1
Original line number Diff line number Diff line
@@ -17,7 +17,8 @@
        "php": ">=7.0.8",
        "ext-mbstring": "*",
        "squizlabs/php_codesniffer": "^3.5.5",
        "symfony/yaml": ">=2.0.5"
        "symfony/yaml": ">=2.0.5",
        "sirbrillig/phpcs-variable-analysis": "^2.8"
    },
    "autoload": {
        "psr-4": {
+2 −1
Original line number Diff line number Diff line
@@ -17,7 +17,8 @@
        "php": ">=7.0.8",
        "ext-mbstring": "*",
        "squizlabs/php_codesniffer": "^3.5.5",
        "symfony/yaml": ">=2.0.5"
        "symfony/yaml": ">=2.0.5",
        "sirbrillig/phpcs-variable-analysis": "^2.8"
    },
    "autoload": {
        "psr-4": {
+14 −0
Original line number Diff line number Diff line
@@ -51,3 +51,17 @@ function test6() {

  return [$a, $b, $x, $y];
}

$hospitals = [];
$simplified = [];
array_map(function ($item) use (&$simplified) {
  $simplified[$item['nid']] = preg_replace('/^www./', '', $item['domain']);
}, $hospitals);

foreach ($hospitals as $id => $hospital) {
  print $hospital;
}

foreach ($hospitals as $i => list($event_name, $description)) {
  $names[$i] = $event_name;
}