These rules are adopted from the AngularJS commit conventions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Populate organisation with given already existing user list. | |
* | |
* @param array $userList | |
* | |
* @return \Doctrine\Common\Collections\ArrayCollection | |
*/ | |
private function populateUsers(array $userList): ArrayCollection | |
{ | |
$collection = new ArrayCollection(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class LaBase { | |
// private function foobar() {return true;} | |
// public function foobar() {return true;} | |
} | |
class NoMagic extends LaBase { | |
function isParentFoobarCallable() { | |
return is_callable('parent::foobar'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
final class Money | |
{ | |
public $coin2; | |
public $billet5; | |
public $billet10; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$first = 0; | |
$second = 1; | |
$current = 1; | |
$tableau = []; | |
$nbToFound = 51; | |
for ($i = 0; $i <= $nbToFound; $i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tools: | |
php_mess_detector: | |
config: | |
code_size_rules: { cyclomatic_complexity: true, npath_complexity: true, excessive_method_length: true, excessive_class_length: true, excessive_parameter_list: true, excessive_public_count: true, too_many_fields: true, too_many_methods: true, excessive_class_complexity: true } | |
design_rules: { number_of_class_children: true, depth_of_inheritance: true, coupling_between_objects: true } | |
unused_code_rules: { unused_local_variable: true, unused_private_method: true, unused_formal_parameter: true } | |
naming_rules: { short_variable: true, long_variable: true, short_method: true, boolean_method_name: true } | |
controversial_rules: { camel_case_class_name: true, camel_case_property_name: true, camel_case_method_name: true, camel_case_parameter_name: true, camel_case_variable_name: true } | |
php_cs_fixer: | |
config: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filter: | |
paths: | |
- 'module/*' | |
tools: | |
php_mess_detector: | |
config: | |
code_size_rules: { cyclomatic_complexity: true, npath_complexity: true, excessive_method_length: true, excessive_class_length: true, excessive_parameter_list: true, excessive_public_count: true, too_many_fields: true, too_many_methods: true, excessive_class_complexity: true } | |
design_rules: { number_of_class_children: true, depth_of_inheritance: true, coupling_between_objects: true } | |
unused_code_rules: { unused_local_variable: true, unused_private_method: true, unused_formal_parameter: true } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\my_dummy_module; | |
use Drupal\Core\DependencyInjection\ContainerInjectionInterface; | |
use Drupal\Core\Session\AccountInterface; | |
use Symfony\Component\DependencyInjection\ContainerInterface; | |
/** | |
* Manipulates entity type information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\ton_module\Ajax; | |
use Drupal\Core\Ajax\CommandInterface; | |
/** | |
* Provides an AJAX command .... | |
* | |
* This command is implemented in Drupal.AjaxCommands.prototype.ajaxRedirect. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$field_updated = &$form['YOUR_FIELD_NAME']; | |
$field_state = \Drupal\Core\Field\WidgetBase::getWidgetState($form['#parents'], $field_updated['widget']['#field_name'], $form_state); | |
// You can change number of item to control the number of items we can change it with another field value into $form_state. | |
if ($field_state['items_count'] >= 2) { | |
$field_updated['widget']['add_more']['#access'] = FALSE; | |
} | |
$form['YOUR_FIELD_NAME'] = $field_updated; |
NewerOlder