Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/AbraFlexi/RO.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ class RO extends \Ease\Sand
* Class for read only interaction with AbraFlexi.
*
* @param mixed $init default record id or initial data. See processInit()
* @param array<string, int|string|true> $options Connection settings and other options override
* @param array<string, mixed> $options Connection settings and other options override
*/
public function __construct($init = null, $options = [])
{
Expand Down
2 changes: 1 addition & 1 deletion src/AbraFlexi/RW.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class RW extends RO
/**
* SetUp Object to be ready for work.
*
* @param array $options Object Options (authSessionId,user,password,
* @param array<mixed> $options Object Options (authSessionId,user,password,
* url,company,evidence,companyUrl
* prefix,defaultUrlParams,debug,ver,dry-run
* detail,offline,atomic,filter,ignore404
Expand Down
6 changes: 6 additions & 0 deletions src/AbraFlexi/Relations.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class Relations

/**
* Evidence adresar (Adresy firem) Relations.
*
* @var array<string,array<string,string>>
*/
public static array $adresar = [
'odberatele' => [
Expand Down Expand Up @@ -94,6 +96,8 @@ class Relations

/**
* Evidence atribut (Atributy) Relations.
*
* @var array<string,array<string,string>>
*/
public static array $atribut = [
'uzivatelske-vazby' => [
Expand All @@ -105,6 +109,8 @@ class Relations

/**
* Evidence autotisk (Automatický tisk) Relations.
*
* @var array<string,array<string,string>>
*/
public static array $autotisk = [
'uzivatelske-vazby' => [
Expand Down
12 changes: 7 additions & 5 deletions src/AbraFlexi/Stitek.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Stitek extends RW
{
/**
* Evidence Path for vsb supported by label.
* @var array<string,string>
*/
public static array $vsbToEvidencePath = [
'vsbAdr' => 'adresar', // Adresář
Expand Down Expand Up @@ -56,7 +57,8 @@ class Stitek extends RW
/**
* Convert coma-separated list to array.
*
* @param array|string $listRaw
* @param array<mixed>|string $listRaw
* @return array<mixed>
*/
public static function listToArray($listRaw): array
{
Expand All @@ -80,7 +82,7 @@ public static function listToArray($listRaw): array
*
* @param RO $object
*
* @return array
* @return array<mixed>
*/
public static function getAvailableLabels($object)
{
Expand Down Expand Up @@ -112,8 +114,8 @@ public static function getAvailableLabels($object)
* Create New Label for given evidences.
*
* @param string $name Label Name
* @param array $evidences Evidence code list ex: ['faktura-vydana','faktura-prijata']
* @param array $options Additional Label properties ex: ['kod'=>'EXAMPLE','skupVybKlic'=>'SKUPINA_STITKU']
* @param array<mixed> $evidences Evidence code list ex: ['faktura-vydana','faktura-prijata']
* @param array<mixed> $options Additional Label properties ex: ['kod'=>'EXAMPLE','skupVybKlic'=>'SKUPINA_STITKU']
*
* @return bool success
*/
Expand All @@ -129,7 +131,7 @@ public function createNew($name, $evidences, $options = []): bool
}

if (!\array_key_exists('kod', $options)) {
$this->setDataValue('kod', self::code($name));
$this->setDataValue('kod', \AbraFlexi\Functions::code($name));
}

$this->setDataValue('nazev', $name);
Expand Down
9 changes: 6 additions & 3 deletions src/AbraFlexi/Zurnal.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@ class Zurnal extends RO
* Evidence užitá objektem.
*/
public ?string $evidence = 'zurnal';
/**
* @var array<string,string>
*/
public static array $evidenceToDb = ['faktura-vydana' => 'ddoklfak'];

/**
* Class for read only interaction with AbraFlexi.
*
* @param mixed $init default record id or initial data
* @param array $options Connection settings and other options override
* @param array<mixed> $options Connection settings and other options override
*/
public function __construct($init = null, $options = [])
{
Expand All @@ -60,7 +63,7 @@ public function __construct($init = null, $options = [])
*
* @param RO $object
*
* @return array changes history
* @return array<mixed> changes history
*/
public function getAllChanges($object)
{
Expand Down Expand Up @@ -88,7 +91,7 @@ public function getAllChanges($object)
*
* @param RO $object
*
* @return array Old/New values pairs
* @return array<mixed> Old/New values pairs
*/
public function getLastChange($object)
{
Expand Down
2 changes: 1 addition & 1 deletion src/AbraFlexi/firma.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ trait firma
/**
* Instance of Adresar( $this->getDataValue('firma') ).
*
* @param array $options for new Object
* @param array<mixed> $options for new Object
*
* @return Adresar
*/
Expand Down
2 changes: 1 addition & 1 deletion src/AbraFlexi/getChanges.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ trait getChanges
/**
* Obtain Chaneges from Journal.
*
* @return array Changes obtained
* @return array<mixed> Changes obtained
*/
public function getChanges()
{
Expand Down
2 changes: 1 addition & 1 deletion src/AbraFlexi/kod.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ trait kod
*/
public function _getRecordCode()
{
return empty($this->getDataValue('kod')) ? null : self::code($this->getDataValue('kod'));
return empty($this->getDataValue('kod')) ? null : \AbraFlexi\Functions::code($this->getDataValue('kod'));
}
Comment on lines 34 to 37
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Switch to Functions::code() fixes the call-site, but watch deprecation and nullability

Delegating _getRecordCode() to \AbraFlexi\Functions::code() will resolve the previous self::code(...) static-analysis issue, but there are two follow‑ups worth addressing:

  • Functions::code() is marked as deprecated in its own PHPDoc; longer term it would be better to align this method with RO::getRecordCode() and use the Code helper (for example, Code::ensure(...)) so all code paths share the same, non‑deprecated implementation.
  • The docblock declares @return string, but the method actually returns null when 'kod' is empty. Consider updating the PHPDoc (and, if you add a return type, using ?string) to keep the contract honest.

These are small inconsistencies, but fixing them will make PHPStan happier and keep the API clearer.

🤖 Prompt for AI Agents
In src/AbraFlexi/kod.php around lines 34-37, the method delegates to deprecated
\AbraFlexi\Functions::code() and its docblock promises string but actually may
return null; replace the call with the non-deprecated Code helper (e.g. use
Code::ensure(...) or delegate to RO::getRecordCode() to match other paths) and
update the PHPDoc to reflect nullable return (change @return string to @return
string|null) and, if you add an explicit return type, make it ?string so the
signature matches the actual nullability.

}
4 changes: 2 additions & 2 deletions src/AbraFlexi/stitky.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ trait stitky
/**
* Get all labels for current record.
*
* @return array
* @return array<mixed>
*/
public function getLabels()
{
Expand All @@ -50,7 +50,7 @@ public function setLabel($label)
/**
* UnSet Label for Current Object record.
*
* @param array|string $labelsToRemove Label/Labels
* @param array<mixed>|string $labelsToRemove Label/Labels
*
* @return bool success result ?
*/
Expand Down
3 changes: 2 additions & 1 deletion src/AbraFlexi/subItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ trait subItems
/**
* Subitems - ex. items of invoice.
*
* @return array of document items or null
* @return array<mixed> of document items or null
*/
public function getSubItems()
{
return $this->getDataValue($this->getSubmenuName());
}

/**
* @param array<mixed> $subitems
* @return bool
*/
public function setSubitems(array $subitems)
Expand Down
4 changes: 2 additions & 2 deletions src/AbraFlexi/sum.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ trait sum
/**
* Vrací z AbraFlexi sumaci i podle podmínek.
*
* @param array $conditions pole podmínek nebo ID záznamu
* @param array<mixed> $conditions
*
* @return array
* @return array<mixed>
*/
public function getSumFromAbraFlexi($conditions = [])
{
Expand Down