Skip to content

Commit

Permalink
Add some typehints
Browse files Browse the repository at this point in the history
  • Loading branch information
flack committed Mar 21, 2024
1 parent 79b6350 commit a6245c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/org/openpsa/invoices/calculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class org_openpsa_invoices_calculator

private org_openpsa_invoices_invoice_dba $_invoice;

public function process_deliverable(org_openpsa_sales_salesproject_deliverable_dba $deliverable, $cycle_number = null)
public function process_deliverable(org_openpsa_sales_salesproject_deliverable_dba $deliverable, int $cycle_number = null)
{
$this->_deliverable = $deliverable;
// Recalculate price to catch possible unit changes
Expand Down Expand Up @@ -68,7 +68,7 @@ public function get_invoice() : org_openpsa_invoices_invoice_dba
* as deliverables) for different types of work. Instead of sending the customer
* one invoice per hourly rate per month, one composite invoice for all fees is generated
*/
private function _probe_invoice($cycle_number) : org_openpsa_invoices_invoice_dba
private function _probe_invoice(?int $cycle_number) : org_openpsa_invoices_invoice_dba
{
$item_mc = org_openpsa_invoices_invoice_item_dba::new_collector('deliverable.salesproject', $this->_deliverable->salesproject);
$item_mc->add_constraint('invoice.sent', '=', 0);
Expand All @@ -91,7 +91,7 @@ private function _probe_invoice($cycle_number) : org_openpsa_invoices_invoice_db
return $this->_create_invoice($cycle_number);
}

private function _create_invoice($cycle_number) : org_openpsa_invoices_invoice_dba
private function _create_invoice(?int $cycle_number) : org_openpsa_invoices_invoice_dba
{
$salesproject = new org_openpsa_sales_salesproject_dba($this->_deliverable->salesproject);
$invoice = new org_openpsa_invoices_invoice_dba();
Expand Down
6 changes: 3 additions & 3 deletions lib/org/openpsa/invoices/scheduler.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct(org_openpsa_sales_salesproject_deliverable_dba $deli
* The subscription cycles rely on midcom.services.at. I'm not sure if it is wise to rely on it for such
* a totally mission critical part of OpenPSA. Some safeguards might be wise to add.
*/
public function run_cycle($cycle_number, bool $send_invoice = true) : bool
public function run_cycle(int $cycle_number, bool $send_invoice = true) : bool
{
if (time() < $this->_deliverable->start) {
debug_add('Subscription hasn\'t started yet, register the start-up event to $start');
Expand Down Expand Up @@ -114,7 +114,7 @@ public function run_cycle($cycle_number, bool $send_invoice = true) : bool
return true;
}

private function _create_at_entry($cycle_number, int $start) : bool
private function _create_at_entry(int $cycle_number, int $start) : bool
{
$args = [
'deliverable' => $this->_deliverable->guid,
Expand Down Expand Up @@ -355,7 +355,7 @@ private function _add_month(Datetime $orig, int $offset) : DateTime
return $new_date;
}

public function get_cycle_start($cycle_number, int $time)
public function get_cycle_start(int $cycle_number, int $time)
{
if ($cycle_number == 1) {
if ($this->subscription_day) {
Expand Down

0 comments on commit a6245c6

Please sign in to comment.