Support for PHP 8 (#2158)
painful 66 commits later: required PHP version bumped to 7.3, plugin updates using migrations necessary!
This commit is contained in:
@@ -68,7 +68,7 @@ final class ReloadCommand extends Command
|
||||
|
||||
// many users execute the bin/console command from arbitrary locations
|
||||
$path = getcwd();
|
||||
\chdir($this->getRootDirectory());
|
||||
chdir($this->getRootDirectory());
|
||||
|
||||
try {
|
||||
$command = $this->getApplication()->find('lint:yaml');
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Composer\InstalledVersions;
|
||||
use PackageVersions\Versions;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -111,26 +112,37 @@ class DoctorController extends AbstractController
|
||||
|
||||
private function getComposerPackages(): array
|
||||
{
|
||||
$packages = [];
|
||||
$versions = [];
|
||||
|
||||
if (class_exists('Composer\Versions')) {
|
||||
// TODO composer 2
|
||||
if (class_exists(InstalledVersions::class)) {
|
||||
$rootPackage = InstalledVersions::getRootPackage()['name'];
|
||||
foreach (InstalledVersions::getInstalledPackages() as $package) {
|
||||
$versions[$package] = InstalledVersions::getPrettyVersion($package);
|
||||
}
|
||||
} else {
|
||||
$packages = Versions::VERSIONS;
|
||||
// @deprecated since 1.14, will be removed with 2.0
|
||||
$rootPackage = Versions::rootPackageName();
|
||||
foreach (Versions::VERSIONS as $name => $version) {
|
||||
$versions[$name] = explode('@', $version)[0];
|
||||
}
|
||||
}
|
||||
|
||||
// remove kimai from the package list
|
||||
$packages = array_filter($packages, function ($name) {
|
||||
if ($name === Versions::ROOT_PACKAGE_NAME) {
|
||||
$versions = array_filter($versions, function ($version, $name) use ($rootPackage) {
|
||||
if ($name === $rootPackage) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($version === null || $version === '*') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}, ARRAY_FILTER_USE_KEY);
|
||||
}, ARRAY_FILTER_USE_BOTH);
|
||||
|
||||
ksort($packages);
|
||||
ksort($versions);
|
||||
|
||||
return $packages;
|
||||
return $versions;
|
||||
}
|
||||
|
||||
private function getLoadedExtensions()
|
||||
|
||||
@@ -9,51 +9,36 @@
|
||||
|
||||
namespace App\Doctrine;
|
||||
|
||||
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
|
||||
use Doctrine\DBAL\DBALException;
|
||||
use Doctrine\DBAL\Exception;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration as BaseAbstractMigration;
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Base class for all Doctrine migrations.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
abstract class AbstractMigration extends BaseAbstractMigration implements ContainerAwareInterface
|
||||
abstract class AbstractMigration extends BaseAbstractMigration
|
||||
{
|
||||
/**
|
||||
* @var ContainerInterface
|
||||
*/
|
||||
private $container;
|
||||
|
||||
/**
|
||||
* @param ContainerInterface $container
|
||||
*/
|
||||
public function setContainer(ContainerInterface $container = null)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ContainerInterface
|
||||
*/
|
||||
public function getContainer()
|
||||
{
|
||||
return $this->container;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return string
|
||||
* @deprecated since 0.9 - will be removed with 2.0
|
||||
*/
|
||||
protected function getTableName($name)
|
||||
{
|
||||
@trigger_error('AbstractMigration::getTableName() is deprecated and will be removed with 2.0', E_USER_DEPRECATED);
|
||||
|
||||
return 'kimai2_' . $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://github.com/doctrine/migrations/issues/1104
|
||||
*/
|
||||
public function isTransactional(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.14 - will be removed with 2.0
|
||||
*/
|
||||
@@ -82,7 +67,7 @@ abstract class AbstractMigration extends BaseAbstractMigration implements Contai
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
* @throws DBALException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function preUp(Schema $schema): void
|
||||
{
|
||||
@@ -91,7 +76,7 @@ abstract class AbstractMigration extends BaseAbstractMigration implements Contai
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
* @throws DBALException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function preDown(Schema $schema): void
|
||||
{
|
||||
@@ -101,7 +86,7 @@ abstract class AbstractMigration extends BaseAbstractMigration implements Contai
|
||||
/**
|
||||
* Abort the migration is the current platform is not supported.
|
||||
*
|
||||
* @throws DBALException
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function abortIfPlatformNotSupported()
|
||||
{
|
||||
@@ -128,27 +113,13 @@ abstract class AbstractMigration extends BaseAbstractMigration implements Contai
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws DBALException
|
||||
* @throws Exception
|
||||
*/
|
||||
protected function getPlatform()
|
||||
{
|
||||
return $this->connection->getDatabasePlatform()->getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Call me like this:
|
||||
* $schema = $this->getClassMetaData(User::class);
|
||||
*
|
||||
* @param string $entityName
|
||||
* @return ClassMetadata
|
||||
*/
|
||||
protected function getClassMetaData($entityName)
|
||||
{
|
||||
$em = $this->getContainer()->get('doctrine')->getManager();
|
||||
|
||||
return $em->getClassMetadata($entityName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.14 - will be removed with 2.0
|
||||
*/
|
||||
|
||||
@@ -40,7 +40,7 @@ class DurationStringToSecondsTransformer implements DataTransformerInterface
|
||||
{
|
||||
try {
|
||||
return $this->formatter->format($intToFormat);
|
||||
} catch (\Exception $e) {
|
||||
} catch (\Exception | \TypeError $e) {
|
||||
throw new TransformationFailedException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ class LdapUserProvider implements UserProviderInterface
|
||||
|
||||
public function supportsClass($class)
|
||||
{
|
||||
return $class === User::class || $class === 'App\Entity\User';
|
||||
return $class === User::class;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace App\Repository;
|
||||
|
||||
use App\Entity\Role;
|
||||
use App\Entity\RolePermission;
|
||||
use Doctrine\ORM\AbstractQuery;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
/**
|
||||
@@ -38,6 +37,6 @@ class RolePermissionRepository extends EntityRepository
|
||||
$qb->select('r.name as role,rp.permission,rp.allowed')
|
||||
->leftJoin('rp.role', 'r');
|
||||
|
||||
return $qb->getQuery()->execute([], AbstractQuery::HYDRATE_ARRAY);
|
||||
return $qb->getQuery()->getArrayResult();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +72,6 @@ final class DoctrineUserProvider implements UserProviderInterface
|
||||
*/
|
||||
public function supportsClass($class)
|
||||
{
|
||||
return $class === User::class || $class === 'App\Entity\User';
|
||||
return $class === User::class;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ final class LocaleHelper
|
||||
$value = 0;
|
||||
}
|
||||
|
||||
return $this->getNumberFormatter()->format($value);
|
||||
return $this->getNumberFormatter()->format((float) $value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user