Skip to content

Commit

Permalink
PsrAutoloadingFixer - call realpath only once
Browse files Browse the repository at this point in the history
  • Loading branch information
keradus committed Mar 19, 2021
1 parent 55a9991 commit 5d2d99d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Fixer/Basic/PsrAutoloadingFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ class InvalidName {}
);
}

/**
* {@inheritdoc}
*/
public function configure(array $configuration = null)
{
parent::configure($configuration);

if (null !== $this->configuration['dir']) {
$this->configuration['dir'] = realpath($this->configuration['dir']);
}
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -137,7 +149,7 @@ protected function createConfigurationDefinition()
*/
protected function applyFix(\SplFileInfo $file, Tokens $tokens)
{
if (null !== $this->configuration['dir'] && 0 !== strpos($file->getRealPath(), realpath($this->configuration['dir']))) {
if (null !== $this->configuration['dir'] && 0 !== strpos($file->getRealPath(), $this->configuration['dir'])) {
return;
}

Expand Down

0 comments on commit 5d2d99d

Please sign in to comment.