Skip to content

Commit

Permalink
Use Docker-Image provided by friendsofphp/php-cs-fixer (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpdude authored Aug 27, 2024
1 parent 0cb6d17 commit d774a25
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 72 deletions.
2 changes: 2 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?php

return (new PhpCsFixer\Config())
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
->setRules([
'@Symfony' => true,
'phpdoc_separation' => false,
'array_syntax' => array('syntax' => 'short'),
'no_unreachable_default_argument_value' => false,
'braces' => array('allow_single_line_closure' => true),
Expand Down
4 changes: 2 additions & 2 deletions bin/php-cs-fixer
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -e

PHP_CS_FIXER_VERSION=${PHP_CS_FIXER_VERSION:-3.11.0}
PHP_CS_FIXER_VERSION=${PHP_CS_FIXER_VERSION:-3.62.0-php8.3}
if [ -t 1 ]; then TTY='--tty'; else TTY=''; fi

exec docker run --rm --init --interactive $TTY -w=/${PWD} -v $(pwd):/${PWD} oskarstark/php-cs-fixer-ga:$PHP_CS_FIXER_VERSION "$@"
exec docker run --rm --init --interactive $TTY -v $(pwd):/code ghcr.io/php-cs-fixer/php-cs-fixer:$PHP_CS_FIXER_VERSION fix "$@"

42 changes: 0 additions & 42 deletions src/AppBundle/Driver/KilnDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ class KilnDriver extends VcsDriver
/** @var string */
private $oAuthToken;

/**
* {@inheritDoc}
*/
public function initialize()
{
preg_match('/^(?:https:\/\/webfactory.kilnhg.com\/(.*)\/(.*?)(?:$|\.))/', $this->url, $match);
Expand Down Expand Up @@ -81,9 +78,6 @@ public function getRepositoryUrl()
return 'https://'.$this->originUrl.'/'.$this->owner.'/'.$this->repository;
}

/**
* {@inheritDoc}
*/
public function getRootIdentifier()
{
if ($this->gitDriver) {
Expand All @@ -93,9 +87,6 @@ public function getRootIdentifier()
return $this->rootIdentifier;
}

/**
* {@inheritDoc}
*/
public function getUrl()
{
if ($this->gitDriver) {
Expand All @@ -105,21 +96,11 @@ public function getUrl()
return 'https://'.$this->originUrl.'/'.$this->owner.'/'.$this->repository.'.git';
}

/**
* {@inheritDoc}
*
* @param string $operation
* e.g. listing all Projects $operation = 'Project'
* e.g. getting file content $operation = 'Repo/{repoId}/Raw/File/{$filePath}
*/
protected function getApiUrl()
{
return 'https://'.$this->originUrl.'/Api/1.0/';
}

/**
* {@inheritDoc}
*/
public function getSource($identifier)
{
if ($this->gitDriver) {
Expand All @@ -130,18 +111,13 @@ public function getSource($identifier)
}

/**
* {@inheritDoc}
*
* @throws RuntimeException
*/
public function getDist($identifier)
{
throw new RuntimeException('Zip downloads are not supported by the Kiln API');
}

/**
* {@inheritDoc}
*/
public function getComposerInformation($identifier)
{
if ($this->gitDriver) {
Expand Down Expand Up @@ -170,9 +146,6 @@ public function getComposerInformation($identifier)
return $this->infoCache[$identifier];
}

/**
* {@inheritdoc}
*/
public function getFileContent($file, $identifier)
{
if ($this->gitDriver) {
Expand All @@ -192,9 +165,6 @@ public function getFileContent($file, $identifier)
}
}

/**
* {@inheritdoc}
*/
public function getChangeDate($identifier)
{
if ($this->gitDriver) {
Expand All @@ -207,9 +177,6 @@ public function getChangeDate($identifier)
return new DateTime($commit['commit']['committer']['date']);
}

/**
* {@inheritDoc}
*/
public function getTags()
{
if ($this->gitDriver) {
Expand All @@ -230,9 +197,6 @@ public function getTags()
return $this->tags;
}

/**
* {@inheritDoc}
*/
public function getBranches()
{
if ($this->gitDriver) {
Expand All @@ -258,9 +222,6 @@ public function getBranches()
return $this->branches;
}

/**
* {@inheritDoc}
*/
public static function supports(IOInterface $io, Config $config, $url, $deep = false)
{
return false !== strpos($url, 'kilnhg');
Expand All @@ -276,9 +237,6 @@ protected function generateSshUrl()
return 'ssh://webfactory@'.$this->originUrl.'/'.$this->owner.'/'.$this->repository;
}

/**
* {@inheritDoc}
*/
protected function getContents($url, $fetchingRepoData = false)
{
$contents = file_get_contents($url);
Expand Down
2 changes: 1 addition & 1 deletion src/AppBundle/Factory/VcsDriverFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class VcsDriverFactory
/** @var array ['platform' => VcsDriverInterface class ] */
private $drivers;

public function __construct($githubOAuthToken, $kilnOAuthToken, array $drivers = null)
public function __construct($githubOAuthToken, $kilnOAuthToken, ?array $drivers = null)
{
$this->githubOAuthToken = $githubOAuthToken;
$this->kilnOAuthToken = $kilnOAuthToken;
Expand Down
3 changes: 0 additions & 3 deletions src/AppBundle/ProjectImport/DoctrinePackageProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ public function __construct(PackageRepository $packageRepository)
$this->packageRepository = $packageRepository;
}

/**
* {@inheritdoc}
*/
public function providePackage($name)
{
$package = $this->packageRepository->findOneBy(['name' => $name]);
Expand Down
3 changes: 0 additions & 3 deletions src/AppBundle/ProjectImport/DoctrineProjectProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ public function __construct(ProjectRepository $projectRepository)
$this->projectRepository = $projectRepository;
}

/**
* {@inheritdoc}
*/
public function provideProject($name)
{
$project = $this->projectRepository->findOneBy(['name' => $name]);
Expand Down
2 changes: 0 additions & 2 deletions src/AppBundle/ProjectImport/LockFileFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ public function __construct(VcsDriverFactory $vcsDriverFactory)
}

/**
* @param $vcsUrl
*
* @return string|null
*/
public function getLockContents($vcsUrl)
Expand Down
2 changes: 1 addition & 1 deletion src/AppBundle/Tests/Driver/KilnDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class KilnDriverTest extends TestCase
/**
* @var KilnDriver|MockObject
*/
private $driver = null;
private $driver;

/**
* Initializes the test environment.
Expand Down
34 changes: 17 additions & 17 deletions src/AppBundle/Tests/Entity/VersionConstraintTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public function versionConstraintWithSmallerThanOperatorMatchesPackageVersionsWi
{
$versionConstraint = new VersionConstraint('<', '2.0.0');
$packageVersions = [
new PackageVersion('1.0.0', new Package('foo')),
new PackageVersion('3.0.0', new Package('foo')),
new PackageVersion('1.0.0', new Package('foo')),
new PackageVersion('3.0.0', new Package('foo')),
];

$matches = $this->matchPackageVersions($versionConstraint, $packageVersions);
Expand All @@ -33,10 +33,10 @@ public function versionConstraintWithSmallerEqualsOperatorMatchesPackageVersions
{
$versionConstraint = new VersionConstraint('<=', '2.0.0');
$packageVersions = [
new PackageVersion('1.0.0', new Package('foo')),
new PackageVersion('2.0.0', new Package('foo')),
new PackageVersion('3.0.0', new Package('foo')),
];
new PackageVersion('1.0.0', new Package('foo')),
new PackageVersion('2.0.0', new Package('foo')),
new PackageVersion('3.0.0', new Package('foo')),
];

$matches = $this->matchPackageVersions($versionConstraint, $packageVersions);

Expand All @@ -52,9 +52,9 @@ public function versionConstraintWithLargerThanOperatorMatchesPackageVersionsWit
{
$versionConstraint = new VersionConstraint('>', '2.0.0');
$packageVersions = [
new PackageVersion('1.0.0', new Package('foo')),
new PackageVersion('3.0.0', new Package('foo')),
];
new PackageVersion('1.0.0', new Package('foo')),
new PackageVersion('3.0.0', new Package('foo')),
];

$matches = $this->matchPackageVersions($versionConstraint, $packageVersions);

Expand All @@ -69,9 +69,9 @@ public function versionConstraintWithLargerEqualsOperatorMatchesPackageVersionsW
{
$versionConstraint = new VersionConstraint('>=', '2.0.0');
$packageVersions = [
new PackageVersion('1.0.0', new Package('foo')),
new PackageVersion('2.0.0', new Package('foo')),
new PackageVersion('3.0.0', new Package('foo')),
new PackageVersion('1.0.0', new Package('foo')),
new PackageVersion('2.0.0', new Package('foo')),
new PackageVersion('3.0.0', new Package('foo')),
];

$matches = $this->matchPackageVersions($versionConstraint, $packageVersions);
Expand All @@ -88,8 +88,8 @@ public function versionConstraintWithEqualsOperatorMatchesPackageVersionsWithEqu
{
$versionConstraint = new VersionConstraint('==', '2.0.0');
$packageVersions = [
new PackageVersion('1.0.0', new Package('foo')),
new PackageVersion('2.0.0', new Package('foo')),
new PackageVersion('1.0.0', new Package('foo')),
new PackageVersion('2.0.0', new Package('foo')),
];

$matches = $this->matchPackageVersions($versionConstraint, $packageVersions);
Expand All @@ -105,9 +105,9 @@ public function versionConstraintWithAllOperatorMatchesAllPackagesVersions()
{
$versionConstraint = new VersionConstraint('all', '2.0.0');
$packageVersions = [
new PackageVersion('1.0.0', new Package('foo')),
new PackageVersion('2.0.0', new Package('foo')),
new PackageVersion('3.0.0', new Package('foo')),
new PackageVersion('1.0.0', new Package('foo')),
new PackageVersion('2.0.0', new Package('foo')),
new PackageVersion('3.0.0', new Package('foo')),
];

$matches = $this->matchPackageVersions($versionConstraint, $packageVersions);
Expand Down
2 changes: 1 addition & 1 deletion www/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
}

if ($enableCache) {
class AppCache extends \Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache
class AppCache extends Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache
{
}
$kernel = new AppCache($kernel);
Expand Down

0 comments on commit d774a25

Please sign in to comment.