mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-24 10:49:00 +02:00
Fixed further inspection issues
This commit is contained in:
parent
33e36f3d2b
commit
87533b6031
37 changed files with 46 additions and 71 deletions
|
@ -74,10 +74,11 @@ abstract class BaseAdminController extends AbstractController
|
||||||
protected string $route_base = '';
|
protected string $route_base = '';
|
||||||
protected string $attachment_class = '';
|
protected string $attachment_class = '';
|
||||||
protected ?string $parameter_class = '';
|
protected ?string $parameter_class = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var EventDispatcher|EventDispatcherInterface
|
* @var EventDispatcher|EventDispatcherInterface
|
||||||
*/
|
*/
|
||||||
protected $eventDispatcher;
|
protected EventDispatcher|EventDispatcherInterface $eventDispatcher;
|
||||||
|
|
||||||
public function __construct(protected TranslatorInterface $translator, protected UserPasswordHasherInterface $passwordEncoder,
|
public function __construct(protected TranslatorInterface $translator, protected UserPasswordHasherInterface $passwordEncoder,
|
||||||
protected AttachmentSubmitHandler $attachmentSubmitHandler,
|
protected AttachmentSubmitHandler $attachmentSubmitHandler,
|
||||||
|
|
|
@ -31,7 +31,6 @@ use App\Services\Attachments\AttachmentSubmitHandler;
|
||||||
use App\Services\InfoProviderSystem\PartInfoRetriever;
|
use App\Services\InfoProviderSystem\PartInfoRetriever;
|
||||||
use App\Services\InfoProviderSystem\ProviderRegistry;
|
use App\Services\InfoProviderSystem\ProviderRegistry;
|
||||||
use App\Services\LogSystem\EventCommentHelper;
|
use App\Services\LogSystem\EventCommentHelper;
|
||||||
use App\Services\Parts\PartFormHelper;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
|
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
|
||||||
|
|
|
@ -22,7 +22,6 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Controller;
|
namespace App\Controller;
|
||||||
|
|
||||||
use App\DataTables\Column\LogEntryTargetColumn;
|
|
||||||
use App\DataTables\Filters\LogFilter;
|
use App\DataTables\Filters\LogFilter;
|
||||||
use App\DataTables\LogDataTable;
|
use App\DataTables\LogDataTable;
|
||||||
use App\Entity\Base\AbstractDBElement;
|
use App\Entity\Base\AbstractDBElement;
|
||||||
|
@ -48,7 +47,7 @@ use Symfony\Component\HttpFoundation\JsonResponse;
|
||||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
|
|
||||||
#[Route(path: '/log')]
|
#[Route(path: '/log')]
|
||||||
class LogController extends AbstractController
|
class LogController extends AbstractController
|
||||||
|
|
|
@ -50,7 +50,6 @@ use DateTime;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Omines\DataTablesBundle\DataTableFactory;
|
use Omines\DataTablesBundle\DataTableFactory;
|
||||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
|
||||||
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
|
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\Form\FormInterface;
|
use Symfony\Component\Form\FormInterface;
|
||||||
|
|
|
@ -73,6 +73,7 @@ class RedirectController extends AbstractController
|
||||||
* Check if mod_rewrite is available (URL rewriting is possible).
|
* Check if mod_rewrite is available (URL rewriting is possible).
|
||||||
* If this is true, we can redirect to /en, otherwise we have to redirect to index.php/en.
|
* If this is true, we can redirect to /en, otherwise we have to redirect to index.php/en.
|
||||||
* When the PHP is not used via Apache SAPI, we just assume that URL rewriting is available.
|
* When the PHP is not used via Apache SAPI, we just assume that URL rewriting is available.
|
||||||
|
* @noinspection PhpUndefinedFunctionInspection
|
||||||
*/
|
*/
|
||||||
public function checkIfModRewriteAvailable(): bool
|
public function checkIfModRewriteAvailable(): bool
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,10 +60,7 @@ use Symfony\Component\Validator\Constraints\Length;
|
||||||
#[Route(path: '/user')]
|
#[Route(path: '/user')]
|
||||||
class UserSettingsController extends AbstractController
|
class UserSettingsController extends AbstractController
|
||||||
{
|
{
|
||||||
/**
|
protected EventDispatcher|EventDispatcherInterface $eventDispatcher;
|
||||||
* @var EventDispatcher|EventDispatcherInterface
|
|
||||||
*/
|
|
||||||
protected $eventDispatcher;
|
|
||||||
|
|
||||||
public function __construct(protected bool $demo_mode, EventDispatcherInterface $eventDispatcher)
|
public function __construct(protected bool $demo_mode, EventDispatcherInterface $eventDispatcher)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,7 +23,6 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\DataTables\Adapters;
|
namespace App\DataTables\Adapters;
|
||||||
|
|
||||||
use App\DataTables\Events\ORMPostQueryEvent;
|
|
||||||
use Doctrine\ORM\AbstractQuery;
|
use Doctrine\ORM\AbstractQuery;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Omines\DataTablesBundle\Adapter\AdapterQuery;
|
use Omines\DataTablesBundle\Adapter\AdapterQuery;
|
||||||
|
@ -45,7 +44,7 @@ class FetchResultsAtOnceORMAdapter extends ORMAdapter
|
||||||
$state = $query->getState();
|
$state = $query->getState();
|
||||||
|
|
||||||
// Apply definitive view state for current 'page' of the table
|
// Apply definitive view state for current 'page' of the table
|
||||||
foreach ($state->getOrderBy() as list($column, $direction)) {
|
foreach ($state->getOrderBy() as [$column, $direction]) {
|
||||||
/** @var AbstractColumn $column */
|
/** @var AbstractColumn $column */
|
||||||
if ($column->isOrderable()) {
|
if ($column->isOrderable()) {
|
||||||
$builder->addOrderBy($column->getOrderField(), $direction);
|
$builder->addOrderBy($column->getOrderField(), $direction);
|
||||||
|
|
|
@ -157,7 +157,7 @@ class TwoStepORMAdapter extends ORMAdapter
|
||||||
$state = $query->getState();
|
$state = $query->getState();
|
||||||
|
|
||||||
// Apply definitive view state for current 'page' of the table
|
// Apply definitive view state for current 'page' of the table
|
||||||
foreach ($state->getOrderBy() as list($column, $direction)) {
|
foreach ($state->getOrderBy() as [$column, $direction]) {
|
||||||
/** @var AbstractColumn $column */
|
/** @var AbstractColumn $column */
|
||||||
if ($column->isOrderable()) {
|
if ($column->isOrderable()) {
|
||||||
$builder->addOrderBy($column->getOrderField(), $direction);
|
$builder->addOrderBy($column->getOrderField(), $direction);
|
||||||
|
|
|
@ -42,7 +42,7 @@ class EntityColumn extends AbstractColumn
|
||||||
* @param mixed $value The single value of the column
|
* @param mixed $value The single value of the column
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function normalize($value): mixed
|
public function normalize(mixed $value): mixed
|
||||||
{
|
{
|
||||||
/** @var AbstractNamedDBElement $value */
|
/** @var AbstractNamedDBElement $value */
|
||||||
return $value;
|
return $value;
|
||||||
|
|
|
@ -37,7 +37,7 @@ class MarkdownColumn extends AbstractColumn
|
||||||
* @param mixed $value The single value of the column
|
* @param mixed $value The single value of the column
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function normalize($value): string
|
public function normalize(mixed $value): string
|
||||||
{
|
{
|
||||||
return $this->markdown->markForRendering($value, true);
|
return $this->markdown->markForRendering($value, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ class PartAttachmentsColumn extends AbstractColumn
|
||||||
* @param mixed $value The single value of the column
|
* @param mixed $value The single value of the column
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function normalize($value): mixed
|
public function normalize(mixed $value): mixed
|
||||||
{
|
{
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ class TagsColumn extends AbstractColumn
|
||||||
* @param mixed $value The single value of the column
|
* @param mixed $value The single value of the column
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function normalize($value): mixed
|
public function normalize(mixed $value): mixed
|
||||||
{
|
{
|
||||||
if (empty($value)) {
|
if (empty($value)) {
|
||||||
return [];
|
return [];
|
||||||
|
|
|
@ -40,14 +40,14 @@ class EntityConstraint extends AbstractConstraint
|
||||||
* @param class-string<T> $class
|
* @param class-string<T> $class
|
||||||
* @param string $property
|
* @param string $property
|
||||||
* @param string|null $identifier
|
* @param string|null $identifier
|
||||||
* @param null|T $value
|
* @param T|null $value
|
||||||
* @param string|null $operator
|
* @param string|null $operator
|
||||||
*/
|
*/
|
||||||
public function __construct(protected ?NodesListBuilder $nodesListBuilder,
|
public function __construct(protected ?NodesListBuilder $nodesListBuilder,
|
||||||
protected string $class,
|
protected string $class,
|
||||||
string $property,
|
string $property,
|
||||||
string $identifier = null,
|
string $identifier = null,
|
||||||
protected $value = null,
|
protected ?AbstractDBElement $value = null,
|
||||||
protected ?string $operator = null)
|
protected ?string $operator = null)
|
||||||
{
|
{
|
||||||
if (!$nodesListBuilder instanceof NodesListBuilder && $this->isStructural()) {
|
if (!$nodesListBuilder instanceof NodesListBuilder && $this->isStructural()) {
|
||||||
|
|
|
@ -24,7 +24,6 @@ namespace App\Entity\Attachments;
|
||||||
|
|
||||||
use App\Entity\Parts\Part;
|
use App\Entity\Parts\Part;
|
||||||
use App\Serializer\APIPlatform\OverrideClassDenormalizer;
|
use App\Serializer\APIPlatform\OverrideClassDenormalizer;
|
||||||
use App\Serializer\TypeOverride\TypeOverridableSerializer;
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||||
use Symfony\Component\Serializer\Attribute\Context;
|
use Symfony\Component\Serializer\Attribute\Context;
|
||||||
|
|
|
@ -37,7 +37,6 @@ use ApiPlatform\Metadata\Patch;
|
||||||
use ApiPlatform\Metadata\Post;
|
use ApiPlatform\Metadata\Post;
|
||||||
use ApiPlatform\Serializer\Filter\PropertyFilter;
|
use ApiPlatform\Serializer\Filter\PropertyFilter;
|
||||||
use App\ApiPlatform\Filter\LikeFilter;
|
use App\ApiPlatform\Filter\LikeFilter;
|
||||||
use App\Repository\PartLotRepository;
|
|
||||||
use Doctrine\DBAL\Types\Types;
|
use Doctrine\DBAL\Types\Types;
|
||||||
use App\Entity\Base\AbstractDBElement;
|
use App\Entity\Base\AbstractDBElement;
|
||||||
use App\Entity\Base\TimestampTrait;
|
use App\Entity\Base\TimestampTrait;
|
||||||
|
|
|
@ -75,6 +75,7 @@ class ConsoleEnsureWebserverUserListener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @noinspection PhpUndefinedFunctionInspection */
|
||||||
private function isRunningAsRoot(): bool
|
private function isRunningAsRoot(): bool
|
||||||
{
|
{
|
||||||
//If we are on windows, we can't run as root
|
//If we are on windows, we can't run as root
|
||||||
|
@ -96,6 +97,7 @@ class ConsoleEnsureWebserverUserListener
|
||||||
* Determines the username of the user who started the current script if possible.
|
* Determines the username of the user who started the current script if possible.
|
||||||
* Returns null if the username could not be determined.
|
* Returns null if the username could not be determined.
|
||||||
* @return string|null
|
* @return string|null
|
||||||
|
* @noinspection PhpUndefinedFunctionInspection
|
||||||
*/
|
*/
|
||||||
private function getRunningUser(): ?string
|
private function getRunningUser(): ?string
|
||||||
{
|
{
|
||||||
|
@ -126,6 +128,7 @@ class ConsoleEnsureWebserverUserListener
|
||||||
if (PHP_OS_FAMILY === 'Windows') {
|
if (PHP_OS_FAMILY === 'Windows') {
|
||||||
//If we have the COM extension available, we can use it to determine the owner
|
//If we have the COM extension available, we can use it to determine the owner
|
||||||
if (extension_loaded('com_dotnet')) {
|
if (extension_loaded('com_dotnet')) {
|
||||||
|
/** @noinspection PhpUndefinedClassInspection */
|
||||||
$su = new \COM("ADsSecurityUtility"); // Call interface
|
$su = new \COM("ADsSecurityUtility"); // Call interface
|
||||||
//@phpstan-ignore-next-line
|
//@phpstan-ignore-next-line
|
||||||
$securityInfo = $su->GetSecurityDescriptor($path_to_check, 1, 1); // Call method
|
$securityInfo = $su->GetSecurityDescriptor($path_to_check, 1, 1); // Call method
|
||||||
|
|
|
@ -47,7 +47,7 @@ final class PermissionsMapper implements DataMapperInterface
|
||||||
* @param mixed $viewData View data of the compound form being initialized
|
* @param mixed $viewData View data of the compound form being initialized
|
||||||
* @param Traversable $forms A list of {@link FormInterface} instances
|
* @param Traversable $forms A list of {@link FormInterface} instances
|
||||||
*/
|
*/
|
||||||
public function mapDataToForms($viewData, \Traversable $forms): void
|
public function mapDataToForms(mixed $viewData, \Traversable $forms): void
|
||||||
{
|
{
|
||||||
foreach ($forms as $form) {
|
foreach ($forms as $form) {
|
||||||
if ($this->inherit) {
|
if ($this->inherit) {
|
||||||
|
@ -94,7 +94,7 @@ final class PermissionsMapper implements DataMapperInterface
|
||||||
* @param mixed $viewData The compound form's view data that get mapped
|
* @param mixed $viewData The compound form's view data that get mapped
|
||||||
* its children model data
|
* its children model data
|
||||||
*/
|
*/
|
||||||
public function mapFormsToData(\Traversable $forms, &$viewData): void
|
public function mapFormsToData(\Traversable $forms, mixed &$viewData): void
|
||||||
{
|
{
|
||||||
if ($this->inherit) {
|
if ($this->inherit) {
|
||||||
throw new RuntimeException('The permission type is readonly when it is showing read only data!');
|
throw new RuntimeException('The permission type is readonly when it is showing read only data!');
|
||||||
|
|
|
@ -153,7 +153,7 @@ final class SIUnitType extends AbstractType implements DataMapperInterface
|
||||||
*
|
*
|
||||||
* @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported
|
* @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported
|
||||||
*/
|
*/
|
||||||
public function mapDataToForms($viewData, \Traversable $forms): void
|
public function mapDataToForms(mixed $viewData, \Traversable $forms): void
|
||||||
{
|
{
|
||||||
$forms = iterator_to_array($forms);
|
$forms = iterator_to_array($forms);
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ final class SIUnitType extends AbstractType implements DataMapperInterface
|
||||||
*
|
*
|
||||||
* @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported
|
* @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported
|
||||||
*/
|
*/
|
||||||
public function mapFormsToData(\Traversable $forms, &$viewData): void
|
public function mapFormsToData(\Traversable $forms, mixed &$viewData): void
|
||||||
{
|
{
|
||||||
//Convert both fields to a single float value.
|
//Convert both fields to a single float value.
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ final class TriStateCheckboxType extends AbstractType implements DataTransformer
|
||||||
*
|
*
|
||||||
* @throws TransformationFailedException when the transformation fails
|
* @throws TransformationFailedException when the transformation fails
|
||||||
*/
|
*/
|
||||||
public function transform($value)
|
public function transform(mixed $value)
|
||||||
{
|
{
|
||||||
if (true === $value) {
|
if (true === $value) {
|
||||||
return 'true';
|
return 'true';
|
||||||
|
@ -145,7 +145,7 @@ final class TriStateCheckboxType extends AbstractType implements DataTransformer
|
||||||
*
|
*
|
||||||
* @throws TransformationFailedException when the transformation fails
|
* @throws TransformationFailedException when the transformation fails
|
||||||
*/
|
*/
|
||||||
public function reverseTransform($value)
|
public function reverseTransform(mixed $value)
|
||||||
{
|
{
|
||||||
return match ($value) {
|
return match ($value) {
|
||||||
'true' => true,
|
'true' => true,
|
||||||
|
|
|
@ -162,10 +162,10 @@ class LogEntryRepository extends DBElementRepository
|
||||||
/**
|
/**
|
||||||
* Gets the last log entries ordered by timestamp.
|
* Gets the last log entries ordered by timestamp.
|
||||||
*
|
*
|
||||||
* @param int|null $limit
|
* @param int|null $limit
|
||||||
* @param int|null $offset
|
* @param int|null $offset
|
||||||
*/
|
*/
|
||||||
public function getLogsOrderedByTimestamp(string $order = 'DESC', $limit = null, $offset = null): array
|
public function getLogsOrderedByTimestamp(string $order = 'DESC', int $limit = null, int $offset = null): array
|
||||||
{
|
{
|
||||||
return $this->findBy([], ['timestamp' => $order], $limit, $offset);
|
return $this->findBy([], ['timestamp' => $order], $limit, $offset);
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,7 @@ final class AttachmentVoter extends Voter
|
||||||
*
|
*
|
||||||
* @return bool True if the attribute and subject are supported, false otherwise
|
* @return bool True if the attribute and subject are supported, false otherwise
|
||||||
*/
|
*/
|
||||||
protected function supports(string $attribute, $subject): bool
|
protected function supports(string $attribute, mixed $subject): bool
|
||||||
{
|
{
|
||||||
if (is_a($subject, Attachment::class, true)) {
|
if (is_a($subject, Attachment::class, true)) {
|
||||||
//These are the allowed attributes
|
//These are the allowed attributes
|
||||||
|
|
|
@ -57,7 +57,7 @@ final class GroupVoter extends Voter
|
||||||
*
|
*
|
||||||
* @return bool True if the attribute and subject are supported, false otherwise
|
* @return bool True if the attribute and subject are supported, false otherwise
|
||||||
*/
|
*/
|
||||||
protected function supports(string $attribute, $subject): bool
|
protected function supports(string $attribute, mixed $subject): bool
|
||||||
{
|
{
|
||||||
if (is_a($subject, Group::class, true)) {
|
if (is_a($subject, Group::class, true)) {
|
||||||
return $this->helper->isValidOperation('groups', $attribute);
|
return $this->helper->isValidOperation('groups', $attribute);
|
||||||
|
|
|
@ -62,7 +62,7 @@ final class PermissionVoter extends Voter
|
||||||
*
|
*
|
||||||
* @return bool True if the attribute and subject are supported, false otherwise
|
* @return bool True if the attribute and subject are supported, false otherwise
|
||||||
*/
|
*/
|
||||||
protected function supports(string $attribute, $subject): bool
|
protected function supports(string $attribute, mixed $subject): bool
|
||||||
{
|
{
|
||||||
//Check if the attribute has the form @permission.operation
|
//Check if the attribute has the form @permission.operation
|
||||||
if (preg_match('#^@\\w+\\.\\w+$#', $attribute)) {
|
if (preg_match('#^@\\w+\\.\\w+$#', $attribute)) {
|
||||||
|
|
|
@ -68,7 +68,7 @@ final class StructureVoter extends Voter
|
||||||
*
|
*
|
||||||
* @return bool True if the attribute and subject are supported, false otherwise
|
* @return bool True if the attribute and subject are supported, false otherwise
|
||||||
*/
|
*/
|
||||||
protected function supports(string $attribute, $subject): bool
|
protected function supports(string $attribute, mixed $subject): bool
|
||||||
{
|
{
|
||||||
if (is_object($subject) || is_string($subject)) {
|
if (is_object($subject) || is_string($subject)) {
|
||||||
$permission_name = $this->instanceToPermissionName($subject);
|
$permission_name = $this->instanceToPermissionName($subject);
|
||||||
|
@ -87,11 +87,11 @@ final class StructureVoter extends Voter
|
||||||
/**
|
/**
|
||||||
* Maps an instance type to the permission name.
|
* Maps an instance type to the permission name.
|
||||||
*
|
*
|
||||||
* @param object|string $subject The subject for which the permission name should be generated
|
* @param object|string $subject The subject for which the permission name should be generated
|
||||||
*
|
*
|
||||||
* @return string|null the name of the permission for the subject's type or null, if the subject is not supported
|
* @return string|null the name of the permission for the subject's type or null, if the subject is not supported
|
||||||
*/
|
*/
|
||||||
protected function instanceToPermissionName($subject): ?string
|
protected function instanceToPermissionName(object|string $subject): ?string
|
||||||
{
|
{
|
||||||
$class_name = is_string($subject) ? $subject : $subject::class;
|
$class_name = is_string($subject) ? $subject : $subject::class;
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ final class UserVoter extends Voter
|
||||||
*
|
*
|
||||||
* @return bool True if the attribute and subject are supported, false otherwise
|
* @return bool True if the attribute and subject are supported, false otherwise
|
||||||
*/
|
*/
|
||||||
protected function supports(string $attribute, $subject): bool
|
protected function supports(string $attribute, mixed $subject): bool
|
||||||
{
|
{
|
||||||
if (is_a($subject, User::class, true)) {
|
if (is_a($subject, User::class, true)) {
|
||||||
return in_array($attribute,
|
return in_array($attribute,
|
||||||
|
|
|
@ -175,8 +175,7 @@ class DigikeyProvider implements InfoProviderInterface
|
||||||
null => null,
|
null => null,
|
||||||
'Active' => ManufacturingStatus::ACTIVE,
|
'Active' => ManufacturingStatus::ACTIVE,
|
||||||
'Obsolete' => ManufacturingStatus::DISCONTINUED,
|
'Obsolete' => ManufacturingStatus::DISCONTINUED,
|
||||||
'Discontinued at Digi-Key' => ManufacturingStatus::EOL,
|
'Discontinued at Digi-Key', 'Last Time Buy' => ManufacturingStatus::EOL,
|
||||||
'Last Time Buy' => ManufacturingStatus::EOL,
|
|
||||||
'Not For New Designs' => ManufacturingStatus::NRFND,
|
'Not For New Designs' => ManufacturingStatus::NRFND,
|
||||||
'Preliminary' => ManufacturingStatus::ANNOUNCED,
|
'Preliminary' => ManufacturingStatus::ANNOUNCED,
|
||||||
default => ManufacturingStatus::NOT_SET,
|
default => ManufacturingStatus::NOT_SET,
|
||||||
|
|
|
@ -190,41 +190,20 @@ class Element14Provider implements InfoProviderInterface
|
||||||
{
|
{
|
||||||
//Decide based on the shop ID
|
//Decide based on the shop ID
|
||||||
return match ($this->store_id) {
|
return match ($this->store_id) {
|
||||||
'bg.farnell.com' => 'EUR',
|
'bg.farnell.com', 'at.farnell.com', 'si.farnell.com', 'sk.farnell.com', 'ro.farnell.com', 'pt.farnell.com', 'nl.farnell.com', 'be.farnell.com', 'lv.farnell.com', 'lt.farnell.com', 'it.farnell.com', 'fr.farnell.com', 'fi.farnell.com', 'ee.farnell.com', 'es.farnell.com', 'ie.farnell.com', 'cpcireland.farnell.com', 'de.farnell.com' => 'EUR',
|
||||||
'cz.farnell.com' => 'CZK',
|
'cz.farnell.com' => 'CZK',
|
||||||
'dk.farnell.com' => 'DKK',
|
'dk.farnell.com' => 'DKK',
|
||||||
'at.farnell.com' => 'EUR',
|
|
||||||
'ch.farnell.com' => 'CHF',
|
'ch.farnell.com' => 'CHF',
|
||||||
'de.farnell.com' => 'EUR',
|
'cpc.farnell.com', 'uk.farnell.com', 'onecall.farnell.com', 'export.farnell.com' => 'GBP',
|
||||||
'cpc.farnell.com' => 'GBP',
|
'il.farnell.com', 'www.newark.com' => 'USD',
|
||||||
'cpcireland.farnell.com' => 'EUR',
|
|
||||||
'export.farnell.com' => 'GBP',
|
|
||||||
'onecall.farnell.com' => 'GBP',
|
|
||||||
'ie.farnell.com' => 'EUR',
|
|
||||||
'il.farnell.com' => 'USD',
|
|
||||||
'uk.farnell.com' => 'GBP',
|
|
||||||
'es.farnell.com' => 'EUR',
|
|
||||||
'ee.farnell.com' => 'EUR',
|
|
||||||
'fi.farnell.com' => 'EUR',
|
|
||||||
'fr.farnell.com' => 'EUR',
|
|
||||||
'hu.farnell.com' => 'HUF',
|
'hu.farnell.com' => 'HUF',
|
||||||
'it.farnell.com' => 'EUR',
|
|
||||||
'lt.farnell.com' => 'EUR',
|
|
||||||
'lv.farnell.com' => 'EUR',
|
|
||||||
'be.farnell.com' => 'EUR',
|
|
||||||
'nl.farnell.com' => 'EUR',
|
|
||||||
'no.farnell.com' => 'NOK',
|
'no.farnell.com' => 'NOK',
|
||||||
'pl.farnell.com' => 'PLN',
|
'pl.farnell.com' => 'PLN',
|
||||||
'pt.farnell.com' => 'EUR',
|
|
||||||
'ro.farnell.com' => 'EUR',
|
|
||||||
'ru.farnell.com' => 'RUB',
|
'ru.farnell.com' => 'RUB',
|
||||||
'sk.farnell.com' => 'EUR',
|
|
||||||
'si.farnell.com' => 'EUR',
|
|
||||||
'se.farnell.com' => 'SEK',
|
'se.farnell.com' => 'SEK',
|
||||||
'tr.farnell.com' => 'TRY',
|
'tr.farnell.com' => 'TRY',
|
||||||
'canada.newark.com' => 'CAD',
|
'canada.newark.com' => 'CAD',
|
||||||
'mexico.newark.com' => 'MXN',
|
'mexico.newark.com' => 'MXN',
|
||||||
'www.newark.com' => 'USD',
|
|
||||||
'cn.element14.com' => 'CNY',
|
'cn.element14.com' => 'CNY',
|
||||||
'au.element14.com' => 'AUD',
|
'au.element14.com' => 'AUD',
|
||||||
'nz.element14.com' => 'NZD',
|
'nz.element14.com' => 'NZD',
|
||||||
|
|
|
@ -296,9 +296,8 @@ class MouserProvider implements InfoProviderInterface
|
||||||
null => null,
|
null => null,
|
||||||
"New Product" => ManufacturingStatus::ANNOUNCED,
|
"New Product" => ManufacturingStatus::ANNOUNCED,
|
||||||
"Not Recommended for New Designs" => ManufacturingStatus::NRFND,
|
"Not Recommended for New Designs" => ManufacturingStatus::NRFND,
|
||||||
"Factory Special Order" => ManufacturingStatus::DISCONTINUED,
|
"Factory Special Order", "Obsolete" => ManufacturingStatus::DISCONTINUED,
|
||||||
"End of Life" => ManufacturingStatus::EOL,
|
"End of Life" => ManufacturingStatus::EOL,
|
||||||
"Obsolete" => ManufacturingStatus::DISCONTINUED,
|
|
||||||
default => ManufacturingStatus::ACTIVE,
|
default => ManufacturingStatus::ACTIVE,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ class ConsoleInfoHelper
|
||||||
/**
|
/**
|
||||||
* Returns the username of the user who started the current script if possible.
|
* Returns the username of the user who started the current script if possible.
|
||||||
* @return string|null the username of the user who started the current script if possible, null otherwise
|
* @return string|null the username of the user who started the current script if possible, null otherwise
|
||||||
|
* @noinspection PhpUndefinedFunctionInspection
|
||||||
*/
|
*/
|
||||||
public function getCLIUser(): ?string
|
public function getCLIUser(): ?string
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,6 +69,7 @@ final class TwigCoreExtension extends AbstractExtension
|
||||||
throw new \InvalidArgumentException(sprintf('The given class "%s" is not an enum!', $enum_class));
|
throw new \InvalidArgumentException(sprintf('The given class "%s" is not an enum!', $enum_class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @noinspection PhpUndefinedMethodInspection */
|
||||||
return ($enum_class)::cases();
|
return ($enum_class)::cases();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ class NoLockoutValidator extends ConstraintValidator
|
||||||
* @param mixed $value The value that should be validated
|
* @param mixed $value The value that should be validated
|
||||||
* @param Constraint $constraint The constraint for the validation
|
* @param Constraint $constraint The constraint for the validation
|
||||||
*/
|
*/
|
||||||
public function validate($value, Constraint $constraint): void
|
public function validate(mixed $value, Constraint $constraint): void
|
||||||
{
|
{
|
||||||
if (!$constraint instanceof NoLockout) {
|
if (!$constraint instanceof NoLockout) {
|
||||||
throw new UnexpectedTypeException($constraint, NoLockout::class);
|
throw new UnexpectedTypeException($constraint, NoLockout::class);
|
||||||
|
|
|
@ -39,7 +39,7 @@ class NoneOfItsChildrenValidator extends ConstraintValidator
|
||||||
* @param mixed $value The value that should be validated
|
* @param mixed $value The value that should be validated
|
||||||
* @param Constraint $constraint The constraint for the validation
|
* @param Constraint $constraint The constraint for the validation
|
||||||
*/
|
*/
|
||||||
public function validate($value, Constraint $constraint): void
|
public function validate(mixed $value, Constraint $constraint): void
|
||||||
{
|
{
|
||||||
if (!$constraint instanceof NoneOfItsChildren) {
|
if (!$constraint instanceof NoneOfItsChildren) {
|
||||||
throw new UnexpectedTypeException($constraint, NoneOfItsChildren::class);
|
throw new UnexpectedTypeException($constraint, NoneOfItsChildren::class);
|
||||||
|
|
|
@ -31,5 +31,5 @@ use Symfony\Component\Validator\Constraint;
|
||||||
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
#[\Attribute(\Attribute::TARGET_PROPERTY)]
|
||||||
class Selectable extends Constraint
|
class Selectable extends Constraint
|
||||||
{
|
{
|
||||||
public $message = 'validator.isSelectable';
|
public string $message = 'validator.isSelectable';
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ class SelectableValidator extends ConstraintValidator
|
||||||
* @param mixed $value The value that should be validated
|
* @param mixed $value The value that should be validated
|
||||||
* @param Constraint $constraint The constraint for the validation
|
* @param Constraint $constraint The constraint for the validation
|
||||||
*/
|
*/
|
||||||
public function validate($value, Constraint $constraint): void
|
public function validate(mixed $value, Constraint $constraint): void
|
||||||
{
|
{
|
||||||
if (!$constraint instanceof Selectable) {
|
if (!$constraint instanceof Selectable) {
|
||||||
throw new UnexpectedTypeException($constraint, Selectable::class);
|
throw new UnexpectedTypeException($constraint, Selectable::class);
|
||||||
|
|
|
@ -42,7 +42,7 @@ class ValidFileFilterValidator extends ConstraintValidator
|
||||||
* @param mixed $value The value that should be validated
|
* @param mixed $value The value that should be validated
|
||||||
* @param Constraint $constraint The constraint for the validation
|
* @param Constraint $constraint The constraint for the validation
|
||||||
*/
|
*/
|
||||||
public function validate($value, Constraint $constraint): void
|
public function validate(mixed $value, Constraint $constraint): void
|
||||||
{
|
{
|
||||||
if (!$constraint instanceof ValidFileFilter) {
|
if (!$constraint instanceof ValidFileFilter) {
|
||||||
throw new UnexpectedTypeException($constraint, ValidFileFilter::class);
|
throw new UnexpectedTypeException($constraint, ValidFileFilter::class);
|
||||||
|
|
|
@ -42,7 +42,7 @@ class ValidPartLotValidator extends ConstraintValidator
|
||||||
* @param mixed $value The value that should be validated
|
* @param mixed $value The value that should be validated
|
||||||
* @param Constraint $constraint The constraint for the validation
|
* @param Constraint $constraint The constraint for the validation
|
||||||
*/
|
*/
|
||||||
public function validate($value, Constraint $constraint): void
|
public function validate(mixed $value, Constraint $constraint): void
|
||||||
{
|
{
|
||||||
if (!$constraint instanceof ValidPartLot) {
|
if (!$constraint instanceof ValidPartLot) {
|
||||||
throw new UnexpectedTypeException($constraint, ValidPartLot::class);
|
throw new UnexpectedTypeException($constraint, ValidPartLot::class);
|
||||||
|
|
|
@ -46,7 +46,7 @@ class ValidPermissionValidator extends ConstraintValidator
|
||||||
* @param mixed $value The value that should be validated
|
* @param mixed $value The value that should be validated
|
||||||
* @param Constraint $constraint The constraint for the validation
|
* @param Constraint $constraint The constraint for the validation
|
||||||
*/
|
*/
|
||||||
public function validate($value, Constraint $constraint): void
|
public function validate(mixed $value, Constraint $constraint): void
|
||||||
{
|
{
|
||||||
if (!$constraint instanceof ValidPermission) {
|
if (!$constraint instanceof ValidPermission) {
|
||||||
throw new UnexpectedTypeException($constraint, ValidPermission::class);
|
throw new UnexpectedTypeException($constraint, ValidPermission::class);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue