Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ff553e0
phpstan.neon: Remove now superfluous `scanDirectories`
sukhwinder33445 Dec 10, 2025
8ce944b
Fix Unit test warning about undefined property
sukhwinder33445 Dec 11, 2025
475ab27
Add types in classes that are not extended
Jan-Schuppik Dec 8, 2025
f8acc1c
Add types in Contract\Translator interface
Jan-Schuppik Dec 8, 2025
25ec156
Add types in Filters trait
Jan-Schuppik Dec 8, 2025
b7a19a0
Add types in Filter/Chain
Jan-Schuppik Dec 8, 2025
10f73e8
Add types in Filter/Condition
Jan-Schuppik Dec 8, 2025
e85a1da
Add types in Filter/MetaData
Jan-Schuppik Dec 8, 2025
ead06b6
Add types in Filter/MetaDataProvider interface
Jan-Schuppik Dec 8, 2025
b0c7d2e
Add types in Contract/Filterable interface
Jan-Schuppik Dec 8, 2025
d8e4964
Add types in Contract/Pagination interface
Jan-Schuppik Dec 8, 2025
f270417
Add types in Contract/PluginLoader interface
Jan-Schuppik Dec 8, 2025
e751a98
Apply review suggestions
Jan-Schuppik Dec 9, 2025
fbead8c
Fix missing property initialization
Jan-Schuppik Dec 9, 2025
1148d95
Update BaseFilter with nullable property
Jan-Schuppik Dec 9, 2025
152e88f
Adjust Condition setter & getter
Jan-Schuppik Dec 9, 2025
fa6c4ef
Add Datetime to Filter parameter uniontype
Jan-Schuppik Dec 9, 2025
58b90f7
Replace null with empty string in Plugins::wantPluginLoader()
Jan-Schuppik Dec 9, 2025
e34c39f
Adjust types in Filter/Condition
Jan-Schuppik Dec 9, 2025
b04e7f4
Appply review suggestion: return type to static
Jan-Schuppik Dec 10, 2025
96e539b
Appply review suggestion: add DateTime to union types
Jan-Schuppik Dec 10, 2025
7615b51
Appply review suggestion: TestPluginLoader add return type
Jan-Schuppik Dec 10, 2025
cf59452
Appply review suggestion: declare $traversable as iterable
Jan-Schuppik Dec 10, 2025
eb5ac10
Add null to parameter union types, to preserve expected behavior
Jan-Schuppik Dec 10, 2025
0e8fbc5
Apply review suggestions
Jan-Schuppik Dec 11, 2025
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
3 changes: 0 additions & 3 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ parameters:
paths:
- src

scanDirectories:
- /usr/share/icinga-php

ignoreErrors:
-
messages:
Expand Down
8 changes: 4 additions & 4 deletions src/BaseFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

trait BaseFilter
{
/** @var Rule Base filter */
private $baseFilter;
/** @var ?Rule Base filter */
private ?Rule $baseFilter = null;

/**
* Get whether a base filter has been set
Expand All @@ -24,7 +24,7 @@ public function hasBaseFilter(): bool
*
* @return ?Rule
*/
public function getBaseFilter()
public function getBaseFilter(): ?Rule
{
return $this->baseFilter;
}
Expand All @@ -36,7 +36,7 @@ public function getBaseFilter()
*
* @return $this
*/
public function setBaseFilter(?Rule $baseFilter = null): self
public function setBaseFilter(?Rule $baseFilter = null): static
{
$this->baseFilter = $baseFilter;

Expand Down
10 changes: 5 additions & 5 deletions src/Contract/Filterable.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface Filterable
*
* @return Filter\Chain
*/
public function getFilter();
public function getFilter(): Filter\Chain;

/**
* Add a filter to the query
Expand All @@ -23,7 +23,7 @@ public function getFilter();
*
* @return $this
*/
public function filter(Filter\Rule $filter);
public function filter(Filter\Rule $filter): static;

/**
* Add a filter to the query
Expand All @@ -35,7 +35,7 @@ public function filter(Filter\Rule $filter);
*
* @return $this
*/
public function orFilter(Filter\Rule $filter);
public function orFilter(Filter\Rule $filter): static;

/**
* Add a filter to the query
Expand All @@ -47,7 +47,7 @@ public function orFilter(Filter\Rule $filter);
*
* @return $this
*/
public function notFilter(Filter\Rule $filter);
public function notFilter(Filter\Rule $filter): static;

/**
* Add a filter to the query
Expand All @@ -59,5 +59,5 @@ public function notFilter(Filter\Rule $filter);
*
* @return $this
*/
public function orNotFilter(Filter\Rule $filter);
public function orNotFilter(Filter\Rule $filter): static;
}
12 changes: 6 additions & 6 deletions src/Contract/Paginatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ interface Paginatable extends Countable
*
* @return bool
*/
public function hasLimit();
public function hasLimit(): bool;

/**
* Get the limit
*
* @return int|null
*/
public function getLimit();
public function getLimit(): ?int;

/**
* Set the limit
Expand All @@ -28,21 +28,21 @@ public function getLimit();
*
* @return $this
*/
public function limit($limit);
public function limit(?int $limit): static;

/**
* Get whether an offset is set
*
* @return bool
*/
public function hasOffset();
public function hasOffset(): bool;

/**
* Get the offset
*
* @return int|null
*/
public function getOffset();
public function getOffset(): ?int;

/**
* Set the offset
Expand All @@ -52,5 +52,5 @@ public function getOffset();
*
* @return $this
*/
public function offset($offset);
public function offset(?int $offset): static;
}
2 changes: 1 addition & 1 deletion src/Contract/PluginLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ interface PluginLoader
*
* @return string|false FQN of the plugin's class if found, false otherwise
*/
public function load($name);
public function load(string $name): false|string;
}
36 changes: 18 additions & 18 deletions src/Contract/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,40 @@ interface Translator
/**
* Translate a message
*
* @param string $message
* @param string $context Message context
* @param string $message
* @param string|null $context Message context
*
* @return string Translated message or original message if no translation is found
*/
public function translate($message, $context = null);
public function translate(string $message, ?string $context = null): string;

/**
* Translate a message in the given domain
*
* If no translation is found in the specified domain, the translation is also searched for in the default domain.
*
* @param string $domain
* @param string $message
* @param string $context Message context
* @param string $domain
* @param string $message
* @param string|null $context Message context
*
* @return string Translated message or original message if no translation is found
*/
public function translateInDomain($domain, $message, $context = null);
public function translateInDomain(string $domain, string $message, ?string $context = null): string;

/**
* Translate a plural message
*
* The returned message is based on the given number to decide between the singular and plural forms.
* That is also the case if no translation is found.
*
* @param string $singular Singular message
* @param string $plural Plural message
* @param int $number Number to decide between the returned singular and plural forms
* @param string $context Message context
* @param string $singular Singular message
* @param string $plural Plural message
* @param int $number Number to decide between the returned singular and plural forms
* @param string|null $context Message context
*
* @return string Translated message or original message if no translation is found
*/
public function translatePlural($singular, $plural, $number, $context = null);
public function translatePlural(string $singular, string $plural, int $number, ?string $context = null): string;

/**
* Translate a plural message in the given domain
Expand All @@ -53,13 +53,13 @@ public function translatePlural($singular, $plural, $number, $context = null);
* The returned message is based on the given number to decide between the singular and plural forms.
* That is also the case if no translation is found.
*
* @param string $domain
* @param string $singular Singular message
* @param string $plural Plural message
* @param int $number Number to decide between the returned singular and plural forms
* @param string $context Message context
* @param string $domain
* @param string $singular Singular message
* @param string $plural Plural message
* @param int $number Number to decide between the returned singular and plural forms
* @param string|null $context Message context
*
* @return string Translated message or original message if no translation is found
*/
public function translatePluralInDomain($domain, $singular, $plural, $number, $context = null);
public function translatePluralInDomain(string $domain, string $singular, string $plural, int $number, ?string $context = null): string;
}
14 changes: 7 additions & 7 deletions src/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
class Data
{
/** @var array<string, mixed> */
protected $data = [];
protected array $data = [];

/**
* Check whether there's any data
*
* @return bool
*/
public function isEmpty()
public function isEmpty(): bool
{
return empty($this->data);
}
Expand All @@ -24,7 +24,7 @@ public function isEmpty()
*
* @return bool
*/
public function has($name)
public function has(string $name): bool
{
return array_key_exists($name, $this->data);
}
Expand All @@ -37,7 +37,7 @@ public function has($name)
*
* @return mixed
*/
public function get($name, $default = null)
public function get(string $name, mixed $default = null): mixed
{
if ($this->has($name)) {
return $this->data[$name];
Expand All @@ -54,7 +54,7 @@ public function get($name, $default = null)
*
* @return $this
*/
public function set($name, $value)
public function set(string $name, mixed $value): static
{
$this->data[$name] = $value;

Expand All @@ -68,7 +68,7 @@ public function set($name, $value)
*
* @return $this
*/
public function merge(self $with)
public function merge(self $with): static
{
$this->data = array_merge($this->data, $with->data);

Expand All @@ -80,7 +80,7 @@ public function merge(self $with)
*
* @return $this
*/
public function clear()
public function clear(): static
{
$this->data = [];

Expand Down
Loading