Skip to content

Commit

Permalink
2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Stark committed Feb 8, 2021
1 parent 0f33194 commit 34e8f5d
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 27 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file.

## [2.2.0] - 2021-02-05
### Changed
- Added support for `symfony/process:^5.0`
- Updated `phpunit/phpunit`
- Removed `version` from composer.json
- Switched to `psalm` for static analysis

## [2.1.1] - 2020-04-03
### Fix
- Catch Exception when trying to count reserved jobs
Expand Down
9 changes: 4 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "ostark/craft-async-queue",
"description": "A queue handler that moves queue execution to a non-blocking background process",
"type": "craft-plugin",
"version": "2.1.1",
"keywords": [
"craft",
"cms",
Expand All @@ -22,6 +21,7 @@
}
],
"require": {
"php": ">=7.1",
"craftcms/cms": "^3.0.0",
"symfony/process": "^4.2|^5.0"
},
Expand All @@ -38,12 +38,11 @@
"changelogUrl": "https://raw.githubusercontent.com/ostark/craft-async-queue/master/CHANGELOG.md"
},
"require-dev": {
"phpstan/phpstan": "^0.11.1",
"phpunit/phpunit": "^6.0"
"phpunit/phpunit": "^7.0",
"vimeo/psalm": "^4.4"
},
"scripts": {
"ps": "vendor/bin/phpstan analyse src --level=3 -c phpstan.neon",
"stan": "@ps",
"ps": "vendor/bin/phpstan.phar analyse src --level=3 -c phpstan.neon",
"tests": "vendor/bin/phpunit -v"
}
}
7 changes: 0 additions & 7 deletions phpstan.neon

This file was deleted.

28 changes: 28 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0"?>
<psalm
errorLevel="4"
resolveFromConfigFile="true"
autoloader="tests/bootstrap.php"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src"/>
<ignoreFiles>
<directory name="vendor"/>
</ignoreFiles>
</projectFiles>
<issueHandlers>
<InvalidNullableReturnType>
<errorLevel type="suppress">
<file name="./src/Plugin.php"/>
</errorLevel>
</InvalidNullableReturnType>
<NullableReturnStatement>
<errorLevel type="suppress">
<file name="./src/Plugin.php"/>
</errorLevel>
</NullableReturnStatement>
</issueHandlers>
</psalm>
2 changes: 1 addition & 1 deletion src/Exceptions/LogicException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class LogicException extends \LogicException implements ProcessException
{
protected $process;

public function setProcess(Process $process)
public function setProcess(Process $process): void
{
$this->process = $process;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/ProcessException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

interface ProcessException
{
public function setProcess(Process $process);
public function setProcess(Process $process): void;

public function getProcess(): Process;

Expand Down
6 changes: 5 additions & 1 deletion src/Exceptions/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@

class RuntimeException extends \RuntimeException implements ProcessException
{

/**
* @var Process
*/
protected $process;

public function setProcess(Process $process)
public function setProcess(Process $process): void
{
$this->process = $process;
}
Expand Down
6 changes: 1 addition & 5 deletions src/Handlers/BackgroundQueueHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,7 @@ public function __invoke(PushEvent $event)
}


/**
* @param \yii\queue\PushEvent $event
* @param bool $handled
*/
protected function logPushEvent(PushEvent $event, $handled = false)
protected function logPushEvent(PushEvent $event, bool $handled = false): void
{
if (!YII_DEBUG) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Plugin extends BasePlugin
/**
* Init plugin
*/
public function init()
public function init(): void
{
parent::init();

Expand Down
4 changes: 2 additions & 2 deletions src/RateLimiter.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ public function canIUse(string $context = null): bool
return ($currentUsage < $this->maxItems) ? true : false;
}

public function increment()
public function increment(): void
{
$this->internalCount++;
}


protected function logAttempt(int $currentUsage, string $context = null)
protected function logAttempt(int $currentUsage, string $context = null): void
{

\Craft::debug(
Expand Down
2 changes: 1 addition & 1 deletion src/TestUtility/Utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static function contentHtml(): string
}


public static function setup(Plugin $plugin)
public static function setup(Plugin $plugin): void
{
if (!\Craft::$app->getRequest()->getIsCpRequest()) {
return;
Expand Down
9 changes: 6 additions & 3 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?php

define('CRAFT_BASE_PATH', __DIR__);
define('YII_DEBUG', true);
define('TEST_FILE', '/tmp/craft-async-queue.txt');
if (!defined('CRAFT_BASE_PATH')) {
define('CRAFT_BASE_PATH', __DIR__);
define('YII_DEBUG', true);
define('TEST_FILE', '/tmp/craft-async-queue.txt');
}


require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__.'/../vendor/yiisoft/yii2/Yii.php';
Expand Down

0 comments on commit 34e8f5d

Please sign in to comment.