cleanup for 1.10 (#1906)

This commit is contained in:
Kevin Papst
2020-08-22 19:15:54 +02:00
committed by GitHub
parent 064d083db6
commit c2c4f087e4
26 changed files with 66 additions and 13 deletions

View File

@@ -103,7 +103,7 @@ return PhpCsFixer\Config::create()
'phpdoc_inline_tag' => true, 'phpdoc_inline_tag' => true,
'phpdoc_no_access' => true, 'phpdoc_no_access' => true,
'phpdoc_no_alias_tag' => true, 'phpdoc_no_alias_tag' => true,
'phpdoc_no_empty_return' => true, 'phpdoc_no_empty_return' => false,
'phpdoc_no_package' => true, 'phpdoc_no_package' => true,
'phpdoc_no_useless_inheritdoc' => true, 'phpdoc_no_useless_inheritdoc' => true,
'phpdoc_return_self_reference' => true, 'phpdoc_return_self_reference' => true,

View File

@@ -370,7 +370,7 @@ final class InvoiceController extends AbstractController
* @Route(path="/template/{id}/delete", name="admin_invoice_template_delete", methods={"GET", "POST"}) * @Route(path="/template/{id}/delete", name="admin_invoice_template_delete", methods={"GET", "POST"})
* @Security("is_granted('manage_invoice_template')") * @Security("is_granted('manage_invoice_template')")
*/ */
public function deleteTemplate(InvoiceTemplate $template, Request $request): Response public function deleteTemplate(InvoiceTemplate $template): Response
{ {
try { try {
$this->templateRepository->removeTemplate($template); $this->templateRepository->removeTemplate($template);

View File

@@ -237,7 +237,7 @@ class Configuration implements ConfigurationInterface
->defaultValue([]) ->defaultValue([])
->end() ->end()
->booleanNode('simple_form') ->booleanNode('simple_form')
->defaultTrue() ->defaultFalse()
->end() ->end()
->scalarNode('number_format') ->scalarNode('number_format')
->defaultValue('{Y}/{cy,3}') ->defaultValue('{Y}/{cy,3}')

View File

@@ -37,6 +37,7 @@ interface MetaDisplayEventInterface
* Adds a field that should be displayed. * Adds a field that should be displayed.
* *
* @param MetaTableTypeInterface $meta * @param MetaTableTypeInterface $meta
* @return void
*/ */
public function addField(MetaTableTypeInterface $meta); public function addField(MetaTableTypeInterface $meta) /* : void */;
} }

View File

@@ -29,7 +29,12 @@ abstract class AbstractMergedCalculator extends AbstractCalculator
$this->mergeInvoiceItems($invoiceItem, $entry); $this->mergeInvoiceItems($invoiceItem, $entry);
} }
protected function mergeInvoiceItems(InvoiceItem $invoiceItem, InvoiceItemInterface $entry) /**
* @param InvoiceItem $invoiceItem
* @param InvoiceItemInterface $entry
* @return void
*/
protected function mergeInvoiceItems(InvoiceItem $invoiceItem, InvoiceItemInterface $entry) /* : void */
{ {
$duration = $invoiceItem->getDuration(); $duration = $invoiceItem->getDuration();
if (null !== $entry->getDuration()) { if (null !== $entry->getDuration()) {

View File

@@ -53,7 +53,12 @@ abstract class AbstractSumInvoiceCalculator extends AbstractMergedCalculator imp
return array_values($invoiceItems); return array_values($invoiceItems);
} }
protected function mergeSumInvoiceItem(InvoiceItem $invoiceItem, InvoiceItemInterface $entry) /**
* @param InvoiceItem $invoiceItem
* @param InvoiceItemInterface $entry
* @return void
*/
protected function mergeSumInvoiceItem(InvoiceItem $invoiceItem, InvoiceItemInterface $entry) /* : void */
{ {
if (method_exists($this, 'mergeSumTimesheet')) { if (method_exists($this, 'mergeSumTimesheet')) {
@trigger_error('mergeSumTimesheet() is deprecated and will be removed with 2.0 - use mergeSumInvoiceItem() instead', E_USER_DEPRECATED); @trigger_error('mergeSumTimesheet() is deprecated and will be removed with 2.0 - use mergeSumInvoiceItem() instead', E_USER_DEPRECATED);

View File

@@ -13,9 +13,6 @@ use App\Entity\Activity;
use App\Entity\Project; use App\Entity\Project;
use App\Entity\User; use App\Entity\User;
/**
* @internal
*/
final class InvoiceItem final class InvoiceItem
{ {
/** /**

View File

@@ -15,8 +15,9 @@ interface InvoiceItemRepositoryInterface
{ {
/** /**
* @param InvoiceItemInterface[] $invoiceItems * @param InvoiceItemInterface[] $invoiceItems
* @return void
*/ */
public function setExported(array $invoiceItems); public function setExported(array $invoiceItems) /* : void */;
/** /**
* @param InvoiceQuery $query * @param InvoiceQuery $query

View File

@@ -94,7 +94,8 @@ class PluginManager
$json = json_decode(file_get_contents($composer), true); $json = json_decode(file_get_contents($composer), true);
$reqVersion = $json['extra']['kimai']['require'] ?? 'unknown'; $reqVersion = $json['extra']['kimai']['require'] ?? 'unknown';
$version = $json['extra']['kimai']['version'] ?? 'unknown'; // the version field is required if we use composer to install a plugin via var/packages/
$version = $json['extra']['kimai']['version'] ?? ($json['version'] ?? 'unknown');
$description = $json['description'] ?? ''; $description = $json['description'] ?? '';
$homepage = $json['homepage'] ?? Constants::HOMEPAGE . '/store/'; $homepage = $json['homepage'] ?? Constants::HOMEPAGE . '/store/';

View File

@@ -14,6 +14,9 @@ use App\Entity\ActivityRate;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\ORMException; use Doctrine\ORM\ORMException;
/**
* @extends \Doctrine\ORM\EntityRepository<ActivityRate>
*/
class ActivityRateRepository extends EntityRepository class ActivityRateRepository extends EntityRepository
{ {
public function saveRate(ActivityRate $rate) public function saveRate(ActivityRate $rate)

View File

@@ -25,6 +25,9 @@ use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
use Pagerfanta\Pagerfanta; use Pagerfanta\Pagerfanta;
/**
* @extends \Doctrine\ORM\EntityRepository<Activity>
*/
class ActivityRepository extends EntityRepository class ActivityRepository extends EntityRepository
{ {
/** /**

View File

@@ -15,6 +15,9 @@ use App\Form\Model\SystemConfiguration;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\ORMException; use Doctrine\ORM\ORMException;
/**
* @extends \Doctrine\ORM\EntityRepository<Configuration>
*/
class ConfigurationRepository extends EntityRepository implements ConfigLoaderInterface class ConfigurationRepository extends EntityRepository implements ConfigLoaderInterface
{ {
private static $cacheByPrefix = null; private static $cacheByPrefix = null;

View File

@@ -14,6 +14,9 @@ use App\Entity\CustomerRate;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\ORMException; use Doctrine\ORM\ORMException;
/**
* @extends \Doctrine\ORM\EntityRepository<CustomerRate>
*/
class CustomerRateRepository extends EntityRepository class CustomerRateRepository extends EntityRepository
{ {
public function saveRate(CustomerRate $rate) public function saveRate(CustomerRate $rate)

View File

@@ -27,6 +27,9 @@ use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
use Pagerfanta\Pagerfanta; use Pagerfanta\Pagerfanta;
/**
* @extends \Doctrine\ORM\EntityRepository<Customer>
*/
class CustomerRepository extends EntityRepository class CustomerRepository extends EntityRepository
{ {
/** /**

View File

@@ -20,6 +20,9 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
use Pagerfanta\Pagerfanta; use Pagerfanta\Pagerfanta;
/**
* @extends \Doctrine\ORM\EntityRepository<Invoice>
*/
class InvoiceRepository extends EntityRepository class InvoiceRepository extends EntityRepository
{ {
public function saveInvoice(Invoice $invoice) public function saveInvoice(Invoice $invoice)

View File

@@ -16,6 +16,9 @@ use Doctrine\ORM\QueryBuilder;
use Pagerfanta\Adapter\DoctrineORMAdapter; use Pagerfanta\Adapter\DoctrineORMAdapter;
use Pagerfanta\Pagerfanta; use Pagerfanta\Pagerfanta;
/**
* @extends \Doctrine\ORM\EntityRepository<InvoiceTemplate>
*/
class InvoiceTemplateRepository extends EntityRepository class InvoiceTemplateRepository extends EntityRepository
{ {
public function hasTemplate(): bool public function hasTemplate(): bool

View File

@@ -14,6 +14,9 @@ use App\Entity\ProjectRate;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\ORMException; use Doctrine\ORM\ORMException;
/**
* @extends \Doctrine\ORM\EntityRepository<ProjectRate>
*/
class ProjectRateRepository extends EntityRepository class ProjectRateRepository extends EntityRepository
{ {
public function saveRate(ProjectRate $rate) public function saveRate(ProjectRate $rate)

View File

@@ -26,6 +26,9 @@ use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
use Pagerfanta\Pagerfanta; use Pagerfanta\Pagerfanta;
/**
* @extends \Doctrine\ORM\EntityRepository<Project>
*/
class ProjectRepository extends EntityRepository class ProjectRepository extends EntityRepository
{ {
/** /**

View File

@@ -14,6 +14,9 @@ use App\Entity\RolePermission;
use Doctrine\ORM\AbstractQuery; use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
/**
* @extends \Doctrine\ORM\EntityRepository<RolePermission>
*/
class RolePermissionRepository extends EntityRepository class RolePermissionRepository extends EntityRepository
{ {
public function saveRolePermission(RolePermission $permission) public function saveRolePermission(RolePermission $permission)

View File

@@ -14,6 +14,7 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\ORMException; use Doctrine\ORM\ORMException;
/** /**
* @extends \Doctrine\ORM\EntityRepository<Role>
* @method Role[] findAll() * @method Role[] findAll()
*/ */
class RoleRepository extends EntityRepository class RoleRepository extends EntityRepository

View File

@@ -18,6 +18,9 @@ use Doctrine\ORM\QueryBuilder;
use Pagerfanta\Adapter\DoctrineORMAdapter; use Pagerfanta\Adapter\DoctrineORMAdapter;
use Pagerfanta\Pagerfanta; use Pagerfanta\Pagerfanta;
/**
* @extends \Doctrine\ORM\EntityRepository<Tag>
*/
class TagRepository extends EntityRepository class TagRepository extends EntityRepository
{ {
/** /**

View File

@@ -21,6 +21,9 @@ use Doctrine\ORM\ORMException;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
use Pagerfanta\Pagerfanta; use Pagerfanta\Pagerfanta;
/**
* @extends \Doctrine\ORM\EntityRepository<Team>
*/
class TeamRepository extends EntityRepository class TeamRepository extends EntityRepository
{ {
public function find($id, $lockMode = null, $lockVersion = null) public function find($id, $lockMode = null, $lockVersion = null)

View File

@@ -28,6 +28,9 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
use Pagerfanta\Pagerfanta; use Pagerfanta\Pagerfanta;
/**
* @extends \Doctrine\ORM\EntityRepository<Timesheet>
*/
class TimesheetRepository extends EntityRepository class TimesheetRepository extends EntityRepository
{ {
public const STATS_QUERY_DURATION = 'duration'; public const STATS_QUERY_DURATION = 'duration';

View File

@@ -24,6 +24,9 @@ use Pagerfanta\Adapter\DoctrineORMAdapter;
use Pagerfanta\Pagerfanta; use Pagerfanta\Pagerfanta;
use Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface; use Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface;
/**
* @extends \Doctrine\ORM\EntityRepository<User>
*/
class UserRepository extends EntityRepository implements UserLoaderInterface class UserRepository extends EntityRepository implements UserLoaderInterface
{ {
public function getById($id): ?User public function getById($id): ?User

View File

@@ -28,7 +28,7 @@ interface WidgetRendererInterface
* The given $options array overwrites the widgets internal options for this call. * The given $options array overwrites the widgets internal options for this call.
* *
* @param WidgetInterface $widget * @param WidgetInterface $widget
* @param array $options * @param array<string, mixed> $options
* @return string * @return string
*/ */
public function render(WidgetInterface $widget, array $options = []): string; public function render(WidgetInterface $widget, array $options = []): string;

View File

@@ -295,7 +295,7 @@ class ConfigurationTest extends TestCase
0 => 'var/invoices/', 0 => 'var/invoices/',
1 => 'templates/invoice/renderer/', 1 => 'templates/invoice/renderer/',
], ],
'simple_form' => true, 'simple_form' => false,
'number_format' => '{Y}/{cy,3}', 'number_format' => '{Y}/{cy,3}',
], ],
'export' => [ 'export' => [