Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

WIP rewrite for Craft 4 #69

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 9 additions & 31 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,33 +1,11 @@
# CRAFT ENVIRONMENT
.env.php
.env.sh
.env

# COMPOSER
/vendor
.idea
.php_cs
.php_cs.cache
.php-cs-fixer.cache
.phpunit.result.cache
/build
composer.lock
vendor
*.log
/tests/_craft/storage/

# BUILD FILES
/bower_components/*
/node_modules/*
/build/*
/yarn-error.log

# MISC FILES
.cache
.DS_Store
.idea
.project
.settings
*.esproj
*.sublime-workspace
*.sublime-project
*.tmproj
*.tmproject
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
config.codekit3
prepros-6.config
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [2.0.0] - Unreleased



## [1.9.2] - 2022-03-26
- Fix issues with Supertable / exclude SuperTableBlockElement

Expand Down
31 changes: 24 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,43 @@
}
],
"require": {
"craftcms/cms": "^3.2.0",
"craftcms/cms": "^4.1.0",
"guzzlehttp/guzzle": "^6.5.5|^7.2.0"
},
"require-dev": {
"vimeo/psalm": "^4.4"
"craftcms/phpstan": "*",
"friendsofphp/php-cs-fixer": "^3.0",
"pestphp/pest": "^1.2",
"pestphp/pest-plugin-parallel": "^1.0"
},
"autoload": {
"psr-4": {
"ostark\\upper\\": "src/"
}
"ostark\\Upper\\": "src/"
},
"files": [
"src/helpers.php"
]
},
"scripts": {
"ps": "phpstan analyse src --level=5 -c phpstan.neon",
"stan": "@ps"
"phpstan": "vendor/bin/phpstan analyse",
"test": "vendor/bin/pest"
},
"extra": {
"name": "Upper",
"handle": "upper",
"hasCpSettings": false,
"hasCpSection": false,
"changelogUrl": "https://raw.githubusercontent.com/ostark/upper/master/CHANGELOG.md"
}
},
"config": {
"allow-plugins": {
"yiisoft/yii2-composer": true,
"composer/package-versions-deprecated": true,
"craftcms/plugin-installer": true,
"pestphp/pest-plugin": true
}
},

"prefer-stable": true,
"minimum-stability": "dev"
}
11 changes: 11 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
includes:
- vendor/craftcms/phpstan/phpstan.neon
parameters:
level: 6
paths:
- src
- tests
tmpDir: build/phpstan
checkMissingIterableValueType: false
ignoreErrors:
- "#Unable to resolve the template type T in call to method static method#"
38 changes: 38 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="tests/bootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
failOnWarning="true"
failOnRisky="true"
failOnEmptyTestSuite="true"
beStrictAboutOutputDuringTests="true"
verbose="true"
>
<testsuites>
<testsuite name="Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
<report>
<html outputDirectory="build/test/coverage"/>
<text outputFile="build/test/coverage.txt"/>
<clover outputFile="build/test/logs/clover.xml"/>
</report>
</coverage>
<logging>
<junit outputFile="build/test/report.junit.xml"/>
</logging>
</phpunit>
28 changes: 0 additions & 28 deletions psalm.xml

This file was deleted.

4 changes: 2 additions & 2 deletions src/CacheResponse.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php namespace ostark\upper;
<?php namespace ostark\Upper;

use yii\base\Response;

class CacheResponse
{
/**
* @var \yii\base\Response|\ostark\upper\behaviors\CacheControlBehavior
* @var \yii\base\Response|\ostark\Upper\behaviors\CacheControlBehavior
*/
public $response;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php namespace ostark\upper\drivers;
<?php namespace ostark\Upper\Drivers;

use ostark\upper\Plugin;
use ostark\Upper\Plugin;
use yii\base\BaseObject;
use yii\db\Exception;
use yii\helpers\ArrayHelper;

/**
* Class AbstractPurger Driver
*
* @package ostark\upper\drivers
* @package ostark\Upper\Drivers
*/
class AbstractPurger extends BaseObject
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php namespace ostark\upper\drivers;
<?php namespace ostark\Upper\Drivers;


/**
* Interface CachePurgeInterface
*
* @package ostark\upper\drivers
* @package ostark\Upper\Drivers
*/
interface CachePurgeInterface
{
Expand Down
10 changes: 5 additions & 5 deletions src/drivers/Cloudflare.php → src/Drivers/Cloudflare.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php namespace ostark\upper\drivers;
<?php namespace ostark\Upper\Drivers;

use Craft;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\BadResponseException;
use ostark\upper\exceptions\CloudflareApiException;
use ostark\Upper\Exceptions\CloudflareApiException;

/**
* Class Cloudflare Driver
*
* @package ostark\upper\drivers
* @package ostark\Upper\Drivers
*/
class Cloudflare extends AbstractPurger implements CachePurgeInterface
{
Expand Down Expand Up @@ -51,7 +51,7 @@ public function purgeTag(string $tag)
* @param array $urls
*
* @return bool
* @throws \ostark\upper\exceptions\CloudflareApiException
* @throws \ostark\Upper\exceptions\CloudflareApiException
*/
public function purgeUrls(array $urls)
{
Expand Down Expand Up @@ -99,7 +99,7 @@ public function purgeAll()
* @param array $params
*
* @return bool
* @throws \ostark\upper\exceptions\CloudflareApiException
* @throws \ostark\Upper\exceptions\CloudflareApiException
*/
protected function sendRequest($method = 'DELETE', string $type, array $params = [])
{
Expand Down
4 changes: 2 additions & 2 deletions src/drivers/Dummy.php → src/Drivers/Dummy.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php namespace ostark\upper\drivers;
<?php namespace ostark\Upper\Drivers;

/**
* Class Dummy Driver
*
* @package ostark\upper\drivers
* @package ostark\Upper\Drivers
*/
class Dummy extends AbstractPurger implements CachePurgeInterface
{
Expand Down
8 changes: 4 additions & 4 deletions src/drivers/Fastly.php → src/Drivers/Fastly.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php namespace ostark\upper\drivers;
<?php namespace ostark\Upper\Drivers;

use GuzzleHttp\Client;
use GuzzleHttp\Exception\BadResponseException;
use ostark\upper\exceptions\FastlyApiException;
use ostark\Upper\Exceptions\FastlyApiException;

/**
* Class Keycdn Driver
Expand All @@ -19,7 +19,7 @@
* PURGE https://www.example.com/example/uri HTTP/1.1
* Fastly-Key:{$apiToken}
*
* @package ostark\upper\drivers
* @package ostark\Upper\Drivers
*
*/
class Fastly extends AbstractPurger implements CachePurgeInterface
Expand Down Expand Up @@ -109,7 +109,7 @@ public function purgeAll()
* @param array $headers
*
* @return bool
* @throws \ostark\upper\exceptions\FastlyApiException
* @throws \ostark\Upper\exceptions\FastlyApiException
*/
protected function sendRequest(string $method = 'PURGE', string $uri, array $headers = [])
{
Expand Down
8 changes: 4 additions & 4 deletions src/drivers/Keycdn.php → src/Drivers/Keycdn.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php namespace ostark\upper\drivers;
<?php namespace ostark\Upper\Drivers;

use GuzzleHttp\Client;
use GuzzleHttp\Exception\BadResponseException;
use ostark\upper\exceptions\KeycdnApiException;
use ostark\Upper\Exceptions\KeycdnApiException;

/**
* Class Keycdn Driver
*
* @package ostark\upper\drivers
* @package ostark\Upper\Drivers
*/
class Keycdn extends AbstractPurger implements CachePurgeInterface
{
Expand Down Expand Up @@ -70,7 +70,7 @@ public function purgeAll()
* @param array $params
*
* @return bool
* @throws \ostark\upper\exceptions\KeycdnApiException
* @throws \ostark\Upper\exceptions\KeycdnApiException
*/
protected function sendRequest($method = 'DELETE', string $type, array $params = [])
{
Expand Down
4 changes: 2 additions & 2 deletions src/drivers/Varnish.php → src/Drivers/Varnish.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php namespace ostark\upper\drivers;
<?php namespace ostark\Upper\Drivers;

use Craft;
use GuzzleHttp\Client;
Expand All @@ -7,7 +7,7 @@
/**
* Class Varnish Driver
*
* @package ostark\upper\drivers
* @package ostark\Upper\Drivers
*/
class Varnish extends AbstractPurger implements CachePurgeInterface
{
Expand Down
Loading