Skip to content

Commit

Permalink
Add support for PHP 8, drop support for Symfony 4, add support for Sy…
Browse files Browse the repository at this point in the history
…mfony 6
  • Loading branch information
Kai Eichinger committed Feb 17, 2022
1 parent 389fb6f commit 224119b
Show file tree
Hide file tree
Showing 11 changed files with 114 additions and 134 deletions.
76 changes: 0 additions & 76 deletions .circleci/config.yml

This file was deleted.

3 changes: 1 addition & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# LTE: JZ + KE
* @apfelbox @keichinger
* @keichinger @jesko-plitt
44 changes: 44 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
on: [push, pull_request]

name: CI

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.4', '8.0', '8.1']
name: PHP ${{ matrix.php-versions }} Testing
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl
ini-values: post_max_size=256M, max_execution_time=180
coverage: xdebug

- name: Composer Install
run: composer install

- name: Composer Plugins
run: composer global require ergebnis/composer-normalize bamarni/composer-bin-plugin php-coveralls/php-coveralls --no-interaction --prefer-dist --no-progress --no-suggest --no-suggest

- name: Composer Vendor-Bin Dependencies
run: composer bin all install --no-interaction --prefer-dist --no-progress --no-suggest

- name: Create Build Logs Directory
run: mkdir -p build/logs

- name: Composer Normalize
run: composer normalize --indent-size 4 --indent-style space --dry-run

- name: PHP Cs Fixer
run: ./vendor/bin/php-cs-fixer fix --diff --config vendor-bin/test/vendor/becklyn/php-cs/.php_cs.dist.php --dry-run --no-interaction

- name: PhpStan
run: ./vendor/bin/phpstan analyse --memory-limit 4G --ansi -c vendor-bin/test/vendor/becklyn/php-cs/phpstan/lib.neon src --no-interaction --no-progress

- name: PhpUnit
run: ./vendor/bin/simple-phpunit -c phpunit.xml --testdox
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
3.3.0
=====

* (feature) Add support for PHP 8.
* (internal) Fix Symfony deprecations.
* (internal) Replace CircleCI with GitHub Actions.
* (improvement) Add missing property types and return types.
* (improvement) Add support for Symfony 6.


3.2.2
=====

Expand Down
40 changes: 20 additions & 20 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,46 +1,37 @@
{
"name": "becklyn/hosting",
"type": "symfony-bundle",
"description": "A symfony bundle that configures several hosting-related things.",
"license": "BSD-3-Clause",
"type": "symfony-bundle",
"keywords": [
"becklyn",
"hosting",
"sentry",
"trackjs",
"uptime"
],
"homepage": "https://github.com/Becklyn/Hosting",
"license": "BSD-3-Clause",
"authors": [
{
"name": "Becklyn Studios",
"homepage": "https://becklyn.com/"
}
],
"homepage": "https://github.com/Becklyn/Hosting",
"require": {
"php": ">=7.4",
"ext-json": "*",
"becklyn/assets-bundle": "^2.6.9",
"sentry/sentry-symfony": "^4.2.3",
"symfony/cache-contracts": "^2.4.0",
"symfony/config": "^5.3.4",
"symfony/console": "^5.3.7",
"symfony/dependency-injection": "^5.3.8",
"symfony/http-kernel": "^5.3.9"
"becklyn/assets-bundle": "^2.7.1",
"sentry/sentry-symfony": "^4.2.6",
"symfony/cache-contracts": "^2.4.0 || ^3.0.0",
"symfony/config": "^5.4.3 || ^6.0.3",
"symfony/console": "^5.4.3 || ^6.0.3",
"symfony/dependency-injection": "^5.4.3 || ^6.0.3",
"symfony/http-kernel": "^5.4.4 || ^6.0.4"
},
"require-dev": {
"symfony/phpunit-bridge": "^5.3.8",
"symfony/phpunit-bridge": "^5.4.3 || ^6.0.3",
"twig/twig": "^2.0 || ^3.3.3"
},
"config": {
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "3.x-dev",
"dev-next": "3.x-dev"
}
},
"autoload": {
"psr-4": {
"Becklyn\\Hosting\\": "src/"
Expand All @@ -50,5 +41,14 @@
"psr-4": {
"Tests\\Becklyn\\Hosting\\": "tests/"
}
},
"config": {
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "3.x-dev",
"dev-next": "3.x-dev"
}
}
}
14 changes: 0 additions & 14 deletions phpstan.neon

This file was deleted.

35 changes: 20 additions & 15 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,37 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php"
bootstrap="tests/bootstrap.php"
convertDeprecationsToExceptions="false"
>
<php>
<ini name="display_errors" value="1" />
<ini name="error_reporting" value="-1" />
<server name="APP_ENV" value="test" force="true" />
<server name="SHELL_VERBOSITY" value="-1" />
<server name="SYMFONY_PHPUNIT_REMOVE" value="" />
<server name="SYMFONY_PHPUNIT_VERSION" value="8.5" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[direct]=0"/>
<server name="SYMFONY_PHPUNIT_VERSION" value="9.5" />
</php>

<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>

<testsuites>
<testsuite name="Bundle tests">
<testsuite name="Project Test Suite">
<directory>tests</directory>
<exclude>tests/fixtures</exclude>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>src/</directory>
</whitelist>
</filter>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>

<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
</listeners>

<!-- Run `composer require symfony/panther` before enabling this extension -->
<!--
<extensions>
<extension class="Symfony\Component\Panther\ServerExtension" />
</extensions>
-->
</phpunit>
3 changes: 2 additions & 1 deletion src/BecklynHostingBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Becklyn\Hosting\DependencyInjection\BecklynHostingExtension;
use Becklyn\Hosting\DependencyInjection\CompilerPass\ConfigureSentryPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
use Symfony\Component\HttpKernel\Bundle\Bundle;

class BecklynHostingBundle extends Bundle
Expand Down Expand Up @@ -37,7 +38,7 @@ public function build (ContainerBuilder $container) : void
/**
* @inheritDoc
*/
public function getContainerExtension ()
public function getContainerExtension () : ?ExtensionInterface
{
return new BecklynHostingExtension($this->releaseVersionPass);
}
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/BecklynHostingConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class BecklynHostingConfiguration implements ConfigurationInterface
/**
* @inheritDoc
*/
public function getConfigTreeBuilder ()
public function getConfigTreeBuilder () : TreeBuilder
{
$treeBuilder = new TreeBuilder("becklyn_hosting");

Expand Down
7 changes: 2 additions & 5 deletions src/Listener/MonitoringTokenListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@

class MonitoringTokenListener implements EventSubscriberInterface
{
/** @var string */
private $uptimeHtmlEmbed;
private string $uptimeHtmlEmbed;


/**
*/
public function __construct (HostingConfig $config)
{
$this->uptimeHtmlEmbed = $config->getUptimeMonitorHtmlString();
Expand All @@ -26,7 +23,7 @@ public function __construct (HostingConfig $config)
public function onResponse (ResponseEvent $event) : void
{
// skip if not master request
if (!$event->isMasterRequest() || null === $this->uptimeHtmlEmbed)
if (!$event->isMainRequest())
{
return;
}
Expand Down
14 changes: 14 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

use Symfony\Component\Dotenv\Dotenv;

require dirname(__DIR__) . '/vendor/autoload.php';

if (file_exists(dirname(__DIR__) . '/config/bootstrap.php'))
{
require dirname(__DIR__) . '/config/bootstrap.php';
}
elseif (method_exists(Dotenv::class, 'bootEnv'))
{
(new Dotenv())->bootEnv(dirname(__DIR__) . '/.env');
}

0 comments on commit 224119b

Please sign in to comment.