Encourage more usage of PHP Interfaces in Drupal Better Core. Better Modules. Better Drupal. Chris Charlton - XTND.US - http://xtnd.us
Jun 14, 2015
Encourage more usage of PHP Interfaces in DrupalBetter Core. Better Modules. Better Drupal.
Chris Charlton - XTND.US - http://xtnd.us
PHP Interfaces implements
Maps out required functions a Class file implements.
Multiple Interfaces allowed per Class file.
Can be extended using the extends operator.
Prevents errors and misspellings of functions/hooks.
Smart IDE software use Interface files as blueprints.
PHP Interfaces usage example
<?php
/** * Query builder for SELECT statements. */class SelectQuery extends Query implements SelectQueryInterface { // ...}
Interfaces used in over 20 instances of Drupal 7 core
Queries & DB Engine
Queues
File transfers
class Drupal implements IDrupal
Attract OOP-based followers (PHP, Java, etc.).
Represents a level of code maturity (and complexity).
Next-gen Module / Theme Engine development?
Might be too soon for Drupal. D9? D10?