N°4756 - Improve PHPDoc and type hints

This commit is contained in:
Molkobain
2022-12-20 10:55:56 +01:00
parent a668b92051
commit 5cb2f19ea0
2 changed files with 129 additions and 47 deletions

View File

@@ -5644,115 +5644,124 @@ JS
}
/**
* @return void
* @inheritDoc
* @throws \CoreException
*/
final protected function EventInsertRequested()
final protected function EventInsertRequested(): void
{
$this->FireEvent(EVENT_SERVICE_DB_INSERT_REQUESTED);
}
/**
* @return void
* @inheritDoc
* @throws \CoreException
*/
final protected function EventInsertBefore()
final protected function EventInsertBefore(): void
{
$this->FireEvent(EVENT_SERVICE_DB_ABOUT_TO_INSERT);
}
/**
* @return void
* @inheritDoc
* @throws \CoreException
*/
final protected function EventInsertAfter()
final protected function EventInsertAfter(): void
{
$this->FireEvent(EVENT_SERVICE_DB_INSERT_DONE);
}
final protected function EventComputeValues()
/**
* @inheritDoc
* @throws \CoreException
*/
final protected function EventComputeValues(): void
{
$this->FireEvent(EVENT_SERVICE_DB_COMPUTE_VALUES);
}
/**
* @return void
* @inheritDoc
* @throws \CoreException
*/
final protected function EventCheckToWrite()
final protected function EventCheckToWrite(): void
{
$this->FireEvent(EVENT_SERVICE_DB_CHECK_TO_WRITE);
}
/**
* @return void
* @inheritDoc
* @throws \CoreException
*/
final protected function EventCheckToDelete()
final protected function EventCheckToDelete(): void
{
$this->FireEvent(EVENT_SERVICE_DB_CHECK_TO_DELETE);
}
/**
* @return void
* @inheritDoc
* @throws \CoreException
*/
final protected function EventUpdateRequested()
final protected function EventUpdateRequested(): void
{
$this->FireEvent(EVENT_SERVICE_DB_UPDATE_REQUESTED);
}
/**
* @return void
* @inheritDoc
* @throws \CoreException
*/
final protected function EventUpdateBefore()
final protected function EventUpdateBefore(): void
{
$this->FireEvent(EVENT_SERVICE_DB_ABOUT_TO_UPDATE);
}
/**
* @param array $aEventData
*
* @return void
* @inheritDoc
* @throws \CoreException
*/
final protected function EventUpdateAfter(array $aEventData)
final protected function EventUpdateAfter(array $aEventData): void
{
$this->FireEvent(EVENT_SERVICE_DB_UPDATE_DONE, $aEventData);
}
/**
* @return void
* @inheritDoc
* @throws \CoreException
*/
final protected function EventDeleteBefore()
final protected function EventDeleteBefore(): void
{
$this->FireEvent(EVENT_SERVICE_DB_ABOUT_TO_DELETE);
}
/**
* @return void
* @inheritDoc
* @throws \CoreException
*/
final protected function EventDeleteAfter()
final protected function EventDeleteAfter(): void
{
$this->FireEvent(EVENT_SERVICE_DB_DELETE_DONE);
}
final protected function EventArchive()
/**
* @inheritDoc
* @throws \CoreException
*/
final protected function EventArchive(): void
{
$this->FireEvent(EVENT_SERVICE_DB_ARCHIVE);
}
final protected function EventUnarchive()
/**
* @inheritDoc
* @throws \CoreException
*/
final protected function EventUnarchive(): void
{
$this->FireEvent(EVENT_SERVICE_DB_UNARCHIVE);
}
/**
* Append attribute flags
* Append $iFlags to $sAttCode attribute in $sTargetState
*
* @param string $sAttCode
* @param int $iFlags
@@ -5762,7 +5771,7 @@ JS
* @return void
* @since 3.1.0
*/
final public function AddAttributeFlags(string $sAttCode, int $iFlags, string $sTargetState = '', string $sReason = null)
final public function AddAttributeFlags(string $sAttCode, int $iFlags, string $sTargetState = '', string $sReason = null): void
{
if (!isset($this->aAttributesFlags[$sTargetState])) {
$this->aAttributesFlags[$sTargetState] = [];
@@ -5774,7 +5783,7 @@ JS
}
/**
* Force attribute state
* Force $iFlags to $sAttCode attribute in $sTargetState
*
* @param string $sAttCode
* @param int $iFlags
@@ -5784,7 +5793,7 @@ JS
* @return void
* @since 3.1.0
*/
final public function ForceAttributeFlags(string $sAttCode, int $iFlags, string $sTargetState = '', string $sReason = null)
final public function ForceAttributeFlags(string $sAttCode, int $iFlags, string $sTargetState = '', string $sReason = null): void
{
if (!isset($this->aAttributesFlags[$sTargetState])) {
$this->aAttributesFlags[$sTargetState] = [];
@@ -5795,6 +5804,10 @@ JS
}
}
/**
* @inheritDoc
* @throws \CoreException
*/
final protected function GetExtensionsAttributeFlags(string $sAttCode, array &$aReasons, string $sTargetState): int
{
if (!isset($this->aAttributesFlags[$sTargetState])) {
@@ -5812,7 +5825,7 @@ JS
/**
* Append attribute flags
* Append $iFlags to $sAttCode attribute in initial state
*
* @param string $sAttCode
* @param int $iFlags
@@ -5833,7 +5846,7 @@ JS
}
/**
* Force attribute state
* Force $iFlags to $sAttCode attribute in initial state
*
* @param string $sAttCode
* @param int $iFlags
@@ -5853,6 +5866,10 @@ JS
}
}
/**
* @inheritDoc
* @throws \CoreException
*/
final protected function GetExtensionsInitialStateAttributeFlags(string $sAttCode, array &$aReasons): int
{
if (!isset($this->aInitialAttributesFlags)) {

View File

@@ -5844,13 +5844,15 @@ abstract class DBObject implements iDisplay
}
/**
* @param $sEvent
* @param string $sEvent
* @param array $aEventData
* @return void
*
* @throws \CoreException
* @throws \Exception
* @since 3.1.0
*/
public function FireEvent($sEvent, $aEventData = array())
public function FireEvent(string $sEvent, array $aEventData = array()): void
{
if (EventService::IsEventRegistered($sEvent)) {
$aEventData['debug_info'] = 'from: '.get_class($this).':'.$this->GetKey();
@@ -5863,64 +5865,127 @@ abstract class DBObject implements iDisplay
}
}
protected function EventInsertRequested()
/**
* @return void
* @since 3.1.0
*/
protected function EventInsertRequested(): void
{
}
protected function EventInsertBefore()
/**
* @return void
* @since 3.1.0
*/
protected function EventInsertBefore(): void
{
}
protected function EventInsertAfter()
protected function EventInsertAfter(): void
{
}
protected function EventComputeValues()
/**
* @return void
* @since 3.1.0
*/
protected function EventComputeValues(): void
{
}
protected function EventCheckToWrite()
/**
* @return void
* @since 3.1.0
*/
protected function EventCheckToWrite(): void
{
}
protected function EventCheckToDelete()
/**
* @return void
* @since 3.1.0
*/
protected function EventCheckToDelete(): void
{
}
protected function EventUpdateRequested()
/**
* @return void
* @since 3.1.0
*/
protected function EventUpdateRequested(): void
{
}
protected function EventUpdateBefore()
/**
* @return void
* @since 3.1.0
*/
protected function EventUpdateBefore(): void
{
}
protected function EventUpdateAfter(array $aEventData)
/**
* @return void
* @since 3.1.0
*/
protected function EventUpdateAfter(array $aEventData): void
{
}
protected function EventDeleteBefore()
/**
* @return void
* @since 3.1.0
*/
protected function EventDeleteBefore(): void
{
}
protected function EventDeleteAfter()
/**
* @return void
* @since 3.1.0
*/
protected function EventDeleteAfter(): void
{
}
protected function EventArchive()
/**
* @return void
* @since 3.1.0
*/
protected function EventArchive(): void
{
}
protected function EventUnarchive()
/**
* @return void
* @since 3.1.0
*/
protected function EventUnarchive(): void
{
}
/**
* @param string $sAttCode
* @param array $aReasons
* @param string $sTargetState
*
* @return int
* @since 3.1.0
*/
protected function GetExtensionsAttributeFlags(string $sAttCode, array &$aReasons, string $sTargetState): int
{
return 0;
}
/**
* @param string $sAttCode
* @param array $aReasons
*
* @return int
* @since 3.1.0
*/
protected function GetExtensionsInitialStateAttributeFlags(string $sAttCode, array &$aReasons): int
{
return 0;