Skip to content

Commit

Permalink
MDL-63020 xmldb: Improve PHPdoc comments for better IDE autocomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
timhunt committed Sep 20, 2018
1 parent 02a31d5 commit 8f76f17
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 22 deletions.
2 changes: 1 addition & 1 deletion lib/ddl/sql_generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ public function getNameForObject($tablename, $fields, $suffix='') {
* if it's a reserved word
*
* @param string|array $input String to quote.
* @return string Quoted string.
* @return string|array Quoted string.
*/
public function getEncQuoted($input) {

Expand Down
4 changes: 3 additions & 1 deletion lib/ddl/tests/ddl_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
defined('MOODLE_INTERNAL') || die();

class core_ddl_testcase extends database_driver_testcase {
/** @var xmldb_table[] keys are table name. Created in setUp. */
private $tables = array();
private $records= array();
/** @var array table name => array of stdClass test records loaded into that table. Created in setUp. */
private $records = array();

protected function setUp() {
parent::setUp();
Expand Down
2 changes: 1 addition & 1 deletion lib/dml/moodle_database.php
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,7 @@ public abstract function get_indexes($table);
* Returns detailed information about columns in table. This information is cached internally.
* @param string $table The table's name.
* @param bool $usecache Flag to use internal cacheing. The default is true.
* @return array of database_column_info objects indexed with column names
* @return database_column_info[] of database_column_info objects indexed with column names
*/
public abstract function get_columns($table, $usecache=true);

Expand Down
2 changes: 1 addition & 1 deletion lib/xmldb/xmldb_index.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ public function readableInfo() {
*/
public function validateDefinition(xmldb_table $xmldb_table=null) {
if (!$xmldb_table) {
return 'Invalid xmldb_index->validateDefinition() call, $xmldb_table si required.';
return 'Invalid xmldb_index->validateDefinition() call, $xmldb_table is required.';
}

$total = 0;
Expand Down
36 changes: 18 additions & 18 deletions lib/xmldb/xmldb_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@

class xmldb_table extends xmldb_object {

/** @var array table columns */
/** @var xmldb_field[] table columns */
protected $fields;

/** @var array keys */
/** @var xmldb_key[] keys */
protected $keys;

/** @var array indexes */
/** @var xmldb_index[] indexes */
protected $indexes;

/**
Expand Down Expand Up @@ -239,23 +239,23 @@ public function addIndex($index, $after=null) {

/**
* This function will return the array of fields in the table
* @return array
* @return xmldb_field[]
*/
public function getFields() {
return $this->fields;
}

/**
* This function will return the array of keys in the table
* @return array
* @return xmldb_key[]
*/
public function getKeys() {
return $this->keys;
}

/**
* This function will return the array of indexes in the table
* @return array
* @return xmldb_index[]
*/
public function getIndexes() {
return $this->indexes;
Expand All @@ -264,7 +264,7 @@ public function getIndexes() {
/**
* Returns one xmldb_field
* @param string $fieldname
* @return mixed
* @return xmldb_field|null
*/
public function getField($fieldname) {
$i = $this->findFieldInArray($fieldname);
Expand All @@ -277,7 +277,7 @@ public function getField($fieldname) {
/**
* Returns the position of one field in the array.
* @param string $fieldname
* @return mixed
* @return int|null index of the field, or null if not found.
*/
public function findFieldInArray($fieldname) {
foreach ($this->fields as $i => $field) {
Expand All @@ -290,7 +290,7 @@ public function findFieldInArray($fieldname) {

/**
* This function will reorder the array of fields
* @return bool
* @return bool whether the reordering succeeded.
*/
public function orderFields() {
$result = $this->orderElements($this->fields);
Expand All @@ -305,7 +305,7 @@ public function orderFields() {
/**
* Returns one xmldb_key
* @param string $keyname
* @return mixed
* @return xmldb_key|null
*/
public function getKey($keyname) {
$i = $this->findKeyInArray($keyname);
Expand All @@ -318,7 +318,7 @@ public function getKey($keyname) {
/**
* Returns the position of one key in the array.
* @param string $keyname
* @return mixed
* @return int|null index of the key, or null if not found.
*/
public function findKeyInArray($keyname) {
foreach ($this->keys as $i => $key) {
Expand All @@ -331,7 +331,7 @@ public function findKeyInArray($keyname) {

/**
* This function will reorder the array of keys
* @return bool
* @return bool whether the reordering succeeded.
*/
public function orderKeys() {
$result = $this->orderElements($this->keys);
Expand All @@ -346,7 +346,7 @@ public function orderKeys() {
/**
* Returns one xmldb_index
* @param string $indexname
* @return mixed
* @return xmldb_index|null
*/
public function getIndex($indexname) {
$i = $this->findIndexInArray($indexname);
Expand All @@ -359,7 +359,7 @@ public function getIndex($indexname) {
/**
* Returns the position of one index in the array.
* @param string $indexname
* @return mixed
* @return int|null index of the index, or null if not found.
*/
public function findIndexInArray($indexname) {
foreach ($this->indexes as $i => $index) {
Expand All @@ -372,7 +372,7 @@ public function findIndexInArray($indexname) {

/**
* This function will reorder the array of indexes
* @return bool
* @return bool whether the reordering succeeded.
*/
public function orderIndexes() {
$result = $this->orderElements($this->indexes);
Expand All @@ -386,23 +386,23 @@ public function orderIndexes() {

/**
* This function will set the array of fields in the table
* @param array $fields
* @param xmldb_field[] $fields
*/
public function setFields($fields) {
$this->fields = $fields;
}

/**
* This function will set the array of keys in the table
* @param array $keys
* @param xmldb_key[] $keys
*/
public function setKeys($keys) {
$this->keys = $keys;
}

/**
* This function will set the array of indexes in the table
* @param array $indexes
* @param xmldb_index[] $indexes
*/
public function setIndexes($indexes) {
$this->indexes = $indexes;
Expand Down

0 comments on commit 8f76f17

Please sign in to comment.