Skip to content

Instantly share code, notes, and snippets.

@vishwac09
Created March 3, 2022 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vishwac09/0c0bf4f1a877b995dce2cf6895848820 to your computer and use it in GitHub Desktop.
Save vishwac09/0c0bf4f1a877b995dce2cf6895848820 to your computer and use it in GitHub Desktop.
ExtendedPHPGuideline
<?php
// Violates Import order nto gouped.
use Auth0\SDK\Auth0;
use Drupal\my_custom_module_1\Service\UserService;
use Drupal\my_custom_module_1\Entity\UserEntity;
use Drupal\my_custom_module_2\Service\MessageService;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Field\FieldItemList;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
use Auth0\SDK\Auth0;
use Dompdf\Adapter\CPDF;
use JsonSchema\Validator;
class K {
public static function abcd() {}
public static function pqrs() {
self::abcd();
}
}
class ABC {
public function a(){
// Violates Static class reference.
K::pqrs();
}
// Violates order of methods not in order.
public function d(){}
// Violates order of methods not in order.
public function c() {}
}
interface ABL {
// Violates order of methods not in order.
public function z();
// Violates order of methods not in order.
public function x();
}
trait ezcReflectionReturnInfo {
function getReturnDescription() { /*2*/ }
function getReturnType() { /*1*/ }
}
// Repace switch with match for php 8.0
switch (1) {
default:
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment