Skip to content

Commit

Permalink
Allowing Laminas form 3.x, updating dev deps (#167)
Browse files Browse the repository at this point in the history
* Allowing Laminas form 3.x, updating dev deps

* some dependency updates

* allowing package-versions plugin

* more version bumps

* using auto-merge instead of merge-me

* allowing php 8.3
  • Loading branch information
jaydiablo authored May 1, 2024
1 parent 68a508d commit b080d7f
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 87 deletions.
100 changes: 40 additions & 60 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,43 @@
name: Build
on:
push:
branches:
- master
pull_request:
branches:
- master
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
name: PHP ${{ matrix.php-versions }} ${{ matrix.composer-args }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.3', '7.4']
composer-args: ['', '--prefer-lowest']
include:
- operating-system: ubuntu-latest
php-versions: '8.0'
composer-args: '--ignore-platform-reqs --no-scripts'
- operating-system: ubuntu-latest
php-versions: '8.0'
composer-args: '--prefer-lowest --ignore-platform-reqs --no-scripts'
runs-on: ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/[email protected]
- name: Setup PHP
uses: shivammathur/[email protected]
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring
tools: cs2pr
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/[email protected]
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Dependencies
run: |
composer update --no-progress --no-suggest --prefer-stable --optimize-autoloader ${{ matrix.composer-args }}
- name: PHPStan
run: composer phpstan
- name: Code Style Check
run: composer check-style -- --format=checkstyle | cs2pr
merge-me:
name: Merge me!
needs:
- build
runs-on: ubuntu-latest
steps:
- name: Merge me!
uses: ridedott/merge-me-action@master
with:
# This must be used as GitHub Actions token does not support
# pushing to protected branches.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_LOGIN: 'dependabot[bot]'
build:
name: PHP ${{ matrix.php-versions }} ${{ matrix.composer-args }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ["7.4", "8.0", "8.1", "8.2", "8.3"]
composer-args: ["", "--prefer-lowest"]
runs-on: ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/[email protected]
- name: Setup PHP
uses: shivammathur/[email protected]
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring
tools: cs2pr
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/[email protected]
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Dependencies
run: |
composer update --no-progress --no-suggest --prefer-stable --optimize-autoloader ${{ matrix.composer-args }}
- name: PHPStan
run: composer phpstan
- name: Code Style Check
run: composer check-style -- --format=checkstyle | cs2pr
22 changes: 22 additions & 0 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Dependabot auto-merge
on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/composer.lock
/vendor
/.php_cs.cache
/.php-cs-fixer.cache
7 changes: 4 additions & 3 deletions .php_cs → .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
->in(__DIR__)
;

return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
$config = new PhpCsFixer\Config();

return $config->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'binary_operator_spaces' => ['align_double_arrow' => true, 'align_equals' => true],
'binary_operator_spaces' => ['operators' => ['=' => 'align', '=>' => 'align']],
'single_quote' => false,
'array_syntax' => ['syntax' => 'short'],
'concat_space' => ['spacing' => 'one'],
Expand Down
2 changes: 1 addition & 1 deletion Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function getServiceConfig()
},
'OAuth2Server\AuthorizeForm' => function (ServiceManager $serviceManager) {
$config = $serviceManager->get('Config');
$form = new $config['oauth2server']['authorize_form_class'](
$form = new $config['oauth2server']['authorize_form_class'](
'Authorize',
$config['oauth2server']['csrf_salt']
);
Expand Down
16 changes: 11 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
],
"homepage": "https://github.com/diablomedia/zf2-oauth2-server",
"require": {
"php": "^7.3 || ^8.0",
"php": "^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0",
"bshaffer/oauth2-server-php": "^1.10",
"diablomedia/oauth2-server-zendhttp-bridge": "^3.0.0",
"laminas/laminas-form": "^2.0.0",
"laminas/laminas-form": "^2.0.0 || ^3.0.0",
"laminas/laminas-view": "^2.0.0",
"laminas/laminas-mvc": "^2.0 || ^3.0",
"container-interop/container-interop": "^1.2",
"psr/container": "^1.0 || ^2.0",
"laminas/laminas-modulemanager": "^2.10",
"laminas/laminas-servicemanager": "^3.6"
},
Expand All @@ -44,14 +44,20 @@
]
},
"require-dev": {
"friendsofphp/php-cs-fixer": "2.18.4",
"phpstan/phpstan": "0.12.82",
"friendsofphp/php-cs-fixer": "3.51.0",
"phpstan/phpstan": "1.10.67",
"maglnet/composer-require-checker": "^2.0 || ^3.0",
"phpro/grumphp-shim": "^0.22.0 || ^1.1"
},
"scripts": {
"fix-style": "php-cs-fixer fix",
"check-style": "php-cs-fixer fix --dry-run -vv",
"phpstan": "phpstan analyze -c phpstan.neon --no-progress --ansi"
},
"config": {
"allow-plugins": {
"phpro/grumphp-shim": true,
"ocramius/package-versions": true
}
}
}
2 changes: 1 addition & 1 deletion grumphp.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ grumphp:
composer_require_checker: ~
phpcsfixer2:
allow_risky: true
config: .php_cs
config: .php-cs-fixer.php
phpstan:
memory_limit: 768M
6 changes: 0 additions & 6 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,3 @@ parameters:
message: "#^Parameter \\#2 \\$response of method OAuth2\\\\Server\\:\\:handleTokenRequest\\(\\) expects OAuth2\\\\ResponseInterface\\|null, Laminas\\\\Stdlib\\\\ResponseInterface given\\.$#"
count: 1
path: src/OAuth2Server/Controller/AuthorizeController.php

-
message: "#^Call to an undefined method Laminas\\\\ServiceManager\\\\ServiceLocatorInterface\\:\\:getServiceLocator\\(\\)\\.$#"
count: 1
path: src/OAuth2Server/Controller/Factory/AuthorizeControllerFactory.php

3 changes: 2 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ includes:
- ./phpstan-baseline.neon
parameters:
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
inferPrivatePropertyTypeFromConstructor: true
level: 8
paths:
- ./
excludes_analyse:
excludePaths:
- ./vendor/*
ignoreErrors:
12 changes: 2 additions & 10 deletions src/OAuth2Server/Controller/Factory/AuthorizeControllerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,12 @@

namespace OAuth2Server\Controller\Factory;

use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\Factory\FactoryInterface;
use OAuth2Server\Controller\AuthorizeController;
use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;
use Psr\Container\ContainerInterface;

class AuthorizeControllerFactory implements FactoryInterface
{
public function createService(ServiceLocatorInterface $serviceLocator)
{
// This only gets called in older versions of Laminas\ServiceManager,
// left for backwards compatibility
return $this($serviceLocator->getServiceLocator(), AuthorizeController::class);
}

public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
return new AuthorizeController(
Expand Down

0 comments on commit b080d7f

Please sign in to comment.