Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinDev committed Nov 12, 2021
1 parent f9020d6 commit 7d5c721
Show file tree
Hide file tree
Showing 60 changed files with 244 additions and 16 deletions.
15 changes: 11 additions & 4 deletions packages/admin-block-editor/src/BlockEditorFilter.php
Expand Up @@ -18,16 +18,21 @@ final class BlockEditorFilter extends AbstractFilter
use RequiredEntityTrait;
use RequiredTwigTrait;

/**
* @var BlockInterface[]|null
*/
private ?array $appBlocks = null;

/**
* @return string
* @return mixed|string
*/
public function apply($propertyValue)
{
$json = json_decode($propertyValue);

if (false === $json || null === $json) {
if (
! \is_string($propertyValue)
|| ! \is_object($json = json_decode($propertyValue))
|| ! property_exists($json, 'blocks')
) {
return $propertyValue;
}

Expand Down Expand Up @@ -69,6 +74,8 @@ private function getBlockManager(string $type): BlockInterface
/**
* @psalm-suppress NullableReturnStatement
* @psalm-suppress InvalidNullableReturnType
*
* @return BlockInterface[]
*/
private function getAppBlocks(): array
{
Expand Down
Expand Up @@ -58,6 +58,9 @@ public function manage(Request $request, ImageManager $imageManager, string $pub
]));
}

/**
* @return array<string, mixed>
*/
private function exportMedia(MediaInterface $media, string $url): array
{
$properties = Entity::getProperties($media);
Expand Down
Expand Up @@ -24,6 +24,9 @@ class Configuration implements ConfigurationInterface
*/
public const DEFAULT_TYPE_TO_PROSE = ['paragraph', 'image', 'list', 'blockquote', 'code', 'delimiter', 'header'];

/**
* @return \Symfony\Component\Config\Definition\Builder\TreeBuilder
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('admin_block_editor');
Expand Down
Expand Up @@ -15,6 +15,9 @@

class AdminFormEventSuscriber extends AbstractEventSuscriber
{
/**
* @return array<string, string>
*/
public static function getSubscribedEvents(): array
{
return [
Expand Down Expand Up @@ -59,6 +62,9 @@ public function replaceFields(FormEvent $formEvent): void
$page->jsMainContent = $this->transformMainContent($page->getMainContent());
}

/**
* @return string
*/
private function transformMainContent(string $content)
{
// We never come to false here because we ever checked before with mayUseEditorBlock
Expand Down
Expand Up @@ -13,6 +13,9 @@ class EnityFilterSuscriber extends AbstractEventSuscriber
/** @required */
public Twig $twig;

/**
* @return array<string, string>
*/
public static function getSubscribedEvents(): array
{
return [
Expand Down
2 changes: 2 additions & 0 deletions packages/admin-block-editor/src/Form/EditorjsType.php
Expand Up @@ -8,6 +8,8 @@ class EditorjsType extends TextType
{
/**
* {@inheritdoc}
*
* @return string
*/
public function getBlockPrefix()
{
Expand Down
3 changes: 3 additions & 0 deletions packages/admin/src/DependencyInjection/Configuration.php
Expand Up @@ -84,6 +84,9 @@ class Configuration implements ConfigurationInterface
[MediaPreviewField::class],
];

/**
* @return \Symfony\Component\Config\Definition\Builder\TreeBuilder
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('pushword_admin');
Expand Down
3 changes: 3 additions & 0 deletions packages/admin/src/FormField/Event.php
Expand Up @@ -31,6 +31,9 @@ public function getAdmin(): AdminInterface
return $this->admin;
}

/**
* @return mixed[]
*/
public function getFields(): array
{
return $this->fields;
Expand Down
3 changes: 3 additions & 0 deletions packages/admin/src/FormField/HostField.php
Expand Up @@ -41,6 +41,9 @@ public function datagridMapper(DatagridMapper $datagrid): DatagridMapper
]);
}

/**
* @return string[]
*/
private function getHosts(): array
{
return $this->admin->getApps()->getHosts();
Expand Down
3 changes: 3 additions & 0 deletions packages/admin/src/FormField/MediaPreviewField.php
Expand Up @@ -41,6 +41,9 @@ private function issetRelatedPages(): bool
}
}

/**
* @return mixed[]|array<string, mixed>
*/
private function getRelatedPages(): array
{
if (null !== $this->relatedPages) {
Expand Down
3 changes: 3 additions & 0 deletions packages/admin/src/FormField/PageSlugField.php
Expand Up @@ -8,6 +8,9 @@

class PageSlugField extends AbstractField
{
/**
* @return string
*/
protected function getSlugHelp()
{
if ('' === $this->admin->getSubject()->getSlug()) {
Expand Down
6 changes: 6 additions & 0 deletions packages/admin/src/Utils/FormFieldReplacer.php
Expand Up @@ -11,6 +11,9 @@ public function count(): int
return $this->replaced;
}

/**
* @return mixed[]
*/
public function run(string $formFieldClass, string $newFormFieldClass, array $fields): array
{
foreach ($fields as $k => $field) {
Expand All @@ -31,6 +34,9 @@ public function run(string $formFieldClass, string $newFormFieldClass, array $fi
return $fields;
}

/**
* @return mixed[]
*/
public static function run2(string $formFieldClass, string $newFormFieldClass, $fields): array
{
$key = array_search($formFieldClass, $fields[0]);
Expand Down
Expand Up @@ -14,6 +14,9 @@ class Configuration implements ConfigurationInterface
'advanced_main_image',
];

/**
* @return \Symfony\Component\Config\Definition\Builder\TreeBuilder
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('admin_block_editor');
Expand Down
Expand Up @@ -21,6 +21,9 @@ public function __construct(AppPool $appPool)
$this->apps = $appPool;
}

/**
* @return array<string, string>
*/
public static function getSubscribedEvents(): array
{
return [
Expand Down
3 changes: 3 additions & 0 deletions packages/advanced-main-image/src/Twig/AppExtension.php
Expand Up @@ -8,6 +8,9 @@

class AppExtension extends AbstractExtension
{
/**
* @return \Twig\TwigFunction[]
*/
public function getFunctions()
{
return [
Expand Down
3 changes: 3 additions & 0 deletions packages/conversation/src/Command/NotificationCommand.php
Expand Up @@ -29,6 +29,9 @@ protected function configure(): void
;
}

/**
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
if (true === $this->notifier->send()) {
Expand Down
Expand Up @@ -56,6 +56,9 @@ public function __construct(
$this->router = $router;
}

/**
* @return class-string
*/
private function getFormManagerClass(string $type)
{
$param = 'conversation_form_'.str_replace('-', '_', $type);
Expand All @@ -74,6 +77,8 @@ private function getFormManagerClass(string $type)

/**
* Return current form manager depending on `type` (request).
*
* @return object
*/
private function getFormManager(string $type, Request $request)
{
Expand All @@ -96,6 +101,9 @@ private function getFormManager(string $type, Request $request)
);
}

/**
* @return mixed[]
*/
private function getPossibleOrigins(Request $request): array
{
//$host = $request->getHost();
Expand Down
Expand Up @@ -25,6 +25,9 @@ class Configuration implements ConfigurationInterface
'possible_origins',
];

/**
* @return \Symfony\Component\Config\Definition\Builder\TreeBuilder
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('conversation');
Expand Down
Expand Up @@ -12,6 +12,9 @@ class PushwordConversationExtension extends ConfigurableExtension implements Pre

private $configFolder = __DIR__.'/../Resources/config';

/**
* @return string
*/
public function getAlias()
{
return 'conversation';
Expand Down
3 changes: 3 additions & 0 deletions packages/conversation/src/Entity/Message.php
Expand Up @@ -190,6 +190,9 @@ public function setAuthorIpRaw(string $authorIp): self
return $this->setAuthorIp(ip2long(IPUtils::anonymize($authorIp)));
}

/**
* @return bool|string
*/
public function getAuthorIpRaw()
{
return long2ip($this->getAuthorIp());
Expand Down
21 changes: 21 additions & 0 deletions packages/conversation/src/Form/FormTrait.php
Expand Up @@ -219,6 +219,9 @@ protected function showSuccess(): string
]);
}

/**
* @return bool|string
*/
protected function getNextStepFunctionName()
{
$getFormMethod = 'getStep'.self::$step[$this->getNextStep()];
Expand All @@ -229,6 +232,9 @@ protected function getNextStepFunctionName()
return $getFormMethod;
}

/**
* @return float|int
*/
protected function getNextStep()
{
return $this->getStep() + 1;
Expand All @@ -241,6 +247,9 @@ protected function sanitizeConversation()
);
}

/**
* @return mixed
*/
protected function getStep()
{
if (null !== $this->currentStep) {
Expand All @@ -256,6 +265,9 @@ protected function incrementStep()
++$this->currentStep;
}

/**
* @return mixed
*/
protected function getId()
{
return $this->messageId ? $this->messageId : $this->request->query->getInt('id', 0);
Expand All @@ -271,11 +283,17 @@ protected function getType()
return $this->request->get('type');
}

/**
* @return \Doctrine\Bundle\DoctrineBundle\Registry
*/
protected function getDoctrine()
{
return $this->doctrine;
}

/**
* @return \Symfony\Component\Validator\Constraints\Length[]|\Symfony\Component\Validator\Constraints\NotBlank[]
*/
protected function getAuthorNameConstraints()
{
return [
Expand All @@ -287,6 +305,9 @@ protected function getAuthorNameConstraints()
];
}

/**
* @return \Symfony\Component\Validator\Constraints\Email[]|\Symfony\Component\Validator\Constraints\NotBlank[]
*/
protected function getAuthorEmailConstraints()
{
return [
Expand Down
3 changes: 3 additions & 0 deletions packages/conversation/src/PushwordConversationBundle.php
Expand Up @@ -7,6 +7,9 @@

class PushwordConversationBundle extends Bundle
{
/**
* @return \Pushword\Conversation\DependencyInjection\PushwordConversationExtension|null
*/
public function getContainerExtension()
{
if (null === $this->extension) {
Expand Down
3 changes: 3 additions & 0 deletions packages/conversation/src/Service/NewMessageMailNotifier.php
Expand Up @@ -70,6 +70,9 @@ protected function getMessagesPostedSince($datetime)
return $query->getResult();
}

/**
* @return bool|void
*/
public function send()
{
if (! $this->emailTo) {
Expand Down
3 changes: 3 additions & 0 deletions packages/conversation/src/Twig/AppExtension.php
Expand Up @@ -32,6 +32,9 @@ public function __construct(EntityManagerInterface $entityManager, string $messa
$this->router = $router;
}

/**
* @return \Twig\TwigFunction[]
*/
public function getFunctions()
{
return [
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/Command/ImageManagerCommand.php
Expand Up @@ -20,6 +20,9 @@ protected function configure(): void
->addArgument('media', InputArgument::OPTIONAL, 'Image name (eg: filename.jpg).');
}

/**
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$medias = $this->getMedias($input);
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/Command/ImageOptimizerCommand.php
Expand Up @@ -20,6 +20,9 @@ protected function configure(): void
->addArgument('media', InputArgument::OPTIONAL, 'Image name (eg: filename.jpg).');
}

/**
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$medias = $this->getMedias($input);
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/Command/NewCommand.php
Expand Up @@ -27,6 +27,9 @@ protected function configure(): void
$this->setDescription('Add a new website into your config file (config/packages/pushword.yaml).');
}

/**
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$configFile = $this->projectDir.'/config/packages/pushword.yaml';
Expand Down

0 comments on commit 7d5c721

Please sign in to comment.