Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

experiment with psalm detection of unused code #2263

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 0 additions & 12 deletions src/phpDocumentor/Descriptor/ArgumentDescriptor.php
Expand Up @@ -64,18 +64,6 @@ public function getType() : ?Type
return $this->type;
}

/**
* @return list<?Type>
*
* @phpstan-return array<int, ?Type>
*/
public function getTypes() : array
{
trigger_error('Please use getType', E_USER_DEPRECATED);

return [$this->getType()];
}

public function getInheritedElement() : ?ArgumentDescriptor
{
if ($this->method instanceof MethodDescriptor &&
Expand Down
19 changes: 0 additions & 19 deletions src/phpDocumentor/Descriptor/Builder/Reflector/FileAssembler.php
Expand Up @@ -200,25 +200,6 @@ protected function addTraits(array $traits, FileDescriptor $fileDescriptor) : vo
}
}

/**
* Registers the markers that were found in a File with the File Descriptor.
*
* @param array<array<string>> $markers
*/
protected function addMarkers(array $markers, FileDescriptor $fileDescriptor) : void
{
foreach ($markers as $marker) {
[$type, $message, $line] = $marker;
$fileDescriptor->getMarkers()->add(
[
'type' => $type,
'message' => $message,
'line' => $line,
]
);
}
}

protected function overridePackageTag(File $data, FileDescriptor $fileDescriptor) : void
{
/** @var Collection<TagDescriptor> $packages */
Expand Down
23 changes: 0 additions & 23 deletions src/phpDocumentor/Descriptor/Tag/BaseTypes/TypedAbstract.php
Expand Up @@ -27,15 +27,6 @@ abstract class TypedAbstract extends TagDescriptor
/** @var Type $types */
protected $types;

/**
* Sets a list of types associated with this tag.
*/
public function setTypes(?Type $types = null) : void
{
trigger_error('Use setType, because type is an object', E_USER_DEPRECATED);
$this->types = $types;
}

/**
* Sets a list of types associated with this tag.
*/
Expand All @@ -44,20 +35,6 @@ public function setType(?Type $types = null) : void
$this->types = $types;
}

/**
* Returns the list of types associated with this tag.
*
* @return list<Type>
*
* @phpstan-return array<int, Type>
*/
public function getTypes() : array
{
trigger_error('Use getType, because type is an object', E_USER_DEPRECATED);

return array_filter([$this->types]);
}

public function getType() : ?Type
{
return $this->types;
Expand Down
13 changes: 0 additions & 13 deletions src/phpDocumentor/Descriptor/Validation/Error.php
Expand Up @@ -46,21 +46,8 @@ public function getCode() : string
return $this->code;
}

public function getLine() : int
{
return $this->line;
}

public function getSeverity() : string
{
return $this->severity;
}

/**
* @return mixed[]
*/
public function getContext() : array
{
return $this->context;
}
}
5 changes: 0 additions & 5 deletions src/phpDocumentor/Descriptor/VersionDescriptor.php
Expand Up @@ -30,11 +30,6 @@ public function __construct(string $number, Collection $documentationSets)
$this->number = $number;
}

public function getNumber() : string
{
return $this->number;
}

/**
* @return Collection<GuideSetDescriptor>
*/
Expand Down
7 changes: 0 additions & 7 deletions src/phpDocumentor/Guides/Listener/AssetsCopyListener.php
Expand Up @@ -29,11 +29,4 @@ public function __construct(FilesystemInterface $targetFilesystem)
{
$this->targetFilesystem = $targetFilesystem;
}

public function postBuildRender()
{
$sourceFilesystem = new Filesystem(new Local(sprintf('%s/../Templates/rtd/assets', __DIR__)));

FlySystemMirror::mirror($sourceFilesystem, $this->targetFilesystem, '', 'assets');
}
}
36 changes: 0 additions & 36 deletions src/phpDocumentor/Guides/Listener/CopyImagesListener.php
Expand Up @@ -32,40 +32,4 @@ public function __construct(BuildContext $buildContext, ErrorManager $errorManag
$this->buildContext = $buildContext;
$this->errorManager = $errorManager;
}

public function preNodeRender(PreNodeRenderEvent $event)
{
$node = $event->getNode();
if (!$node instanceof ImageNode) {
return;
}

$sourceImage = $node->getEnvironment()->absoluteRelativePath($node->getUrl());

if (!file_exists($sourceImage)) {
$this->errorManager->error(
sprintf(
'Missing image file "%s" in "%s"',
$node->getUrl(),
$node->getEnvironment()->getCurrentFileName()
)
);

return;
}

$fileInfo = new SplFileInfo($sourceImage);
$fs = new Filesystem();

// the /_images path is currently hardcoded here and respected
// in the overridden image node template
$newPath = '/_images/' . $fileInfo->getFilename();
$fs->copy($sourceImage, $this->buildContext->getOutputFilesystem() . $newPath, true);

$node->setValue(
$node->getEnvironment()->relativeUrl(
'/_images/' . $fileInfo->getFilename()
)
);
}
}
1 change: 0 additions & 1 deletion src/phpDocumentor/Parser/FlySystemFactory.php
Expand Up @@ -67,7 +67,6 @@ private function createAdapter(Dsn $dsn) : AdapterInterface
}

try {
$root = (string) $dsn;
} catch (InvalidArgumentException $e) {
throw new InvalidArgumentException(
'Failed to determine the root path for the given DSN, received: ' . (string) $dsn,
Expand Down
11 changes: 0 additions & 11 deletions src/phpDocumentor/Transformer/Transformer.php
Expand Up @@ -178,17 +178,6 @@ public function log(string $message, string $priority = LogLevel::INFO) : void
$this->logger->log($priority, $message);
}

/**
* Dispatches a logging request to log a debug message.
*
* This method can be used by writers to output logs without having to know anything about
* the logging mechanism of phpDocumentor.
*/
public function debug(string $message) : void
{
$this->log($message, LogLevel::DEBUG);
}

/**
* Initializes all writers that are used during this transformation.
*
Expand Down